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..457f1aff71ca 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 @@ -1,119 +1,154 @@ { "CRM_WITH_CORRECT_FREE_VALUE": { - "desc": "CRM_WITH_CORRECT_FREE_VALUE no failure." + "desc": "CRM_WITH_CORRECT_FREE_VALUE no failure." }, "CRM_WITH_CORRECT_USED_VALUE": { - "desc": "CRM_WITH_CORRECT_USED_VALUE no failure." + "desc": "CRM_WITH_CORRECT_USED_VALUE no failure." }, "CRM_WITH_WRONG_THRESHOLD_TYPE": { - "desc": "CRM_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "desc": "CRM_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", - "eStr": ["wrong" ] + "eStr": ["wrong" ] }, "CRM_WITH_WRONG_PERCENTAGE": { - "desc": "CRM_WITH_WRONG_PERCENTAGE must condition failure.", + "desc": "CRM_WITH_WRONG_PERCENTAGE must condition failure.", "eStrKey": "Must" }, "CRM_WITH_HIGH_THRESHOLD_ERR": { - "desc": "CRM_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", - "eStr": ["high_threshold should be more than low_threshold"] - }, - "CRM_WITH_CORRECT_USED_VALUE": { - "desc": "CRM_WITH_CORRECT_USED_VALUE no failure." + "desc": "CRM_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": ["high_threshold should be more than low_threshold"] }, "SNAT_WITH_WRONG_PERCENTAGE": { - "desc": "SNAT_WITH_WRONG_PERCENTAGE must condition failure.", + "desc": "SNAT_WITH_WRONG_PERCENTAGE must condition failure.", "eStrKey": "Must" }, "SNAT_WITH_HIGH_THRESHOLD_ERR": { - "desc": "SNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", - "eStr": [ "high_threshold should be more than low_threshold" ] + "desc": "SNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": [ "high_threshold should be more than low_threshold" ] }, "SNAT_WITH_CORRECT_FREE_VALUE": { - "desc": "SNAT_WITH_CORRECT_FREE_VALUE no failure." + "desc": "SNAT_WITH_CORRECT_FREE_VALUE no failure." }, "SNAT_WITH_CORRECT_USED_VALUE": { - "desc": "SNAT_WITH_CORRECT_USED_VALUE no failure." + "desc": "SNAT_WITH_CORRECT_USED_VALUE no failure." }, "SNAT_WITH_WRONG_THRESHOLD_TYPE": { - "desc": "SNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "desc": "SNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", - "eStr": ["wrong" ] + "eStr": ["wrong" ] }, "DNAT_WITH_WRONG_PERCENTAGE": { - "desc": "DNAT_WITH_WRONG_PERCENTAGE must condition failure.", + "desc": "DNAT_WITH_WRONG_PERCENTAGE must condition failure.", "eStrKey": "Must" }, "DNAT_WITH_HIGH_THRESHOLD_ERR": { - "desc": "DNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", - "eStr": [ "high_threshold should be more than low_threshold" ] + "desc": "DNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": [ "high_threshold should be more than low_threshold" ] }, "DNAT_WITH_CORRECT_FREE_VALUE": { - "desc": "DNAT_WITH_CORRECT_FREE_VALUE no failure." + "desc": "DNAT_WITH_CORRECT_FREE_VALUE no failure." }, "DNAT_WITH_CORRECT_USED_VALUE": { - "desc": "DNAT_WITH_CORRECT_USED_VALUE no failure." + "desc": "DNAT_WITH_CORRECT_USED_VALUE no failure." }, "DNAT_WITH_WRONG_THRESHOLD_TYPE": { - "desc": "DNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "desc": "DNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", - "eStr": ["wrong" ] + "eStr": ["wrong" ] }, "IPMC_WITH_WRONG_PERCENTAGE": { - "desc": "IPMC_WITH_WRONG_PERCENTAGE must condition failure.", + "desc": "IPMC_WITH_WRONG_PERCENTAGE must condition failure.", "eStrKey": "Must" }, "IPMC_WITH_HIGH_THRESHOLD_ERR": { - "desc": "IPMC_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", - "eStr": [ "high_threshold should be more than low_threshold" ] + "desc": "IPMC_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": [ "high_threshold should be more than low_threshold" ] }, "IPMC_WITH_CORRECT_FREE_VALUE": { - "desc": "IPMC_WITH_CORRECT_FREE_VALUE no failure." + "desc": "IPMC_WITH_CORRECT_FREE_VALUE no failure." }, "IPMC_WITH_CORRECT_USED_VALUE": { - "desc": "IPMC_WITH_CORRECT_USED_VALUE no failure." + "desc": "IPMC_WITH_CORRECT_USED_VALUE no failure." }, "IPMC_WITH_WRONG_THRESHOLD_TYPE": { - "desc": "IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "desc": "IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", - "eStr": ["wrong" ] + "eStr": ["wrong" ] }, "MPLS_INSEG_WITH_WRONG_THRESHOLD_TYPE": { - "desc": "MPLS_INSEG_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "desc": "MPLS_INSEG_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", - "eStr": ["wrong" ] + "eStr": ["wrong" ] }, "MPLS_INSEG_WITH_WRONG_PERCENTAGE": { - "desc": "MPLS_INSEG_WITH_WRONG_PERCENTAGE must condition failure.", + "desc": "MPLS_INSEG_WITH_WRONG_PERCENTAGE must condition failure.", "eStrKey": "Must" }, "MPLS_INSEG_WITH_HIGH_THRESHOLD_ERR": { - "desc": "MPLS_INSEG_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", - "eStr": ["high_threshold should be more than low_threshold"] + "desc": "MPLS_INSEG_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.", + "eStr": ["high_threshold should be more than low_threshold"] }, "MPLS_INSEG_WITH_CORRECT_USED_VALUE": { - "desc": "MPLS_INSEG_WITH_CORRECT_USED_VALUE no failure." + "desc": "MPLS_INSEG_WITH_CORRECT_USED_VALUE no failure." }, "MPLS_INSEG_WITH_CORRECT_FREE_VALUE": { - "desc": "MPLS_INSEG_WITH_CORRECT_FREE_VALUE no failure." + "desc": "MPLS_INSEG_WITH_CORRECT_FREE_VALUE no failure." }, "MPLS_NH_WITH_WRONG_THRESHOLD_TYPE": { - "desc": "MPLS_NH_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "desc": "MPLS_NH_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", - "eStr": ["wrong" ] + "eStr": ["wrong" ] }, "MPLS_NH_WITH_WRONG_PERCENTAGE": { - "desc": "MPLS_NH_WITH_WRONG_PERCENTAGE must condition failure.", + "desc": "MPLS_NH_WITH_WRONG_PERCENTAGE must condition failure.", "eStrKey": "Must" }, "MPLS_NH_WITH_HIGH_THRESHOLD_ERR": { - "desc": "MPLS_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"] + "desc": "MPLS_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"] }, "MPLS_NH_WITH_CORRECT_USED_VALUE": { - "desc": "MPLS_NH_WITH_CORRECT_USED_VALUE no failure." + "desc": "MPLS_NH_WITH_CORRECT_USED_VALUE no failure." }, - "MPLS_NH_WITH_CORRECT_USED_VALUE": { - "desc": "MPLS_NH_WITH_CORRECT_USED_VALUE no failure." + "MPLS_NH_WITH_CORRECT_FREE_VALUE": { + "desc": "MPLS_NH_WITH_CORRECT_USED_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_FREE_VALUE": { + "desc": "SRV6_NH_WITH_CORRECT_USED_VALUE no failure." + }, + "SRV6_MSE_WITH_WRONG_THRESHOLD_TYPE": { + "desc": "SRV6_MSE_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "eStrKey": "Pattern", + "eStr": ["wrong" ] + }, + "SRV6_MSE_WITH_WRONG_PERCENTAGE": { + "desc": "SRV6_MSE_WITH_WRONG_PERCENTAGE must condition failure.", + "eStrKey": "Must" + }, + "SRV6_MSE_WITH_HIGH_THRESHOLD_ERR": { + "desc": "SRV6_MSE_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_MSE_WITH_CORRECT_USED_VALUE": { + "desc": "SRV6_MSE_WITH_CORRECT_USED_VALUE no failure." + }, + "SRV6_MSE_WITH_CORRECT_FREE_VALUE": { + "desc": "SRV6_MSE_WITH_CORRECT_USED_VALUE no failure." } } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json b/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json index 42d09a773c0d..6845484ca97b 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json @@ -12,7 +12,7 @@ }, "SFLOW_TEST_EXCEEDING_MAX_ELEMENTS": { "desc": "Configure collectors above the specified limit in SFLOW_COLLECTOR table.", - "eStr": ["Too many \"SFLOW_COLLECTOR_LIST\" elements"] + "eStr": ["Too many \"SFLOW_COLLECTOR_LIST\" elements"] }, "SFLOW_SESSION_TEST": { "desc": "Configure a sflow session in SFLOW_SESSION table." 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..a15085739e85 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_MSE_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_MSE_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_MSE_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_MSE_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_MSE_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/tests/yang_model_tests/tests_config/sflow.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sflow.json index 5d1a561a9f66..4dabbc06513a 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/sflow.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/sflow.json @@ -6,7 +6,8 @@ { "name": "collector1", "collector_ip": "10.100.12.13", - "collector_port": "6343" + "collector_port": "6343", + "collector_vrf": "default" } ] } @@ -46,11 +47,11 @@ "name": "collector1", "collector_ip": "10.100.12.13" }, - { + { "name": "collector2", "collector_ip": "10.144.1.2" }, - { + { "name": "collector3", "collector_ip": "10.100.12.15" } @@ -60,7 +61,7 @@ }, "SFLOW_SESSION_TEST": { - "sonic-port:sonic-port": { + "sonic-port:sonic-port": { "sonic-port:PORT": { "PORT_LIST": [ { diff --git a/src/sonic-yang-models/yang-models/sonic-crm.yang b/src/sonic-yang-models/yang-models/sonic-crm.yang index d1ac84eec391..5fce1e79af6a 100644 --- a/src/sonic-yang-models/yang-models/sonic-crm.yang +++ b/src/sonic-yang-models/yang-models/sonic-crm.yang @@ -404,6 +404,46 @@ module sonic-crm { type threshold; } + leaf srv6_my_sid_entry_threshold_type{ + 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 { + 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 { + type threshold; + } + + + leaf srv6_nexthop_threshold_type{ + 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 { + must "(current() > ../srv6_nexthop_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf srv6_nexthop_low_threshold { + type threshold; + } } /* end of Config */ } diff --git a/src/sonic-yang-models/yang-models/sonic-sflow.yang b/src/sonic-yang-models/yang-models/sonic-sflow.yang index 62984f064c51..9c523fd50ffe 100644 --- a/src/sonic-yang-models/yang-models/sonic-sflow.yang +++ b/src/sonic-yang-models/yang-models/sonic-sflow.yang @@ -56,6 +56,10 @@ module sonic-sflow{ default 6343; } + leaf collector_vrf { + type string; //TODO + } + } /* end of list SFLOW_COLLECTOR_LIST */ } /* end of container SFLOW_COLLECTOR */