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

Update port2alias to work for multi-asic systems. #3217

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

abdosi
Copy link
Contributor

@abdosi abdosi commented Mar 15, 2024

What I did

Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.
Microsoft ADO: 27245737

How I did it
Add load_db_config call to port2alias for initialization

How to verify it:

Before fix

admin@svcstr2-xxxx-lc3-1:/usr/local/bin$ show interface status | port2alias
Traceback (most recent call last):
  File "/usr/local/bin/port2alias", line 60, in <module>
    main()
  File "/usr/local/bin/port2alias", line 54, in main
    (ports_ns, _, _) = get_port_config(hwsku=hwsku, platform=platform, asic_name=ns)
  File "/usr/local/lib/python3.9/dist-packages/portconfig.py", line 172, in get_port_config
    config_db = db_connect_configdb(asic_name)
  File "/usr/local/lib/python3.9/dist-packages/portconfig.py", line 75, in db_connect_configdb
    config_db = swsscommon.ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 2337, in __init__
    super(ConfigDBConnector, self).__init__(use_unix_socket_path = use_unix_socket_path, namespace = namespace)
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1966, in __init__
    for db_name in self.get_db_list():
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1902, in get_db_list
    return _swsscommon.SonicV2Connector_Native_get_db_list(self)
RuntimeError: :- validateNamespace: Initialize global DB config using API SonicDBConfig::initializeGlobalConfig

After fix:

admin@svcstr2-xxxx-lc3-1:/usr/local/bin$ show interface status | port2alias
      Interface                  Lanes    Speed    MTU    FEC        Alias             Vlan    Oper    Admin             Type    Asym PFC
---------------  ---------------------  -------  -----  -----  -----------  ---------------  ------  -------  ---------------  ----------
      Eth0/2/0/0    1288,1289,1290,1291     100G   9100     rs   Eth0/2/0/0  PortChannel1049      up       up  QSFP28 or later         off
      Eth0/2/0/1    1280,1281,1282,1283     100G   9100     rs   Eth0/2/0/1  PortChannel1049      up       up  QSFP28 or later         off
     Eth0/2/0/2    1032,1033,1034,1035     100G   9100     rs   Eth0/2/0/2  PortChannel1050      up       up  QSFP28 or later         off
     Eth0/2/0/3    1024,1025,1026,1027     100G   9100     rs   Eth0/2/0/3  PortChannel1050      up       up  QSFP28 or later         off
     Eth0/2/0/4        776,777,778,779     100G   9100     rs   Eth0/2/0/4  PortChannel1051      up       up  QSFP28 or later         off
     Eth0/2/0/5        768,769,770,771     100G   9100     rs   Eth0/2/0/5  PortChannel1051      up       up  QSFP28 or later         off
     Eth0/2/0/6        520,521,522,523     100G   9100     rs   Eth0/2/0/6  PortChannel1052      up       up  QSFP28 or later         off

@abdosi abdosi changed the title Update port2alias Update port2alias to work for multi-asic systems. Mar 15, 2024
@abdosi abdosi merged commit d8541ad into sonic-net:master Mar 20, 2024
5 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-utilities that referenced this pull request Mar 20, 2024
Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.

How I did it
Add load_db_config call to port2alias for initialization
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #3223

mssonicbld pushed a commit that referenced this pull request Mar 20, 2024
Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.

How I did it
Add load_db_config call to port2alias for initialization
mssonicbld pushed a commit to mssonicbld/sonic-utilities that referenced this pull request Mar 21, 2024
Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.

How I did it
Add load_db_config call to port2alias for initialization
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #3231

mssonicbld pushed a commit that referenced this pull request Mar 21, 2024
Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.

How I did it
Add load_db_config call to port2alias for initialization
arfeigin pushed a commit to arfeigin/sonic-utilities that referenced this pull request Apr 2, 2024
Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.

How I did it
Add load_db_config call to port2alias for initialization
wumiaont pushed a commit to wumiaont/sonic-utilities that referenced this pull request Apr 22, 2024
Basically port2alias Cli became broken on multi-asic platforms after introduction of sonic-net/sonic-buildimage#10960 which removed the initialization of global DB config from portconfig.py (library side) and expects application to do it, but here application side (port2alias) was not updated accordingly.

How I did it
Add load_db_config call to port2alias for initialization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants