From 526f2d52d97ed97c947721e387714b7e7e7a8484 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Sat, 8 Feb 2025 01:52:26 +0000 Subject: [PATCH 1/2] [YANG] Add missing field in port qos map --- .../tests/files/sample_config_db.json | 14 ++++++++------ .../yang-models/sonic-port-qos-map.yang | 12 ++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index d06e03abdf97..6a4ca851e76b 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -2341,6 +2341,7 @@ "Ethernet0": { "dot1p_to_tc_map" : "Dot1p_to_tc_map1", "dscp_to_tc_map": "Dscp_to_tc_map1", + "tc_to_dscp_map": "tc_to_dscp_map1", "tc_to_queue_map": "tc_to_q_map1", "tc_to_pg_map": "tc_to_pg_map1", "pfc_to_queue_map": "pfc_prio_to_q_map1", @@ -2352,12 +2353,13 @@ "Ethernet4": { "dot1p_to_tc_map" : "Dot1p_to_tc_map2", "dscp_to_tc_map": "Dscp_to_tc_map2", - "tc_to_queue_map": "tc_to_q_map2", - "tc_to_pg_map": "tc_to_pg_map2", - "pfc_to_queue_map": "pfc_prio_to_q_map2", - "pfc_to_pg_map" : "pfc_prio_to_pg_map2", - "pfc_enable" : "3,4", - "pfcwd_sw_enable" : "3,4" + "tc_to_dscp_map": "tc_to_dscp_map2", + "tc_to_queue_map": "tc_to_q_map2", + "tc_to_pg_map": "tc_to_pg_map2", + "pfc_to_queue_map": "pfc_prio_to_q_map2", + "pfc_to_pg_map" : "pfc_prio_to_pg_map2", + "pfc_enable" : "3,4", + "pfcwd_sw_enable" : "3,4" } }, 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 b8a448c6526b..f1b725ca8892 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 @@ -38,6 +38,11 @@ module sonic-port-qos-map { prefix sch; } + import sonic-tc-dscp-map { + prefix tdm; + } + + organization "SONiC"; @@ -116,6 +121,13 @@ module sonic-port-qos-map { } } + leaf tc_to_dscp_map { + type leafref { + path "/tdm:sonic-tc-dscp-map/tdm:TC_TO_DSCP_MAP/tdm:TC_TO_DSCP_MAP_LIST/tdm:name"; + } + } + + leaf dot1p_to_tc_map { type leafref { path "/dot1ptm:sonic-dot1p-tc-map/dot1ptm:DOT1P_TO_TC_MAP/dot1ptm:DOT1P_TO_TC_MAP_LIST/dot1ptm:name"; From 9251e5ec55c291b15bfd0605e6187bd25085dd02 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Sat, 8 Feb 2025 06:00:06 +0000 Subject: [PATCH 2/2] ut --- .../tests_config/qosmaps.json | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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 e926ba161f04..ee0ba3fe4722 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 @@ -530,6 +530,30 @@ } }, + "sonic-tc-dscp-map:sonic-tc-dscp-map": { + "sonic-tc-dscp-map:TC_TO_DSCP_MAP": { + "TC_TO_DSCP_MAP_LIST": [ + { + "name": "map1", + "TC_TO_DSCP_MAP": [ + { + "tc": "1", + "dscp": "1" + }, + { + "tc":"2", + "dscp":"2" + }, + { + "tc": "8", + "dscp": "8" + } + ] + } + ] + } + }, + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { "DOT1P_TO_TC_MAP_LIST": [ @@ -681,11 +705,11 @@ { "ifname": "Ethernet0", "dscp_to_tc_map": "map1", + "tc_to_dscp_map": "map1", "tc_to_pg_map": "map1", "tc_to_queue_map": "map1", "pfc_to_queue_map": "map1", "pfc_to_pg_map": "map1", - "dscp_to_tc_map": "map1", "dot1p_to_tc_map": "map1", "pfc_enable": "2,3,4,6", "pfcwd_sw_enable" : "2,3,4,6",