diff --git a/setup.cfg b/setup.cfg index e00e419427..8b204adf8e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,7 +31,6 @@ neutron.db.alembic_migrations = neutron.core_plugins = vmware = vmware_nsx.plugin:NsxMhPlugin neutron.service_plugins = - vmware_nsx_l2gw = vmware_nsx.services.l2gateway.common.plugin:NsxL2GatewayPlugin vmware_nsxv_qos = vmware_nsx.services.qos.nsx_v.plugin:NsxVQosPlugin neutron.qos.notification_drivers = vmware_nsxv3_message_queue = vmware_nsx.services.qos.nsx_v3.message_queue:NsxV3QosNotificationDriver diff --git a/vmware_nsx/services/l2gateway/README.rst b/vmware_nsx/services/l2gateway/README.rst new file mode 100644 index 0000000000..a8840ad4b3 --- /dev/null +++ b/vmware_nsx/services/l2gateway/README.rst @@ -0,0 +1,19 @@ +============================================ + Enabling NSX L2 Gateway Plugin in DevStack +============================================ + +1. Download DevStack + +2. Add networking-l2gw repo as an external repository and configure following flags in ``local.conf``:: + + [[local|localrc]] + enable_plugin networking-l2gw https://github.com/openstack/networking-l2gw + ENABLED_SERVICES=l2gw-plugin + NETWORKING_L2GW_SERVICE_DRIVER=L2GW:vmware-nsx-l2gw:vmware_nsx.services.l2gateway.common.plugin.NsxL2GatewayPlugin:default + +3. For NSXv3 include the following additional flags in ``local.conf``:: + [[local|localrc]] + NSX_L2GW_DRIVER='vmware_nsx.services.l2gateway.nsx_v3.driver.NsxV3Driver' + DEFAULT_BRIDGE_CLUSTER_UUID= + +4. run ``stack.sh`` diff --git a/vmware_nsx/services/l2gateway/common/plugin.py b/vmware_nsx/services/l2gateway/common/plugin.py index 3d4e2647c8..3c62a5b1a9 100644 --- a/vmware_nsx/services/l2gateway/common/plugin.py +++ b/vmware_nsx/services/l2gateway/common/plugin.py @@ -40,9 +40,10 @@ class NsxL2GatewayPlugin(l2gateway_db.L2GatewayMixin): "update_l2_gateway_connection", "delete_l2_gateway_connection"] - def __init__(self): + def __init__(self, plugin): """Initialize service plugin and load backend driver.""" super(NsxL2GatewayPlugin, self).__init__() + self._plugin = plugin LOG.debug("Starting service plugin for NSX L2Gateway") self._nsx_l2gw_driver = cfg.CONF.nsx_l2gw_driver if not getattr(self, "_nsx_l2gw_driver"): diff --git a/vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py b/vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py index c6c14721e3..657dd438cd 100644 --- a/vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py +++ b/vmware_nsx/tests/unit/services/l2gateway/test_nsxv3_driver.py @@ -50,7 +50,7 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase, self.core_plugin = importutils.import_object(NSX_V3_PLUGIN_CLASS) self.driver = nsx_v3_driver.NsxV3Driver() - self.l2gw_plugin = l2gw_plugin.NsxL2GatewayPlugin() + self.l2gw_plugin = l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock()) self.context = context.get_admin_context() def _get_nw_data(self): @@ -65,7 +65,7 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase, 'subscribe_callback_notifications') as sub: with mock.patch.object(nsx_v3_driver.LOG, 'debug') as debug: - l2gw_plugin.NsxL2GatewayPlugin() + l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock()) self.assertTrue(def_gw.called) self.assertTrue(sub.called) self.assertTrue(debug.called) @@ -77,7 +77,7 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase, cfg.CONF.set_override("default_bridge_cluster", def_bridge_cluster_name, "nsx_v3") - l2gw_plugin.NsxL2GatewayPlugin() + l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock()) l2gws = self.driver._get_l2_gateways(self.context) def_bridge_cluster_id = nsxlib.get_bridge_cluster_id_by_name_or_id( def_bridge_cluster_name) @@ -99,8 +99,8 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase, cfg.CONF.set_override("default_bridge_cluster", def_bridge_cluster_name, "nsx_v3") - l2gw_plugin.NsxL2GatewayPlugin() - l2gw_plugin.NsxL2GatewayPlugin() + l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock()) + l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock()) l2gws = self.driver._get_l2_gateways(self.context) # Verify whether only one default L2 gateway is created self.assertEqual(1, len(l2gws)) @@ -108,7 +108,7 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase, def test_create_default_l2_gateway_no_bc_uuid_noop(self): with mock.patch.object(nsx_v3_driver.NsxV3Driver, 'subscribe_callback_notifications'): - l2gw_plugin.NsxL2GatewayPlugin() + l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock()) l2gws = self.driver._get_l2_gateways(self.context) # Verify no default L2 gateway is created if bridge cluster id is # not configured in nsx.ini