Skip to content

Commit

Permalink
[aclshow] restore PRIO column and sort entries by priority (#476)
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Kachur <romankac@mellanox.com>
  • Loading branch information
romankachur-mlnx authored and liat-grozovik committed Mar 11, 2019
1 parent 9957e2f commit a7a512f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/aclshow
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ from natsort import natsorted
COUNTER_POSITION = '/tmp/.counters_acl.p'

### acl display header
ACL_HEADER = ["RULE NAME", "TABLE NAME", "PACKETS COUNT", "BYTES COUNT"]
ACL_HEADER = ["RULE NAME", "TABLE NAME", "PRIO", "PACKETS COUNT", "BYTES COUNT"]

# some constants for rule properties
PACKETS_COUNTER = "packets counter"
Expand Down Expand Up @@ -178,12 +178,13 @@ class AclStat(object):
continue
rule = self.acl_rules[rule_key]
line = [rule_key[1], rule_key[0],
rule['PRIORITY'],
self.get_counter_value(rule_key, 'packets'),
self.get_counter_value(rule_key, 'bytes')]
aclstat.append(line)

# sort the list with table name first and then descending priority
aclstat.sort(key=lambda x: (x[1], -int(x[3])))
aclstat.sort(key=lambda x: (x[1], -int(x[2])))
print(tabulate(aclstat, header))

def clear_counters(self):
Expand Down

0 comments on commit a7a512f

Please sign in to comment.