NSX|v3 replace dhcp profile and metadata proxy uuids with names

Support configuration of name or uuid (instead of only uuid) for
2 nsx_v3 parameters: dhcp_profile, metadata_proxy.

Assert on init if the uuid or name was no found on the backend,
or if the name is not unique.

Change-Id: Ife6263b7cf1759a2fc309205552eb79138d512a1
This commit is contained in:
Zhenmei 2016-08-31 03:20:10 -04:00
parent 990cf7475a
commit 074edfefa5
11 changed files with 112 additions and 46 deletions

View File

@ -166,8 +166,8 @@ function neutron_plugin_configure_service {
if [[ "$NATIVE_DHCP_METADATA" == "True" ]]; then if [[ "$NATIVE_DHCP_METADATA" == "True" ]]; then
_nsxv3_ini_set native_dhcp_metadata $NATIVE_DHCP_METADATA _nsxv3_ini_set native_dhcp_metadata $NATIVE_DHCP_METADATA
_nsxv3_ini_set native_metadata_route $NATIVE_METADATA_ROUTE _nsxv3_ini_set native_metadata_route $NATIVE_METADATA_ROUTE
_nsxv3_ini_set dhcp_profile_uuid $DHCP_PROFILE_UUID _nsxv3_ini_set dhcp_profile $DHCP_PROFILE_UUID
_nsxv3_ini_set metadata_proxy_uuid $METADATA_PROXY_UUID _nsxv3_ini_set metadata_proxy $METADATA_PROXY_UUID
iniset $NEUTRON_CONF DEFAULT dhcp_agent_notification False iniset $NEUTRON_CONF DEFAULT dhcp_agent_notification False
fi fi
} }

View File

@ -0,0 +1,9 @@
---
prelude: >
- In NSX|v3 plugin, the 'dhcp_profile_uuid' and 'metadata_proxy_uuid'
options have been deprecated and replaced by 'dhcp_profile'
and 'metadata_proxy' respectively, which can accept both name or uuid.
deprecations:
- In NSX|v3 plugin, the 'dhcp_profile_uuid' and 'metadata_proxy_uuid'
options have been deprecated and replaced by 'dhcp_profile'
and 'metadata_proxy' respectively, which can accept both name or uuid.

View File

