From 9e9ff3b477ac4e37d8b705c6678090fa2ac6c52e Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Tue, 11 Feb 2014 17:35:30 -0800 Subject: [PATCH] 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 --- .../versions/1149d7de0cfa_port_security.py | 5 +- .../versions/128e042a2b68_ext_gw_mode.py | 5 +- .../1341ed32cc1e_nvp_netbinding_update.py | 5 +- .../1421183d533f_nsx_dhcp_metadata.py | 4 +- .../176a85fc7d79_add_portbindings_db.py | 7 +- .../versions/1d76643bcec4_nvp_netbinding.py | 5 +- .../1efb85914233_allowedaddresspairs.py | 7 +- ...c149aca4_agents_unique_by_type_and_host.py | 7 +- .../versions/2c4af419145b_l3_support.py | 5 +- .../versions/38335592a0dc_nvp_portmap.py | 5 +- .../3c6e57a23db4_add_multiprovider.py | 5 +- .../versions/3cb5d900c5de_security_groups.py | 3 + .../versions/3cbf70257c28_nvp_mac_learning.py | 5 +- .../versions/3d2585038b95_vmware_nsx.py | 65 +++++++++++++++++++ .../3d3cb89d84ee_nsx_switch_mappings.py | 4 +- .../versions/40dffbf4b549_nvp_dist_router.py | 5 +- .../versions/45680af419f9_nvp_qos.py | 5 +- .../versions/4692d074d587_agent_scheduler.py | 7 +- .../versions/4a666eb208c2_service_router.py | 4 +- .../4ca36cfc898c_nsx_router_mappings.py | 2 + .../versions/50e86cb2637a_nsx_mappings.py | 4 +- .../511471cc46b_agent_ext_model_supp.py | 11 ++-- neutron/plugins/nicira/NeutronPlugin.py | 38 +++++------ neutron/plugins/nicira/common/nsx_utils.py | 16 ++--- .../nicira/dbexts/{nicira_db.py => db.py} | 41 ++++++------ .../nicira/dbexts/distributedrouter.py | 7 +- neutron/plugins/nicira/dbexts/maclearning.py | 2 - .../dbexts/{nicira_models.py => models.py} | 17 +++-- neutron/plugins/nicira/dbexts/networkgw_db.py | 6 +- neutron/plugins/nicira/dbexts/nsxrouter.py | 10 +-- neutron/plugins/nicira/dbexts/qos_db.py | 2 - .../plugins/nicira/dbexts/servicerouter.py | 2 - neutron/plugins/nicira/dbexts/vcns_db.py | 5 +- neutron/plugins/nicira/dbexts/vcns_models.py | 5 +- neutron/tests/unit/vmware/db/test_nsx_db.py | 4 +- neutron/tests/unit/vmware/test_nsx_plugin.py | 2 +- neutron/tests/unit/vmware/test_nsx_utils.py | 14 ++-- 37 files changed, 224 insertions(+), 122 deletions(-) create mode 100644 neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py rename neutron/plugins/nicira/dbexts/{nicira_db.py => db.py} (79%) rename neutron/plugins/nicira/dbexts/{nicira_models.py => models.py} (91%) diff --git a/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py b/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py index 29f798f6e..1b035eb08 100644 --- a/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py +++ b/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py b/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py index 448010496..9fc53cca9 100644 --- a/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py +++ b/neutron/db/migration/alembic_migrations/versions/128e042a2b68_ext_gw_mode.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py b/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py index 9bff77298..43e1dd328 100644 --- a/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py +++ b/neutron/db/migration/alembic_migrations/versions/1341ed32cc1e_nvp_netbinding_update.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py b/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py index 2cfbf7505..69e5414a8 100644 --- a/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py +++ b/neutron/db/migration/alembic_migrations/versions/1421183d533f_nsx_dhcp_metadata.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py b/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py index e7c48c81e..82e40a1ce 100644 --- a/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py +++ b/neutron/db/migration/alembic_migrations/versions/176a85fc7d79_add_portbindings_db.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py b/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py index 47784d31d..114d575fe 100644 --- a/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py +++ b/neutron/db/migration/alembic_migrations/versions/1d76643bcec4_nvp_netbinding.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/1efb85914233_allowedaddresspairs.py b/neutron/db/migration/alembic_migrations/versions/1efb85914233_allowedaddresspairs.py index c01e60df5..771934618 100644 --- a/neutron/db/migration/alembic_migrations/versions/1efb85914233_allowedaddresspairs.py +++ b/neutron/db/migration/alembic_migrations/versions/1efb85914233_allowedaddresspairs.py @@ -30,10 +30,13 @@ down_revision = '51b4de912379' # Change to ['*'] if this migration applies to all plugins migration_for_plugins = [ + 'neutron.plugins.cisco.network_plugin.PluginV2', 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2', + 'neutron.plugins.nicira.NeutronServicePlugin.NvpAdvancedPlugin', + 'neutron.plugins.ml2.plugin.Ml2Plugin', 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2', - 'neutron.plugins.cisco.network_plugin.PluginV2', - 'neutron.plugins.ml2.plugin.Ml2Plugin' + 'neutron.plugins.vmware.plugin.NsxPlugin', + 'neutron.plugins.vmware.plugin.NsxServicePlugin', ] from alembic import op diff --git a/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py b/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py index 6337d2a8c..b563f9c89 100644 --- a/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py +++ b/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py @@ -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', ] diff --git a/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py b/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py index f142fc38f..4499c4aee 100644 --- a/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py +++ b/neutron/db/migration/alembic_migrations/versions/2c4af419145b_l3_support.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py b/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py index a514d36c3..a5304ec22 100644 --- a/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py +++ b/neutron/db/migration/alembic_migrations/versions/38335592a0dc_nvp_portmap.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py b/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py index 5ccf7ee0d..70f66ac61 100644 --- a/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py +++ b/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py b/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py index ee07e3bd2..5959efd3d 100644 --- a/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py +++ b/neutron/db/migration/alembic_migrations/versions/3cb5d900c5de_security_groups.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py b/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py index 2dc9f65cd..b62ebcab2 100644 --- a/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py +++ b/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py b/neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py new file mode 100644 index 000000000..c51f02a3d --- /dev/null +++ b/neutron/db/migration/alembic_migrations/versions/3d2585038b95_vmware_nsx.py @@ -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') diff --git a/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py b/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py index 246076fe5..2b4da4891 100644 --- a/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py +++ b/neutron/db/migration/alembic_migrations/versions/3d3cb89d84ee_nsx_switch_mappings.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/40dffbf4b549_nvp_dist_router.py b/neutron/db/migration/alembic_migrations/versions/40dffbf4b549_nvp_dist_router.py index 523d9aba3..2bb3e83ef 100644 --- a/neutron/db/migration/alembic_migrations/versions/40dffbf4b549_nvp_dist_router.py +++ b/neutron/db/migration/alembic_migrations/versions/40dffbf4b549_nvp_dist_router.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py b/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py index 9a2381aad..bf59288ab 100644 --- a/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py +++ b/neutron/db/migration/alembic_migrations/versions/45680af419f9_nvp_qos.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py b/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py index d89879cfd..86d14f790 100644 --- a/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py +++ b/neutron/db/migration/alembic_migrations/versions/4692d074d587_agent_scheduler.py @@ -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.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.brocade.NeutronPlugin.BrocadePluginV2', + 'neutron.plugins.vmware.plugin.NsxPlugin', + 'neutron.plugins.vmware.plugin.NsxServicePlugin', ] from alembic import op diff --git a/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py b/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py index 911182b45..1d22a9e42 100644 --- a/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py +++ b/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py b/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py index f259161a5..89715a2fa 100644 --- a/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py +++ b/neutron/db/migration/alembic_migrations/versions/4ca36cfc898c_nsx_router_mappings.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py b/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py index 7ecc46070..e571f378a 100644 --- a/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py +++ b/neutron/db/migration/alembic_migrations/versions/50e86cb2637a_nsx_mappings.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py b/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py index c372b413e..ec21abda5 100644 --- a/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py +++ b/neutron/db/migration/alembic_migrations/versions/511471cc46b_agent_ext_model_supp.py @@ -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.brocade.NeutronPlugin.BrocadePluginV2', 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2', - 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2', + 'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2', 'neutron.plugins.nec.nec_plugin.NECPluginV2', - 'neutron.plugins.brocade.NeutronPlugin.BrocadePluginV2', - 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin', + '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 diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index f04762491..b706b5db5 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -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 diff --git a/neutron/plugins/nicira/common/nsx_utils.py b/neutron/plugins/nicira/common/nsx_utils.py index 50dcadf4f..0e42cd9f3 100644 --- a/neutron/plugins/nicira/common/nsx_utils.py +++ b/neutron/plugins/nicira/common/nsx_utils.py @@ -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) diff --git a/neutron/plugins/nicira/dbexts/nicira_db.py b/neutron/plugins/nicira/dbexts/db.py similarity index 79% rename from neutron/plugins/nicira/dbexts/nicira_db.py rename to neutron/plugins/nicira/dbexts/db.py index a998cc5f6..b02b0bb65 100644 --- a/neutron/plugins/nicira/dbexts/nicira_db.py +++ b/neutron/plugins/nicira/dbexts/db.py @@ -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()) diff --git a/neutron/plugins/nicira/dbexts/distributedrouter.py b/neutron/plugins/nicira/dbexts/distributedrouter.py index c1d3bfbc4..279ae64f6 100644 --- a/neutron/plugins/nicira/dbexts/distributedrouter.py +++ b/neutron/plugins/nicira/dbexts/distributedrouter.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/maclearning.py b/neutron/plugins/nicira/dbexts/maclearning.py index ab824b18e..340ccf46c 100644 --- a/neutron/plugins/nicira/dbexts/maclearning.py +++ b/neutron/plugins/nicira/dbexts/maclearning.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/nicira_models.py b/neutron/plugins/nicira/dbexts/models.py similarity index 91% rename from neutron/plugins/nicira/dbexts/nicira_models.py rename to neutron/plugins/nicira/dbexts/models.py index 9d9a0cb32..b9ec6823b 100644 --- a/neutron/plugins/nicira/dbexts/nicira_models.py +++ b/neutron/plugins/nicira/dbexts/models.py @@ -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) diff --git a/neutron/plugins/nicira/dbexts/networkgw_db.py b/neutron/plugins/nicira/dbexts/networkgw_db.py index 39b60d17e..128b86bbe 100644 --- a/neutron/plugins/nicira/dbexts/networkgw_db.py +++ b/neutron/plugins/nicira/dbexts/networkgw_db.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/nsxrouter.py b/neutron/plugins/nicira/dbexts/nsxrouter.py index de00ec985..5b53c5b6a 100644 --- a/neutron/plugins/nicira/dbexts/nsxrouter.py +++ b/neutron/plugins/nicira/dbexts/nsxrouter.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/qos_db.py b/neutron/plugins/nicira/dbexts/qos_db.py index b40031941..716892171 100644 --- a/neutron/plugins/nicira/dbexts/qos_db.py +++ b/neutron/plugins/nicira/dbexts/qos_db.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/servicerouter.py b/neutron/plugins/nicira/dbexts/servicerouter.py index 9cba25362..8ca2968f6 100644 --- a/neutron/plugins/nicira/dbexts/servicerouter.py +++ b/neutron/plugins/nicira/dbexts/servicerouter.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/vcns_db.py b/neutron/plugins/nicira/dbexts/vcns_db.py index 17904eeb8..e34d2efc6 100644 --- a/neutron/plugins/nicira/dbexts/vcns_db.py +++ b/neutron/plugins/nicira/dbexts/vcns_db.py @@ -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 diff --git a/neutron/plugins/nicira/dbexts/vcns_models.py b/neutron/plugins/nicira/dbexts/vcns_models.py index c63ff221a..847161358 100644 --- a/neutron/plugins/nicira/dbexts/vcns_models.py +++ b/neutron/plugins/nicira/dbexts/vcns_models.py @@ -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 diff --git a/neutron/tests/unit/vmware/db/test_nsx_db.py b/neutron/tests/unit/vmware/db/test_nsx_db.py index 5176f1ed0..61ba452d6 100644 --- a/neutron/tests/unit/vmware/db/test_nsx_db.py +++ b/neutron/tests/unit/vmware/db/test_nsx_db.py @@ -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 diff --git a/neutron/tests/unit/vmware/test_nsx_plugin.py b/neutron/tests/unit/vmware/test_nsx_plugin.py index a676c5937..c5882bc85 100644 --- a/neutron/tests/unit/vmware/test_nsx_plugin.py +++ b/neutron/tests/unit/vmware/test_nsx_plugin.py @@ -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 diff --git a/neutron/tests/unit/vmware/test_nsx_utils.py b/neutron/tests/unit/vmware/test_nsx_utils.py index 1b8f74c16..3c199aca3 100644 --- a/neutron/tests/unit/vmware/test_nsx_utils.py +++ b/neutron/tests/unit/vmware/test_nsx_utils.py @@ -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 -- 2.45.2