Skip to content
Merged
Changes from 1 commit
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
13 changes: 8 additions & 5 deletions tests/acl/test_acl_outer_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,16 @@ def get_acl_counter(duthost, table_name, rule_name, timeout=ACL_COUNTERS_UPDATE_
Returns:
Acl counter value for packets
"""
cmd = "redis-cli -n 2 hget 'COUNTERS:{}:{}' Packets"
# Wait for orchagent to update the ACL counters
time.sleep(timeout)
result = duthost.shell(cmd.format(table_name, rule_name))['stdout']
if result == "":
pytest.fail("Failed to retrieve acl counter for {}|{}".format(table_name, rule_name))
return int(result)
result = duthost.show_and_parse('aclshow')

if len(result) == 0:
return 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "0" expected behavior? If not, could we some add debug/error print here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StormLiangMS If there is no rule for acl, the output looks like below, result is empty.
We return 0 here. The log file includes all the output of shell command.

admin@str-dx010-acs-5:~$ aclshow -a
RULE NAME    TABLE NAME    PRIO    PACKETS COUNT    BYTES COUNT
-----------  ------------  ------  ---------------  -------------

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StormLiangMS Rethinking about your comment, you are correct. get_acl_counter is called after setup acl rules, so if can't find any expected rule, fail the test case.

for rule in result:
if rule_name == rule['rule name']:
return int(rule['packets count'])
return 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done in my second commit.



def craft_packet(src_mac, dst_mac, dst_ip, ip_version, stage, tagged_mode, vlan_id=10, outer_vlan_id=0, pkt_type=None):
Expand Down