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
24 changes: 15 additions & 9 deletions tests/everflow/everflow_test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,22 +956,27 @@ def remove_outer_ip(self, packet_data):

return new_packet

def check_rule_counters(self, duthost):
def check_rule_active(self, duthost, table_name):
"""
Check if Acl rule counters initialized
Check if Acl rule initialized

Args:
duthost: DUT host object
Returns:
Bool value
"""
res = duthost.shell("aclshow -a")['stdout_lines']
if len(res) <= 2 or [line for line in res if 'N/A' in line]:
res = duthost.shell(f"show acl rule {table_name}")['stdout_lines']
if "Status" not in res[0]:
return False
else:
return True
status_index = res[0].index("Status")
for line in res[2:]:
if len(line) < status_index:
continue
if line[status_index:] != 'Active':
return False
return True

def apply_non_openconfig_acl_rle(self, duthost, extra_vars, rule_file):
def apply_non_openconfig_acl_rule(self, duthost, extra_vars, rule_file, table_name):
"""
Not all ACL match groups are valid in openconfig-acl format used in rest of these
tests. Instead we must load these uing SONiC-style acl jsons.
Expand All @@ -988,7 +993,8 @@ def apply_non_openconfig_acl_rle(self, duthost, extra_vars, rule_file):
duthost.shell("config load -y {}".format(dest_path))

if duthost.facts['asic_type'] != 'vs':
pytest_assert(wait_until(60, 2, 0, self.check_rule_counters, duthost), "Acl rule counters are not ready")
pytest_assert(wait_until(60, 2, 0, self.check_rule_active, duthost, table_name),
"Acl rule counters are not ready")

def apply_ip_type_rule(self, duthost, ip_version):
"""
Expand All @@ -1011,7 +1017,7 @@ def apply_ip_type_rule(self, duthost, ip_version):
'table_name': table_name,
'action': action
}
self.apply_non_openconfig_acl_rle(duthost, extra_vars, rule_file)
self.apply_non_openconfig_acl_rule(duthost, extra_vars, rule_file, table_name)

def send_and_check_mirror_packets(self,
setup,
Expand Down
Loading