1
# Copyright 2012 NEC Corporation. All rights reserved.
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
# not use this file except in compliance with the License. You may obtain
5
# a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations
19
@six.add_metaclass(abc.ABCMeta)
20
class OFCDriverBase(object):
21
"""OpenFlow Controller (OFC) Driver Specification.
23
OFCDriverBase defines the minimum set of methods required by this plugin.
24
It would be better that other methods like update_* are implemented.
28
def create_tenant(self, description, tenant_id=None):
29
"""Create a new tenant at OpenFlow Controller.
31
:param description: A description of this tenant.
32
:param tenant_id: A hint of OFC tenant ID.
33
A driver could use this id as a OFC id or ignore it.
34
:returns: ID of the tenant created at OpenFlow Controller.
35
:raises: neutron.plugin.nec.common.exceptions.OFCException
40
def delete_tenant(self, ofc_tenant_id):
41
"""Delete a tenant at OpenFlow Controller.
43
:raises: neutron.plugin.nec.common.exceptions.OFCException
48
def create_network(self, ofc_tenant_id, description, network_id=None):
49
"""Create a new network on specified OFC tenant at OpenFlow Controller.
51
:param ofc_tenant_id: a OFC tenant ID in which a new network belongs.
52
:param description: A description of this network.
53
:param network_id: A hint of an ID of OFC network.
54
:returns: ID of the network created at OpenFlow Controller.
55
ID returned must be unique in the OpenFlow Controller.
56
If a network is identified in conjunction with other information
57
such as a tenant ID, such information should be included in the ID.
58
:raises: neutron.plugin.nec.common.exceptions.OFCException
63
def delete_network(self, ofc_network_id):
64
"""Delete a netwrok at OpenFlow Controller.
66
:raises: neutron.plugin.nec.common.exceptions.OFCException
71
def create_port(self, ofc_network_id, portinfo,
72
port_id=None, filters=None):
73
"""Create a new port on specified network at OFC.
75
:param ofc_network_id: a OFC tenant ID in which a new port belongs.
76
:param portinfo: An OpenFlow information of this port.
77
{'datapath_id': Switch ID that a port connected.
78
'port_no': Port Number that a port connected on a Swtich.
79
'vlan_id': VLAN ID that a port tagging.
82
:param port_id: A hint of an ID of OFC port.
83
ID returned must be unique in the OpenFlow Controller.
85
If a port is identified in combination with a network or
86
a tenant, such information should be included in the ID.
87
:param filters: A list of packet filter associated with the port.
88
Each element is a tuple (neutron ID, OFC ID)
90
:returns: ID of the port created at OpenFlow Controller.
91
:raises: neutron.plugin.nec.common.exceptions.OFCException
96
def delete_port(self, ofc_port_id):
97
"""Delete a port at OpenFlow Controller.
99
:raises: neutron.plugin.nec.common.exceptions.OFCException