From 37b417d993a73b137c81d2b6c130d6fa1363b2f1 Mon Sep 17 00:00:00 2001 From: Miguel Lavalle Date: Sat, 19 Apr 2025 11:31:19 -0500 Subject: [PATCH 1/5] Increase threshold in TestHAL3Agent fullstack test The HA router failover fullstack test has a maximum threshold of ICMP packets lost after a failover has been executed. Based on the number of failures observed in zuul recently, this threshold seems to be set at a value too low. In this change, an increase in this value is proposed. Change-Id: I4555ed821865db724c4e5fc502648fe71d5febea Partial-Bug: #2104019 Partial-Bug: #2091351 (cherry picked from commit 557d57e165ffd7859724cb9bbbafc959a7dab5ea) Signed-off-by: Yatin Karel --- neutron/tests/fullstack/test_l3_agent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/tests/fullstack/test_l3_agent.py b/neutron/tests/fullstack/test_l3_agent.py index 5903058e397..2c2be2a4c85 100644 --- a/neutron/tests/fullstack/test_l3_agent.py +++ b/neutron/tests/fullstack/test_l3_agent.py @@ -566,8 +566,9 @@ def is_one_host_active_for_router(): netcat_udp.stop_processes() # With the default advert_int of 2s the keepalived master timeout is - # about 6s. Assert less than 90 lost packets (9 seconds) - threshold = 90 + # about 6s. Assert less than 90 lost packets (9 seconds) plus 30 to + # account for CI infrastructure variability + threshold = 120 lost = pinger.sent - pinger.received message = (f'Sent {pinger.sent} packets, received {pinger.received} ' From 23ef72bc04f931e460dc1492472509dc5c594d55 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 18 Jun 2025 04:15:00 +0000 Subject: [PATCH 2/5] [FT] Randomize OVS test bridges and pre-delete them Now the test creates random name bridges and, before executing the test, it tries to delete them if exist. Closes-Bug: #2114909 Signed-off-by: Rodolfo Alonso Hernandez Change-Id: I2bcf6c264dcec4ceaadebf14dbd20cd13750e20f (cherry picked from commit f315b9a8071287f41b6c8e6f73c0846b92869f54) --- .../agent/ovsdb/native/test_connection.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/neutron/tests/functional/agent/ovsdb/native/test_connection.py b/neutron/tests/functional/agent/ovsdb/native/test_connection.py index ea3651bd5ad..e750416efae 100644 --- a/neutron/tests/functional/agent/ovsdb/native/test_connection.py +++ b/neutron/tests/functional/agent/ovsdb/native/test_connection.py @@ -15,6 +15,7 @@ import threading +from oslo_utils import uuidutils from ovsdbapp import event from neutron.agent.common import ovs_lib @@ -52,9 +53,17 @@ def _delete_bridges(self, bridges): self.ovs.delete_bridge(bridge) def test_create_bridges(self): - bridges_to_monitor = ['br01', 'br02', 'br03'] - bridges_to_create = ['br01', 'br02', 'br03', 'br04', 'br05'] + bridges_to_create = [ + 'br_' + uuidutils.generate_uuid()[:12], + 'br_' + uuidutils.generate_uuid()[:12], + 'br_' + uuidutils.generate_uuid()[:12], + 'br_' + uuidutils.generate_uuid()[:12], + 'br_' + uuidutils.generate_uuid()[:12], + ] + bridges_to_monitor = bridges_to_create[:3] self.ovs = ovs_lib.BaseOVS() + self._delete_bridges(bridges_to_create) + self.ovs.ovsdb.idl_monitor.start_bridge_monitor(bridges_to_monitor) self.addCleanup(self._delete_bridges, bridges_to_create) event = WaitForBridgesEvent(bridges_to_monitor) From c1dab18079533a81c401adc2f42fd06887430a00 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Tue, 15 Jul 2025 10:55:48 +0000 Subject: [PATCH 3/5] [FT] Increate the bridge creation event timeout This event is used in ``BridgeMonitorTestCase.test_create_bridges``. Related-Bug: #2114909 Signed-off-by: Rodolfo Alonso Hernandez Change-Id: I36a32c7b6eb44aa2ac315b1e51d54ee662c1d189 (cherry picked from commit cc705812fddf223c705cf7430c8fb0fda9898c0e) --- neutron/tests/functional/agent/ovsdb/native/test_connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/tests/functional/agent/ovsdb/native/test_connection.py b/neutron/tests/functional/agent/ovsdb/native/test_connection.py index ea3651bd5ad..b7e20913820 100644 --- a/neutron/tests/functional/agent/ovsdb/native/test_connection.py +++ b/neutron/tests/functional/agent/ovsdb/native/test_connection.py @@ -25,7 +25,7 @@ class WaitForBridgesEvent(event.RowEvent): event_name = 'WaitForBridgesEvent' ONETIME = True - def __init__(self, bridges, timeout=5): + def __init__(self, bridges, timeout=20): self.bridges_not_seen = set(bridges) self.timeout = timeout self.event = threading.Event() From f277c5a90be4c4c2beea5871e36fb3653a974048 Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Mon, 7 Jul 2025 16:23:02 +0530 Subject: [PATCH 4/5] [FT] Mark test_fip_connection_for_address_scope unstable The test is failing randomly from quite some time now, marking this unstable until this gets fixed. Related-Bug: #2115026 Change-Id: Idff5aa32df45592992312347ad2eaa424391909a Signed-off-by: yatinkarel (cherry picked from commit 5454e76ff07fade109a23857024ba5cd26444113) --- neutron/tests/functional/agent/l3/test_dvr_router.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/neutron/tests/functional/agent/l3/test_dvr_router.py b/neutron/tests/functional/agent/l3/test_dvr_router.py index 73873914448..922296b571b 100644 --- a/neutron/tests/functional/agent/l3/test_dvr_router.py +++ b/neutron/tests/functional/agent/l3/test_dvr_router.py @@ -32,6 +32,7 @@ from neutron.agent.linux import ip_lib from neutron.agent.linux import iptables_manager from neutron.common import utils +from neutron.tests import base as test_base from neutron.tests.common import l3_test_common from neutron.tests.common import machine_fixtures from neutron.tests.common import net_helpers @@ -2180,6 +2181,7 @@ def test_connection_from_diff_address_scope(self): test_machine1.assert_no_ping(test_machine2.ip) test_machine2.assert_no_ping(test_machine1.ip) + @test_base.unstable_test('bug 2115026') def test_fip_connection_for_address_scope(self): self.agent.conf.agent_mode = 'dvr_snat' (machine_same_scope, machine_diff_scope, From fdc376e366a4647c93920127656edc8adb9ae9af Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Thu, 4 Sep 2025 22:52:34 -0400 Subject: [PATCH 5/5] Fix AttributeError accessing local compute port The items returned from the RPC call get_ports_on_host_by_subnet() are dictionaries, not objects, so referencing by *.id will throw an AttributeError. Added tests that would have caught it and fixed the mocking to return correct values. Introduced in: https://review.opendev.org/c/openstack/neutron/+/938657 Closes-bug: #2122065 Change-Id: If4ff23f6c79580918d90380eda1326f583fc937f Signed-off-by: Brian Haley (cherry picked from commit e51a6bdbff0c813676d1a0cba2e8e9f8682ddac8) --- .../openvswitch/agent/ovs_dvr_neutron_agent.py | 2 +- .../openvswitch/agent/test_ovs_neutron_agent.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py index 80b35e795d7..f94deb3ec55 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_dvr_neutron_agent.py @@ -805,7 +805,7 @@ def _unbind_port_on_dvr_subnet(self, port, lvm): self.context, self.host, sub_uuid)) local_aap_macs = set() for lport in local_compute_ports: - if lport.id != port.vif_id: + if lport['id'] != port.vif_id: local_aap_macs.update({ aap["mac_address"] for aap in lport.get( "allowed_address_pairs", [])}) diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py index 4cf35fd3431..c437883b154 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py @@ -4083,6 +4083,7 @@ def _test_treat_devices_removed_for_dvr( self, device_owner, ip_version=n_const.IP_VERSION_4, aaps=False): self._setup_for_dvr_test() port_obj = {"id": "fake-port-uuid"} + local_port_obj = {"id": "fake-port-uuid"} aap_mac = 'aa:bb:cc:dd:ee:ff' aap_mac2 = 'aa:bb:cc:dd:ee:fe' aap_mac3 = 'aa:bb:cc:dd:ee:fd' @@ -4107,7 +4108,7 @@ def _test_treat_devices_removed_for_dvr( 'mac_address': aap_mac}, {'ip_address': '2001:100::11', 'mac_address': aap_mac2}, - {'ip_address': '2001:100::0/0', + {'ip_address': '::/0', 'mac_address': aap_mac3} ] self._port.dvr_mac = self.agent.dvr_agent.dvr_mac_address @@ -4185,6 +4186,9 @@ def _test_treat_devices_removed_for_dvr( self._compute_port.vif_id], 'failed_devices_up': [], 'failed_devices_down': []}),\ + mock.patch.object(self.agent.dvr_agent.plugin_rpc, + 'get_ports_on_host_by_subnet', + return_value=[local_port_obj]),\ mock.patch.object(self.agent.dvr_agent.plugin_rpc, 'get_ports', return_value=[port_obj]),\ @@ -4223,6 +4227,11 @@ def test_treat_devices_removed_for_dvr_with_compute_ports(self): device_owner=DEVICE_OWNER_COMPUTE) self._test_treat_devices_removed_for_dvr( device_owner=DEVICE_OWNER_COMPUTE, ip_version=n_const.IP_VERSION_6) + self._test_treat_devices_removed_for_dvr( + device_owner=DEVICE_OWNER_COMPUTE, aaps=True) + self._test_treat_devices_removed_for_dvr( + device_owner=DEVICE_OWNER_COMPUTE, ip_version=n_const.IP_VERSION_6, + aaps=True) def test_treat_devices_removed_for_dvr_with_dhcp_ports(self): self._test_treat_devices_removed_for_dvr(