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

This commit is contained in:
Jenkins 2016-04-28 06:35:15 +00:00 committed by Gerrit Code Review
commit 454fc090bc
4 changed files with 27 additions and 8 deletions

View File

@ -31,7 +31,6 @@ neutron.db.alembic_migrations =
neutron.core_plugins = neutron.core_plugins =
vmware = vmware_nsx.plugin:NsxMhPlugin vmware = vmware_nsx.plugin:NsxMhPlugin
neutron.service_plugins = neutron.service_plugins =
vmware_nsx_l2gw = vmware_nsx.services.l2gateway.common.plugin:NsxL2GatewayPlugin
vmware_nsxv_qos = vmware_nsx.services.qos.nsx_v.plugin:NsxVQosPlugin vmware_nsxv_qos = vmware_nsx.services.qos.nsx_v.plugin:NsxVQosPlugin
neutron.qos.notification_drivers = neutron.qos.notification_drivers =
vmware_nsxv3_message_queue = vmware_nsx.services.qos.nsx_v3.message_queue:NsxV3QosNotificationDriver 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", "update_l2_gateway_connection",
"delete_l2_gateway_connection"] "delete_l2_gateway_connection"]
def __init__(self): def __init__(self, plugin):
"""Initialize service plugin and load backend driver.""" """Initialize service plugin and load backend driver."""
super(NsxL2GatewayPlugin, self).__init__() super(NsxL2GatewayPlugin, self).__init__()
self._plugin = plugin
LOG.debug("Starting service plugin for NSX L2Gateway") LOG.debug("Starting service plugin for NSX L2Gateway")
self._nsx_l2gw_driver = cfg.CONF.nsx_l2gw_driver self._nsx_l2gw_driver = cfg.CONF.nsx_l2gw_driver
if not getattr(self, "_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.core_plugin = importutils.import_object(NSX_V3_PLUGIN_CLASS)
self.driver = nsx_v3_driver.NsxV3Driver() 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() self.context = context.get_admin_context()
def _get_nw_data(self): def _get_nw_data(self):
@ -65,7 +65,7 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase,
'subscribe_callback_notifications') as sub: 'subscribe_callback_notifications') as sub:
with mock.patch.object(nsx_v3_driver.LOG, with mock.patch.object(nsx_v3_driver.LOG,
'debug') as debug: 'debug') as debug:
l2gw_plugin.NsxL2GatewayPlugin() l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock())
self.assertTrue(def_gw.called) self.assertTrue(def_gw.called)
self.assertTrue(sub.called) self.assertTrue(sub.called)
self.assertTrue(debug.called) self.assertTrue(debug.called)
@ -77,7 +77,7 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase,
cfg.CONF.set_override("default_bridge_cluster", cfg.CONF.set_override("default_bridge_cluster",
def_bridge_cluster_name, def_bridge_cluster_name,
"nsx_v3") "nsx_v3")
l2gw_plugin.NsxL2GatewayPlugin() l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock())
l2gws = self.driver._get_l2_gateways(self.context) l2gws = self.driver._get_l2_gateways(self.context)
def_bridge_cluster_id = nsxlib.get_bridge_cluster_id_by_name_or_id( def_bridge_cluster_id = nsxlib.get_bridge_cluster_id_by_name_or_id(
def_bridge_cluster_name) def_bridge_cluster_name)
@ -99,8 +99,8 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase,
cfg.CONF.set_override("default_bridge_cluster", cfg.CONF.set_override("default_bridge_cluster",
def_bridge_cluster_name, def_bridge_cluster_name,
"nsx_v3") "nsx_v3")
l2gw_plugin.NsxL2GatewayPlugin() l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock())
l2gw_plugin.NsxL2GatewayPlugin() l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock())
l2gws = self.driver._get_l2_gateways(self.context) l2gws = self.driver._get_l2_gateways(self.context)
# Verify whether only one default L2 gateway is created # Verify whether only one default L2 gateway is created
self.assertEqual(1, len(l2gws)) 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): def test_create_default_l2_gateway_no_bc_uuid_noop(self):
with mock.patch.object(nsx_v3_driver.NsxV3Driver, with mock.patch.object(nsx_v3_driver.NsxV3Driver,
'subscribe_callback_notifications'): 'subscribe_callback_notifications'):
l2gw_plugin.NsxL2GatewayPlugin() l2gw_plugin.NsxL2GatewayPlugin(mock.MagicMock())
l2gws = self.driver._get_l2_gateways(self.context) l2gws = self.driver._get_l2_gateways(self.context)
# Verify no default L2 gateway is created if bridge cluster id is # Verify no default L2 gateway is created if bridge cluster id is
# not configured in nsx.ini # not configured in nsx.ini