From 4cb1ba688e291b6917289d445a36d5965cfc5b0c Mon Sep 17 00:00:00 2001 From: Zhaohui Sun <94606222+ZhaohuiS@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:57:02 +0800 Subject: [PATCH] Fix Unexpected DHCP iptables rules for test_cacl_application_dualtor case (#11878) Description of PR Summary: Fixes # (issue) On latest master image, test_cacl_application_dualtor case could fail due to the following reason: Failed: Missing expected iptables rules: {'-A DHCP -m mark --mark 0x67005 -j DROP'} This is caused by the oscillation logic: sonic-net/sonic-linkmgrd#221 As there is no icmp_responder running, the mux will start flap, if it flaps betrween expected_dhcp_rules_for_standby fixture and the real iptables check, there could be some unexpected dhcp iptables which will cause case failure. What is the motivation for this PR? Fix Unexpected DHCP iptables rules for test_cacl_application_dualtor How did you do it? test_cacl_application_dualtor is used to verify dhcp iptables on dualtor, not oscillation. Before dualtor case, set mux mode to manual sudo config mux mode manual all in test teardown, run to set to auto back. sudo config mux mode auto all How did you verify/test it? Run cacl/test_cacl_application.py::test_cacl_application_dualtor on dualtor testbed against master image. Any platform specific information? --- tests/cacl/test_cacl_application.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cacl/test_cacl_application.py b/tests/cacl/test_cacl_application.py index 1918761796..6df1fc743f 100644 --- a/tests/cacl/test_cacl_application.py +++ b/tests/cacl/test_cacl_application.py @@ -28,7 +28,9 @@ def duthost_dualtor(request, upper_tor_host, lower_tor_host): # noqa F811 else: logger.info("Select upper tor...") dut = upper_tor_host - return dut + dut.shell("sudo config mux mode manual all") + yield dut + dut.shell("sudo config mux mode auto all") @pytest.fixture