Skip to content

Commit

Permalink
[yang]: sonic-yang-models updates for MPLS (#7881)
Browse files Browse the repository at this point in the history
SONiC YANG model support in buildimage for MPLS:

sonic-yang-model support for MPLS enable/disable
sonic-yang-model support for MPLS CRM thresholds
  • Loading branch information
qbdwlr authored Sep 2, 2021
1 parent 2300a88 commit 7c9be31
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 1 deletion.
38 changes: 38 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/crm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
112 changes: 111 additions & 1 deletion src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
}
52 changes: 52 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-crm.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-interface.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
7 changes: 7 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-portchannel.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-vlan.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 7c9be31

Please sign in to comment.