Jump to: navigation, search

QuantumAbstractPlugin

To define the Quantum plug-in interface, we will define a python class with all the methods that must be implemented in order to implement the plugin. All required methods will throw a "not implemented" error, similar to the network manager impl from nova.

During the summit we agreed that to start the plugin interface would map closely to the tenant API. Essentially, the API will parse the request, authenticate the request, enforce necessary limits, and hand the request to the plugin.

A common point of discussion during the summit was whether a plugin mapped one-to-one with a "type" of switch that could be managed (e.g., Open vSwitch, Cisco Nexus, etc.). A key point is that while a plugin may decide to only manage a particular type of switch, there is nothing that prevents a plugin from talking to multiple different types of switches to tie together interfaces plugged into different types of switches. It is even possible that a plugin could present a "driver" model that allows people to develop a standard interface for managing different types of switches using a uniform interface. This is POSSIBLE in the model, but not required.

As common functionality amount multiple plugins emerges, this can be shared among plugins in several ways:

  • sharing the code among plugins using shared python modules as libraries
  • extracting code from the plugin and putting it "above" the plugin layer (must be sure that ALL plugins need this functionality).
  • sub-classing a base plugin class to that provides the common functionality.
  • creating "meta plugins" that dispatch requests from the API layer depending on some criteria (e.g., interface-id type).

Proposal for Quantum Plugin - Abstract class:


#!highlight python
"""
Quantum Plug-in API specification.

QuantumPluginBase provides the definition of minimum set of
methods that needs to be implemented by a Quantum Plug-in.
"""

from abc import ABCMeta, abstractmethod

class QuantumPluginBase(object):

    __metaclass__ = ABCMeta

    @abstractmethod
    def get_all_networks(self, tenant_id):
        """
        Returns a dictionary containing all
        <network_uuid, network_name> for
        the specified tenant. 
        """
        pass
    
    @abstractmethod
    def create_network(self, tenant_id, net_name):
        """
        Creates a new Virtual Network, and assigns it
        a symbolic name.
        """
        pass
    
    @abstractmethod
    def delete_network(self, tenant_id, net_id):
        """
        Deletes the network with the specified network identifier
        belonging to the specified tenant.
        """
        pass

    @abstractmethod
    def get_network_details(self, tenant_id, net_id):
        """
        Deletes the Virtual Network belonging to a the
        spec
        """
        pass
    
    @abstractmethod
    def rename_network(self, tenant_id, net_id, new_name):
        """
        Updates the symbolic name belonging to a particular
        Virtual Network.
        """
        pass
    
    @abstractmethod
    def get_all_ports(self, tenant_id, net_id):
        """
        Retrieves all port identifiers belonging to the
        specified Virtual Network.
        """
        pass
    
    @abstractmethod
    def create_port(self, tenant_id, net_id):
        """
        Creates a port on the specified Virtual Network.
        """
        pass
    
    @abstractmethod
    def delete_port(self, tenant_id, net_id, port_id):
        """
        Deletes a port on a specified Virtual Network,
        if the port contains a remote interface attachment,
        the remote interface is first un-plugged and then the port
        is deleted.
        """
        pass
    
    @abstractmethod
    def get_port_details(self, tenant_id, net_id, port_id):
        """
        This method allows the user to retrieve a remote interface
        that is attached to this particular port.
        """
        pass
    
    @abstractmethod
    def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
        """
        Attaches a remote interface to the specified port on the
        specified Virtual Network.
        """
        pass
    
    @abstractmethod
    def unplug_interface(self, tenant_id, net_id, port_id):
        """
        Detaches a remote interface from the specified port on the
        specified Virtual Network.
        """
        pass
    
    @abstractmethod
    def get_interface_details(self, tenant_id, net_id, port_id):
        """
        Retrieves the remote interface that is attached at this
        particular port.
        """
        pass
    
    @abstractmethod
    def get_all_attached_interfaces(self, tenant_id, net_id):
        """
        Retrieves all remote interfaces that are attached to
        a particular Virtual Network.
        """
        pass