From 14ecd2811d4457e8ab58a6f3c70eceea479433f1 Mon Sep 17 00:00:00 2001 From: anamehra <54692434+anamehra@users.noreply.github.com> Date: Wed, 17 May 2023 13:21:16 -0700 Subject: [PATCH] Enable 400G to 100G/40G speed change via minigraph for all platforms (#14736) (#15079) - Why I did it There are chassis-packet and Single asic platforms which support this 400G to 100G/40G speed change via config. Enabling this feature for all platforms which can support this. Keeping it enabled for all does not affect the platforms which do not support this feature yet. Work item tracking Microsoft ADO (number only): 17952356 - How I did it Removed switch_type and role type check. - How to verify it Loaded router with default 400G config. Loaded minigraph to convert 400G to 100G speed. Signed-off-by: anamehra --- src/sonic-config-engine/minigraph.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index a530a99bef..6458aad179 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1706,17 +1706,15 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw port_default_speed = port_speeds_default.get(port_name, None) port_png_speed = port_speed_png[port_name] - # Add a check for for voq, T1 - if results['DEVICE_METADATA']['localhost']['type'].lower() == 'leafrouter' or switch_type == 'voq': - # when the port speed is changes from 400g to 100g - # update the port lanes, use the first 4 lanes of the 400G port to support 100G port - if port_default_speed == '400000' and port_png_speed == '100000': - port_lanes = ports[port_name].get('lanes', '').split(',') - # check if the 400g port has only 8 lanes - if len(port_lanes) != 8: - continue - updated_lanes = ",".join(port_lanes[:4]) - ports[port_name]['lanes'] = updated_lanes + # when the port speed is changes from 400g to 100g/40g + # update the port lanes, use the first 4 lanes of the 400G port to support 100G/40G port + if port_default_speed == '400000' and (port_png_speed == '100000' or port_png_speed == '40000'): + port_lanes = ports[port_name].get('lanes', '').split(',') + # check if the 400g port has only 8 lanes + if len(port_lanes) != 8: + continue + updated_lanes = ",".join(port_lanes[:4]) + ports[port_name]['lanes'] = updated_lanes ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name]