Skip to content

Commit 57ec10d

Browse files
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
1 parent ecb6fea commit 57ec10d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/acl/test_stress_acl.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ def prepare_test_file(rand_selected_dut):
9191
@pytest.fixture(scope='module')
9292
def prepare_test_port(rand_selected_dut, tbinfo):
9393
mg_facts = rand_selected_dut.get_extended_minigraph_facts(tbinfo)
94-
if tbinfo["topo"]["type"] == "mx":
95-
dut_port = mg_facts["minigraph_acls"]["DataAcl"][0]
96-
else:
97-
dut_port = list(mg_facts['minigraph_portchannels'].keys())[0]
94+
95+
ports = list(mg_facts['minigraph_portchannels'])
96+
if not ports:
97+
ports = mg_facts["minigraph_acls"]["DataAcl"]
98+
99+
dut_port = ports[0] if ports else None
100+
98101
if not dut_port:
99-
pytest.skip('No portchannels found')
102+
pytest.skip('No portchannels nor dataacl ports found')
100103
if "Ethernet" in dut_port:
101104
dut_eth_port = dut_port
102105
elif "PortChannel" in dut_port:

0 commit comments

Comments
 (0)