@ -363,11 +363,12 @@ nsx_v3_opts = [
default="169.254.169.254/32", default="169.254.169.254/32",
help=_("The metadata route used for native metadata proxy " help=_("The metadata route used for native metadata proxy "
"service.")), "service.")),
cfg.StrOpt('dhcp_profile_uuid', cfg.StrOpt('dhcp_profile',
help=_("This is the UUID of the NSX DHCP Profile that will be " deprecated_name='dhcp_profile_uuid',
"used to enable native DHCP service. It needs to be " help=_("This is the name or UUID of the NSX DHCP Profile "
"created in NSX before starting Neutron with the NSX " "that will be used to enable native DHCP service. It "
"plugin.")), "needs to be created in NSX before starting Neutron"
"with the NSX plugin")),
cfg.IntOpt('dhcp_lease_time', cfg.IntOpt('dhcp_lease_time',
default=86400, default=86400,
help=_("DHCP default lease time.")), help=_("DHCP default lease time.")),
@ -379,11 +380,12 @@ nsx_v3_opts = [
help=_("List of nameservers to configure for the DHCP " help=_("List of nameservers to configure for the DHCP "
"binding entries. These will be used if there are no " "binding entries. These will be used if there are no "
"nameservers defined on the subnet.")), "nameservers defined on the subnet.")),
cfg.StrOpt('metadata_proxy_uuid', cfg.StrOpt('metadata_proxy',
help=_("This is the UUID of the NSX Metadata Proxy that will " deprecated_name='metadata_proxy_uuid',
"be used to enable native metadata service. It needs " help=_("This is the name or UUID of the NSX Metadata Proxy "
"to be created in NSX before starting Neutron with " "that will be used to enable native metadata service. "
"the NSX plugin.")), "It needs to be created in NSX before starting Neutron "
"with the NSX plugin.")),
cfg.BoolOpt('log_security_groups_blocked_traffic', cfg.BoolOpt('log_security_groups_blocked_traffic',
default=False, default=False,
help=_("(Optional) Indicates whether distributed-firewall " help=_("(Optional) Indicates whether distributed-firewall "

View File

@ -60,6 +60,10 @@ class NsxLib(object):
self.client, nsxlib_config) self.client, nsxlib_config)
self.transport_zone = NsxLibTransportZone( self.transport_zone = NsxLibTransportZone(
self.client, nsxlib_config) self.client, nsxlib_config)
self.native_dhcp_profile = NsxLibDhcpProfile(
self.client, nsxlib_config)
self.native_md_proxy = NsxLibMetadataProxy(
self.client, nsxlib_config)
self.firewall_section = security.NsxLibFirewallSection( self.firewall_section = security.NsxLibFirewallSection(
self.client, nsxlib_config) self.client, nsxlib_config)
self.ns_group = security.NsxLibNsGroup( self.ns_group = security.NsxLibNsGroup(
@ -424,6 +428,32 @@ class NsxLibTransportZone(utils.NsxLibApiBase):
'transport-zones') 'transport-zones')
class NsxLibDhcpProfile(utils.NsxLibApiBase):
def get_id_by_name_or_id(self, name_or_id):
"""Get a dhcp profile by it's display name or uuid
Return the dhcp profile data, or raise an exception if not found or
not unique
"""
return self._get_resource_by_name_or_id(name_or_id,
'dhcp/server-profiles')
class NsxLibMetadataProxy(utils.NsxLibApiBase):
def get_id_by_name_or_id(self, name_or_id):
"""Get a metadata proxy by it's display name or uuid
Return the metadata proxy data, or raise an exception if not found or
not unique
"""
return self._get_resource_by_name_or_id(name_or_id,
'md-proxies')
class NsxLibBridgeCluster(utils.NsxLibApiBase): class NsxLibBridgeCluster(utils.NsxLibApiBase):
def get_id_by_name_or_id(self, name_or_id): def get_id_by_name_or_id(self, name_or_id):

View File

@ -55,7 +55,6 @@ class NsxLibNativeDhcp(utils.NsxLibApiBase):
name = utils.get_name_and_uuid(network['name'] or 'dhcpserver', name = utils.get_name_and_uuid(network['name'] or 'dhcpserver',
network['id']) network['id'])
return {'name': name, return {'name': name,
'dhcp_profile_id': self.nsxlib_config.dhcp_profile_uuid,
'server_ip': server_ip, 'server_ip': server_ip,
'dns_nameservers': dns_nameservers, 'dns_nameservers': dns_nameservers,
'domain_name': self.nsxlib_config.dns_domain, 'domain_name': self.nsxlib_config.dns_domain,

View File

@ -178,6 +178,9 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
self.cfg_group = 'nsx_v3' # group name for nsx_v3 section in nsx.ini self.cfg_group = 'nsx_v3' # group name for nsx_v3 section in nsx.ini
self.tier0_groups_dict = {} self.tier0_groups_dict = {}
# Translate configured transport zones, routers, dhcp profile and
# metadata proxy names to uuid.
self._translate_configured_names_to_uuids()
self._init_dhcp_metadata() self._init_dhcp_metadata()
self._port_client = nsx_resources.LogicalPort(self._nsx_client) self._port_client = nsx_resources.LogicalPort(self._nsx_client)
@ -207,9 +210,6 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
if cfg.CONF.api_replay_mode: if cfg.CONF.api_replay_mode:
self.supported_extension_aliases.append('api-replay') self.supported_extension_aliases.append('api-replay')
# translate configured transport zones/rotuers names to uuid
self._translate_configured_names_2_uuids()
# Register NSXv3 trunk driver to support trunk extensions # Register NSXv3 trunk driver to support trunk extensions
self.trunk_driver = trunk_driver.NsxV3TrunkDriver.create(self) self.trunk_driver = trunk_driver.NsxV3TrunkDriver.create(self)
@ -257,7 +257,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
return (self._psec_profile, self._no_psec_profile_id, return (self._psec_profile, self._no_psec_profile_id,
self._dhcp_profile, self._mac_learning_profile) self._dhcp_profile, self._mac_learning_profile)
def _translate_configured_names_2_uuids(self): def _translate_configured_names_to_uuids(self):
# default VLAN transport zone name / uuid # default VLAN transport zone name / uuid
self._default_vlan_tz_uuid = None self._default_vlan_tz_uuid = None
if cfg.CONF.nsx_v3.default_vlan_tz: if cfg.CONF.nsx_v3.default_vlan_tz:
@ -279,6 +279,23 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
cfg.CONF.nsx_v3.default_tier0_router) cfg.CONF.nsx_v3.default_tier0_router)
self._default_tier0_router = rtr_id self._default_tier0_router = rtr_id
self._native_dhcp_profile_uuid = None
self._native_md_proxy_uuid = None
if cfg.CONF.nsx_v3.native_dhcp_metadata:
if cfg.CONF.nsx_v3.dhcp_profile:
id = self.nsxlib.native_dhcp_profile.get_id_by_name_or_id(
cfg.CONF.nsx_v3.dhcp_profile)
self._native_dhcp_profile_uuid = id
else:
raise cfg.RequiredOptError("dhcp_profile")
if cfg.CONF.nsx_v3.metadata_proxy:
proxy_id = self.nsxlib.native_md_proxy.get_id_by_name_or_id(
cfg.CONF.nsx_v3.metadata_proxy)
self._native_md_proxy_uuid = proxy_id
else:
raise cfg.RequiredOptError("metadata_proxy")
def _extend_port_dict_binding(self, context, port_data): def _extend_port_dict_binding(self, context, port_data):
port_data[pbin.VIF_TYPE] = pbin.VIF_TYPE_OVS port_data[pbin.VIF_TYPE] = pbin.VIF_TYPE_OVS
port_data[pbin.VNIC_TYPE] = pbin.VNIC_NORMAL port_data[pbin.VNIC_TYPE] = pbin.VNIC_NORMAL
@ -432,30 +449,26 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
self._start_rpc_notifiers() self._start_rpc_notifiers()
def _init_native_dhcp(self): def _init_native_dhcp(self):
if not cfg.CONF.nsx_v3.dhcp_profile_uuid:
raise cfg.RequiredOptError("dhcp_profile_uuid")
try: try:
nsx_resources.DhcpProfile(self._nsx_client).get( nsx_resources.DhcpProfile(self._nsx_client).get(
cfg.CONF.nsx_v3.dhcp_profile_uuid) self._native_dhcp_profile_uuid)
self._dhcp_server = nsx_resources.LogicalDhcpServer( self._dhcp_server = nsx_resources.LogicalDhcpServer(
self._nsx_client) self._nsx_client)
except nsx_lib_exc.ManagerError: except nsx_lib_exc.ManagerError:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_LE("Unable to retrieve DHCP Profile %s, " LOG.error(_LE("Unable to retrieve DHCP Profile %s, "
"native DHCP service is not supported"), "native DHCP service is not supported"),
cfg.CONF.nsx_v3.dhcp_profile_uuid) self._native_dhcp_profile_uuid)
def _init_native_metadata(self): def _init_native_metadata(self):
if not cfg.CONF.nsx_v3.metadata_proxy_uuid:
raise cfg.RequiredOptError("metadata_proxy_uuid")
try: try:
nsx_resources.MetaDataProxy(self._nsx_client).get( nsx_resources.MetaDataProxy(self._nsx_client).get(
cfg.CONF.nsx_v3.metadata_proxy_uuid) self._native_md_proxy_uuid)
except nsx_lib_exc.ManagerError: except nsx_lib_exc.ManagerError:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_LE("Unable to retrieve Metadata Proxy %s, " LOG.error(_LE("Unable to retrieve Metadata Proxy %s, "
"native metadata service is not supported"), "native metadata service is not supported"),
cfg.CONF.nsx_v3.metadata_proxy_uuid) self._native_md_proxy_uuid)
def _setup_rpc(self): def _setup_rpc(self):
self.endpoints = [dhcp_rpc.DhcpRpcCallback(), self.endpoints = [dhcp_rpc.DhcpRpcCallback(),
@ -720,7 +733,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
'mdproxy', created_net['name'] or 'network'), 'mdproxy', created_net['name'] or 'network'),
created_net['id']) created_net['id'])
md_port = self._port_client.create( md_port = self._port_client.create(
nsx_net_id, cfg.CONF.nsx_v3.metadata_proxy_uuid, nsx_net_id, self._native_md_proxy_uuid,
tags=tags, name=name, tags=tags, name=name,
attachment_type=nsxlib_consts.ATTACHMENT_MDPROXY) attachment_type=nsxlib_consts.ATTACHMENT_MDPROXY)
LOG.debug("Created MD-Proxy logical port %(port)s " LOG.debug("Created MD-Proxy logical port %(port)s "
@ -911,7 +924,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
port_data = { port_data = {
"name": "", "name": "",
"admin_state_up": True, "admin_state_up": True,
"device_id": cfg.CONF.nsx_v3.dhcp_profile_uuid, "device_id": self._native_dhcp_profile_uuid,
"device_owner": const.DEVICE_OWNER_DHCP, "device_owner": const.DEVICE_OWNER_DHCP,
"network_id": network['id'], "network_id": network['id'],
"tenant_id": network["tenant_id"], "tenant_id": network["tenant_id"],
@ -925,6 +938,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
project_name=context.tenant_name) project_name=context.tenant_name)
server_data = self.nsxlib.native_dhcp.build_server_config( server_data = self.nsxlib.native_dhcp.build_server_config(
network, subnet, neutron_port, net_tags) network, subnet, neutron_port, net_tags)
server_data['dhcp_profile_id'] = self._native_dhcp_profile_uuid
nsx_net_id = self._get_network_nsx_id(context, network['id']) nsx_net_id = self._get_network_nsx_id(context, network['id'])
port_tags = self.nsxlib.build_v3_tags_payload( port_tags = self.nsxlib.build_v3_tags_payload(
neutron_port, resource_type='os-neutron-dport-id', neutron_port, resource_type='os-neutron-dport-id',

View File

@ -43,5 +43,5 @@ def get_nsxlib_wrapper():
plugin_ver=n_version.version_info.release_string(), plugin_ver=n_version.version_info.release_string(),
dns_nameservers=cfg.CONF.nsx_v3.nameservers, dns_nameservers=cfg.CONF.nsx_v3.nameservers,
dns_domain=cfg.CONF.nsx_v3.dns_domain, dns_domain=cfg.CONF.nsx_v3.dns_domain,
dhcp_profile_uuid=cfg.CONF.nsx_v3.dhcp_profile_uuid) dhcp_profile_uuid=cfg.CONF.nsx_v3.dhcp_profile)
return v3.NsxLib(nsxlib_config) return v3.NsxLib(nsxlib_config)

View File

@ -64,7 +64,7 @@ def nsx_update_dhcp_bindings(resource, event, trigger, **kwargs):
cfg.CONF.set_override('dhcp_agent_notification', False) cfg.CONF.set_override('dhcp_agent_notification', False)
cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3') cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3')
cfg.CONF.set_override('dhcp_profile_uuid', dhcp_profile_uuid, 'nsx_v3') cfg.CONF.set_override('dhcp_profile', dhcp_profile_uuid, 'nsx_v3')
nsx_client = utils.get_nsxv3_client() nsx_client = utils.get_nsxv3_client()
port_resource = resources.LogicalPort(nsx_client) port_resource = resources.LogicalPort(nsx_client)

View File

@ -74,7 +74,7 @@ def nsx_update_metadata_proxy(resource, event, trigger, **kwargs):
cfg.CONF.set_override('dhcp_agent_notification', False) cfg.CONF.set_override('dhcp_agent_notification', False)
cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3') cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3')
cfg.CONF.set_override('metadata_proxy_uuid', metadata_proxy_uuid, 'nsx_v3') cfg.CONF.set_override('metadata_proxy', metadata_proxy_uuid, 'nsx_v3')
plugin = utils.NsxV3PluginWrapper() plugin = utils.NsxV3PluginWrapper()
nsx_client = utils.get_nsxv3_client() nsx_client = utils.get_nsxv3_client()

