Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPB] sonic-cfggen does not correctly match breakout modes with different default speed #7958

Closed
alexrallen opened this issue Jun 23, 2021 · 2 comments · Fixed by #9278
Closed

Comments

@alexrallen
Copy link
Contributor

Currently sonic-cfggen does a very simple comparison between breakout modes in hwsku.json and supported modes in platform.json this means if you want to have a mode with a different default speed than is defined in platform.json

i.e. 1x10G[100G,50G] vs 1x100G[50G,10G]

Then you need an independent entry in platform.json. This is not best practice for these files as it will bloat quickly and become unmaintainable.

Steps to Reproduce

  1. Open platform.json and locate a supported breakout mode for a port (i.e. 4x25G[10G] for Ethernet0)

  2. Open hwsku.json and locate the default breakout mode for the port

  3. Change the platform.json breakout mode to an equivalent one with a different default (i.e. 4x10G[25G])

  4. Run sonic-cfggen --preset t1 -p -H -k [SKU YOU MODIFIED]

Observed Results

admin@l-csi-3800-01:/tmp$ sudo sonic-cfggen --preset t1 -p -H -k Mellanox-SN3800-D100C12S2 --print-data
Traceback (most recent call last):
File "/usr/local/bin/sonic-cfggen", line 436, in <module>
main()
File "/usr/local/bin/sonic-cfggen", line 316, in main
(ports, _, _) = get_port_config(hwsku, platform, args.port_config, asic_id)
File "/usr/local/lib/python3.7/dist-packages/portconfig.py", line 109, in get_port_config
return parse_platform_json_file(hwsku_json_file, port_config_file)
File "/usr/local/lib/python3.7/dist-packages/portconfig.py", line 254, in parse_platform_json_file
child_ports = get_child_ports(intf, brkout_mode, platform_json_file)
File "/usr/local/lib/python3.7/dist-packages/portconfig.py", line 204, in get_child_ports
alias_list = port_dict[INTF_KEY][interface]['breakout_modes'][breakout_mode]
KeyError: '1x10G[100G,50G,40G,25G]'
admin@l-csi-3800-01:/tmp$

Expected Results

Prints a config.json where the speed of the port you configured is the default speed defined in hwsku.json

Version Info

SONiC Software Version: SONiC.master.140-a4b31fcb7_Internal
Distribution: Debian 10.9
Kernel: 4.19.0-12-2-amd64
Build commit: a4b31fcb7
Build date: Mon Jun 14 15:31:01 UTC 2021
Built by: sw-r2d2-bot@r-build-sonic-ci02

Platform: x86_64-mlnx_msn4700-r0
HwSKU: ACS-MSN4700
ASIC: mellanox
ASIC Count: 1
Serial Number: MT2022X08597
Uptime: 21:11:29 up 16:58,  3 users,  load average: 0.32, 0.25, 0.26

