[sonic-mpls-tc-map.yang]: yang model for mpls_tc_to_tc_map table. (#12176)
changes: -- yang model for mpls_tc_to_tc_map table. -- tests. #### Why I did it yang model for mpls_tc_to_tc_map table. #### How I did it -- yang model for mpls_tc_to_tc_map table. -- yang model tests. #### How to verify it -- yang model build time tests.
This commit is contained in:
parent
bc684fef0b
commit
86fec08928
@ -17,7 +17,8 @@ Type_1_list_maps_model = [
|
|||||||
'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST',
|
'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST',
|
||||||
'DSCP_TO_FC_MAP_LIST',
|
'DSCP_TO_FC_MAP_LIST',
|
||||||
'EXP_TO_FC_MAP_LIST',
|
'EXP_TO_FC_MAP_LIST',
|
||||||
'CABLE_LENGTH_LIST'
|
'CABLE_LENGTH_LIST',
|
||||||
|
'MPLS_TC_TO_TC_MAP_LIST'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Workaround for those fields who is defined as leaf-list in YANG model but have string value in config DB.
|
# Workaround for those fields who is defined as leaf-list in YANG model but have string value in config DB.
|
||||||
@ -422,7 +423,7 @@ class SonicYangExtMixin:
|
|||||||
vValue = list()
|
vValue = list()
|
||||||
if isinstance(value, str) and (self.elementPath[0], self.elementPath[-1]) in LEAF_LIST_WITH_STRING_VALUE_DICT:
|
if isinstance(value, str) and (self.elementPath[0], self.elementPath[-1]) in LEAF_LIST_WITH_STRING_VALUE_DICT:
|
||||||
# For field defined as leaf-list but has string value in CONFIG DB, need do special handling here. For exampe:
|
# For field defined as leaf-list but has string value in CONFIG DB, need do special handling here. For exampe:
|
||||||
# port.adv_speeds in CONFIG DB has value "100,1000,10000", it shall be transferred to [100,1000,10000] as YANG value here to
|
# port.adv_speeds in CONFIG DB has value "100,1000,10000", it shall be transferred to [100,1000,10000] as YANG value here to
|
||||||
# make it align with its YANG definition.
|
# make it align with its YANG definition.
|
||||||
value = (x.strip() for x in value.split(LEAF_LIST_WITH_STRING_VALUE_DICT[(self.elementPath[0], self.elementPath[-1])]))
|
value = (x.strip() for x in value.split(LEAF_LIST_WITH_STRING_VALUE_DICT[(self.elementPath[0], self.elementPath[-1])]))
|
||||||
for v in value:
|
for v in value:
|
||||||
|
@ -117,6 +117,7 @@ setup(
|
|||||||
'./yang-models/sonic-mgmt_port.yang',
|
'./yang-models/sonic-mgmt_port.yang',
|
||||||
'./yang-models/sonic-mgmt_vrf.yang',
|
'./yang-models/sonic-mgmt_vrf.yang',
|
||||||
'./yang-models/sonic-mirror-session.yang',
|
'./yang-models/sonic-mirror-session.yang',
|
||||||
|
'./yang-models/sonic-mpls-tc-map.yang',
|
||||||
'./yang-models/sonic-mux-cable.yang',
|
'./yang-models/sonic-mux-cable.yang',
|
||||||
'./yang-models/sonic-ntp.yang',
|
'./yang-models/sonic-ntp.yang',
|
||||||
'./yang-models/sonic-nat.yang',
|
'./yang-models/sonic-nat.yang',
|
||||||
|
@ -830,7 +830,7 @@
|
|||||||
"role": "Int",
|
"role": "Int",
|
||||||
"speed": "40000",
|
"speed": "40000",
|
||||||
"tpid": "0x8100"
|
"tpid": "0x8100"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ACL_TABLE": {
|
"ACL_TABLE": {
|
||||||
"V4-ACL-TABLE": {
|
"V4-ACL-TABLE": {
|
||||||
@ -1680,6 +1680,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"MPLS_TC_TO_TC_MAP": {
|
||||||
|
"Mpls_tc_to_tc_map1": {
|
||||||
|
"1": "1",
|
||||||
|
"3": "2"
|
||||||
|
},
|
||||||
|
"Mpls_tc_to_tc_map2": {
|
||||||
|
"2": "3",
|
||||||
|
"4": "4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"DOT1P_TO_TC_MAP": {
|
"DOT1P_TO_TC_MAP": {
|
||||||
"Dot1p_to_tc_map1": {
|
"Dot1p_to_tc_map1": {
|
||||||
"1": "1",
|
"1": "1",
|
||||||
@ -1831,7 +1842,7 @@
|
|||||||
"server_ipv6": "fc02:1000::30/128",
|
"server_ipv6": "fc02:1000::30/128",
|
||||||
"soc_ipv4": "192.168.0.3/32",
|
"soc_ipv4": "192.168.0.3/32",
|
||||||
"state": "auto"
|
"state": "auto"
|
||||||
},
|
},
|
||||||
"Ethernet0": {
|
"Ethernet0": {
|
||||||
"server_ipv4": "192.168.0.2/32",
|
"server_ipv4": "192.168.0.2/32",
|
||||||
"server_ipv6": "fc02:1000::30/128",
|
"server_ipv6": "fc02:1000::30/128",
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"MPLS_TCP_MAP_INCORRECT_MPLS_PATTERN": {
|
||||||
|
"desc": "Configure INCORRECT_MPLS_PATTERN in MPLS_TCP_MAP Table.",
|
||||||
|
"eStr": ["Invalid MPLS"]
|
||||||
|
|
||||||
|
},
|
||||||
|
"MPLS_TCP_MAP_INCORRECT_TC_PATTERN": {
|
||||||
|
"desc": "Configure INCORRECT_TC_PATTERN in MPLS_TCP_MAP Table.",
|
||||||
|
"eStr": ["Invalid Traffic Class"]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"MPLS_TCP_MAP_INCORRECT_MPLS_PATTERN": {
|
||||||
|
"sonic-mpls-tc-map:sonic-mpls-tc-map": {
|
||||||
|
"sonic-mpls-tc-map:MPLS_TC_TO_TC_MAP": {
|
||||||
|
"MPLS_TC_TO_TC_MAP_LIST": [
|
||||||
|
{
|
||||||
|
"name": "Mpls_tc_to_tc_map1",
|
||||||
|
"MPLS_TC_TO_TC_MAP": [
|
||||||
|
{
|
||||||
|
"mpls": "8",
|
||||||
|
"tc": "1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MPLS_TCP_MAP_INCORRECT_TC_PATTERN": {
|
||||||
|
"sonic-mpls-tc-map:sonic-mpls-tc-map": {
|
||||||
|
"sonic-mpls-tc-map:MPLS_TC_TO_TC_MAP": {
|
||||||
|
"MPLS_TC_TO_TC_MAP_LIST": [
|
||||||
|
{
|
||||||
|
"name": "Mpls_tc_to_tc_map2",
|
||||||
|
"MPLS_TC_TO_TC_MAP": [
|
||||||
|
{
|
||||||
|
"mpls": "1",
|
||||||
|
"tc": "16"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
src/sonic-yang-models/yang-models/sonic-mpls-tc-map.yang
Normal file
70
src/sonic-yang-models/yang-models/sonic-mpls-tc-map.yang
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
module sonic-mpls-tc-map {
|
||||||
|
|
||||||
|
yang-version 1.1;
|
||||||
|
|
||||||
|
namespace "http://github.com/Azure/sonic-mpls-tc-map";
|
||||||
|
|
||||||
|
prefix mpls_tc_map;
|
||||||
|
|
||||||
|
import sonic-types {
|
||||||
|
prefix stypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
organization
|
||||||
|
"SONiC";
|
||||||
|
|
||||||
|
contact
|
||||||
|
"SONiC";
|
||||||
|
|
||||||
|
description
|
||||||
|
"MPLS_TC_TO_TC_MAP yang Module for SONiC OS";
|
||||||
|
|
||||||
|
revision 2021-04-15 {
|
||||||
|
description
|
||||||
|
"Initial revision.";
|
||||||
|
}
|
||||||
|
|
||||||
|
container sonic-mpls-tc-map {
|
||||||
|
|
||||||
|
container MPLS_TC_TO_TC_MAP {
|
||||||
|
|
||||||
|
description "MPLS_TC_TO_TC_MAP part of config_db.json";
|
||||||
|
|
||||||
|
list MPLS_TC_TO_TC_MAP_LIST {
|
||||||
|
|
||||||
|
key "name";
|
||||||
|
|
||||||
|
leaf name {
|
||||||
|
description "Name of MPLS TC Mpping List";
|
||||||
|
type string {
|
||||||
|
pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})';
|
||||||
|
length 1..32 {
|
||||||
|
error-message "Invalid length for map name.";
|
||||||
|
error-app-tag map-name-invalid-length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list MPLS_TC_TO_TC_MAP { //this is list inside list for storing mapping between two fields
|
||||||
|
|
||||||
|
key "mpls";
|
||||||
|
|
||||||
|
leaf mpls {
|
||||||
|
description "MPLS TC Value";
|
||||||
|
type string {
|
||||||
|
pattern "[0-7]?" {
|
||||||
|
error-message "Invalid MPLS";
|
||||||
|
error-app-tag mpls-invalid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leaf tc {
|
||||||
|
description "Matching TC Value";
|
||||||
|
type stypes:tc_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user