Merge "Prepare for multiple cisco ML2 mech drivers"

This commit is contained in:
Jenkins 2014-02-11 06:57:01 +00:00 committed by Gerrit Code Review
commit 27012a178b
21 changed files with 60 additions and 82 deletions

View File

@ -1,19 +0,0 @@
Neutron ML2 Cisco Mechanism Drivers README
Cisco mechanism drivers implement the ML2 driver APIs for managing
Cisco devices.
Notes:
The initial version of the Cisco Nexus driver supports only the
VLAN network type on a single physical network.
Provider networks are not currently supported.
The Cisco Nexus mechanism driver's database may have duplicate entries also
found in the core ML2 database. Since the Cisco Nexus DB code is a port from
the plugins/cisco implementation this duplication will remain until the
plugins/cisco code is deprecated.
For more details on using Cisco Nexus switches under ML2 please refer to:
http://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus

View File

@ -0,0 +1,19 @@
Neutron ML2 Cisco Nexus Mechanism Driver README
Notes:
The initial version of this driver supports only a single physical
network.
For provider networks, extended configuration options are not
currently supported.
This driver's database may have duplicate entries also found in the
core ML2 database. Since the Cisco Nexus DB code is a port from the
plugins/cisco implementation this duplication will remain until the
plugins/cisco code is deprecated.
For more details on using Cisco Nexus switches under ML2 please refer to:
http://wiki.openstack.org/wiki/Neutron/ML2/MechCiscoNexus

View File

@ -15,25 +15,6 @@
# #
# Attachment attributes
INSTANCE_ID = 'instance_id'
TENANT_ID = 'tenant_id'
TENANT_NAME = 'tenant_name'
HOST_NAME = 'host_name'
# Network attributes
NET_ID = 'id'
NET_NAME = 'name'
NET_VLAN_ID = 'vlan_id'
NET_VLAN_NAME = 'vlan_name'
NET_PORTS = 'ports'
# Network types
NETWORK_TYPE_FLAT = 'flat'
NETWORK_TYPE_LOCAL = 'local'
NETWORK_TYPE_VLAN = 'vlan'
NETWORK_TYPE_NONE = 'none'
CREDENTIAL_USERNAME = 'user_name' CREDENTIAL_USERNAME = 'user_name'
CREDENTIAL_PASSWORD = 'password' CREDENTIAL_PASSWORD = 'password'
@ -41,8 +22,3 @@ USERNAME = 'username'
PASSWORD = 'password' PASSWORD = 'password'
NETWORK_ADMIN = 'network_admin' NETWORK_ADMIN = 'network_admin'
NETWORK = 'network'
PORT = 'port'
CONTEXT = 'context'
SUBNET = 'subnet'

View File

@ -14,10 +14,10 @@
# under the License. # under the License.
# #
from neutron.plugins.ml2.drivers.cisco import config as config from neutron.plugins.ml2.drivers.cisco.nexus import config
from neutron.plugins.ml2.drivers.cisco import constants as const from neutron.plugins.ml2.drivers.cisco.nexus import constants as const
from neutron.plugins.ml2.drivers.cisco import exceptions as cexc from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as cexc
from neutron.plugins.ml2.drivers.cisco import network_db_v2 as cdb from neutron.plugins.ml2.drivers.cisco.nexus import network_db_v2 as cdb
TENANT = const.NETWORK_ADMIN TENANT = const.NETWORK_ADMIN

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""Exceptions used by Cisco ML2 mechanism drivers.""" """Exceptions used by Cisco Nexus ML2 mechanism driver."""
from neutron.common import exceptions from neutron.common import exceptions

View File

@ -22,12 +22,13 @@ from oslo.config import cfg
from neutron.common import constants as n_const from neutron.common import constants as n_const
from neutron.extensions import portbindings from neutron.extensions import portbindings
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.common import constants as p_const
from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers.cisco import config as conf from neutron.plugins.ml2.drivers.cisco.nexus import config as conf
from neutron.plugins.ml2.drivers.cisco import credentials_v2 as cred from neutron.plugins.ml2.drivers.cisco.nexus import credentials_v2 as cred
from neutron.plugins.ml2.drivers.cisco import exceptions as excep from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as excep
from neutron.plugins.ml2.drivers.cisco import nexus_db_v2 as nxos_db from neutron.plugins.ml2.drivers.cisco.nexus import nexus_db_v2 as nxos_db
from neutron.plugins.ml2.drivers.cisco import nexus_network_driver from neutron.plugins.ml2.drivers.cisco.nexus import nexus_network_driver
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -57,7 +58,7 @@ class CiscoNexusMechanismDriver(api.MechanismDriver):
def _get_vlanid(self, context): def _get_vlanid(self, context):
segment = context.bound_segment segment = context.bound_segment
if (segment and segment[api.NETWORK_TYPE] == 'vlan' and if (segment and segment[api.NETWORK_TYPE] == p_const.TYPE_VLAN and
self._valid_network_segment(segment)): self._valid_network_segment(segment)):
return context.bound_segment.get(api.SEGMENTATION_ID) return context.bound_segment.get(api.SEGMENTATION_ID)

View File

@ -19,9 +19,10 @@ from sqlalchemy.orm import exc
from neutron.db import api as db from neutron.db import api as db
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.openstack.common import uuidutils from neutron.openstack.common import uuidutils
from neutron.plugins.ml2.drivers.cisco import exceptions as c_exc from neutron.plugins.ml2.drivers.cisco.nexus import constants as const
from neutron.plugins.ml2.drivers.cisco import network_models_v2 from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as c_exc
from neutron.plugins.ml2.drivers.cisco import nexus_models_v2 # noqa from neutron.plugins.ml2.drivers.cisco.nexus import network_models_v2
from neutron.plugins.ml2.drivers.cisco.nexus import nexus_models_v2 # noqa
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -104,9 +105,9 @@ def update_credential(tenant_id, credential_id,
filter_by(tenant_id=tenant_id). filter_by(tenant_id=tenant_id).
filter_by(credential_id=credential_id).one()) filter_by(credential_id=credential_id).one())
if new_user_name: if new_user_name:
cred["user_name"] = new_user_name cred[const.CREDENTIAL_USERNAME] = new_user_name
if new_password: if new_password:
cred["password"] = new_password cred[const.CREDENTIAL_PASSWORD] = new_password
session.merge(cred) session.merge(cred)
session.flush() session.flush()
return cred return cred

View File

@ -18,8 +18,8 @@ import sqlalchemy.orm.exc as sa_exc
import neutron.db.api as db import neutron.db.api as db
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.ml2.drivers.cisco import exceptions as c_exc from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as c_exc
from neutron.plugins.ml2.drivers.cisco import nexus_models_v2 from neutron.plugins.ml2.drivers.cisco.nexus import nexus_models_v2
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -20,12 +20,12 @@ Implements a Nexus-OS NETCONF over SSHv2 API Client
from neutron.openstack.common import excutils from neutron.openstack.common import excutils
from neutron.openstack.common import importutils from neutron.openstack.common import importutils
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.ml2.drivers.cisco import config as conf from neutron.plugins.ml2.drivers.cisco.nexus import config as conf
from neutron.plugins.ml2.drivers.cisco import constants as const from neutron.plugins.ml2.drivers.cisco.nexus import constants as const
from neutron.plugins.ml2.drivers.cisco import credentials_v2 as cred from neutron.plugins.ml2.drivers.cisco.nexus import credentials_v2 as cred
from neutron.plugins.ml2.drivers.cisco import exceptions as cexc from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as cexc
from neutron.plugins.ml2.drivers.cisco import nexus_db_v2 from neutron.plugins.ml2.drivers.cisco.nexus import nexus_db_v2
from neutron.plugins.ml2.drivers.cisco import nexus_snippets as snipp from neutron.plugins.ml2.drivers.cisco.nexus import nexus_snippets as snipp
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -25,10 +25,10 @@ from neutron.extensions import portbindings
from neutron.manager import NeutronManager from neutron.manager import NeutronManager
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.plugins.ml2 import config as ml2_config from neutron.plugins.ml2 import config as ml2_config
from neutron.plugins.ml2.drivers.cisco import config as cisco_config from neutron.plugins.ml2.drivers.cisco.nexus import config as cisco_config
from neutron.plugins.ml2.drivers.cisco import exceptions as c_exc from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as c_exc
from neutron.plugins.ml2.drivers.cisco import mech_cisco_nexus from neutron.plugins.ml2.drivers.cisco.nexus import mech_cisco_nexus
from neutron.plugins.ml2.drivers.cisco import nexus_network_driver from neutron.plugins.ml2.drivers.cisco.nexus import nexus_network_driver
from neutron.plugins.ml2.drivers import type_vlan as vlan_config from neutron.plugins.ml2.drivers import type_vlan as vlan_config
from neutron.tests.unit import test_db_plugin from neutron.tests.unit import test_db_plugin

View File

@ -17,8 +17,8 @@ import collections
import testtools import testtools
from neutron.db import api as db from neutron.db import api as db
from neutron.plugins.ml2.drivers.cisco import exceptions from neutron.plugins.ml2.drivers.cisco.nexus import exceptions
from neutron.plugins.ml2.drivers.cisco import network_db_v2 from neutron.plugins.ml2.drivers.cisco.nexus import network_db_v2
from neutron.tests import base from neutron.tests import base

View File

@ -22,11 +22,11 @@ from neutron.db import api as db
from neutron.extensions import portbindings from neutron.extensions import portbindings
from neutron.openstack.common import importutils from neutron.openstack.common import importutils
from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers.cisco import constants from neutron.plugins.ml2.drivers.cisco.nexus import constants
from neutron.plugins.ml2.drivers.cisco import exceptions from neutron.plugins.ml2.drivers.cisco.nexus import exceptions
from neutron.plugins.ml2.drivers.cisco import mech_cisco_nexus from neutron.plugins.ml2.drivers.cisco.nexus import mech_cisco_nexus
from neutron.plugins.ml2.drivers.cisco import nexus_db_v2 from neutron.plugins.ml2.drivers.cisco.nexus import nexus_db_v2
from neutron.plugins.ml2.drivers.cisco import nexus_network_driver from neutron.plugins.ml2.drivers.cisco.nexus import nexus_network_driver
from neutron.tests import base from neutron.tests import base
@ -48,7 +48,7 @@ DEVICE_OWNER = 'compute:test'
NEXUS_SSH_PORT = '22' NEXUS_SSH_PORT = '22'
PORT_STATE = n_const.PORT_STATUS_ACTIVE PORT_STATE = n_const.PORT_STATUS_ACTIVE
NETWORK_TYPE = 'vlan' NETWORK_TYPE = 'vlan'
NEXUS_DRIVER = ('neutron.plugins.ml2.drivers.cisco.' NEXUS_DRIVER = ('neutron.plugins.ml2.drivers.cisco.nexus.'
'nexus_network_driver.CiscoNexusDriver') 'nexus_network_driver.CiscoNexusDriver')

View File

@ -17,8 +17,8 @@ import collections
import testtools import testtools
from neutron.db import api as db from neutron.db import api as db
from neutron.plugins.ml2.drivers.cisco import exceptions from neutron.plugins.ml2.drivers.cisco.nexus import exceptions
from neutron.plugins.ml2.drivers.cisco import nexus_db_v2 from neutron.plugins.ml2.drivers.cisco.nexus import nexus_db_v2
from neutron.tests import base from neutron.tests import base

View File

@ -157,7 +157,7 @@ neutron.ml2.mechanism_drivers =
hyperv = neutron.plugins.ml2.drivers.mech_hyperv:HypervMechanismDriver hyperv = neutron.plugins.ml2.drivers.mech_hyperv:HypervMechanismDriver
ncs = neutron.plugins.ml2.drivers.mechanism_ncs:NCSMechanismDriver ncs = neutron.plugins.ml2.drivers.mechanism_ncs:NCSMechanismDriver
arista = neutron.plugins.ml2.drivers.mech_arista.mechanism_arista:AristaDriver arista = neutron.plugins.ml2.drivers.mech_arista.mechanism_arista:AristaDriver
cisco_nexus = neutron.plugins.ml2.drivers.cisco.mech_cisco_nexus:CiscoNexusMechanismDriver cisco_nexus = neutron.plugins.ml2.drivers.cisco.nexus.mech_cisco_nexus:CiscoNexusMechanismDriver
l2population = neutron.plugins.ml2.drivers.l2pop.mech_driver:L2populationMechanismDriver l2population = neutron.plugins.ml2.drivers.l2pop.mech_driver:L2populationMechanismDriver
bigswitch = neutron.plugins.ml2.drivers.mech_bigswitch.driver:BigSwitchMechanismDriver bigswitch = neutron.plugins.ml2.drivers.mech_bigswitch.driver:BigSwitchMechanismDriver