Skip to content

Commit

Permalink
set cable length to 1m for backplane ports (#13572)
Browse files Browse the repository at this point in the history
Signed-off-by: Zhixin Zhu zhixzhu@cisco.com

Why I did it
backplane ports cable length need to be specified.

How I did it
separated handling for the specific port name.
  • Loading branch information
zhixzhu authored Feb 11, 2023
1 parent 23fde86 commit f0f7639
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 36 deletions.
10 changes: 9 additions & 1 deletion files/build_templates/buffers_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def
{%- set ports2cable = defs.ports2cable %}
{%- else %}
{%- set ports2cable = {
'internal' : '5m',
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
Expand Down Expand Up @@ -93,7 +94,14 @@ def
{{ default_cable }}
{%- endif %}
{%- else -%}
{{ default_cable }}
{%- if port_name.startswith('Ethernet-BP') %}
{%- if 'internal' not in ports2cable %}
{%- set _ = ports2cable.update({'internal': '5m'}) %}
{%- endif -%}
{{ ports2cable['internal'] }}
{%- else -%}
{{ default_cable }}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endmacro %}
Expand Down
3 changes: 3 additions & 0 deletions src/sonic-config-engine/tests/multi_npu_data/buffers.json.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- set default_topo = 't2' %}
{%- include 'buffers_config.j2' %}

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{%- set default_cable = '300m' %}

{%- set ports2cable = {
'internal' : '1m'
}
-%}

{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"ingress_lossless_pool": {
"size": "12766208",
"type": "ingress",
"mode": "dynamic"
},
"egress_lossless_pool": {
"size": "12766208",
"type": "egress",
"mode": "static"
},
"egress_lossy_pool": {
"size": "7326924",
"type": "egress",
"mode": "dynamic"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"ingress_lossless_pool",
"size":"0",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"0",
"static_th":"12766208"
},
"egress_lossy_profile": {
"pool":"egress_lossy_pool",
"size":"1518",
"dynamic_th":"3"
}
},
{%- endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ Ethernet43 12,13,14,15 Eth1/1/43 43 100000 Eth43-ASIC1 Ext
Ethernet44 8,9,10,11 Eth1/1/44 44 100000 Eth44-ASIC1 Ext
Ethernet46 4,5,6,7 Eth1/1/46 46 100000 Eth46-ASIC1 Ext
Ethernet47 0,1,2,3 Eth1/1/47 47 100000 Eth47-ASIC1 Ext
Ethernet2320 16,17 Eth2320-ASIC1 2320 100000 Eth2320-ASIC1 Int
Ethernet2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int
Ethernet2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int
Ethernet2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int
Ethernet2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int
Ethernet2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int
Ethernet2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int
Ethernet2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int
Ethernet2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int
Ethernet2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int
Ethernet2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int
Ethernet2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int
Ethernet2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int
Ethernet2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int
Ethernet2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int
Ethernet2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int
Ethernet2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int
Ethernet2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int
Ethernet2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int
Ethernet2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int
Ethernet2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int
Ethernet2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int
Ethernet2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int
Ethernet2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int
Ethernet2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int
Ethernet2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int
Ethernet2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int
Ethernet2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int
Ethernet2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int
Ethernet2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int
Ethernet2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int
Ethernet2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int
Ethernet2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int
Ethernet2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int
Ethernet2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int
Ethernet-BP2320 16,17 Eth2320-ASIC1 2320 100000 Eth2320-ASIC1 Int
Ethernet-BP2452 2052,2053 Eth2452-ASIC1 2452 100000 Eth2452-ASIC1 Int
Ethernet-BP2454 2054,2055 Eth2454-ASIC1 2454 100000 Eth2454-ASIC1 Int
Ethernet-BP2456 2056,2057 Eth2456-ASIC1 2456 100000 Eth2456-ASIC1 Int
Ethernet-BP2458 2058,2059 Eth2458-ASIC1 2458 100000 Eth2458-ASIC1 Int
Ethernet-BP2460 2060,2061 Eth2460-ASIC1 2460 100000 Eth2460-ASIC1 Int
Ethernet-BP2462 2062,2063 Eth2462-ASIC1 2462 100000 Eth2462-ASIC1 Int
Ethernet-BP2464 2064,2065 Eth2464-ASIC1 2464 100000 Eth2464-ASIC1 Int
Ethernet-BP2466 2304,2305 Eth2466-ASIC1 2466 100000 Eth2466-ASIC1 Int
Ethernet-BP2468 2306,2307 Eth2468-ASIC1 2468 100000 Eth2468-ASIC1 Int
Ethernet-BP2470 2308,2309 Eth2470-ASIC1 2470 100000 Eth2470-ASIC1 Int
Ethernet-BP2472 2310,2311 Eth2472-ASIC1 2472 100000 Eth2472-ASIC1 Int
Ethernet-BP2474 2312,2313 Eth2474-ASIC1 2474 100000 Eth2474-ASIC1 Int
Ethernet-BP2476 2314,2315 Eth2476-ASIC1 2476 100000 Eth2476-ASIC1 Int
Ethernet-BP2478 2316,2317 Eth2478-ASIC1 2478 100000 Eth2478-ASIC1 Int
Ethernet-BP2480 2318,2319 Eth2480-ASIC1 2480 100000 Eth2480-ASIC1 Int
Ethernet-BP2482 2320,2321 Eth2482-ASIC1 2482 100000 Eth2482-ASIC1 Int
Ethernet-BP2484 2560,2561 Eth2484-ASIC1 2484 100000 Eth2484-ASIC1 Int
Ethernet-BP2486 2562,2563 Eth2486-ASIC1 2486 100000 Eth2486-ASIC1 Int
Ethernet-BP2488 2564,2565 Eth2488-ASIC1 2488 100000 Eth2488-ASIC1 Int
Ethernet-BP2490 2566,2567 Eth2490-ASIC1 2490 100000 Eth2490-ASIC1 Int
Ethernet-BP2492 2568,2569 Eth2492-ASIC1 2492 100000 Eth2492-ASIC1 Int
Ethernet-BP2494 2570,2571 Eth2494-ASIC1 2494 100000 Eth2494-ASIC1 Int
Ethernet-BP2496 2572,2573 Eth2496-ASIC1 2496 100000 Eth2496-ASIC1 Int
Ethernet-BP2498 2574,2575 Eth2498-ASIC1 2498 100000 Eth2498-ASIC1 Int
Ethernet-BP2500 2576,2577 Eth2500-ASIC1 2500 100000 Eth2500-ASIC1 Int
Ethernet-BP2502 2816,2817 Eth2502-ASIC1 2502 100000 Eth2502-ASIC1 Int
Ethernet-BP2504 2818,2819 Eth2504-ASIC1 2504 100000 Eth2504-ASIC1 Int
Ethernet-BP2506 2820,2821 Eth2506-ASIC1 2506 100000 Eth2506-ASIC1 Int
Ethernet-BP2508 2822,2823 Eth2508-ASIC1 2508 100000 Eth2508-ASIC1 Int
Ethernet-BP2510 2824,2825 Eth2510-ASIC1 2510 100000 Eth2510-ASIC1 Int
Ethernet-BP2512 2826,2827 Eth2512-ASIC1 2512 100000 Eth2512-ASIC1 Int
Ethernet-BP2514 2828,2829 Eth2514-ASIC1 2514 100000 Eth2514-ASIC1 Int
Ethernet-BP2516 2830,2831 Eth2516-ASIC1 2516 100000 Eth2516-ASIC1 Int
Ethernet-BP2518 2832,2833 Eth2518-ASIC1 2518 100000 Eth2518-ASIC1 Int
91 changes: 91 additions & 0 deletions src/sonic-config-engine/tests/test_multinpu_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,97 @@ def test_buffers_multi_asic_template(self):
}
}
)