Docker images:
REPOSITORY                                        TAG                             IMAGE ID            SIZE
harbor.mellanox.com/sonic-lc-manager/lc-manager   0.0.6                           07dab0396238        554MB
docker-syncd-mlnx                                 latest                          41d9f031f17d        670MB
docker-syncd-mlnx                                 master.140-a4b31fcb7_Internal   41d9f031f17d        670MB
docker-snmp                                       latest                          93bd11cff0c5        454MB
docker-snmp                                       master.140-a4b31fcb7_Internal   93bd11cff0c5        454MB
docker-teamd                                      latest                          39519881ce7e        423MB
docker-teamd                                      master.140-a4b31fcb7_Internal   39519881ce7e        423MB
docker-nat                                        latest                          094f94d8687c        426MB
docker-nat                                        master.140-a4b31fcb7_Internal   094f94d8687c        426MB
docker-router-advertiser                          latest                          d31730f2d8a1        412MB
docker-router-advertiser                          master.140-a4b31fcb7_Internal   d31730f2d8a1        412MB
docker-platform-monitor                           latest                          6708eb3468f2        701MB
docker-platform-monitor                           master.140-a4b31fcb7_Internal   6708eb3468f2        701MB
docker-lldp                                       latest                          e699b0e15f80        452MB
docker-lldp                                       master.140-a4b31fcb7_Internal   e699b0e15f80        452MB
docker-dhcp-relay                                 latest                          9139ad1c1bfc        419MB
docker-dhcp-relay                                 master.140-a4b31fcb7_Internal   9139ad1c1bfc        419MB
docker-database                                   latest                          7dcb114a2d7a        412MB
docker-database                                   master.140-a4b31fcb7_Internal   7dcb114a2d7a        412MB
docker-orchagent                                  latest                          9f289a7b96c3        442MB
docker-orchagent                                  master.140-a4b31fcb7_Internal   9f289a7b96c3        442MB
docker-macsec                                     latest                          0ddeec697dbc        426MB
docker-macsec                                     master.140-a4b31fcb7_Internal   0ddeec697dbc        426MB
docker-sonic-telemetry                            latest                          4e07a8ec7a64        501MB
docker-sonic-telemetry                            master.140-a4b31fcb7_Internal   4e07a8ec7a64        501MB
docker-sonic-mgmt-framework                       latest                          52b04ff3a071        570MB
docker-sonic-mgmt-framework                       master.140-a4b31fcb7_Internal   52b04ff3a071        570MB
docker-fpm-frr                                    latest                          1aa221bda051        441MB
docker-fpm-frr                                    master.140-a4b31fcb7_Internal   1aa221bda051        441MB
docker-sflow                                      latest                          1540482a009e        424MB
docker-sflow                                      master.140-a4b31fcb7_Internal   1540482a009e        424MB
docker-sonic-restapi                              latest                          6f4fdb26f843        355MB
docker-sonic-restapi                              master.140-a4b31fcb7_Internal   6f4fdb26f843        355MB
@zhangyanzhao
Copy link
Collaborator

@alexrallen please provide more detail on your proposal.

@alexrallen
Copy link
Contributor Author

To resolve this we would improve sonic-cfggen to intelligently match port breakout configurations from hwsku.json to the supported ones defined in platform.json

This would require parsing the breakout string and matching using logic rather than string comparison.

A breakout configuration with the same supported speeds and a different default speed should be considered functionally equivalent and correctly match rather than having to add a new entry to platform.json for each new default speed for each new SKU.

qiluo-msft pushed a commit that referenced this issue Dec 20, 2021
…ed breakout modes. (#9278)

Closes #7958 

#### Why I did it
The previous implementation of sonic-cfggen did a simple comparison between default breakout mode in
hwsku.json and supported modes in platform.json. To set a different default speed in hwsku.json
it was required to add one more entry to supported modes in platfrom.json file:

1x10G[100G,50G] vs 1x100G[50G,10G]

The new implementation does more intelligent parsing and analysis of supported and default modes. It
allows changing default speed without adding a new entry to platform.json.

#### How I did it
Add more intelligent parsing and analysis of supported and default modes.

#### How to verify it
Run sonic-config-engine unit tests from sonic-config-engine/tests directory
judyjoseph pushed a commit that referenced this issue Dec 27, 2021
…ed breakout modes. (#9278)

Closes #7958 

#### Why I did it
The previous implementation of sonic-cfggen did a simple comparison between default breakout mode in
hwsku.json and supported modes in platform.json. To set a different default speed in hwsku.json
it was required to add one more entry to supported modes in platfrom.json file:

1x10G[100G,50G] vs 1x100G[50G,10G]

The new implementation does more intelligent parsing and analysis of supported and default modes. It
allows changing default speed without adding a new entry to platform.json.

#### How I did it
Add more intelligent parsing and analysis of supported and default modes.

#### How to verify it
Run sonic-config-engine unit tests from sonic-config-engine/tests directory
arlakshm pushed a commit that referenced this issue Mar 24, 2022
…ed breakout modes. (#9278)

Closes #7958 

#### Why I did it
The previous implementation of sonic-cfggen did a simple comparison between default breakout mode in
hwsku.json and supported modes in platform.json. To set a different default speed in hwsku.json
it was required to add one more entry to supported modes in platfrom.json file:

1x10G[100G,50G] vs 1x100G[50G,10G]

The new implementation does more intelligent parsing and analysis of supported and default modes. It
allows changing default speed without adding a new entry to platform.json.

#### How I did it
Add more intelligent parsing and analysis of supported and default modes.

#### How to verify it
Run sonic-config-engine unit tests from sonic-config-engine/tests directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants