Jump to: navigation, search

Difference between revisions of "QuantumAbstractPlugin"

m (Text replace - "__NOTOC__" to "")
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
+
 
 
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.
 
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.
  
Line 16: Line 16:
  
  
<pre><nowiki>
+
<pre><nowiki>#!highlight python
 
"""
 
"""
Quantum L2Network Service Plug-in API specification.
+
Quantum Plug-in API specification.
L2NetworkManagerBase provides the definition of minimum set of
+
 
methods that needs to be implemented by a L2NetworkManager Plug-in.
+
QuantumPluginBase provides the definition of minimum set of
(c) 2011, Nicira Networks, Inc.
+
methods that needs to be implemented by a Quantum Plug-in.
 
"""
 
"""
 +
 
from abc import ABCMeta, abstractmethod
 
from abc import ABCMeta, abstractmethod
class L2NetworkManagerBase(object):
+
 
 +
class QuantumPluginBase(object):
 +
 
 
     __metaclass__ = ABCMeta
 
     __metaclass__ = ABCMeta
 +
 
     @abstractmethod
 
     @abstractmethod
 
     def get_all_networks(self, tenant_id):
 
     def get_all_networks(self, tenant_id):
Line 31: Line 35:
 
         Returns a dictionary containing all
 
         Returns a dictionary containing all
 
         <network_uuid, network_name> for
 
         <network_uuid, network_name> for
         the specified tenant.
+
         the specified tenant.  
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def create_network(self, tenant_id, net_name):
 
     def create_network(self, tenant_id, net_name):
Line 42: Line 46:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def delete_network(self, tenant_id, net_id):
 
     def delete_network(self, tenant_id, net_id):
Line 50: Line 54:
 
         """
 
         """
 
         pass
 
         pass
 +
 
     @abstractmethod
 
     @abstractmethod
 
     def get_network_details(self, tenant_id, net_id):
 
     def get_network_details(self, tenant_id, net_id):
Line 57: Line 62:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def rename_network(self, tenant_id, net_id, new_name):
 
     def rename_network(self, tenant_id, net_id, new_name):
Line 65: Line 70:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def get_all_ports(self, tenant_id, net_id):
 
     def get_all_ports(self, tenant_id, net_id):
Line 73: Line 78:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def create_port(self, tenant_id, net_id):
 
     def create_port(self, tenant_id, net_id):
Line 80: Line 85:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def delete_port(self, tenant_id, net_id, port_id):
 
     def delete_port(self, tenant_id, net_id, port_id):
Line 90: Line 95:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def get_port_details(self, tenant_id, net_id, port_id):
 
     def get_port_details(self, tenant_id, net_id, port_id):
Line 98: Line 103:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
 
     def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
Line 106: Line 111:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def unplug_interface(self, tenant_id, net_id, port_id):
 
     def unplug_interface(self, tenant_id, net_id, port_id):
Line 114: Line 119:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def get_interface_details(self, tenant_id, net_id, port_id):
 
     def get_interface_details(self, tenant_id, net_id, port_id):
Line 122: Line 127:
 
         """
 
         """
 
         pass
 
         pass
 
+
   
 
     @abstractmethod
 
     @abstractmethod
 
     def get_all_attached_interfaces(self, tenant_id, net_id):
 
     def get_all_attached_interfaces(self, tenant_id, net_id):

Latest revision as of 23:29, 17 February 2013

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