Skip to content

Commit

Permalink
Support TC value above 7 in yang model (sonic-net#11630)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingwang-ms authored Aug 9, 2022
1 parent 1fb8536 commit dd5101e
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
{
"dscp":"2",
"tc":"2"
},
{
"dscp":"8",
"tc":"8"
}
]
},
Expand All @@ -26,6 +30,10 @@
{
"dscp":"2",
"tc":"2"
},
{
"dscp":"8",
"tc":"8"
}
]
}
Expand Down Expand Up @@ -65,7 +73,7 @@
"DSCP_TO_TC_MAP": [
{
"dscp": "1",
"tc": "8"
"tc": "16"
},
{
"dscp":"2",
Expand All @@ -92,6 +100,10 @@
{
"dot1p":"2",
"tc":"2"
},
{
"dot1p":"3",
"tc":"8"
}
]
},
Expand All @@ -105,6 +117,10 @@
{
"dot1p":"2",
"tc":"2"
},
{
"dot1p":"3",
"tc":"8"
}
]
}
Expand Down Expand Up @@ -144,7 +160,7 @@
"DOT1P_TO_TC_MAP": [
{
"dot1p": "1",
"tc": "8"
"tc": "16"
},
{
"dot1p":"2",
Expand All @@ -171,6 +187,10 @@
{
"tc":"2",
"qindex":"2"
},
{
"tc":"8",
"qindex":"3"
}
]
},
Expand All @@ -184,6 +204,10 @@
{
"tc":"2",
"qindex":"2"
},
{
"tc":"8",
"qindex":"3"
}
]
}
Expand Down Expand Up @@ -250,6 +274,10 @@
{
"tc":"2",
"pg":"2"
},
{
"tc":"8",
"pg":"3"
}
]
},
Expand All @@ -263,6 +291,10 @@
{
"tc":"2",
"pg":"2"
},
{
"tc":"8",
"pg":"3"
}
]
}
Expand Down Expand Up @@ -487,6 +519,10 @@
{
"dscp":"2",
"tc":"2"
},
{
"dscp":"8",
"tc":"8"
}
]
}
Expand All @@ -507,6 +543,10 @@
{
"dot1p":"2",
"tc":"2"
},
{
"dot1p":"3",
"tc":"8"
}
]
}
Expand All @@ -527,6 +567,10 @@
{
"tc":"2",
"qindex":"2"
},
{
"tc":"8",
"qindex":"3"
}
]
}
Expand All @@ -546,6 +590,10 @@
{
"tc":"2",
"pg":"2"
},
{
"tc":"8",
"pg":"3"
}
]
}
Expand Down Expand Up @@ -643,6 +691,10 @@
{
"dscp":"2",
"tc":"2"
},
{
"dscp":"8",
"tc":"8"
}
]
}
Expand Down
11 changes: 5 additions & 6 deletions src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module sonic-dot1p-tc-map {

prefix dot1ptm;

import sonic-types {
prefix stypes;
}

organization
"SONiC";

Expand Down Expand Up @@ -54,12 +58,7 @@ module sonic-dot1p-tc-map {
}

leaf tc {
type string {
pattern "[0-7]?"{
error-message "Invalid Traffic Class";
error-app-tag tc-invalid;
}
}
type stypes:tc_type;
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module sonic-dscp-tc-map {

prefix dtm;

import sonic-types {
prefix stypes;
}

organization
"SONiC";

Expand Down Expand Up @@ -54,12 +58,7 @@ module sonic-dscp-tc-map {
}

leaf tc {
type string {
pattern "[0-7]?" {
error-message "Invalid Traffic Class";
error-app-tag tc-invalid;
}
}
type stypes:tc_type;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module sonic-tc-priority-group-map {

prefix tpgm;

import sonic-types {
prefix stypes;
}

organization
"SONiC";

Expand Down Expand Up @@ -45,12 +49,7 @@ module sonic-tc-priority-group-map {
key "tc";

leaf tc {
type string {
pattern "[0-7]?" {
error-message "Invalid Traffic Class";
error-app-tag tc-invalid;
}
}
type stypes:tc_type;
}

leaf pg {
Expand Down
11 changes: 5 additions & 6 deletions src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module sonic-tc-queue-map {

prefix tqm;

import sonic-types {
prefix stypes;
}

organization
"SONiC";

Expand Down Expand Up @@ -45,12 +49,7 @@ module sonic-tc-queue-map {
key "tc";

leaf tc {
type string {
pattern "[0-7]?" {
error-message "Invalid Traffic Class";
error-app-tag tc-invalid;
}
}
type stypes:tc_type;
}

leaf qindex {
Expand Down
9 changes: 9 additions & 0 deletions src/sonic-yang-models/yang-templates/sonic-types.yang.j2
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ module sonic-types {
"VXLAN Network Identifier";
}

typedef tc_type {
type uint8 {
range "0..15" {
error-message "Invalid Traffic Class";
error-app-tag tc-invalid;
}
}
}

{% if yang_model_type == "cvl" %}
/* Required for CVL */
container operation {
Expand Down

0 comments on commit dd5101e

Please sign in to comment.