From 16c424b081acf26b6632147bb14f2865c527108b Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Thu, 16 Jun 2022 11:29:38 +0800 Subject: [PATCH] Update YANG for PORT_QOS_MAP to support switch level mapping (#11089) Signed-off-by: bingwang Co-authored-by: Neetha John --- .../tests/yang_model_tests/tests/qosmaps.json | 6 +++- .../tests_config/qosmaps.json | 33 +++++++++++++++++++ .../yang-models/sonic-port-qos-map.yang | 15 ++++++--- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json index 90344d8f11..0528e0e3fe 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json @@ -86,6 +86,10 @@ "PORT_QOS_MAP_APPLY_MAPS": { "desc": "Configure qos maps on port." }, + + "PORT_QOS_MAP_APPLY_MAP_TO_GLOBAL": { + "desc": "Configure qos maps on switch level." + }, "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { "desc": "Configure non exists qos maps on port.", @@ -94,7 +98,7 @@ "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { "desc": "Configure port qos map entry on non exists port.", - "eStrKey": "LeafRef" + "eStr": "Invalid value" }, "PORT_QOS_MAP_APPLY_INVALID_PFC": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json index 991675bc39..f5e5701938 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json @@ -629,6 +629,39 @@ } }, + "PORT_QOS_MAP_APPLY_MAP_TO_GLOBAL": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + }, + + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "global", + "dscp_to_tc_map": "map1" + } + ] + } + } + }, + "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { "sonic-port:sonic-port": { "sonic-port:PORT": { diff --git a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang index 8f4c2d88f4..53ef7f48f5 100644 --- a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang +++ b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang @@ -56,11 +56,16 @@ module sonic-port-qos-map { key "ifname"; leaf ifname { - type leafref { - path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; - } - description - "Reference of port on which QOS MAPS to be configured."; + type union { + type string { + pattern "global"; + } + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + } + description + "Reference of port or global on which QOS MAPS to be configured."; } leaf tc_to_pg_map {