Merge "[NSX-P] Workaround for correctly unsetting trunks" into stable/xena
This commit is contained in:
commit
9a39ffddc8
12
tox.ini
12
tox.ini
|
@ -31,12 +31,12 @@ commands = false
|
|||
# note that order is important to ensure dependencies don't override
|
||||
commands =
|
||||
pip install -q -e "git+https://opendev.org/x/networking-l2gw@origin/stable/wallaby#egg=networking_l2gw"
|
||||
pip install -q -e "git+https://opendev.org/openstack/networking-sfc@origin/stable/xena#egg=networking_sfc"
|
||||
pip install -q -e "git+https://opendev.org/openstack/neutron-dynamic-routing@origin/stable/xena#egg=neutron_dynamic_routing"
|
||||
pip install -q -e "git+https://opendev.org/openstack/neutron-vpnaas@origin/stable/xena#egg=neutron_vpnaas"
|
||||
pip install -q -e "git+https://opendev.org/openstack/octavia@origin/stable/xena#egg=octavia"
|
||||
pip install -q -e "git+https://opendev.org/openstack/vmware-nsxlib@origin/stable/xena#egg=vmware_nsxlib"
|
||||
pip install -q -e "git+https://opendev.org/openstack/neutron@origin/stable/xena#egg=neutron"
|
||||
# pip install -q -e "git+https://opendev.org/openstack/networking-sfc@origin/stable/xena#egg=networking_sfc"
|
||||
# pip install -q -e "git+https://opendev.org/openstack/neutron-dynamic-routing@origin/stable/xena#egg=neutron_dynamic_routing"
|
||||
# pip install -q -e "git+https://opendev.org/openstack/neutron-vpnaas@origin/stable/xena#egg=neutron_vpnaas"
|
||||
# pip install -q -e "git+https://opendev.org/openstack/octavia@origin/stable/xena#egg=octavia"
|
||||
# pip install -q -e "git+https://opendev.org/openstack/vmware-nsxlib@origin/stable/xena#egg=vmware_nsxlib"
|
||||
# pip install -q -e "git+https://opendev.org/openstack/neutron@origin/stable/xena#egg=neutron"
|
||||
|
||||
|
||||
[testenv:functional]
|
||||
|
|
|
@ -139,9 +139,16 @@ class NsxpTrunkHandler(object):
|
|||
if is_compute:
|
||||
vif_id = subport.port_id
|
||||
try:
|
||||
# Workaround for issue with vif removal not propagated
|
||||
# to NSX LCP. Unset and then reset vif_id
|
||||
self.plugin_driver.nsxpolicy.segment_port.detach(
|
||||
segment_id, subport.port_id, vif_id=vif_id, tags=tags)
|
||||
|
||||
segment_id, subport.port_id, vif_id=None, tags=tags)
|
||||
self.plugin_driver.nsxpolicy.segment_port.attach(
|
||||
segment_id,
|
||||
subport.port_id,
|
||||
vif_id=vif_id,
|
||||
attachment_type=p_constants.ATTACHMENT_INDEPENDENT,
|
||||
tags=tags)
|
||||
except nsxlib_exc.ManagerError as e:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error("Unable to update subport for attachment "
|
||||
|
|
|
@ -150,7 +150,7 @@ class TestNsxpTrunkHandler(test_nsx_p_plugin.NsxPPluginTestCaseMixin,
|
|||
vif_id=self.trunk_1.port_id, tags=mock.ANY),
|
||||
mock.call.m_detach(
|
||||
'net_a', self.sub_port_a.port_id,
|
||||
vif_id=self.sub_port_a.port_id, tags=mock.ANY)]
|
||||
vif_id=None, tags=mock.ANY)]
|
||||
m_detach.assert_has_calls(calls, any_order=True)
|
||||
|
||||
# Delete trunk with multiple subports
|
||||
|
@ -162,13 +162,13 @@ class TestNsxpTrunkHandler(test_nsx_p_plugin.NsxPPluginTestCaseMixin,
|
|||
calls = [
|
||||
mock.call.m_detach(
|
||||
'net_2', self.trunk_2.port_id,
|
||||
vif_id=self.trunk_2.port_id, tags=mock.ANY),
|
||||
vif_id='parent_port_2', tags=mock.ANY),
|
||||
mock.call.m_detach(
|
||||
'net_b', self.sub_port_b.port_id,
|
||||
vif_id=self.sub_port_b.port_id, tags=mock.ANY),
|
||||
vif_id=None, tags=mock.ANY),
|
||||
mock.call.m_detach(
|
||||
'net_c', self.sub_port_c.port_id,
|
||||
vif_id=self.sub_port_c.port_id, tags=mock.ANY)]
|
||||
vif_id=None, tags=mock.ANY)]
|
||||
m_detach.assert_has_calls(calls, any_order=True)
|
||||
|
||||
def test_subports_added(self):
|
||||
|
@ -232,11 +232,19 @@ class TestNsxpTrunkHandler(test_nsx_p_plugin.NsxPPluginTestCaseMixin,
|
|||
with mock.patch.object(
|
||||
self.handler.plugin_driver.nsxpolicy.segment_port,
|
||||
'detach') as m_detach:
|
||||
self.handler.subports_deleted(
|
||||
self.context, self.trunk_1, sub_ports)
|
||||
m_detach.assert_called_with(
|
||||
'net_a', self.sub_port_a.port_id,
|
||||
vif_id=self.sub_port_a.port_id, tags=mock.ANY)
|
||||
with mock.patch.object(
|
||||
self.handler.plugin_driver.nsxpolicy.segment_port,
|
||||
'attach') as m_attach:
|
||||
self.handler.subports_deleted(
|
||||
self.context, self.trunk_1, sub_ports)
|
||||
m_detach.assert_called_with(
|
||||
'net_a', self.sub_port_a.port_id,
|
||||
vif_id=None, tags=mock.ANY)
|
||||
m_attach.assert_called_with(
|
||||
'net_a', self.sub_port_a.port_id,
|
||||
attachment_type='INDEPENDENT',
|
||||
vif_id=self.sub_port_a.port_id,
|
||||
tags=[])
|
||||
|
||||
# Update trunk to remove multiple subports
|
||||
sub_ports = [self.sub_port_b, self.sub_port_c]
|
||||
|
@ -248,10 +256,10 @@ class TestNsxpTrunkHandler(test_nsx_p_plugin.NsxPPluginTestCaseMixin,
|
|||
calls = [
|
||||
mock.call.m_detach(
|
||||
'net_b', self.sub_port_b.port_id,
|
||||
vif_id=self.sub_port_b.port_id, tags=mock.ANY),
|
||||
vif_id=None, tags=mock.ANY),
|
||||
mock.call.m_detach(
|
||||
'net_c', self.sub_port_c.port_id,
|
||||
vif_id=self.sub_port_c.port_id, tags=mock.ANY)]
|
||||
vif_id=None, tags=mock.ANY)]
|
||||
m_detach.assert_has_calls(calls, any_order=True)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue