Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions tests/acl/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
from tests.common.dualtor.dual_tor_mock import mock_server_base_ip_addr # noqa F401
from tests.common.helpers.constants import DEFAULT_NAMESPACE
from tests.common.utilities import get_upstream_neigh_type, get_downstream_neigh_type
from tests.common.fixtures.conn_graph_facts import conn_graph_facts # noqa F401
from tests.common.platform.processes_utils import wait_critical_processes
from tests.common.platform.interface_utils import check_all_interface_information

logger = logging.getLogger(__name__)

Expand All @@ -31,6 +34,8 @@
pytest.mark.topology("any"),
]

MAX_WAIT_TIME_FOR_INTERFACES = 360

BASE_DIR = os.path.dirname(os.path.realpath(__file__))
DUT_TMP_DIR = "acl_test_dir" # Keep it under home dir so it persists through reboot
FILES_DIR = os.path.join(BASE_DIR, "files")
Expand Down Expand Up @@ -585,7 +590,7 @@ def setup_rules(self, dut, acl_table, ip_version):
"""
pass

def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo):
def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo, conn_graph_facts): # noqa F811
"""Perform actions after rules have been applied.

Args:
Expand Down Expand Up @@ -614,7 +619,8 @@ def teardown_rules(self, dut):
dut.command("config acl update full {}".format(remove_rules_dut_path))

@pytest.fixture(scope="class", autouse=True)
def acl_rules(self, duthosts, localhost, setup, acl_table, populate_vlan_arp_entries, tbinfo, ip_version):
def acl_rules(self, duthosts, localhost, setup, acl_table, populate_vlan_arp_entries, tbinfo,
ip_version, conn_graph_facts): # noqa F811
"""Setup/teardown ACL rules for the current set of tests.

Args:
Expand All @@ -641,7 +647,7 @@ def acl_rules(self, duthosts, localhost, setup, acl_table, populate_vlan_arp_ent
with loganalyzer:
self.setup_rules(duthost, acl_table, ip_version)

self.post_setup_hook(duthost, localhost, populate_vlan_arp_entries, tbinfo)
self.post_setup_hook(duthost, localhost, populate_vlan_arp_entries, tbinfo, conn_graph_facts)

assert self.check_rule_counters(duthost), "Rule counters should be ready!"

Expand Down Expand Up @@ -1185,7 +1191,7 @@ class TestAclWithReboot(TestBasicAcl):
upon startup.
"""

def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo):
def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo, conn_graph_facts): # noqa F811
"""Save configuration and reboot after rules are applied.

Args:
Expand All @@ -1199,6 +1205,19 @@ def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo):
# We need some additional delay on e1031
if dut.facts["platform"] == "x86_64-cel_e1031-r0":
time.sleep(240)

# We need additional delay and make sure ports are up for Nokia-IXR7250E-36x400G
if dut.facts["hwsku"] == "Nokia-IXR7250E-36x400G":
interfaces = conn_graph_facts["device_conn"][dut.hostname]
logging.info("Wait until all critical services are fully started")
wait_critical_processes(dut)

xcvr_skip_list = {dut.hostname: []}
result = wait_until(MAX_WAIT_TIME_FOR_INTERFACES, 20, 0, check_all_interface_information, dut, interfaces,
xcvr_skip_list)
assert result, "Not all transceivers are detected or interfaces are up in {} seconds".format(
MAX_WAIT_TIME_FOR_INTERFACES)

populate_vlan_arp_entries()


Expand All @@ -1209,7 +1228,7 @@ class TestAclWithPortToggle(TestBasicAcl):
Verify that ACLs still function as expected after links flap.
"""

def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo):
def post_setup_hook(self, dut, localhost, populate_vlan_arp_entries, tbinfo, conn_graph_facts): # noqa F811
"""Toggle ports after rules are applied.

Args:
Expand Down