From 540117e22c780cd756222091fd9db88a7f517f07 Mon Sep 17 00:00:00 2001 From: Justin Wong <51811017+justin-wong-ce@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:19:37 -0800 Subject: [PATCH] Fix acl/test_stress_acl.py invalid interface name (#15796) Description of PR Fix acl/test_stress_acl.py using bad interface name for ACL table creation Summary: Fixes # (issue) In acl/test_stress_acl.py, it attempts to retrieve an interface that can be used to create a ACL table. DUTs with and without PortChannels require different methods respectively. Currently, it checks by filtering with topo. However, some topology flags can have configurations that have or not have PortChannels, making topos no longer a sufficient check - in some topos the test will fail with: Error: Failed to parse ACL table config: exception=Cannot bind ACL to specified port Ethernet136 Reproducible by manually running the following on the DUT: config acl add table DATAACL L3 -s ingress -p Ethernet0 ^FAILS config acl add table DATAACL L3 -s ingress -p PortChannel101 ^WORKS --- tests/acl/test_stress_acl.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/acl/test_stress_acl.py b/tests/acl/test_stress_acl.py index 47244a30bc4..ca0a80e5589 100644 --- a/tests/acl/test_stress_acl.py +++ b/tests/acl/test_stress_acl.py @@ -91,12 +91,15 @@ def prepare_test_file(rand_selected_dut): @pytest.fixture(scope='module') def prepare_test_port(rand_selected_dut, tbinfo): mg_facts = rand_selected_dut.get_extended_minigraph_facts(tbinfo) - if tbinfo["topo"]["type"] == "mx": - dut_port = mg_facts["minigraph_acls"]["DataAcl"][0] - else: - dut_port = list(mg_facts['minigraph_portchannels'].keys())[0] + + ports = list(mg_facts['minigraph_portchannels']) + if not ports: + ports = mg_facts["minigraph_acls"]["DataAcl"] + + dut_port = ports[0] if ports else None + if not dut_port: - pytest.skip('No portchannels found') + pytest.skip('No portchannels nor dataacl ports found') if "Ethernet" in dut_port: dut_eth_port = dut_port elif "PortChannel" in dut_port: