summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-05-04 15:58:10 +0000
committerGerrit Code Review <review@openstack.org>2023-05-04 15:58:10 +0000
commitbb5dbdf06f2fe5571b03e46415948434c6a9f4c9 (patch)
tree45a69cbe2d27c8f50727b4a52d62962f6ee8aa92
parent30c0e5699ed2e4f2d29cf0343bb88c44c1707e6d (diff)
parentb19b55909dffcdc4ebbbd6d723936f8a188e3e47 (diff)
downloadneutron-bb5dbdf06f2fe5571b03e46415948434c6a9f4c9.tar.gz
Merge "Don't set and remove immediately DEAD VLAN tag in tests"
-rw-r--r--neutron/tests/common/net_helpers.py28
-rw-r--r--neutron/tests/fullstack/test_dhcp_agent.py2
2 files changed, 14 insertions, 16 deletions
diff --git a/neutron/tests/common/net_helpers.py b/neutron/tests/common/net_helpers.py
index 89f9042db9..ce8926f4bb 100644
--- a/neutron/tests/common/net_helpers.py
+++ b/neutron/tests/common/net_helpers.py
@@ -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)
diff --git a/neutron/tests/fullstack/test_dhcp_agent.py b/neutron/tests/fullstack/test_dhcp_agent.py
index e6c05b6bca..6d19a30736 100644
--- a/neutron/tests/fullstack/test_dhcp_agent.py
+++ b/neutron/tests/fullstack/test_dhcp_agent.py
@@ -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']