diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json b/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json index cdfc531f212d..b799868194b6 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json @@ -115,5 +115,43 @@ }, "MPLS_NH_WITH_CORRECT_USED_VALUE": { "desc": "MPLS_NH_WITH_CORRECT_USED_VALUE no failure." + }, + "SRV6_MY_SID_ENTRY_WITH_WRONG_THRESHOLD_TYPE": { + "desc": "SRV6_MY_SID_ENTRY_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "eStrKey": "Pattern", + "eStr": ["wrong" ] + }, + "SRV6_MY_SID_ENTRY_WITH_WRONG_PERCENTAGE": { + "desc": "SRV6_MY_SID_ENTRY_WITH_WRONG_PERCENTAGE must condition failure.", + "eStrKey": "Must" + }, + "SRV6_MY_SID_ENTRY_WITH_HIGH_THRESHOLD_ERR": { + "desc": "SRV6_MY_SID_ENTRY_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": ["high_threshold should be more than low_threshold"] + }, + "SRV6_MY_SID_ENTRY_WITH_CORRECT_USED_VALUE": { + "desc": "SRV6_MY_SID_ENTRY_WITH_CORRECT_USED_VALUE no failure." + }, + "SRV6_MY_SID_ENTRY_WITH_CORRECT_FREE_VALUE": { + "desc": "SRV6_MY_SID_ENTRY_WITH_CORRECT_FREE_VALUE no failure." + }, + "SRV6_NH_WITH_WRONG_THRESHOLD_TYPE": { + "desc": "SRV6_NH_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "eStrKey": "Pattern", + "eStr": ["wrong" ] + }, + "SRV6_NH_WITH_WRONG_PERCENTAGE": { + "desc": "SRV6_NH_WITH_WRONG_PERCENTAGE must condition failure.", + "eStrKey": "Must" + }, + "SRV6_NH_WITH_HIGH_THRESHOLD_ERR": { + "desc": "SRV6_NH_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": ["high_threshold should be more than low_threshold"] + }, + "SRV6_NH_WITH_CORRECT_USED_VALUE": { + "desc": "SRV6_NH_WITH_CORRECT_USED_VALUE no failure." + }, + "SRV6_NH_WITH_CORRECT_USED_VALUE": { + "desc": "SRV6_NH_WITH_CORRECT_USED_VALUE no failure." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json index f2878bd7b2a8..5f910b0b6be2 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json @@ -328,5 +328,115 @@ } } } + }, + "SRV6_MY_SID_ENTRY_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_my_sid_entry_high_threshold": 90, + "srv6_my_sid_entry_low_threshold": 70, + "srv6_my_sid_entry_threshold_type": "free" + } + } + } + }, + "SRV6_MY_SID_ENTRY_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_my_sid_entry_high_threshold": 85, + "srv6_my_sid_entry_low_threshold": 25, + "srv6_my_sid_entry_threshold_type": "used" + } + } + } + }, + "SRV6_MY_SID_ENTRY_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_my_sid_entry_high_threshold": 80, + "srv6_my_sid_entry_low_threshold": 81, + "srv6_my_sid_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + "SRV6_MY_SID_ENTRY_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_my_sid_entry_high_threshold": 110, + "srv6_my_sid_entry_low_threshold": 85, + "srv6_my_sid_entry_threshold_type": "PERCENTAGE" + } + } + } + }, + "SRV6_MY_SID_ENTRY_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_my_sid_entry_high_threshold": 90, + "srv6_my_sid_entry_low_threshold": 70, + "srv6_my_sid_entry_threshold_type": "wrong" + } + } + } + }, + "SRV6_NH_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_nexthop_high_threshold": 90, + "srv6_nexthop_low_threshold": 70, + "srv6_nexthop_threshold_type": "free" + } + } + } + }, + "SRV6_NH_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_nexthop_high_threshold": 85, + "srv6_nexthop_low_threshold": 25, + "srv6_nexthop_threshold_type": "used" + } + } + } + }, + "SRV6_NH_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_nexthop_high_threshold": 80, + "srv6_nexthop_low_threshold": 81, + "srv6_nexthop_threshold_type": "PERCENTAGE" + } + } + } + }, + "SRV6_NH_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_nexthop_high_threshold": 110, + "srv6_nexthop_low_threshold": 85, + "srv6_nexthop_threshold_type": "PERCENTAGE" + } + } + } + }, + "SRV6_NH_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "srv6_nexthop_high_threshold": 90, + "srv6_nexthop_low_threshold": 70, + "srv6_nexthop_threshold_type": "wrong" + } + } + } } } diff --git a/src/sonic-yang-models/yang-models/sonic-crm.yang b/src/sonic-yang-models/yang-models/sonic-crm.yang index d1ac84eec391..f554358645f6 100644 --- a/src/sonic-yang-models/yang-models/sonic-crm.yang +++ b/src/sonic-yang-models/yang-models/sonic-crm.yang @@ -404,6 +404,58 @@ module sonic-crm { type threshold; } + leaf srv6_my_sid_entry_threshold_type { + description "CRM threshold support for SRV6 my_sid entries"; + + must "(((current()='PERCENTAGE' or current()='percentage') and + ../srv6_my_sid_entry_high_threshold<100 and + ../srv6_my_sid_entry_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf srv6_my_sid_entry_high_threshold { + description "CRM threshold support for SRV6 my_sid entries"; + + must "(current() > ../srv6_my_sid_entry_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf srv6_my_sid_entry_low_threshold { + description "CRM threshold support for SRV6 my_sid entries"; + + type threshold; + } + + leaf srv6_nexthop_threshold_type { + description "CRM threshold support for SRV6 next-hops"; + + must "(((current()='PERCENTAGE' or current()='percentage') and + ../srv6_nexthop_high_threshold<100 and + ../srv6_nexthop_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf srv6_nexthop_high_threshold { + description "CRM threshold support for SRV6 next-hops"; + + must "(current() > ../srv6_nexthop_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf srv6_nexthop_low_threshold { + description "CRM threshold support for SRV6 next-hops"; + + type threshold; + } + } /* end of Config */ }