From 7c9be314e2f390a5f2c522f74128ac5e1e2b6230 Mon Sep 17 00:00:00 2001 From: Ann Pokora <44511240+qbdwlr@users.noreply.github.com> Date: Thu, 2 Sep 2021 13:32:27 -0400 Subject: [PATCH] [yang]: sonic-yang-models updates for MPLS (#7881) SONiC YANG model support in buildimage for MPLS: sonic-yang-model support for MPLS enable/disable sonic-yang-model support for MPLS CRM thresholds --- .../tests/yang_model_tests/tests/crm.json | 38 ++++++ .../yang_model_tests/tests_config/crm.json | 112 +++++++++++++++++- .../yang-models/sonic-crm.yang | 52 ++++++++ .../yang-models/sonic-interface.yang | 7 ++ .../yang-models/sonic-portchannel.yang | 7 ++ .../yang-models/sonic-vlan.yang | 7 ++ 6 files changed, 222 insertions(+), 1 deletion(-) 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 c10e42d899..cdfc531f21 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 @@ -77,5 +77,43 @@ "desc": "IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.", "eStrKey": "Pattern", "eStr": ["wrong" ] + }, + "MPLS_INSEG_WITH_WRONG_THRESHOLD_TYPE": { + "desc": "MPLS_INSEG_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "eStrKey": "Pattern", + "eStr": ["wrong" ] + }, + "MPLS_INSEG_WITH_WRONG_PERCENTAGE": { + "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"] + }, + "MPLS_INSEG_WITH_CORRECT_USED_VALUE": { + "desc": "MPLS_INSEG_WITH_CORRECT_USED_VALUE no failure." + }, + "MPLS_INSEG_WITH_CORRECT_FREE_VALUE": { + "desc": "MPLS_INSEG_WITH_CORRECT_FREE_VALUE no failure." + }, + "MPLS_NH_WITH_WRONG_THRESHOLD_TYPE": { + "desc": "MPLS_NH_WITH_WRONG_THRESHOLD_TYPE pattern failure.", + "eStrKey": "Pattern", + "eStr": ["wrong" ] + }, + "MPLS_NH_WITH_WRONG_PERCENTAGE": { + "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"] + }, + "MPLS_NH_WITH_CORRECT_USED_VALUE": { + "desc": "MPLS_NH_WITH_CORRECT_USED_VALUE no failure." + }, + "MPLS_NH_WITH_CORRECT_USED_VALUE": { + "desc": "MPLS_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 db08d941b6..f2878bd7b2 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 @@ -218,5 +218,115 @@ } } } + }, + "MPLS_INSEG_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_inseg_high_threshold": 90, + "mpls_inseg_low_threshold": 70, + "mpls_inseg_threshold_type": "free" + } + } + } + }, + "MPLS_INSEG_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_inseg_high_threshold": 85, + "mpls_inseg_low_threshold": 25, + "mpls_inseg_threshold_type": "used" + } + } + } + }, + "MPLS_INSEG_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_inseg_high_threshold": 80, + "mpls_inseg_low_threshold": 81, + "mpls_inseg_threshold_type": "PERCENTAGE" + } + } + } + }, + "MPLS_INSEG_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_inseg_high_threshold": 110, + "mpls_inseg_low_threshold": 85, + "mpls_inseg_threshold_type": "PERCENTAGE" + } + } + } + }, + "MPLS_INSEG_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_inseg_high_threshold": 90, + "mpls_inseg_low_threshold": 70, + "mpls_inseg_threshold_type": "wrong" + } + } + } + }, + "MPLS_NH_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_nexthop_high_threshold": 90, + "mpls_nexthop_low_threshold": 70, + "mpls_nexthop_threshold_type": "free" + } + } + } + }, + "MPLS_NH_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_nexthop_high_threshold": 85, + "mpls_nexthop_low_threshold": 25, + "mpls_nexthop_threshold_type": "used" + } + } + } + }, + "MPLS_NH_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_nexthop_high_threshold": 80, + "mpls_nexthop_low_threshold": 81, + "mpls_nexthop_threshold_type": "PERCENTAGE" + } + } + } + }, + "MPLS_NH_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_nexthop_high_threshold": 110, + "mpls_nexthop_low_threshold": 85, + "mpls_nexthop_threshold_type": "PERCENTAGE" + } + } + } + }, + "MPLS_NH_WITH_WRONG_THRESHOLD_TYPE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "mpls_nexthop_high_threshold": 90, + "mpls_nexthop_low_threshold": 70, + "mpls_nexthop_threshold_type": "wrong" + } + } + } } -} \ No newline at end of file +} diff --git a/src/sonic-yang-models/yang-models/sonic-crm.yang b/src/sonic-yang-models/yang-models/sonic-crm.yang index 29161958e4..48c15b0e48 100644 --- a/src/sonic-yang-models/yang-models/sonic-crm.yang +++ b/src/sonic-yang-models/yang-models/sonic-crm.yang @@ -353,6 +353,58 @@ module sonic-crm { type threshold; } + leaf mpls_inseg_threshold_type { + description "CRM threshold support for MPLS in-segment entries"; + + must "(((current()='PERCENTAGE' or current()='percentage') and + ../mpls_inseg_high_threshold<100 and + ../mpls_inseg_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf mpls_inseg_high_threshold { + description "CRM threshold support for MPLS in-segment entries"; + + must "(current() > ../mpls_inseg_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf mpls_inseg_low_threshold { + description "CRM threshold support for MPLS in-segment entries"; + + type threshold; + } + + leaf mpls_nexthop_threshold_type { + description "CRM threshold support for MPLS next-hops"; + + must "(((current()='PERCENTAGE' or current()='percentage') and + ../mpls_nexthop_high_threshold<100 and + ../mpls_nexthop_low_threshold<100) or + (current()!='PERCENTAGE' and current()!='percentage'))"; + type stypes:crm_threshold_type; + } + + leaf mpls_nexthop_high_threshold { + description "CRM threshold support for MPLS next-hops"; + + must "(current() > ../mpls_nexthop_low_threshold)" + { + error-message "high_threshold should be more than low_threshold"; + } + type threshold; + } + + leaf mpls_nexthop_low_threshold { + description "CRM threshold support for MPLS next-hops"; + + type threshold; + } + } /* end of Config */ } diff --git a/src/sonic-yang-models/yang-models/sonic-interface.yang b/src/sonic-yang-models/yang-models/sonic-interface.yang index 48f63a29c5..f559eb6be1 100644 --- a/src/sonic-yang-models/yang-models/sonic-interface.yang +++ b/src/sonic-yang-models/yang-models/sonic-interface.yang @@ -68,6 +68,13 @@ module sonic-interface { } default "0"; } + leaf mpls { + description "Enable/disable MPLS routing for the interface"; + type enumeration { + enum enable; + enum disable; + } + } } /* end of INTERFACE_LIST */ diff --git a/src/sonic-yang-models/yang-models/sonic-portchannel.yang b/src/sonic-yang-models/yang-models/sonic-portchannel.yang index f02a45d939..587a19e4be 100644 --- a/src/sonic-yang-models/yang-models/sonic-portchannel.yang +++ b/src/sonic-yang-models/yang-models/sonic-portchannel.yang @@ -179,6 +179,13 @@ module sonic-portchannel { } default "0"; } + leaf mpls { + description "Enable/disable MPLS routing for the portchannel interface"; + type enumeration { + enum enable; + enum disable; + } + } } /* end of list PORTCHANNEL_INTERFACE_LIST */ list PORTCHANNEL_INTERFACE_IPPREFIX_LIST { diff --git a/src/sonic-yang-models/yang-models/sonic-vlan.yang b/src/sonic-yang-models/yang-models/sonic-vlan.yang index d6f2a4808a..c63bc6b46a 100644 --- a/src/sonic-yang-models/yang-models/sonic-vlan.yang +++ b/src/sonic-yang-models/yang-models/sonic-vlan.yang @@ -80,6 +80,13 @@ module sonic-vlan { } default "0"; } + leaf mpls { + description "Enable/disable MPLS routing for the vlan interface"; + type enumeration { + enum enable; + enum disable; + } + } } /* end of VLAN_INTERFACE_LIST */