Skip to content

Commit dd5101e

Browse files
authored
Support TC value above 7 in yang model (sonic-net#11630)
1 parent 1fb8536 commit dd5101e

File tree

6 files changed

+83
-26
lines changed

6 files changed

+83
-26
lines changed

src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json

+54-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
{
1414
"dscp":"2",
1515
"tc":"2"
16+
},
17+
{
18+
"dscp":"8",
19+
"tc":"8"
1620
}
1721
]
1822
},
@@ -26,6 +30,10 @@
2630
{
2731
"dscp":"2",
2832
"tc":"2"
33+
},
34+
{
35+
"dscp":"8",
36+
"tc":"8"
2937
}
3038
]
3139
}
@@ -65,7 +73,7 @@
6573
"DSCP_TO_TC_MAP": [
6674
{
6775
"dscp": "1",
68-
"tc": "8"
76+
"tc": "16"
6977
},
7078
{
7179
"dscp":"2",
@@ -92,6 +100,10 @@
92100
{
93101
"dot1p":"2",
94102
"tc":"2"
103+
},
104+
{
105+
"dot1p":"3",
106+
"tc":"8"
95107
}
96108
]
97109
},
@@ -105,6 +117,10 @@
105117
{
106118
"dot1p":"2",
107119
"tc":"2"
120+
},
121+
{
122+
"dot1p":"3",
123+
"tc":"8"
108124
}
109125
]
110126
}
@@ -144,7 +160,7 @@
144160
"DOT1P_TO_TC_MAP": [
145161
{
146162
"dot1p": "1",
147-
"tc": "8"
163+
"tc": "16"
148164
},
149165
{
150166
"dot1p":"2",
@@ -171,6 +187,10 @@
171187
{
172188
"tc":"2",
173189
"qindex":"2"
190+
},
191+
{
192+
"tc":"8",
193+
"qindex":"3"
174194
}
175195
]
176196
},
@@ -184,6 +204,10 @@
184204
{
185205
"tc":"2",
186206
"qindex":"2"
207+
},
208+
{
209+
"tc":"8",
210+
"qindex":"3"
187211
}
188212
]
189213
}
@@ -250,6 +274,10 @@
250274
{
251275
"tc":"2",
252276
"pg":"2"
277+
},
278+
{
279+
"tc":"8",
280+
"pg":"3"
253281
}
254282
]
255283
},
@@ -263,6 +291,10 @@
263291
{
264292
"tc":"2",
265293
"pg":"2"
294+
},
295+
{
296+
"tc":"8",
297+
"pg":"3"
266298
}
267299
]
268300
}
@@ -487,6 +519,10 @@
487519
{
488520
"dscp":"2",
489521
"tc":"2"
522+
},
523+
{
524+
"dscp":"8",
525+
"tc":"8"
490526
}
491527
]
492528
}
@@ -507,6 +543,10 @@
507543
{
508544
"dot1p":"2",
509545
"tc":"2"
546+
},
547+
{
548+
"dot1p":"3",
549+
"tc":"8"
510550
}
511551
]
512552
}
@@ -527,6 +567,10 @@
527567
{
528568
"tc":"2",
529569
"qindex":"2"
570+
},
571+
{
572+
"tc":"8",
573+
"qindex":"3"
530574
}
531575
]
532576
}
@@ -546,6 +590,10 @@
546590
{
547591
"tc":"2",
548592
"pg":"2"
593+
},
594+
{
595+
"tc":"8",
596+
"pg":"3"
549597
}
550598
]
551599
}
@@ -643,6 +691,10 @@
643691
{
644692
"dscp":"2",
645693
"tc":"2"
694+
},
695+
{
696+
"dscp":"8",
697+
"tc":"8"
646698
}
647699
]
648700
}

src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ module sonic-dot1p-tc-map {
66

77
prefix dot1ptm;
88

9+
import sonic-types {
10+
prefix stypes;
11+
}
12+
913
organization
1014
"SONiC";
1115

@@ -54,12 +58,7 @@ module sonic-dot1p-tc-map {
5458
}
5559

5660
leaf tc {
57-
type string {
58-
pattern "[0-7]?"{
59-
error-message "Invalid Traffic Class";
60-
error-app-tag tc-invalid;
61-
}
62-
}
61+
type stypes:tc_type;
6362
}
6463
}
6564
}

src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ module sonic-dscp-tc-map {
66

77
prefix dtm;
88

9+
import sonic-types {
10+
prefix stypes;
11+
}
12+
913
organization
1014
"SONiC";
1115

@@ -54,12 +58,7 @@ module sonic-dscp-tc-map {
5458
}
5559

5660
leaf tc {
57-
type string {
58-
pattern "[0-7]?" {
59-
error-message "Invalid Traffic Class";
60-
error-app-tag tc-invalid;
61-
}
62-
}
61+
type stypes:tc_type;
6362
}
6463
}
6564
}

src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ module sonic-tc-priority-group-map {
66

77
prefix tpgm;
88

9+
import sonic-types {
10+
prefix stypes;
11+
}
12+
913
organization
1014
"SONiC";
1115

@@ -45,12 +49,7 @@ module sonic-tc-priority-group-map {
4549
key "tc";
4650

4751
leaf tc {
48-
type string {
49-
pattern "[0-7]?" {
50-
error-message "Invalid Traffic Class";
51-
error-app-tag tc-invalid;
52-
}
53-
}
52+
type stypes:tc_type;
5453
}
5554

5655
leaf pg {

src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ module sonic-tc-queue-map {
66

77
prefix tqm;
88

9+
import sonic-types {
10+
prefix stypes;
11+
}
12+
913
organization
1014
"SONiC";
1115

@@ -45,12 +49,7 @@ module sonic-tc-queue-map {
4549
key "tc";
4650

4751
leaf tc {
48-
type string {
49-
pattern "[0-7]?" {
50-
error-message "Invalid Traffic Class";
51-
error-app-tag tc-invalid;
52-
}
53-
}
52+
type stypes:tc_type;
5453
}
5554

5655
leaf qindex {

src/sonic-yang-models/yang-templates/sonic-types.yang.j2

+9
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,15 @@ module sonic-types {
270270
"VXLAN Network Identifier";
271271
}
272272

273+
typedef tc_type {
274+
type uint8 {
275+
range "0..15" {
276+
error-message "Invalid Traffic Class";
277+
error-app-tag tc-invalid;
278+
}
279+
}
280+
}
281+
273282
{% if yang_model_type == "cvl" %}
274283
/* Required for CVL */
275284
container operation {

0 commit comments

Comments
 (0)