Skip to content

Commit

Permalink
[counterpoll] Display the correct default poll interval for watermark…
Browse files Browse the repository at this point in the history
… counters (#2082)

Signed-off-by: Neetha John <nejo@microsoft.com>

sonic-net/sonic-swss#2031 updated the flex counter polling interval to 60s for watermark counters but the show command wasn't updated to reflect the correct default value

What I did
Display the correct poll interval for watermark related counters in the 'counterpoll show' command

How I did it
Update the default interval to be the same as the one updated by the Orchs

How to verify it
Issue "counterpoll show", the queue, pg and buffer pool watermark should show default 60s
Updated the counterpoll unit tests to reflect the same
  • Loading branch information
neethajohn authored Feb 28, 2022
1 parent 499988e commit 494c6d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions counterpoll/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,13 @@ def show():
if rif_info:
data.append(["RIF_STAT", rif_info.get("POLL_INTERVAL", DEFLT_1_SEC), rif_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if queue_wm_info:
data.append(["QUEUE_WATERMARK_STAT", queue_wm_info.get("POLL_INTERVAL", DEFLT_10_SEC), queue_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
data.append(["QUEUE_WATERMARK_STAT", queue_wm_info.get("POLL_INTERVAL", DEFLT_60_SEC), queue_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if pg_wm_info:
data.append(["PG_WATERMARK_STAT", pg_wm_info.get("POLL_INTERVAL", DEFLT_10_SEC), pg_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
data.append(["PG_WATERMARK_STAT", pg_wm_info.get("POLL_INTERVAL", DEFLT_60_SEC), pg_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if pg_drop_info:
data.append(['PG_DROP_STAT', pg_drop_info.get("POLL_INTERVAL", DEFLT_10_SEC), pg_drop_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if buffer_pool_wm_info:
data.append(["BUFFER_POOL_WATERMARK_STAT", buffer_pool_wm_info.get("POLL_INTERVAL", DEFLT_10_SEC), buffer_pool_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
data.append(["BUFFER_POOL_WATERMARK_STAT", buffer_pool_wm_info.get("POLL_INTERVAL", DEFLT_60_SEC), buffer_pool_wm_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if acl_info:
data.append([ACL, pg_drop_info.get("POLL_INTERVAL", DEFLT_10_SEC), acl_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if tunnel_info:
Expand Down
18 changes: 9 additions & 9 deletions tests/counterpoll_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

import counterpoll.main as counterpoll

expected_counterpoll_show = """Type Interval (in ms) Status
expected_counterpoll_show = """Type Interval (in ms) Status
-------------------- ------------------ --------
QUEUE_STAT 10000 enable
PORT_STAT 1000 enable
PORT_BUFFER_DROP 60000 enable
QUEUE_WATERMARK_STAT 10000 enable
PG_WATERMARK_STAT 10000 enable
PG_DROP_STAT 10000 enable
ACL 10000 enable
FLOW_CNT_TRAP_STAT 10000 enable
QUEUE_STAT 10000 enable
PORT_STAT 1000 enable
PORT_BUFFER_DROP 60000 enable
QUEUE_WATERMARK_STAT default (60000) enable
PG_WATERMARK_STAT default (60000) enable
PG_DROP_STAT 10000 enable
ACL 10000 enable
FLOW_CNT_TRAP_STAT 10000 enable
"""

class TestCounterpoll(object):
Expand Down
2 changes: 0 additions & 2 deletions tests/mock_tables/config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1576,11 +1576,9 @@
"FLEX_COUNTER_STATUS": "enable"
},
"FLEX_COUNTER_TABLE|QUEUE_WATERMARK": {
"POLL_INTERVAL": "10000",
"FLEX_COUNTER_STATUS": "enable"
},
"FLEX_COUNTER_TABLE|PG_WATERMARK": {
"POLL_INTERVAL": "10000",
"FLEX_COUNTER_STATUS": "enable"
},
"FLEX_COUNTER_TABLE|PG_DROP": {
Expand Down

0 comments on commit 494c6d7

Please sign in to comment.