From 4d9ef44637652453caebd88addd957feab398db1 Mon Sep 17 00:00:00 2001 From: syuan Date: Thu, 5 May 2022 08:38:13 -0700 Subject: [PATCH 1/2] Add QOS and buffer profiles for Arista SKU. --- .../Arista-7800R3-48CQM2-C48/buffers.json.j2 | 2 + .../buffers_defaults_t2.j2 | 65 +++++++++++++++++++ .../pg_profile_lookup.ini | 23 +++++++ .../Arista-7800R3-48CQM2-C48/qos.json.j2 | 21 ++++++ 4 files changed, 111 insertions(+) create mode 100644 device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers.json.j2 create mode 100644 device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers_defaults_t2.j2 create mode 100644 device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/pg_profile_lookup.ini create mode 100644 device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/qos.json.j2 diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers.json.j2 b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers.json.j2 new file mode 100644 index 000000000000..f34a844f4a87 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't2' %} +{%- include 'buffers_config.j2' %} diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers_defaults_t2.j2 b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers_defaults_t2.j2 new file mode 100644 index 000000000000..b292a354b55a --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/buffers_defaults_t2.j2 @@ -0,0 +1,65 @@ +{%- set default_cable = '5m' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,192,4) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "3220805000", + "type": "both", + "mode": "dynamic", + "xoff": "2102272" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"1280", + "dynamic_th":"-2", + "xon_offset":"2560", + "xon":"0", + "xoff":"66048" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "xon_offset":"0", + "static_th":"30535680" + }, + "egress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "static_th":"33030144" + }, + "egress_lossy_profile": { + "pool":"ingress_lossless_pool", + "size":"0", + "dynamic_th":"-1" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "ingress_lossless_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "egress_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|5-6": { + "profile" : "egress_lossy_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +{%- endmacro %} diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/pg_profile_lookup.ini b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/pg_profile_lookup.ini new file mode 100644 index 000000000000..887b6a493291 --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/pg_profile_lookup.ini @@ -0,0 +1,23 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold xon_offset + 10000 5m 1280 2560 45506 0 1280 + 25000 5m 1280 2560 49152 0 1280 + 40000 5m 1280 2560 49152 0 1280 + 50000 5m 1280 2560 53248 0 1280 + 100000 5m 1280 2560 65536 0 1280 + 200000 5m 1280 2560 90112 0 1280 + 400000 5m 1280 2560 135168 0 1280 + 10000 40m 1280 2560 45506 0 1280 + 25000 40m 1280 2560 49152 0 1280 + 40000 40m 1280 2560 53248 0 1280 + 50000 40m 1280 2560 57344 0 1280 + 100000 40m 1280 2560 69632 0 1280 + 200000 40m 1280 2560 102400 0 1280 + 400000 40m 1280 2560 159744 0 1280 + 10000 300m 1280 2560 49152 0 1280 + 25000 300m 1280 2560 61440 0 1280 + 40000 300m 1280 2560 69632 0 1280 + 50000 300m 1280 2560 77824 0 1280 + 100000 300m 1280 2560 114688 0 1280 + 200000 300m 1280 2560 188416 0 1280 + 400000 300m 1280 2560 331776 0 1280 diff --git a/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/qos.json.j2 b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/qos.json.j2 new file mode 100644 index 000000000000..34002048afdb --- /dev/null +++ b/device/arista/x86_64-arista_7800r3_48cqm2_lc/Arista-7800R3-48CQM2-C48/qos.json.j2 @@ -0,0 +1,21 @@ +{%- macro generate_wred_profiles() %} + "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" : "250000", + "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" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} From 19fa4807749345bdb707c8169a40ddc94b152a1b Mon Sep 17 00:00:00 2001 From: syuan Date: Thu, 5 May 2022 18:26:14 -0700 Subject: [PATCH 2/2] Add unit test for SKU Arista-7800R3-48CQM2-C48. --- src/sonic-config-engine/tests/test_j2files.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sonic-config-engine/tests/test_j2files.py b/src/sonic-config-engine/tests/test_j2files.py index 52d4260dba77..af66af8eb59e 100644 --- a/src/sonic-config-engine/tests/test_j2files.py +++ b/src/sonic-config-engine/tests/test_j2files.py @@ -212,8 +212,8 @@ def test_qos_arista7050_render_template(self): sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, 'qos-arista7050.json') assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) - def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): - arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', 'x86_64-arista_7800r3_48cq2_lc', 'Arista-7800R3-48CQ2-C48') + def do_test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self, platform, hwsku): + arista_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'arista', platform, hwsku) qos_file = os.path.join(arista_dir_path, 'qos.json.j2') buffer_file = os.path.join(arista_dir_path, 'buffers.json.j2') port_config_ini_file = os.path.join(arista_dir_path, 'port_config.ini') @@ -236,6 +236,12 @@ def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): sample_output_file = os.path.join(self.test_dir, 'sample_output', utils.PYvX_DIR, sample_output_file) assert utils.cmp(sample_output_file, self.output_file), self.run_diff(sample_output_file, self.output_file) + def test_qos_and_buffer_arista7800r3_48cq2_lc_render_template(self): + self.do_test_qos_and_buffer_arista7800r3_48cq2_lc_render_template('x86_64-arista_7800r3_48cq2_lc', 'Arista-7800R3-48CQ2-C48') + + def test_qos_and_buffer_arista7800r3_48cqm2_lc_render_template(self): + self.do_test_qos_and_buffer_arista7800r3_48cq2_lc_render_template('x86_64-arista_7800r3_48cqm2_lc', 'Arista-7800R3-48CQM2-C48') + def test_qos_dell9332_render_template(self): dell_dir_path = os.path.join(self.test_dir, '..', '..', '..', 'device', 'dell', 'x86_64-dellemc_z9332f_d1508-r0', 'DellEMC-Z9332f-O32') qos_file = os.path.join(dell_dir_path, 'qos.json.j2')