From 037b6ff0c5edffd5955f177ad493a88eeadf50cc Mon Sep 17 00:00:00 2001 From: Justin Wong Date: Wed, 26 Jun 2024 11:36:22 -0700 Subject: [PATCH 1/3] sonic-mgmt: Fix arp/test_unknown_mac by disabling ipv6 The DUT will occasionally (~5 mins) send a echo request through IPV6 to the ptf container (from `arp_update`), and this is casuing the fdb table to be populated - which is bad because the test expects the fdb table to be empty. Temporarily disabling arp_update during the test will eliminate the problem. --- tests/arp/test_unknown_mac.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/arp/test_unknown_mac.py b/tests/arp/test_unknown_mac.py index 71c5d41e08b..7eafa497ceb 100644 --- a/tests/arp/test_unknown_mac.py +++ b/tests/arp/test_unknown_mac.py @@ -41,6 +41,20 @@ def wrapper(self, *args): func(self, *args) return wrapper +@pytest.fixture(autouse=True, scope="module") +def dut_disable_arp_update(rand_selected_dut): + """ + Fixture to disable arp update before the test and re-enable it afterwards + + Args: + rand_selected_dut(AnsibleHost) : dut instance + """ + duthost = rand_selected_dut + assert duthost.shell("docker exec -t swss supervisorctl stop arp_update")['stdout_lines'][0] == 'arp_update: stopped' + + yield + + assert duthost.shell("docker exec -t swss supervisorctl start arp_update")['stdout_lines'][0] == 'arp_update: started' @pytest.fixture(autouse=True, scope="module") def unknownMacSetup(duthosts, rand_one_dut_hostname, tbinfo): From 388931b0c3e573c303d5f257400f398a77fd8366 Mon Sep 17 00:00:00 2001 From: Justin Wong Date: Mon, 15 Jul 2024 15:32:15 -0700 Subject: [PATCH 2/3] Fix precommit check --- tests/arp/test_unknown_mac.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/arp/test_unknown_mac.py b/tests/arp/test_unknown_mac.py index 7eafa497ceb..b212bb83beb 100644 --- a/tests/arp/test_unknown_mac.py +++ b/tests/arp/test_unknown_mac.py @@ -41,6 +41,7 @@ def wrapper(self, *args): func(self, *args) return wrapper + @pytest.fixture(autouse=True, scope="module") def dut_disable_arp_update(rand_selected_dut): """ @@ -50,11 +51,14 @@ def dut_disable_arp_update(rand_selected_dut): rand_selected_dut(AnsibleHost) : dut instance """ duthost = rand_selected_dut - assert duthost.shell("docker exec -t swss supervisorctl stop arp_update")['stdout_lines'][0] == 'arp_update: stopped' + assert duthost.shell("docker exec -t swss supervisorctl stop arp_update")['stdout_lines'][0] \ + == 'arp_update: stopped' yield - assert duthost.shell("docker exec -t swss supervisorctl start arp_update")['stdout_lines'][0] == 'arp_update: started' + assert duthost.shell("docker exec -t swss supervisorctl start arp_update")['stdout_lines'][0] \ + == 'arp_update: started' + @pytest.fixture(autouse=True, scope="module") def unknownMacSetup(duthosts, rand_one_dut_hostname, tbinfo): From 83b479c6587615aa818182215d25536438b49a9e Mon Sep 17 00:00:00 2001 From: Justin Wong Date: Thu, 8 Aug 2024 16:42:21 +0000 Subject: [PATCH 3/3] Allow disabled arp_update before test --- tests/arp/test_unknown_mac.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/arp/test_unknown_mac.py b/tests/arp/test_unknown_mac.py index b212bb83beb..c25ce48765b 100644 --- a/tests/arp/test_unknown_mac.py +++ b/tests/arp/test_unknown_mac.py @@ -51,8 +51,9 @@ def dut_disable_arp_update(rand_selected_dut): rand_selected_dut(AnsibleHost) : dut instance """ duthost = rand_selected_dut - assert duthost.shell("docker exec -t swss supervisorctl stop arp_update")['stdout_lines'][0] \ - == 'arp_update: stopped' + if duthost.shell("docker exec -t swss supervisorctl stop arp_update")['stdout_lines'][0] \ + == 'arp_update: ERROR (not running)': + logger.warning("arp_update not running, already disabled") yield