View File

@ -43,8 +43,10 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3') cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3')
self._patcher = mock.patch.object(nsx_resources.DhcpProfile, 'get') self._patcher = mock.patch.object(nsx_resources.DhcpProfile, 'get')
self._patcher.start() self._patcher.start()
# Need to run _init_dhcp_metadata() manually because plugin was started # Need to run _translate_configured_names_to_uuids and
# _init_dhcp_metadata() manually because plugin was started
# before setUp() overrides CONF.nsx_v3.native_dhcp_metadata. # before setUp() overrides CONF.nsx_v3.native_dhcp_metadata.
self.plugin._translate_configured_names_to_uuids()
self.plugin._init_dhcp_metadata() self.plugin._init_dhcp_metadata()
def tearDown(self): def tearDown(self):
@ -93,7 +95,7 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
dhcp_binding['nsx_binding_id'], **binding_data) dhcp_binding['nsx_binding_id'], **binding_data)
def test_dhcp_profile_configuration(self): def test_dhcp_profile_configuration(self):
# Test if dhcp_agent_notification and dhcp_profile_uuid are # Test if dhcp_agent_notification and dhcp_profile are
# configured correctly. # configured correctly.
orig_dhcp_agent_notification = cfg.CONF.dhcp_agent_notification orig_dhcp_agent_notification = cfg.CONF.dhcp_agent_notification
cfg.CONF.set_override('dhcp_agent_notification', True) cfg.CONF.set_override('dhcp_agent_notification', True)
@ -101,11 +103,11 @@ class NsxNativeDhcpTestCase(test_plugin.NsxV3PluginTestCaseMixin):
self.plugin._init_dhcp_metadata) self.plugin._init_dhcp_metadata)
cfg.CONF.set_override('dhcp_agent_notification', cfg.CONF.set_override('dhcp_agent_notification',
orig_dhcp_agent_notification) orig_dhcp_agent_notification)
orig_dhcp_profile_uuid = cfg.CONF.nsx_v3.dhcp_profile_uuid orig_dhcp_profile_uuid = cfg.CONF.nsx_v3.dhcp_profile
cfg.CONF.set_override('dhcp_profile_uuid', '', 'nsx_v3') cfg.CONF.set_override('dhcp_profile', '', 'nsx_v3')
self.assertRaises(cfg.RequiredOptError, self.assertRaises(cfg.RequiredOptError,
self.plugin._init_dhcp_metadata) self.plugin._translate_configured_names_to_uuids)
cfg.CONF.set_override('dhcp_profile_uuid', orig_dhcp_profile_uuid, cfg.CONF.set_override('dhcp_profile', orig_dhcp_profile_uuid,
'nsx_v3') 'nsx_v3')
def test_dhcp_service_with_create_network(self): def test_dhcp_service_with_create_network(self):
@ -420,8 +422,10 @@ class NsxNativeMetadataTestCase(test_plugin.NsxV3PluginTestCaseMixin):
cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3') cfg.CONF.set_override('native_dhcp_metadata', True, 'nsx_v3')
self._patcher = mock.patch.object(nsx_resources.MetaDataProxy, 'get') self._patcher = mock.patch.object(nsx_resources.MetaDataProxy, 'get')
self._patcher.start() self._patcher.start()
# Need to run _init_dhcp_metadata() manually because plugin was # Need to run _translate_configured_names_to_uuids and
# started before setUp() overrides CONF.nsx_v3.native_dhcp_metadata. # _init_dhcp_metadata() manually because plugin was started
# before setUp() overrides CONF.nsx_v3.native_dhcp_metadata.
self.plugin._translate_configured_names_to_uuids()
self.plugin._init_dhcp_metadata() self.plugin._init_dhcp_metadata()
def tearDown(self): def tearDown(self):
@ -433,7 +437,7 @@ class NsxNativeMetadataTestCase(test_plugin.NsxV3PluginTestCaseMixin):
super(NsxNativeMetadataTestCase, self).tearDown() super(NsxNativeMetadataTestCase, self).tearDown()
def test_metadata_proxy_configuration(self): def test_metadata_proxy_configuration(self):
# Test if dhcp_agent_notification and metadata_proxy_uuid are # Test if dhcp_agent_notification and metadata_proxy are
# configured correctly. # configured correctly.
orig_dhcp_agent_notification = cfg.CONF.dhcp_agent_notification orig_dhcp_agent_notification = cfg.CONF.dhcp_agent_notification
cfg.CONF.set_override('dhcp_agent_notification', True) cfg.CONF.set_override('dhcp_agent_notification', True)
@ -441,11 +445,11 @@ class NsxNativeMetadataTestCase(test_plugin.NsxV3PluginTestCaseMixin):
self.plugin._init_dhcp_metadata) self.plugin._init_dhcp_metadata)
cfg.CONF.set_override('dhcp_agent_notification', cfg.CONF.set_override('dhcp_agent_notification',
orig_dhcp_agent_notification) orig_dhcp_agent_notification)
orig_metadata_proxy_uuid = cfg.CONF.nsx_v3.metadata_proxy_uuid orig_metadata_proxy_uuid = cfg.CONF.nsx_v3.metadata_proxy
cfg.CONF.set_override('metadata_proxy_uuid', '', 'nsx_v3') cfg.CONF.set_override('metadata_proxy', '', 'nsx_v3')
self.assertRaises(cfg.RequiredOptError, self.assertRaises(cfg.RequiredOptError,
self.plugin._init_dhcp_metadata) self.plugin._translate_configured_names_to_uuids)
cfg.CONF.set_override('metadata_proxy_uuid', orig_metadata_proxy_uuid, cfg.CONF.set_override('metadata_proxy', orig_metadata_proxy_uuid,
'nsx_v3') 'nsx_v3')
def test_metadata_proxy_with_create_network(self): def test_metadata_proxy_with_create_network(self):
@ -463,7 +467,7 @@ class NsxNativeMetadataTestCase(test_plugin.NsxV3PluginTestCaseMixin):
'mdproxy', network['network']['name'] or 'network'), 'mdproxy', network['network']['name'] or 'network'),
network['network']['id']) network['network']['id'])
create_logical_port.assert_called_once_with( create_logical_port.assert_called_once_with(
nsx_net_id, cfg.CONF.nsx_v3.metadata_proxy_uuid, nsx_net_id, cfg.CONF.nsx_v3.metadata_proxy,
tags=tags, name=name, tags=tags, name=name,
attachment_type=nsx_constants.ATTACHMENT_MDPROXY) attachment_type=nsx_constants.ATTACHMENT_MDPROXY)