def test_buffers_chassis_packet_lc_template(self):
build_root_dir = os.path.join(
self.test_dir, "..", "..", ".."
)
# using T2 buffer configuration
buffer_template = os.path.join(
build_root_dir, "files", "build_templates", "buffers_config.j2"
)
minigraph = os.path.join(
self.test_dir, "sample-chassis-packet-lc-graph.xml"
)
port_config_ini_asic1 = os.path.join(
self.test_dir, "sample-chassis-packet-lc-port-config.ini"
)
device_config_dir = self.test_data_dir
device_buffer_template = os.path.join(
device_config_dir, "buffers.json.j2"
)
shutil.copy2(buffer_template, device_config_dir)
# asic1 - mix of front end and back end ports
argument = ["-m", minigraph, "-p", port_config_ini_asic1, "-n", "asic1", "-t", device_buffer_template]
output = json.loads(self.run_script(argument, check_stderr=True))
os.remove(os.path.join(device_config_dir, "buffers_config.j2"))
self.assertDictEqual(
output['CABLE_LENGTH'],
{
'AZURE': {
'Ethernet13': '300m',
'Ethernet14': '300m',
'Ethernet16': '300m',
'Ethernet17': '300m',
'Ethernet19': '300m',
'Ethernet20': '300m',
'Ethernet22': '300m',
'Ethernet23': '300m',
'Ethernet25': '300m',
'Ethernet26': '300m',
'Ethernet28': '300m',
'Ethernet29': '300m',
'Ethernet31': '300m',
'Ethernet32': '300m',
'Ethernet34': '300m',
'Ethernet35': '300m',
'Ethernet37': '300m',
'Ethernet38': '300m',
'Ethernet40': '300m',
'Ethernet41': '300m',
'Ethernet43': '300m',
'Ethernet44': '300m',
'Ethernet46': '300m',
'Ethernet47': '300m',
'Ethernet-BP2320': '1m',
'Ethernet-BP2452': '1m',
'Ethernet-BP2454': '1m',
'Ethernet-BP2456': '1m',
'Ethernet-BP2458': '1m',
'Ethernet-BP2460': '1m',
'Ethernet-BP2462': '1m',
'Ethernet-BP2464': '1m',
'Ethernet-BP2466': '1m',
'Ethernet-BP2468': '1m',
'Ethernet-BP2470': '1m',
'Ethernet-BP2472': '1m',
'Ethernet-BP2474': '1m',
'Ethernet-BP2476': '1m',
'Ethernet-BP2478': '1m',
'Ethernet-BP2480': '1m',
'Ethernet-BP2482': '1m',
'Ethernet-BP2484': '1m',
'Ethernet-BP2486': '1m',
'Ethernet-BP2488': '1m',
'Ethernet-BP2490': '1m',
'Ethernet-BP2492': '1m',
'Ethernet-BP2494': '1m',
'Ethernet-BP2496': '1m',
'Ethernet-BP2498': '1m',
'Ethernet-BP2500': '1m',
'Ethernet-BP2502': '1m',
'Ethernet-BP2504': '1m',
'Ethernet-BP2506': '1m',
'Ethernet-BP2508': '1m',
'Ethernet-BP2510': '1m',
'Ethernet-BP2512': '1m',
'Ethernet-BP2514': '1m',
'Ethernet-BP2516': '1m',
'Ethernet-BP2518': '1m'
}
}
)

def test_bgpd_frr_frontendasic(self):
self.assertTrue(*self.run_frr_asic_case('bgpd/bgpd.conf.j2', 'bgpd_frr_frontend_asic.conf', "asic0", self.port_config[0]))

Expand Down

0 comments on commit f0f7639

Please sign in to comment.