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:
1 """
2 Quantum Plug-in API specification.
3
4 QuantumPluginBase provides the definition of minimum set of
5 methods that needs to be implemented by a Quantum Plug-in.
6 """
7
8 from abc import ABCMeta, abstractmethod
9
10 class QuantumPluginBase(object):
11
12 __metaclass__ = ABCMeta
13
14 @abstractmethod
15 def get_all_networks(self, tenant_id):
16 """
17 Returns a dictionary containing all
18 <network_uuid, network_name> for
19 the specified tenant.
20 """
21 pass
22
23 @abstractmethod
24 def create_network(self, tenant_id, net_name):
25 """
26 Creates a new Virtual Network, and assigns it
27 a symbolic name.
28 """
29 pass
30
31 @abstractmethod
32 def delete_network(self, tenant_id, net_id):
33 """
34 Deletes the network with the specified network identifier
35 belonging to the specified tenant.
36 """
37 pass
38
39 @abstractmethod
40 def get_network_details(self, tenant_id, net_id):
41 """
42 Deletes the Virtual Network belonging to a the
43 spec
44 """
45 pass
46
47 @abstractmethod
48 def rename_network(self, tenant_id, net_id, new_name):
49 """
50 Updates the symbolic name belonging to a particular
51 Virtual Network.
52 """
53 pass
54
55 @abstractmethod
56 def get_all_ports(self, tenant_id, net_id):
57 """
58 Retrieves all port identifiers belonging to the
59 specified Virtual Network.
60 """
61 pass
62
63 @abstractmethod
64 def create_port(self, tenant_id, net_id):
65 """
66 Creates a port on the specified Virtual Network.
67 """
68 pass
69
70 @abstractmethod
71 def delete_port(self, tenant_id, net_id, port_id):
72 """
73 Deletes a port on a specified Virtual Network,
74 if the port contains a remote interface attachment,
75 the remote interface is first un-plugged and then the port
76 is deleted.
77 """
78 pass
79
80 @abstractmethod
81 def get_port_details(self, tenant_id, net_id, port_id):
82 """
83 This method allows the user to retrieve a remote interface
84 that is attached to this particular port.
85 """
86 pass
87
88 @abstractmethod
89 def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id):
90 """
91 Attaches a remote interface to the specified port on the
92 specified Virtual Network.
93 """
94 pass
95
96 @abstractmethod
97 def unplug_interface(self, tenant_id, net_id, port_id):
98 """
99 Detaches a remote interface from the specified port on the
100 specified Virtual Network.
101 """
102 pass
103
104 @abstractmethod
105 def get_interface_details(self, tenant_id, net_id, port_id):
106 """
107 Retrieves the remote interface that is attached at this
108 particular port.
109 """
110 pass
111
112 @abstractmethod
113 def get_all_attached_interfaces(self, tenant_id, net_id):
114 """
115 Retrieves all remote interfaces that are attached to
116 a particular Virtual Network.
117 """
118 pass
119