diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 28c31e2e4d03..fd3408e75766 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -921,25 +921,31 @@ "FLEX_COUNTER_STATUS": "enable" }, "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "PORT": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "1000" }, "PORT_RATES": { "FLEX_COUNTER_STATUS": "enable" }, "PORT_BUFFER_DROP": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "60000" }, "BUFFER_POOL_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": "10000" }, "DEBUG_COUNTER": { "FLEX_COUNTER_STATUS": "enable" @@ -1008,13 +1014,13 @@ }, "AAA": { "authentication": { - "login": "local" + "login": "local" }, "authorization": { - "login": "local" + "login": "local" }, "accounting": { - "login": "local" + "login": "local" } }, "TACPLUS": { @@ -1340,73 +1346,73 @@ }, "DSCP_TO_TC_MAP": { - "Dscp_to_tc_map1": { + "Dscp_to_tc_map1": { "1": "1", "2": "2" - }, - "Dscp_to_tc_map2": { + }, + "Dscp_to_tc_map2": { "3": "3", "4": "4" } }, "DOT1P_TO_TC_MAP": { - "Dot1p_to_tc_map1": { + "Dot1p_to_tc_map1": { "1": "1", "2": "2" - }, - "Dot1p_to_tc_map2": { + }, + "Dot1p_to_tc_map2": { "3": "3", "4": "4" } }, "TC_TO_PRIORITY_GROUP_MAP": { - "tc_to_pg_map1": { + "tc_to_pg_map1": { "1": "1", "2": "2" - }, - "tc_to_pg_map2": { + }, + "tc_to_pg_map2": { "3": "3", "4": "4" } }, "TC_TO_QUEUE_MAP": { - "tc_to_q_map1": { + "tc_to_q_map1": { "1": "1", "2": "2" - }, - "tc_to_q_map2": { + }, + "tc_to_q_map2": { "3": "3", "4": "4" } }, "MAP_PFC_PRIORITY_TO_QUEUE": { - "pfc_prio_to_q_map1": { + "pfc_prio_to_q_map1": { "1": "1", "2": "2" - }, - "pfc_prio_to_q_map2": { + }, + "pfc_prio_to_q_map2": { "3": "3", "4": "4" } }, "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "pfc_prio_to_pg_map1": { + "pfc_prio_to_pg_map1": { "1": "1", "2": "2" - }, - "pfc_prio_to_pg_map2": { + }, + "pfc_prio_to_pg_map2": { "3": "3", "4": "4" } }, "PORT_QOS_MAP": { - "Ethernet0": { + "Ethernet0": { "dot1p_to_tc_map" : "Dot1p_to_tc_map1", "dscp_to_tc_map": "Dscp_to_tc_map1", "tc_to_queue_map": "tc_to_q_map1", @@ -1414,8 +1420,8 @@ "pfc_to_queue_map": "pfc_prio_to_q_map1", "pfc_to_pg_map" : "pfc_prio_to_pg_map1", "pfc_enable" : "3,4" - }, - "Ethernet4": { + }, + "Ethernet4": { "dot1p_to_tc_map" : "Dot1p_to_tc_map2", "dscp_to_tc_map": "Dscp_to_tc_map2", "tc_to_queue_map": "tc_to_q_map2", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json index 1de66777cb41..7a328ca693c1 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json @@ -1,5 +1,10 @@ { "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": { - "desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure." + "desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure." + }, + "FLEX_COUNTER_TABLE_WITH_INVALID_POLL_INTERVAL": { + "desc": "Out of range poll interval.", + "eStrKey": "Range", + "eStr": "100..4294967295" } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json index 47bd26d9b5f4..9043132791fd 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json @@ -3,7 +3,8 @@ "sonic-flex_counter:sonic-flex_counter": { "sonic-flex_counter:FLEX_COUNTER_TABLE": { "BUFFER_POOL_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "DEBUG_COUNTER": { "FLEX_COUNTER_STATUS": "enable" @@ -12,31 +13,90 @@ "FLEX_COUNTER_STATUS": "enable" }, "PG_DROP": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "PORT": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 1000 }, "PORT_BUFFER_DROP": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 60000 }, "PORT_RATES": { "FLEX_COUNTER_STATUS": "enable" }, "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "ACL": { - "FLEX_COUNTER_STATUS": "enable" + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 }, "FLOW_CNT_TRAP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 10000 + } + } + } + }, + "FLEX_COUNTER_TABLE_WITH_INVALID_POLL_INTERVAL": { + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLEX_COUNTER_TABLE": { + "BUFFER_POOL_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "DEBUG_COUNTER": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PFCWD": { "FLEX_COUNTER_STATUS": "enable" + }, + "PG_DROP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PG_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PORT_BUFFER_DROP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "PORT_RATES": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "QUEUE_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "ACL": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 + }, + "FLOW_CNT_TRAP": { + "FLEX_COUNTER_STATUS": "enable", + "POLL_INTERVAL": 99 } } } diff --git a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang index 55a6ac2f3ac7..5f92d66331b6 100644 --- a/src/sonic-yang-models/yang-models/sonic-flex_counter.yang +++ b/src/sonic-yang-models/yang-models/sonic-flex_counter.yang @@ -27,6 +27,12 @@ module sonic-flex_counter { type boolean; } + typedef poll_interval { + type uint32 { + range 100..4294967295; + } + } + description "FLEX_COUNTER_TABLE part of config_db.json"; /* below are in alphabetical order */ @@ -39,6 +45,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container DEBUG_COUNTER { @@ -69,6 +78,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container PG_WATERMARK { @@ -79,6 +91,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container PORT { @@ -89,10 +104,13 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container PORT_RATES { - /* PORT_BUFFER_DROP_COUNTER_FLEX_COUNTER_GROUP */ + /* PORT_RATES_COUNTER_FLEX_COUNTER_GROUP */ leaf FLEX_COUNTER_STATUS { type flex_status; } @@ -109,6 +127,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container QUEUE { @@ -119,6 +140,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container QUEUE_WATERMARK { @@ -129,6 +153,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container RIF { @@ -139,6 +166,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container RIF_RATES { @@ -159,6 +189,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } container FLOW_CNT_TRAP { @@ -169,6 +202,9 @@ module sonic-flex_counter { leaf FLEX_COUNTER_DELAY_STATUS { type flex_delay_status; } + leaf POLL_INTERVAL { + type poll_interval; + } } }