From 2158d4e3d518843eb0570f08a21d47c400bf0b29 Mon Sep 17 00:00:00 2001 From: Roman Kachur Date: Fri, 1 Mar 2019 11:47:18 +0200 Subject: [PATCH] [aclshow] restore PRIO column and sort entries by priority Signed-off-by: Roman Kachur --- scripts/aclshow | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/aclshow b/scripts/aclshow index 249db80129..5eb9cb0d8c 100755 --- a/scripts/aclshow +++ b/scripts/aclshow @@ -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" @@ -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):