[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:
Praveen Chaudhary 2022-10-13 10:12:35 -07:00 committed by GitHub
parent bc684fef0b
commit 86fec08928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 134 additions and 4 deletions

View File

@ -17,7 +17,8 @@ Type_1_list_maps_model = [
'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST',
'DSCP_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.

View File

@ -117,6 +117,7 @@ setup(
'./yang-models/sonic-mgmt_port.yang',
'./yang-models/sonic-mgmt_vrf.yang',
'./yang-models/sonic-mirror-session.yang',
'./yang-models/sonic-mpls-tc-map.yang',
'./yang-models/sonic-mux-cable.yang',
'./yang-models/sonic-ntp.yang',
'./yang-models/sonic-nat.yang',

View File

@ -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_map1": {
"1": "1",

View File

@ -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"]
}
}

View File

@ -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"
}
]
}
]
}
}
}
}

View 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;
}
}
}
}
}
}