Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ACL table name associated with the rules and sort the output #263

Merged
merged 1 commit into from
Jun 26, 2018
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
8 changes: 6 additions & 2 deletions scripts/aclshow
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import swsssdk
import sys

from tabulate import tabulate
from natsort import natsorted

### temp file to save counter positions when doing clear counter action.
### if we could have a SAI command to clear counters will be better, so no need to maintain
Expand Down Expand Up @@ -253,10 +254,13 @@ class AclStat(object):
table_props.append(line)
print(tabulate(table_props, headers=['Property', 'Value']), "\n")

for table_name, rule_name in self.acl_rules.keys():
acl_rules_sort = self.acl_rules.keys()
acl_rules_sort = natsorted(acl_rules_sort, key=lambda x: (x[0], x[1]))

for table_name, rule_name in acl_rules_sort:
rule_props = []
rule = self.acl_rules[table_name, rule_name]
header = "ACL Rule: " + rule_name
header = "ACL Table: " + table_name + ", ACL Rule: " + rule_name
print(header)
print("="*len(header))
for rk in rule.keys():
Expand Down