Merge "[dvs] set physical network as dvportgroup moid"
This commit is contained in:
commit
961a87c3c6
@ -146,6 +146,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
if net_data.get(pnet.NETWORK_TYPE) == c_utils.NetworkTypes.VLAN:
|
||||
vlan_tag = net_data.get(pnet.SEGMENTATION_ID, 0)
|
||||
|
||||
net_id = None
|
||||
if net_data.get(pnet.NETWORK_TYPE) == c_utils.NetworkTypes.PORTGROUP:
|
||||
net_id = net_data.get(pnet.PHYSICAL_NETWORK)
|
||||
dvs_id = self._dvs._net_id_to_moref(net_id).value
|
||||
@ -164,7 +165,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
nsx_db.add_network_binding(
|
||||
context.session, new_net['id'],
|
||||
net_data.get(pnet.NETWORK_TYPE),
|
||||
'dvs',
|
||||
net_id or 'dvs',
|
||||
vlan_tag)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
@ -174,7 +175,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
self._dvs.delete_port_group(dvs_id)
|
||||
|
||||
new_net[pnet.NETWORK_TYPE] = net_data.get(pnet.NETWORK_TYPE)
|
||||
new_net[pnet.PHYSICAL_NETWORK] = 'dvs'
|
||||
new_net[pnet.PHYSICAL_NETWORK] = net_id or 'dvs'
|
||||
new_net[pnet.SEGMENTATION_ID] = vlan_tag
|
||||
|
||||
# this extra lookup is necessary to get the
|
||||
|
@ -155,7 +155,8 @@ class NeutronSimpleDvsTest(test_plugin.NeutronDbPluginV2TestCase):
|
||||
self._plugin = manager.NeutronManager.get_plugin()
|
||||
|
||||
def _create_and_delete_dvs_network(self, network_type='flat', vlan_tag=0):
|
||||
params = {'provider:network_type': network_type}
|
||||
params = {'provider:network_type': network_type,
|
||||
'provider:physical_network': 'fake-moid'}
|
||||
if network_type == 'vlan':
|
||||
params['provider:segmentation_id'] = vlan_tag
|
||||
params['arg_list'] = tuple(params.keys())
|
||||
@ -169,16 +170,18 @@ class NeutronSimpleDvsTest(test_plugin.NeutronDbPluginV2TestCase):
|
||||
dvs_id = '%s-%s' % (network['network']['name'], id)
|
||||
binding = nsx_db.get_network_bindings(ctx.session, id)
|
||||
self.assertIsNotNone(binding)
|
||||
self.assertEqual('dvs', binding[0].phy_uuid)
|
||||
if network_type == 'flat':
|
||||
self.assertEqual('flat', binding[0].binding_type)
|
||||
self.assertEqual(0, binding[0].vlan_id)
|
||||
self.assertEqual('dvs', binding[0].phy_uuid)
|
||||
elif network_type == 'vlan':
|
||||
self.assertEqual('vlan', binding[0].binding_type)
|
||||
self.assertEqual(vlan_tag, binding[0].vlan_id)
|
||||
self.assertEqual('dvs', binding[0].phy_uuid)
|
||||
elif network_type == 'portgroup':
|
||||
self.assertEqual('portgroup', binding[0].binding_type)
|
||||
self.assertEqual(0, binding[0].vlan_id)
|
||||
self.assertEqual('fake-moid', binding[0].phy_uuid)
|
||||
else:
|
||||
self.fail()
|
||||
if network_type != 'portgroup':
|
||||
|
Loading…
Reference in New Issue
Block a user