Fix functional tests gate

With commit 88f5e11d8bf[1], neutron plugs new ports as dead vlan. During
functional tests all the ports are untagged. So such tag should be
removed during functional testing.

Closes-Bug: #1777673

[1] I024bbbdf7059835b2f23c264b48478c71633a43c

Change-Id: I7b472b4a4f51fea473635fbd731a897e46af5eee
This commit is contained in:
Hunt Xu 2018-06-19 22:34:59 +08:00
parent 68fd474f73
commit a46f7d6015
1 changed files with 19 additions and 1 deletions

View File

@ -425,7 +425,25 @@ class TestIPSecBase(base.BaseSudoTestCase):
router_info.RouterInfo, 'get_external_device_name').start()
mock_get_external_device_name.side_effect = get_external_device_name
agent._process_added_router(info)
# NOTE(huntxu): with commit 88f5e11d8bf, neutron plugs new ports as
# dead vlan(4095). During functional tests, all the ports are untagged.
# So need to remove such tag during functional testing.
original_plug_new = interface.OVSInterfaceDriver.plug_new
def plug_new(self, *args, **kwargs):
original_plug_new(self, *args, **kwargs)
bridge = (kwargs.get('bridge') or args[4] or
self.conf.ovs_integration_bridge)
device_name = kwargs.get('device_name') or args[2]
ovsbr = ovs_lib.OVSBridge(bridge)
ovsbr.clear_db_attribute('Port', device_name, 'tag')
with mock.patch(
'neutron.agent.linux.interface.OVSInterfaceDriver.plug_new',
autospec=True
) as ovs_plug_new:
ovs_plug_new.side_effect = plug_new
agent._process_added_router(info)
return agent.router_info[info['id']]