Rename DB models and related resources for VMware NSX plugin
This patch also introduces a DB migration to update the affected tables, and the enum type for those DB engines that require it. Additions made to existing migrations are needed to ensure that green deployments using the new plugin name will apply the migrations correctly. Partial-implements blueprint nicira-plugin-renaming Change-Id: Ie0fdb51dfa399c44b749fa8345f334a2c8c29151
This commit is contained in:
parent
ee0788b9b3
commit
1d6d0257a2
@ -30,7 +30,10 @@ down_revision = '1b693c095aa3'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -36,8 +36,11 @@ migration_for_plugins = [
|
||||
'neutron.plugins.ml2.plugin.Ml2Plugin',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2'
|
||||
'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,7 +30,10 @@ down_revision = '4692d074d587'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -28,7 +28,9 @@ down_revision = '8f682276ee4'
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin'
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,10 +30,13 @@ down_revision = 'f489cf14a79c'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,7 +30,10 @@ down_revision = '3cb5d900c5de'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,10 +30,13 @@ down_revision = '51b4de912379'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.cisco.network_plugin.PluginV2',
|
||||
'neutron.plugins.ml2.plugin.Ml2Plugin'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.ml2.plugin.Ml2Plugin',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -28,11 +28,14 @@ revision = '1fcfc149aca4'
|
||||
down_revision = 'e197124d4b9'
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
|
||||
]
|
||||
|
||||
|
@ -33,7 +33,10 @@ migration_for_plugins = [
|
||||
'neutron.plugins.bigswitch.plugin.NeutronRestProxyV2',
|
||||
'neutron.plugins.hyperv.hyperv_neutron_plugin.HyperVNeutronPlugin',
|
||||
'neutron.plugins.midonet.plugin.MidonetPluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
||||
]
|
||||
|
||||
from neutron.db import migration
|
||||
|
@ -30,7 +30,10 @@ down_revision = '49332180ca96'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,7 +30,10 @@ down_revision = '86cf4d88bd3'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -32,9 +32,12 @@ down_revision = '48b6f43f7471'
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.ryu.ryu_neutron_plugin.RyuNeutronPluginV2',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,7 +30,10 @@ down_revision = '5ac71e65402c'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -0,0 +1,65 @@
|
||||
# Copyright 2014 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""VMware NSX rebranding
|
||||
|
||||
Revision ID: 3d2585038b95
|
||||
Revises: 157a5d299379
|
||||
Create Date: 2014-02-11 18:18:34.319031
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3d2585038b95'
|
||||
down_revision = '157a5d299379'
|
||||
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade(active_plugins=None, options=None):
|
||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
||||
return
|
||||
|
||||
op.rename_table('nvp_network_bindings', 'tz_network_bindings')
|
||||
op.rename_table('nvp_multi_provider_networks', 'multi_provider_networks')
|
||||
|
||||
engine = op.get_bind().engine
|
||||
if engine.name == 'postgresql':
|
||||
op.execute("ALTER TYPE nvp_network_bindings_binding_type "
|
||||
"RENAME TO tz_network_bindings_binding_type;")
|
||||
|
||||
|
||||
def downgrade(active_plugins=None, options=None):
|
||||
if not migration.should_run(active_plugins, migration_for_plugins):
|
||||
return
|
||||
|
||||
engine = op.get_bind().engine
|
||||
if engine.name == 'postgresql':
|
||||
op.execute("ALTER TYPE tz_network_bindings_binding_type "
|
||||
"RENAME TO nvp_network_bindings_binding_type;")
|
||||
|
||||
op.rename_table('multi_provider_networks', 'nvp_multi_provider_networks')
|
||||
op.rename_table('tz_network_bindings', 'nvp_network_bindings')
|
@ -27,7 +27,9 @@ down_revision = '1421183d533f'
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin'
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,7 +30,10 @@ down_revision = '63afba73813'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,7 +30,10 @@ down_revision = '54c2c487e913'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,11 +30,14 @@ down_revision = '3b54bf9e29f7'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -33,7 +33,9 @@ down_revision = '38fc1f6789f8'
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin'
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -28,6 +28,8 @@ down_revision = '3d3cb89d84ee'
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin'
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -31,7 +31,9 @@ down_revision = '1fcfc149aca4'
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin'
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -30,12 +30,15 @@ down_revision = '363468ac592c'
|
||||
# Change to ['*'] if this migration applies to all plugins
|
||||
|
||||
migration_for_plugins = [
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2',
|
||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin',
|
||||
'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2',
|
||||
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2',
|
||||
'neutron.plugins.nec.nec_plugin.NECPluginV2',
|
||||
'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2',
|
||||
'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxPlugin',
|
||||
'neutron.plugins.vmware.plugin.NsxServicePlugin',
|
||||
'neutron.services.loadbalancer.plugin.LoadBalancerPlugin'
|
||||
]
|
||||
|
||||
from alembic import op
|
||||
|
@ -66,10 +66,10 @@ from neutron.plugins.nicira.common import exceptions as nvp_exc
|
||||
from neutron.plugins.nicira.common import nsx_utils
|
||||
from neutron.plugins.nicira.common import securitygroups as nvp_sec
|
||||
from neutron.plugins.nicira.common import sync
|
||||
from neutron.plugins.nicira.dbexts import db as nsx_db
|
||||
from neutron.plugins.nicira.dbexts import distributedrouter as dist_rtr
|
||||
from neutron.plugins.nicira.dbexts import maclearning as mac_db
|
||||
from neutron.plugins.nicira.dbexts import networkgw_db
|
||||
from neutron.plugins.nicira.dbexts import nicira_db
|
||||
from neutron.plugins.nicira.dbexts import qos_db
|
||||
from neutron.plugins.nicira import dhcpmeta_modes
|
||||
from neutron.plugins.nicira.extensions import maclearning as mac_ext
|
||||
@ -390,7 +390,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
|
||||
def _nvp_find_lswitch_for_port(self, context, port_data):
|
||||
network = self._get_network(context, port_data['network_id'])
|
||||
network_bindings = nicira_db.get_network_bindings(
|
||||
network_bindings = nsx_db.get_network_bindings(
|
||||
context.session, port_data['network_id'])
|
||||
max_ports = self.nvp_opts.max_lp_per_overlay_ls
|
||||
allow_extra_lswitches = False
|
||||
@ -434,8 +434,8 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# Remove orphaned port from NSX
|
||||
switchlib.delete_port(self.cluster, ls_uuid, lp_uuid)
|
||||
# rollback the neutron-nvp port mapping
|
||||
nicira_db.delete_neutron_nsx_port_mapping(context.session,
|
||||
port_id)
|
||||
nsx_db.delete_neutron_nsx_port_mapping(context.session,
|
||||
port_id)
|
||||
msg = (_("An exception occurred while creating the "
|
||||
"quantum port %s on the NVP plaform") % port_id)
|
||||
LOG.exception(msg)
|
||||
@ -462,7 +462,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
selected_lswitch['uuid'],
|
||||
port_data,
|
||||
True)
|
||||
nicira_db.add_neutron_nsx_port_mapping(
|
||||
nsx_db.add_neutron_nsx_port_mapping(
|
||||
context.session, port_data['id'],
|
||||
selected_lswitch['uuid'], lport['uuid'])
|
||||
if port_data['device_owner'] not in self.port_special_owners:
|
||||
@ -577,7 +577,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
self.cluster, context, nsx_router_id, port_data,
|
||||
"PatchAttachment", ls_port['uuid'],
|
||||
subnet_ids=[subnet_id])
|
||||
nicira_db.add_neutron_nsx_port_mapping(
|
||||
nsx_db.add_neutron_nsx_port_mapping(
|
||||
context.session, port_data['id'],
|
||||
selected_lswitch['uuid'], ls_port['uuid'])
|
||||
LOG.debug(_("_nvp_create_router_port completed for port "
|
||||
@ -712,7 +712,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
selected_lswitch['uuid'],
|
||||
port_data,
|
||||
True)
|
||||
nicira_db.add_neutron_nsx_port_mapping(
|
||||
nsx_db.add_neutron_nsx_port_mapping(
|
||||
context.session, port_data['id'],
|
||||
selected_lswitch['uuid'], lport['uuid'])
|
||||
l2gwlib.plug_l2_gw_service(
|
||||
@ -786,7 +786,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
'max_id': constants.MAX_VLAN_TAG})
|
||||
else:
|
||||
# Verify segment is not already allocated
|
||||
bindings = nicira_db.get_network_bindings_by_vlanid(
|
||||
bindings = nsx_db.get_network_bindings_by_vlanid(
|
||||
context.session, segmentation_id)
|
||||
if bindings:
|
||||
raise q_exc.VlanIdInUse(
|
||||
@ -813,11 +813,11 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
def _extend_network_dict_provider(self, context, network,
|
||||
multiprovider=None, bindings=None):
|
||||
if not bindings:
|
||||
bindings = nicira_db.get_network_bindings(context.session,
|
||||
network['id'])
|
||||
bindings = nsx_db.get_network_bindings(context.session,
|
||||
network['id'])
|
||||
if not multiprovider:
|
||||
multiprovider = nicira_db.is_multiprovider_network(context.session,
|
||||
network['id'])
|
||||
multiprovider = nsx_db.is_multiprovider_network(context.session,
|
||||
network['id'])
|
||||
# With NVP plugin 'normal' overlay networks will have no binding
|
||||
# TODO(salvatore-orlando) make sure users can specify a distinct
|
||||
# phy_uuid as 'provider network' for STT net type
|
||||
@ -876,7 +876,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
transport_zone_config)
|
||||
# add a mapping between the neutron network and the newly
|
||||
# created logical switch
|
||||
nicira_db.add_neutron_nsx_network_mapping(
|
||||
nsx_db.add_neutron_nsx_network_mapping(
|
||||
context.session, network.id, selected_lswitch['uuid'])
|
||||
return selected_lswitch
|
||||
else:
|
||||
@ -1006,21 +1006,21 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# Add mapping between neutron network and NSX switch
|
||||
if (not attr.is_attr_set(external) or
|
||||
attr.is_attr_set(external) and not external):
|
||||
nicira_db.add_neutron_nsx_network_mapping(
|
||||
nsx_db.add_neutron_nsx_network_mapping(
|
||||
context.session, new_net['id'],
|
||||
lswitch['uuid'])
|
||||
if (net_data.get(mpnet.SEGMENTS) and
|
||||
isinstance(provider_type, bool)):
|
||||
net_bindings = []
|
||||
for tz in net_data[mpnet.SEGMENTS]:
|
||||
net_bindings.append(nicira_db.add_network_binding(
|
||||
net_bindings.append(nsx_db.add_network_binding(
|
||||
context.session, new_net['id'],
|
||||
tz.get(pnet.NETWORK_TYPE),
|
||||
tz.get(pnet.PHYSICAL_NETWORK),
|
||||
tz.get(pnet.SEGMENTATION_ID, 0)))
|
||||
if provider_type:
|
||||
nicira_db.set_multiprovider_network(context.session,
|
||||
new_net['id'])
|
||||
nsx_db.set_multiprovider_network(context.session,
|
||||
new_net['id'])
|
||||
self._extend_network_dict_provider(context, new_net,
|
||||
provider_type,
|
||||
net_bindings)
|
||||
@ -1490,7 +1490,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# Ensure neutron router is moved into the transaction's buffer
|
||||
context.session.flush()
|
||||
# Add mapping between neutron and nsx identifiers
|
||||
nicira_db.add_neutron_nsx_router_mapping(
|
||||
nsx_db.add_neutron_nsx_router_mapping(
|
||||
context.session, router_db['id'], lrouter['uuid'])
|
||||
|
||||
if has_gw_info:
|
||||
@ -1640,7 +1640,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# a non-existent NSX router is not left in the DB in case of
|
||||
# failure while removing the router from the neutron DB
|
||||
try:
|
||||
nicira_db.delete_neutron_nsx_router_mapping(
|
||||
nsx_db.delete_neutron_nsx_router_mapping(
|
||||
context.session, router_id)
|
||||
except db_exc.DBError as d_exc:
|
||||
# Do not make this error fatal
|
||||
|
@ -16,7 +16,7 @@
|
||||
# under the License.
|
||||
|
||||
from neutron.openstack.common import log
|
||||
from neutron.plugins.nicira.dbexts import nicira_db
|
||||
from neutron.plugins.nicira.dbexts import db as nsx_db
|
||||
from neutron.plugins.nicira import nsx_cluster
|
||||
from neutron.plugins.nicira.nsxlib import router as routerlib
|
||||
from neutron.plugins.nicira.nsxlib import switch as switchlib
|
||||
@ -50,7 +50,7 @@ def get_nsx_switch_ids(session, cluster, neutron_network_id):
|
||||
First lookup for mappings in Neutron database. If no mapping is
|
||||
found, query the NSX backend and add the mappings.
|
||||
"""
|
||||
nsx_switch_ids = nicira_db.get_nsx_switch_ids(
|
||||
nsx_switch_ids = nsx_db.get_nsx_switch_ids(
|
||||
session, neutron_network_id)
|
||||
if not nsx_switch_ids:
|
||||
# Find logical switches from backend.
|
||||
@ -67,7 +67,7 @@ def get_nsx_switch_ids(session, cluster, neutron_network_id):
|
||||
nsx_switch_id = nsx_switch['uuid']
|
||||
nsx_switch_ids.append(nsx_switch_id)
|
||||
# Create DB mapping
|
||||
nicira_db.add_neutron_nsx_network_mapping(
|
||||
nsx_db.add_neutron_nsx_network_mapping(
|
||||
session,
|
||||
neutron_network_id,
|
||||
nsx_switch_id)
|
||||
@ -91,7 +91,7 @@ def get_nsx_switch_and_port_id(session, cluster, neutron_port_id):
|
||||
the backend logical switch identifier is equal to the neutron
|
||||
network identifier.
|
||||
"""
|
||||
nsx_switch_id, nsx_port_id = nicira_db.get_nsx_switch_and_port_id(
|
||||
nsx_switch_id, nsx_port_id = nsx_db.get_nsx_switch_and_port_id(
|
||||
session, neutron_port_id)
|
||||
if not nsx_switch_id:
|
||||
# Find logical switch for port from backend
|
||||
@ -114,12 +114,12 @@ def get_nsx_switch_and_port_id(session, cluster, neutron_port_id):
|
||||
['LogicalSwitchConfig']['uuid'])
|
||||
if nsx_port_id:
|
||||
# Mapping already exists. Delete before recreating
|
||||
nicira_db.delete_neutron_nsx_port_mapping(
|
||||
nsx_db.delete_neutron_nsx_port_mapping(
|
||||
session, neutron_port_id)
|
||||
else:
|
||||
nsx_port_id = nsx_port['uuid']
|
||||
# (re)Create DB mapping
|
||||
nicira_db.add_neutron_nsx_port_mapping(
|
||||
nsx_db.add_neutron_nsx_port_mapping(
|
||||
session, neutron_port_id,
|
||||
nsx_switch_id, nsx_port_id)
|
||||
return nsx_switch_id, nsx_port_id
|
||||
@ -150,7 +150,7 @@ def get_nsx_router_id(session, cluster, neutron_router_id):
|
||||
First, look up the Neutron database. If not found, execute
|
||||
a query on NSX platform as the mapping might be missing.
|
||||
"""
|
||||
nsx_router_id = nicira_db.get_nsx_router_id(
|
||||
nsx_router_id = nsx_db.get_nsx_router_id(
|
||||
session, neutron_router_id)
|
||||
if not nsx_router_id:
|
||||
# Find logical router from backend.
|
||||
@ -171,7 +171,7 @@ def get_nsx_router_id(session, cluster, neutron_router_id):
|
||||
nsx_router_id = nsx_router['uuid']
|
||||
with session.begin(subtransactions=True):
|
||||
# Create DB mapping
|
||||
nicira_db.add_neutron_nsx_router_mapping(
|
||||
nsx_db.add_neutron_nsx_router_mapping(
|
||||
session,
|
||||
neutron_router_id,
|
||||
nsx_router_id)
|
||||
|
@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2012 Nicira, Inc.
|
||||
# Copyright 2012 VMware, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@ -18,39 +17,39 @@
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
import neutron.db.api as db
|
||||
from neutron.openstack.common.db import exception as d_exc
|
||||
from neutron.openstack.common.db import exception as db_exc
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.nicira.dbexts import models
|
||||
from neutron.plugins.nicira.dbexts import networkgw_db
|
||||
from neutron.plugins.nicira.dbexts import nicira_models
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_network_bindings(session, network_id):
|
||||
session = session or db.get_session()
|
||||
return (session.query(nicira_models.NvpNetworkBinding).
|
||||
return (session.query(models.TzNetworkBinding).
|
||||
filter_by(network_id=network_id).
|
||||
all())
|
||||
|
||||
|
||||
def get_network_bindings_by_vlanid(session, vlan_id):
|
||||
session = session or db.get_session()
|
||||
return (session.query(nicira_models.NvpNetworkBinding).
|
||||
return (session.query(models.TzNetworkBinding).
|
||||
filter_by(vlan_id=vlan_id).
|
||||
all())
|
||||
|
||||
|
||||
def add_network_binding(session, network_id, binding_type, phy_uuid, vlan_id):
|
||||
with session.begin(subtransactions=True):
|
||||
binding = nicira_models.NvpNetworkBinding(network_id, binding_type,
|
||||
phy_uuid, vlan_id)
|
||||
binding = models.TzNetworkBinding(network_id, binding_type,
|
||||
phy_uuid, vlan_id)
|
||||
session.add(binding)
|
||||
return binding
|
||||
|
||||
|
||||
def add_neutron_nsx_network_mapping(session, neutron_id, nsx_switch_id):
|
||||
with session.begin(subtransactions=True):
|
||||
mapping = nicira_models.NeutronNsxNetworkMapping(
|
||||
mapping = models.NeutronNsxNetworkMapping(
|
||||
neutron_id=neutron_id, nsx_id=nsx_switch_id)
|
||||
session.add(mapping)
|
||||
return mapping
|
||||
@ -60,11 +59,11 @@ def add_neutron_nsx_port_mapping(session, neutron_id,
|
||||
nsx_switch_id, nsx_port_id):
|
||||
session.begin(subtransactions=True)
|
||||
try:
|
||||
mapping = nicira_models.NeutronNsxPortMapping(
|
||||
mapping = models.NeutronNsxPortMapping(
|
||||
neutron_id, nsx_switch_id, nsx_port_id)
|
||||
session.add(mapping)
|
||||
session.commit()
|
||||
except d_exc.DBDuplicateEntry:
|
||||
except db_exc.DBDuplicateEntry:
|
||||
session.rollback()
|
||||
# do not complain if the same exact mapping is being added, otherwise
|
||||
# re-raise because even though it is possible for the same neutron
|
||||
@ -75,7 +74,7 @@ def add_neutron_nsx_port_mapping(session, neutron_id,
|
||||
LOG.debug(_("Port mapping for %s already available"), neutron_id)
|
||||
else:
|
||||
raise
|
||||
except d_exc.DBError:
|
||||
except db_exc.DBError:
|
||||
# rollback for any other db error
|
||||
session.rollback()
|
||||
raise
|
||||
@ -84,7 +83,7 @@ def add_neutron_nsx_port_mapping(session, neutron_id,
|
||||
|
||||
def add_neutron_nsx_router_mapping(session, neutron_id, nsx_router_id):
|
||||
with session.begin(subtransactions=True):
|
||||
mapping = nicira_models.NeutronNsxRouterMapping(
|
||||
mapping = models.NeutronNsxRouterMapping(
|
||||
neutron_id=neutron_id, nsx_id=nsx_router_id)
|
||||
session.add(mapping)
|
||||
return mapping
|
||||
@ -94,13 +93,13 @@ def get_nsx_switch_ids(session, neutron_id):
|
||||
# This function returns a list of NSX switch identifiers because of
|
||||
# the possibility of chained logical switches
|
||||
return [mapping['nsx_id'] for mapping in
|
||||
session.query(nicira_models.NeutronNsxNetworkMapping).filter_by(
|
||||
session.query(models.NeutronNsxNetworkMapping).filter_by(
|
||||
neutron_id=neutron_id)]
|
||||
|
||||
|
||||
def get_nsx_switch_and_port_id(session, neutron_id):
|
||||
try:
|
||||
mapping = (session.query(nicira_models.NeutronNsxPortMapping).
|
||||
mapping = (session.query(models.NeutronNsxPortMapping).
|
||||
filter_by(neutron_id=neutron_id).
|
||||
one())
|
||||
return mapping['nsx_switch_id'], mapping['nsx_port_id']
|
||||
@ -112,7 +111,7 @@ def get_nsx_switch_and_port_id(session, neutron_id):
|
||||
|
||||
def get_nsx_router_id(session, neutron_id):
|
||||
try:
|
||||
mapping = (session.query(nicira_models.NeutronNsxRouterMapping).
|
||||
mapping = (session.query(models.NeutronNsxRouterMapping).
|
||||
filter_by(neutron_id=neutron_id).one())
|
||||
return mapping['nsx_id']
|
||||
except exc.NoResultFound:
|
||||
@ -126,12 +125,12 @@ def _delete_by_neutron_id(session, model, neutron_id):
|
||||
|
||||
def delete_neutron_nsx_port_mapping(session, neutron_id):
|
||||
return _delete_by_neutron_id(
|
||||
session, nicira_models.NeutronNsxPortMapping, neutron_id)
|
||||
session, models.NeutronNsxPortMapping, neutron_id)
|
||||
|
||||
|
||||
def delete_neutron_nsx_router_mapping(session, neutron_id):
|
||||
return _delete_by_neutron_id(
|
||||
session, nicira_models.NeutronNsxRouterMapping, neutron_id)
|
||||
session, models.NeutronNsxRouterMapping, neutron_id)
|
||||
|
||||
|
||||
def unset_default_network_gateways(session):
|
||||
@ -149,7 +148,7 @@ def set_default_network_gateway(session, gw_id):
|
||||
|
||||
def set_multiprovider_network(session, network_id):
|
||||
with session.begin(subtransactions=True):
|
||||
multiprovider_network = nicira_models.MultiProviderNetworks(
|
||||
multiprovider_network = models.MultiProviderNetworks(
|
||||
network_id)
|
||||
session.add(multiprovider_network)
|
||||
return multiprovider_network
|
||||
@ -158,5 +157,5 @@ def set_multiprovider_network(session, network_id):
|
||||
def is_multiprovider_network(session, network_id):
|
||||
with session.begin(subtransactions=True):
|
||||
return bool(
|
||||
session.query(nicira_models.MultiProviderNetworks).filter_by(
|
||||
session.query(models.MultiProviderNetworks).filter_by(
|
||||
network_id=network_id).first())
|
@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Nicira Networks, Inc. All rights reserved.
|
||||
# Copyright 2013 VMware, Inc. All rights reserved.
|
||||
#
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@ -14,8 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# @author: Salvatore Orlando, Nicira, Inc
|
||||
#
|
||||
|
||||
from neutron.plugins.nicira.dbexts import nsxrouter
|
||||
from neutron.plugins.nicira.extensions import distributedrouter as dist_rtr
|
||||
|
@ -1,5 +1,3 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
#
|
||||
# Copyright 2013 VMware, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2012 Nicira, Inc.
|
||||
# Copyright 2013 VMware, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
@ -23,13 +22,13 @@ from neutron.db import l3_db
|
||||
from neutron.db.models_v2 import model_base
|
||||
|
||||
|
||||
class NvpNetworkBinding(model_base.BASEV2):
|
||||
class TzNetworkBinding(model_base.BASEV2):
|
||||
"""Represents a binding of a virtual network with a transport zone.
|
||||
|
||||
This model class associates a Neutron network with a transport zone;
|
||||
optionally a vlan ID might be used if the binding type is 'bridge'
|
||||
"""
|
||||
__tablename__ = 'nvp_network_bindings'
|
||||
__tablename__ = 'tz_network_bindings'
|
||||
|
||||
# TODO(arosen) - it might be worth while refactoring the how this data
|
||||
# is stored later so every column does not need to be a primary key.
|
||||
@ -38,7 +37,7 @@ class NvpNetworkBinding(model_base.BASEV2):
|
||||
primary_key=True)
|
||||
# 'flat', 'vlan', stt' or 'gre'
|
||||
binding_type = Column(Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
|
||||
name='nvp_network_bindings_binding_type'),
|
||||
name='tz_network_bindings_binding_type'),
|
||||
nullable=False, primary_key=True)
|
||||
phy_uuid = Column(String(36), primary_key=True, nullable=True)
|
||||
vlan_id = Column(Integer, primary_key=True, nullable=True,
|
||||
@ -96,9 +95,9 @@ class NeutronNsxRouterMapping(model_base.BASEV2):
|
||||
|
||||
|
||||
class MultiProviderNetworks(model_base.BASEV2):
|
||||
"""Networks that were provision through multiprovider extension."""
|
||||
"""Networks provisioned through multiprovider extension."""
|
||||
|
||||
__tablename__ = 'nvp_multi_provider_networks'
|
||||
__tablename__ = 'multi_provider_networks'
|
||||
network_id = Column(String(36),
|
||||
ForeignKey('networks.id', ondelete="CASCADE"),
|
||||
primary_key=True)
|
||||
@ -108,7 +107,7 @@ class MultiProviderNetworks(model_base.BASEV2):
|
||||
|
||||
|
||||
class NSXRouterExtAttributes(model_base.BASEV2):
|
||||
"""Router attributes managed by Nicira plugin extensions."""
|
||||
"""Router attributes managed by NSX plugin extensions."""
|
||||
router_id = Column(String(36),
|
||||
ForeignKey('routers.id', ondelete="CASCADE"),
|
||||
primary_key=True)
|
@ -1,6 +1,4 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
#
|
||||
# Copyright 2013 Nicira Networks, Inc. All rights reserved.
|
||||
# Copyright 2013 VMware, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@ -14,8 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# @author: Salvatore Orlando, VMware
|
||||
#
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Nicira Networks, Inc. All rights reserved.
|
||||
# Copyright 2013 VMware, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@ -14,13 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# @author: Salvatore Orlando, Nicira, Inc
|
||||
#
|
||||
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.extensions import l3
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.nicira.dbexts import nicira_models
|
||||
from neutron.plugins.nicira.dbexts import models
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -48,7 +44,7 @@ class NsxRouterMixin(object):
|
||||
name = attr['name']
|
||||
default = attr['default']
|
||||
kwargs[name] = router_req.get(name, default)
|
||||
nsx_attributes = nicira_models.NSXRouterExtAttributes(
|
||||
nsx_attributes = models.NSXRouterExtAttributes(
|
||||
router_id=router_db['id'], **kwargs)
|
||||
context.session.add(nsx_attributes)
|
||||
router_db['nsx_attributes'] = nsx_attributes
|
||||
|
@ -1,5 +1,3 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
#
|
||||
# Copyright 2013 VMware, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -1,5 +1,3 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 VMware, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Nicira, Inc.
|
||||
# Copyright 2013 VMware, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -1,6 +1,5 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Nicira, Inc.
|
||||
# Copyright 2013 VMware, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -19,8 +19,8 @@ from neutron import context
|
||||
from neutron.db import api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.openstack.common.db import exception as d_exc
|
||||
from neutron.plugins.nicira.dbexts import nicira_db as nsx_db
|
||||
from neutron.plugins.nicira.dbexts import nicira_models as models
|
||||
from neutron.plugins.nicira.dbexts import db as nsx_db
|
||||
from neutron.plugins.nicira.dbexts import models
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ from neutron.openstack.common import log
|
||||
from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.nicira.common import exceptions as nsx_exc
|
||||
from neutron.plugins.nicira.common import sync
|
||||
from neutron.plugins.nicira.dbexts import nicira_db as nsx_db
|
||||
from neutron.plugins.nicira.dbexts import db as nsx_db
|
||||
from neutron.plugins.nicira.extensions import distributedrouter as dist_router
|
||||
from neutron.plugins.nicira import NeutronPlugin
|
||||
from neutron.plugins.nicira import nsxlib
|
||||
|
@ -40,32 +40,32 @@ class NsxUtilsTestCase(base.BaseTestCase):
|
||||
# This will allow for avoiding setting up the plugin
|
||||
# for creating db entries
|
||||
mock.patch(nsx_method('get_nsx_switch_and_port_id',
|
||||
module_name='dbexts.nicira_db'),
|
||||
module_name='dbexts.db'),
|
||||
return_value=ret_value).start()
|
||||
mock.patch(nsx_method('add_neutron_nsx_port_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
module_name='dbexts.db')).start()
|
||||
mock.patch(nsx_method('delete_neutron_nsx_port_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
module_name='dbexts.db')).start()
|
||||
|
||||
def _mock_network_mapping_db_calls(self, ret_value):
|
||||
# Mock relevant db calls
|
||||
# This will allow for avoiding setting up the plugin
|
||||
# for creating db entries
|
||||
mock.patch(nsx_method('get_nsx_switch_ids',
|
||||
module_name='dbexts.nicira_db'),
|
||||
module_name='dbexts.db'),
|
||||
return_value=ret_value).start()
|
||||
mock.patch(nsx_method('add_neutron_nsx_network_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
module_name='dbexts.db')).start()
|
||||
|
||||
def _mock_router_mapping_db_calls(self, ret_value):
|
||||
# Mock relevant db calls
|
||||
# This will allow for avoiding setting up the plugin
|
||||
# for creating db entries
|
||||
mock.patch(nsx_method('get_nsx_router_id',
|
||||
module_name='dbexts.nicira_db'),
|
||||
module_name='dbexts.db'),
|
||||
return_value=ret_value).start()
|
||||
mock.patch(nsx_method('add_neutron_nsx_router_mapping',
|
||||
module_name='dbexts.nicira_db')).start()
|
||||
module_name='dbexts.db')).start()
|
||||
|
||||
def _verify_get_nsx_switch_and_port_id(self, exp_ls_uuid, exp_lp_uuid):
|
||||
# The nvplib and db calls are mocked, therefore the cluster
|
||||
|
Loading…
Reference in New Issue
Block a user