From 494c6d7bcd6a282da7b541adf8fd792cdfe9fb91 Mon Sep 17 00:00:00 2001 From: Neetha John Date: Mon, 28 Feb 2022 13:41:51 -0800 Subject: [PATCH] [counterpoll] Display the correct default poll interval for watermark counters (#2082) Signed-off-by: Neetha John Azure/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 --- counterpoll/main.py | 6 +++--- tests/counterpoll_test.py | 18 +++++++++--------- tests/mock_tables/config_db.json | 2 -- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/counterpoll/main.py b/counterpoll/main.py index e5894e16767f..e23f4b9c59dd 100644 --- a/counterpoll/main.py +++ b/counterpoll/main.py @@ -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: diff --git a/tests/counterpoll_test.py b/tests/counterpoll_test.py index 71d7e914aa12..7f5251e99814 100644 --- a/tests/counterpoll_test.py +++ b/tests/counterpoll_test.py @@ -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): diff --git a/tests/mock_tables/config_db.json b/tests/mock_tables/config_db.json index 780005a40587..9b618df3b37c 100644 --- a/tests/mock_tables/config_db.json +++ b/tests/mock_tables/config_db.json @@ -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": {