Skip to content

Commit a49860c

Browse files
stephenxsmssonicbld
authored andcommitted
Add yang model for scheduler in PORT_QOS_MAP (sonic-net#16244)
Signed-off-by: Stephen Sun <[email protected]>
1 parent e0744e8 commit a49860c

File tree

4 files changed

+83
-9
lines changed

4 files changed

+83
-9
lines changed

src/sonic-yang-models/tests/files/sample_config_db.json

+18-8
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,15 @@
18981898
"pbs": "2048",
18991899
"pir": "2560000",
19001900
"type": "STRICT"
1901+
},
1902+
"port_scheduler": {
1903+
"cbs": "256",
1904+
"cir": "1250000",
1905+
"meter_type": "bytes",
1906+
"pbs": "1024",
1907+
"pir": "25000000",
1908+
"type": "DWRR",
1909+
"weight": "10"
19011910
}
19021911
},
19031912

@@ -2062,14 +2071,15 @@
20622071
},
20632072
"PORT_QOS_MAP": {
20642073
"Ethernet0": {
2065-
"dot1p_to_tc_map" : "Dot1p_to_tc_map1",
2066-
"dscp_to_tc_map": "Dscp_to_tc_map1",
2067-
"tc_to_queue_map": "tc_to_q_map1",
2068-
"tc_to_pg_map": "tc_to_pg_map1",
2069-
"pfc_to_queue_map": "pfc_prio_to_q_map1",
2070-
"pfc_to_pg_map" : "pfc_prio_to_pg_map1",
2071-
"pfc_enable" : "3,4",
2072-
"pfcwd_sw_enable" : "3,4"
2074+
"dot1p_to_tc_map" : "Dot1p_to_tc_map1",
2075+
"dscp_to_tc_map": "Dscp_to_tc_map1",
2076+
"tc_to_queue_map": "tc_to_q_map1",
2077+
"tc_to_pg_map": "tc_to_pg_map1",
2078+
"pfc_to_queue_map": "pfc_prio_to_q_map1",
2079+
"pfc_to_pg_map" : "pfc_prio_to_pg_map1",
2080+
"pfc_enable" : "3,4",
2081+
"pfcwd_sw_enable" : "3,4",
2082+
"scheduler" : "port_scheduler"
20732083
},
20742084
"Ethernet4": {
20752085
"dot1p_to_tc_map" : "Dot1p_to_tc_map2",

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

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@
9696
"eStrKey": "LeafRef"
9797
},
9898

99+
"PORT_QOS_MAP_APPLY_NON_EXISTS_SCHEDULER": {
100+
"desc": "Configure non exists scheduler on port.",
101+
"eStrKey": "LeafRef"
102+
},
103+
99104
"PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": {
100105
"desc": "Configure port qos map entry on non exists port.",
101106
"eStr": "Invalid value"

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

+49-1
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,24 @@
657657
]
658658
}
659659
},
660+
661+
"sonic-scheduler:sonic-scheduler":{
662+
"sonic-scheduler:SCHEDULER": {
663+
"SCHEDULER_LIST": [
664+
{
665+
"name":"port_scheduler",
666+
"cbs": "256",
667+
"cir": "1250000",
668+
"meter_type": "bytes",
669+
"pbs": "1024",
670+
"pir": "25000000",
671+
"type": "DWRR",
672+
"weight": "10"
673+
}
674+
]
675+
}
676+
},
677+
660678
"sonic-port-qos-map:sonic-port-qos-map": {
661679
"sonic-port-qos-map:PORT_QOS_MAP": {
662680
"PORT_QOS_MAP_LIST": [
@@ -670,7 +688,8 @@
670688
"dscp_to_tc_map": "map1",
671689
"dot1p_to_tc_map": "map1",
672690
"pfc_enable": "2,3,4,6",
673-
"pfcwd_sw_enable" : "2,3,4,6"
691+
"pfcwd_sw_enable" : "2,3,4,6",
692+
"scheduler" : "port_scheduler"
674693
}
675694
]
676695
}
@@ -751,6 +770,35 @@
751770
}
752771
},
753772

773+
"PORT_QOS_MAP_APPLY_NON_EXISTS_SCHEDULER": {
774+
"sonic-port:sonic-port": {
775+
"sonic-port:PORT": {
776+
"PORT_LIST": [
777+
{
778+
"admin_status": "up",
779+
"alias": "eth0",
780+
"description": "Ethernet0",
781+
"lanes": "65",
782+
"mtu": "9000",
783+
"name": "Ethernet0",
784+
"tpid": "0x8100",
785+
"speed": "25000"
786+
}
787+
]
788+
}
789+
},
790+
"sonic-port-qos-map:sonic-port-qos-map": {
791+
"sonic-port-qos-map:PORT_QOS_MAP": {
792+
"PORT_QOS_MAP_LIST": [
793+
{
794+
"ifname": "Ethernet0",
795+
"scheduler": "scheduler1"
796+
}
797+
]
798+
}
799+
}
800+
},
801+
754802
"PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": {
755803
"sonic-port:sonic-port": {
756804
"sonic-port:PORT": {

src/sonic-yang-models/yang-models/sonic-port-qos-map.yang

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module sonic-port-qos-map {
3434
prefix dot1ptm;
3535
}
3636

37+
import sonic-scheduler {
38+
prefix sch;
39+
}
40+
3741
organization
3842
"SONiC";
3943

@@ -117,6 +121,13 @@ module sonic-port-qos-map {
117121
path "/dot1ptm:sonic-dot1p-tc-map/dot1ptm:DOT1P_TO_TC_MAP/dot1ptm:DOT1P_TO_TC_MAP_LIST/dot1ptm:name";
118122
}
119123
}
124+
125+
leaf scheduler {
126+
type leafref {
127+
path "/sch:sonic-scheduler/sch:SCHEDULER/sch:SCHEDULER_LIST/sch:name"; //Reference to SCHEDULER table
128+
}
129+
description "Scheduler for port.";
130+
}
120131
}
121132
}
122133
}

0 commit comments

Comments
 (0)