From c5eb031111639a5d4cf500c6ec8ce2877fbea31c Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Sat, 16 Jul 2022 00:44:45 +0800 Subject: [PATCH] [202012] Add flag to control the generation of global level map (#11451) Why I did it This PR is to cherry-pick #11448 to 202012 branch after resolving conflicts. There are conflicts in files/build_templates/qos_config.j2 src/sonic-config-engine/tests/test_j2files.py --- files/build_templates/qos_config.j2 | 5 +- ...ista-7050-t0-storage-backend-minigraph.xml | 781 ++++++++++++++++++ .../qos-arista7050-t0-storage-backend.json | 81 ++ src/sonic-config-engine/tests/test_j2files.py | 9 +- 4 files changed, 872 insertions(+), 4 deletions(-) create mode 100644 src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml create mode 100644 src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json diff --git a/files/build_templates/qos_config.j2 b/files/build_templates/qos_config.j2 index 6a382af18e51..a36d1a124a95 100644 --- a/files/build_templates/qos_config.j2 +++ b/files/build_templates/qos_config.j2 @@ -45,6 +45,8 @@ {%- set backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] -%} {%- set apollo_resource_types = ['DL-NPU-Apollo'] -%} +{%- set require_global_dscp_to_tc_map = true -%} + { {% if (generate_tc_to_pg_map is defined) and tunnel_qos_remap_enable %} {{- generate_tc_to_pg_map() }} @@ -91,6 +93,7 @@ }, {% endif %} {% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types and 'storage_device' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['storage_device'] == 'true' %} +{%- set require_global_dscp_to_tc_map = false %} "DOT1P_TO_TC_MAP": { "AZURE": { "0": "1", @@ -224,7 +227,7 @@ "PORT_QOS_MAP": { {% if generate_global_dscp_to_tc_map is defined %} {{- generate_global_dscp_to_tc_map() }} -{% else %} +{% elif require_global_dscp_to_tc_map %} "global": { "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]" }{% if PORT_ACTIVE %},{% endif %} diff --git a/src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml b/src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml new file mode 100644 index 000000000000..cadd47217a71 --- /dev/null +++ b/src/sonic-config-engine/tests/sample-arista-7050-t0-storage-backend-minigraph.xml @@ -0,0 +1,781 @@ + + + + + + switch-t0 + 10.1.0.32 + BGPMonitor + 10.20.30.40 + 30 + 10 + 3 + + + false + switch-t0 + 10.0.0.58 + ARISTA02T1 + 10.0.0.59 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + switch-t0 + FC00::75 + ARISTA02T1 + FC00::76 + 1 + 180 + 60 + + + false + switch-t0 + 10.2.0.20 + CHASSIS_PEER + 10.2.0.21 + 1 + 180 + 60 + voq + + + + + 1 + + BGPMonitor + + + BGPPeer +
10.1.0.32
+ + + +
+
+ +
+ + 65100 + switch-t0 + + +
10.0.0.59
+ + + +
+ +
10.2.0.21
+ + + +
+
+ +
+ + 64600 + ARISTA01T1 + + + + 64600 + ARISTA02T1 + + + + 64600 + ARISTA03T1 + + + + 64600 + ARISTA04T1 + + + + 65100 + CHASSIS_PEER + + +
+
+ + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + HostIP1 + Loopback0 + + FC00:1::32/128 + + FC00:1::32/128 + + + + + HostIP + eth0 + + 10.0.0.100/24 + + 10.0.0.100/24 + + + + + + + switch-t0 + + + PortChannel1 + fortyGigE0/4 + + + + + + ab1 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1000 + 1000 + 192.168.0.0/27 + + + ab4 + fortyGigE0/8 + 192.0.0.1;192.0.0.2 + 1001 + 1001 + 192.168.0.32/27 + + + kk1 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2020 + 2020 + Tagged + 192.168.0.0/28 + + + ab2 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2000 + 2000 + Tagged + 192.168.0.240/27 + + + ab3 + fortyGigE0/12 + 192.0.0.1;192.0.0.2 + 2001 + 2001 + 192.168.0.240/27 + + + + + + PortChannel1 + 10.0.0.56/31 + + + + PortChannel1 + FC00::71/126 + + + + fortyGigE0/0 + 10.0.0.58/31 + + + + fortyGigE0/0 + FC00::75/126 + + + + ab1 + 192.168.0.1/27 + + + + + + DataAcl + + ERSPAN + everflow + Everflow + 0 + everflow.xml + + + DataAcl + + ERSPANv6 + everflowV6 + Everflow + 0 + everflow.xml + + + DataAcl + + Loopback0 + ipv6-mgmt-only + Management + 0 + + + + DataAcl + + Loopback0 + mgmt-only + Management + 0 + + + + DataAcl + + StaticERSPAN + everflowStatic + Everflow + 0 + everflow.xml + + + + + + + + + + DeviceInterfaceLink + 1000 + ARISTA01T1 + et1 + true + switch-t0 + fortyGigE0/8 + true + + + DeviceMgmtLink + 1000 + switch-t0 + fortyGigE0/16 + true + ChassisMTS1 + mgmt0 + true + + + + + switch-t0 + Arista-7050-QX-32S + AAA00PrdStr00 + + + ARISTA01T1 + Arista + + + ARISTA02T1 + Arista + + + ARISTA03T1 + Arista + + + ARISTA04T1 + Arista + + + + + + + + DeviceInterface + + true + 1 + fortyGigE0/0 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + Ethernet1 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + Ethernet2 + + false + 0 + 0 + 10000 + + + DeviceInterface + + true + 1 + fortyGigE0/4 + + false + 0 + 0 + 25000 + + + DeviceInterface + + true + 1 + fortyGigE0/8 + + false + 0 + 0 + 40000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/12 + + false + 0 + 0 + 100000 + Interface description + + + DeviceInterface + + true + 1 + fortyGigE0/16 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/20 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/24 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/28 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/32 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/36 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/40 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/44 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/48 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/52 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/56 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/60 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/64 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/68 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/72 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/76 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/80 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/84 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/88 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/92 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/96 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/100 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/104 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/108 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/112 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/116 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/120 + + false + 0 + 0 + 100000 + + + DeviceInterface + + true + 1 + fortyGigE0/124 + + false + 0 + 0 + 100000 + + + true + 0 + Arista-7050-QX-32S + + + DeviceInterface + + 1 + Management1 + false + mgmt1 + 1000 + + + + + + + + switch-t0 + + + DeploymentId + + 1 + + + ResourceType + + Storage + + + + + + + switch-t0 + Arista-7050-QX-32S +
diff --git a/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json new file mode 100644 index 000000000000..94aa8d8a7d1d --- /dev/null +++ b/src/sonic-config-engine/tests/sample_output/py3/qos-arista7050-t0-storage-backend.json @@ -0,0 +1,81 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "0", + "1": "0", + "2": "0", + "3": "3", + "4": "4", + "5": "0", + "6": "0", + "7": "7" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "DOT1P_TO_TC_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7" + } + }, + "SCHEDULER": { + "scheduler.0": { + "type" : "DWRR", + "weight": "14" + }, + "scheduler.1": { + "type" : "DWRR", + "weight": "15" + } + }, + "PORT_QOS_MAP": { + }, + "WRED_PROFILE": { + "AZURE_LOSSLESS" : { + "wred_green_enable" : "true", + "wred_yellow_enable" : "true", + "wred_red_enable" : "true", + "ecn" : "ecn_all", + "green_max_threshold" : "2097152", + "green_min_threshold" : "1048576", + "yellow_max_threshold" : "2097152", + "yellow_min_threshold" : "1048576", + "red_max_threshold" : "2097152", + "red_min_threshold" : "1048576", + "green_drop_probability" : "5", + "yellow_drop_probability": "5", + "red_drop_probability" : "5" + } + }, + "QUEUE": { + } +} diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index a307a4cdd6d8..0bc849656575 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -381,7 +381,8 @@ def test_qos_dscp_remapping_render_template(self): '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-D108C8', '../../../device/arista/x86_64-arista_7260cx3_64/Arista-7260CX3-C64', '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64', - '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64' + '../../../device/mellanox/x86_64-mlnx_msn4600c-r0/Mellanox-SN4600C-C64', + '../../../device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S' ] sample_outputs = [ 'qos-arista7050cx3-dualtor.json', @@ -391,7 +392,8 @@ def test_qos_dscp_remapping_render_template(self): 'qos-arista7260-dualtor-remap-disabled.json', 'qos-arista7260-t1-remap-disabled.json', 'qos-mellanox4600c-c64.json', - 'qos-mellanox4600c-c64-remap-disabled.json' + 'qos-mellanox4600c-c64-remap-disabled.json', + 'qos-arista7050-t0-storage-backend.json' ] sample_minigraph_files = [ 'sample-arista-7050cx3-dualtor-minigraph.xml', @@ -401,7 +403,8 @@ def test_qos_dscp_remapping_render_template(self): 'sample-arista-7260-dualtor-minigraph-remap-disabled.xml', 'sample-arista-7260-t1-minigraph-remap-disabled.xml', 'sample-mellanox-4600c-t1-minigraph.xml', - 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml' + 'sample-mellanox-4600c-t1-minigraph-remap-disabled.xml', + 'sample-arista-7050-t0-storage-backend-minigraph.xml' ] for i, path in enumerate(dir_paths):