View File

@ -118,6 +118,14 @@ def _mock_nsx_backend_calls():
"vmware_nsx.nsxlib.v3.NsxLibLogicalSwitch.create", "vmware_nsx.nsxlib.v3.NsxLibLogicalSwitch.create",
side_effect=_return_id_key).start() side_effect=_return_id_key).start()
mock.patch(
"vmware_nsx.nsxlib.v3.NsxLibDhcpProfile.get_id_by_name_or_id",
return_value=NSX_DHCP_PROFILE_ID).start()
mock.patch(
"vmware_nsx.nsxlib.v3.NsxLibMetadataProxy.get_id_by_name_or_id",
return_value=NSX_METADATA_PROXY_ID).start()
mock.patch( mock.patch(
"vmware_nsx.nsxlib.v3.resources.LogicalPort.create", "vmware_nsx.nsxlib.v3.resources.LogicalPort.create",
side_effect=_return_id_key).start() side_effect=_return_id_key).start()
@ -141,9 +149,9 @@ class NsxV3PluginTestCaseMixin(test_plugin.NeutronDbPluginV2TestCase,
def setup_conf_overrides(self): def setup_conf_overrides(self):
cfg.CONF.set_override('default_overlay_tz', NSX_TZ_NAME, 'nsx_v3') cfg.CONF.set_override('default_overlay_tz', NSX_TZ_NAME, 'nsx_v3')
cfg.CONF.set_override('native_dhcp_metadata', False, 'nsx_v3') cfg.CONF.set_override('native_dhcp_metadata', False, 'nsx_v3')
cfg.CONF.set_override('dhcp_profile_uuid', cfg.CONF.set_override('dhcp_profile',
NSX_DHCP_PROFILE_ID, 'nsx_v3') NSX_DHCP_PROFILE_ID, 'nsx_v3')
cfg.CONF.set_override('metadata_proxy_uuid', cfg.CONF.set_override('metadata_proxy',
NSX_METADATA_PROXY_ID, 'nsx_v3') NSX_METADATA_PROXY_ID, 'nsx_v3')
cfg.CONF.set_override( cfg.CONF.set_override(
'network_scheduler_driver', 'network_scheduler_driver',