Don't set and remove immediately DEAD VLAN tag in tests
In fullstack and functional tests where OVSPortFixture is used to create port in OVS bridge, just after port was created by ovs interface driver, DEAD_VLAN tag was removed from the port as it's not needed in tests. But this could cause race condition and instead of removing DEAD_VLAN tag, actually correct tag configured by e.g. neutron_openvswitch_agent was removed and traffic to such port wasn't working at all. To avoid that race, now method which adds setting DEAD_VLAN tag to the port_replace transaction is now mocked so there will be no DEAD VLAN tag set on such port at all. This patch also removes unstable test decorator from the TestDhcpAgentHA.test_multiple_agents_for_network fullstack test as it seems for me that this was the reason why this test was failing pretty often. Closes-Bug: #2000150 Change-Id: I3938c94bbd531fac461e80e791c128821a4f837f
This commit is contained in:
parent
b600498232
commit
b19b55909d
|
@ -24,6 +24,7 @@ import shlex
|
|||
import signal
|
||||
import subprocess
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import netaddr
|
||||
|
@ -880,20 +881,19 @@ class OVSPortFixture(PortFixture):
|
|||
interface_config = cfg.ConfigOpts()
|
||||
config.register_interface_opts(interface_config)
|
||||
ovs_interface = interface.OVSInterfaceDriver(interface_config)
|
||||
ovs_interface.plug_new(
|
||||
None,
|
||||
self.port_id,
|
||||
port_name,
|
||||
self.mac,
|
||||
bridge=self.bridge.br_name,
|
||||
namespace=self.namespace)
|
||||
# NOTE(mangelajo): for OVS implementations remove the DEAD VLAN tag
|
||||
# on ports that we intend to use as fake vm interfaces, they
|
||||
# need to be flat. This is related to lp#1767422
|
||||
self.bridge.clear_db_attribute("Port", port_name, "tag")
|
||||
# Clear vlan_mode that is added for each new port. lp#1930414
|
||||
self.bridge.clear_db_attribute("Port", port_name, "vlan_mode")
|
||||
self.bridge.clear_db_attribute("Port", port_name, "trunks")
|
||||
# NOTE(slaweq): for OVS implementation normally there would be DEAD
|
||||
# VLAN tag set for port and we would need to remove it here as it is
|
||||
# needed during the tests. But to avoid setting and removing tag, we
|
||||
# can simply mock _set_port_dead method so port will not be tagged with
|
||||
# DEAD_VLAN tag initially
|
||||
with mock.patch.object(ovs_lib.OVSBridge, '_set_port_dead'):
|
||||
ovs_interface.plug_new(
|
||||
None,
|
||||
self.port_id,
|
||||
port_name,
|
||||
self.mac,
|
||||
bridge=self.bridge.br_name,
|
||||
namespace=self.namespace)
|
||||
self.addCleanup(self.bridge.delete_port, port_name)
|
||||
self.port = ip_lib.IPDevice(port_name, self.namespace)
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ from oslo_utils import uuidutils
|
|||
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.common import utils as common_utils
|
||||
from neutron.tests import base as test_base
|
||||
from neutron.tests.fullstack.agents import dhcp_agent
|
||||
from neutron.tests.fullstack import base
|
||||
from neutron.tests.fullstack.resources import environment
|
||||
|
@ -185,7 +184,6 @@ class TestDhcpAgentHA(BaseDhcpAgentTest):
|
|||
# check if new vm will get IP from new DHCP agent
|
||||
self._spawn_vm()
|
||||
|
||||
@test_base.unstable_test('bug 2000150')
|
||||
def test_multiple_agents_for_network(self):
|
||||
network_dhcp_agents = self.client.list_dhcp_agent_hosting_networks(
|
||||
self.network['id'])['agents']
|
||||
|
|
Loading…
Reference in New Issue