[L2-gateway]: Fix l2gw plugin due to networking-l2gw changes

Change: Ib56ee8bfd182c031e468c503acb0cd75daea8c40 broke vmware-nsx
L2 gateway plugin for master and mitaka release. Due to this the
l2 gateway plugin for vmware-nsx would not load.

This patch makes the required changes in vmware-nsx to load l2gw
plugin.
This patch also adds a README file to include steps to bring up
L2 gateway plugin with devstack.

Closes-Bug: #1573327
Change-Id: I433c7f51df80ff6ea4250e38c981ffb363cf1b17
This commit is contained in:
Abhishek Raut 2016-04-08 23:56:19 -07:00
parent eebeeec051
commit f70a8c4b8c
4 changed files with 27 additions and 8 deletions

View File

@ -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

View File

@ -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``

View File

@ -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"):

View File

@ -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