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 <anamehra@cisco.com>
This commit is contained in:
anamehra 2023-05-17 13:21:16 -07:00 committed by GitHub
parent b6df524b0f
commit 14ecd2811d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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_default_speed = port_speeds_default.get(port_name, None)
port_png_speed = port_speed_png[port_name] port_png_speed = port_speed_png[port_name]
# Add a check for for voq, T1 # when the port speed is changes from 400g to 100g/40g
if results['DEVICE_METADATA']['localhost']['type'].lower() == 'leafrouter' or switch_type == 'voq': # update the port lanes, use the first 4 lanes of the 400G port to support 100G/40G port
# when the port speed is changes from 400g to 100g if port_default_speed == '400000' and (port_png_speed == '100000' or port_png_speed == '40000'):
# update the port lanes, use the first 4 lanes of the 400G port to support 100G port port_lanes = ports[port_name].get('lanes', '').split(',')
if port_default_speed == '400000' and port_png_speed == '100000': # check if the 400g port has only 8 lanes
port_lanes = ports[port_name].get('lanes', '').split(',') if len(port_lanes) != 8:
# check if the 400g port has only 8 lanes continue
if len(port_lanes) != 8: updated_lanes = ",".join(port_lanes[:4])
continue ports[port_name]['lanes'] = updated_lanes
updated_lanes = ",".join(port_lanes[:4])
ports[port_name]['lanes'] = updated_lanes
ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name] ports.setdefault(port_name, {})['speed'] = port_speed_png[port_name]