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

"show int status" command fails on multi-asic/chassis devices. #2312

Closed
judyjoseph opened this issue Aug 15, 2022 · 7 comments · Fixed by #2323
Closed

"show int status" command fails on multi-asic/chassis devices. #2312

judyjoseph opened this issue Aug 15, 2022 · 7 comments · Fixed by #2323
Labels

Comments

@judyjoseph
Copy link
Contributor

judyjoseph commented Aug 15, 2022

Description

The sanity was failing for chassis & multi-asic devices with the following error in pre-sanity

E                   "msg": "Command failed rc = 1, out = Invalid port 'Ethernet-IB0'\n, err = Traceback (most recent call last):\n  File \"/usr/local/bin/intfutil\", line 838, in <module>\n    main()\n  File \"/usr/local/bin/intfutil\", line 821, in main\n    interface_stat.display_intf_status()\n  File \"/usr/local/bin/intfutil\", line 448, in display_intf_status\n    self.get_intf_status()\n  File \"/usr/local/lib/python3.9/dist-packages/utilities_common/multi_asic.py\", line 151, in wrapped_run_on_all_asics\n    func(self,  *args, **kwargs)\n  File \"/usr/local/bin/intfutil\", line 535, in get_intf_status\n    self.table += self.generate_intf_status()\n  File \"/usr/local/bin/intfutil\", line 479, in generate_intf_status\n    port_oper_speed_get(self.db, key),\n  File \"/usr/local/bin/intfutil\", line 204, in port_oper_speed_get\n    optics_type = port_optics_get(db, intf_name, PORT_OPTICS_TYPE)\n  File \"/usr/local/bin/intfutil\", line 224, in port_optics_get\n    if is_rj45_port(intf_name):\n  File \"/usr/local/lib/python3.9/dist-packages/utilities_common/platform_sfputil_helper.py\", line 134, in is_rj45_port\n    physical_port = logical_port_name_to_physical_port_list(port_name)[0]\nTypeError: 'NoneType' object is not subscriptable\n"

The "show int status" command also fails

admin@str2--lc1-1:~$ show int status
Traceback (most recent call last):
  File "/usr/local/bin/intfutil", line 838, in <module>
    main()
  File "/usr/local/bin/intfutil", line 821, in main
    interface_stat.display_intf_status()
  File "/usr/local/bin/intfutil", line 448, in display_intf_status
    self.get_intf_status()
  File "/usr/local/lib/python3.9/dist-packages/utilities_common/multi_asic.py", line 151, in wrapped_run_on_all_asics
    func(self,  *args, **kwargs)
  File "/usr/local/bin/intfutil", line 535, in get_intf_status
    self.table += self.generate_intf_status()
  File "/usr/local/bin/intfutil", line 479, in generate_intf_status
    port_oper_speed_get(self.db, key),
  File "/usr/local/bin/intfutil", line 204, in port_oper_speed_get
    optics_type = port_optics_get(db, intf_name, PORT_OPTICS_TYPE)
  File "/usr/local/bin/intfutil", line 224, in port_optics_get
    if is_rj45_port(intf_name):
  File "/usr/local/lib/python3.9/dist-packages/utilities_common/platform_sfputil_helper.py", line 139, in is_rj45_port
    physical_port = logical_port_name_to_physical_port_list(port_name)[0]
TypeError: 'NoneType' object is not subscriptable
Invalid port 'Ethernet-IB0'

This was added via #2249, we need to handle special interfaces like Inband/Recirc/Backplane etc in the API is_rj45_port().

Options to fix

  1. Skip for those types of interfaces (REF : https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-py-common/sonic_py_common/interface.py#L16)
  2. Validation check before accessing logical_port_name_to_physical_port_list(port_name)[0] https://github.com/sonic-net/sonic-utilities/blob/master/utilities_common/platform_sfputil_helper.py#L134

Steps to reproduce the issue

  1. Issue a show int status

Describe the results you received

Error in the is_rj45_port API.

Describe the results you expected

show interface status o/p

Additional information you deem important (e.g. issue happens only occasionally)

Output of show version

Latest 202205

(paste your output here)
@judyjoseph
Copy link
Contributor Author

@stephenxs, could you take a look at this issue, we need to handle specially for certain interfaces ?

@stephenxs
Copy link
Collaborator

@stephenxs, could you take a look at this issue, we need to handle specially for certain interfaces ?

checking.

@stephenxs
Copy link
Collaborator

2. logical_port_name_to_physical_port_list

Vote for 2. We can catch the exception and treat it as non-RJ45 port if there is an exception

@stephenxs
Copy link
Collaborator

Fixed by #2313

@judyjoseph judyjoseph changed the title "show int status" command failson multi-asic/chassis devices. "show int status" command fails on multi-asic/chassis devices. Aug 18, 2022
@judyjoseph
Copy link
Contributor Author

@stephenxs there is a minor issue to fix in PR #2313, following error

File "/usr/local/bin/intfutil", line 204, in port_oper_speed_get
optics_type = port_optics_get(db, intf_name, PORT_OPTICS_TYPE)
File "/usr/local/bin/intfutil", line 224, in port_optics_get
if is_rj45_port(intf_name):
File "/usr/local/lib/python3.9/dist-packages/utilities_common/platform_sfputil_helper.py", line 142, in is_rj45_port
return port_type == platform_sfp_base.SFP_PORT_TYPE_BIT_RJ45
UnboundLocalError: local variable 'port_type' referenced before assignment
Invalid port 'Ethernet-Rec0'

Could you add a quick fix, I think we can remove the "if physical_port:" check

@stephenxs
Copy link
Collaborator

@stephenxs there is a minor issue to fix in PR #2313, following error

File "/usr/local/bin/intfutil", line 204, in port_oper_speed_get optics_type = port_optics_get(db, intf_name, PORT_OPTICS_TYPE) File "/usr/local/bin/intfutil", line 224, in port_optics_get if is_rj45_port(intf_name): File "/usr/local/lib/python3.9/dist-packages/utilities_common/platform_sfputil_helper.py", line 142, in is_rj45_port return port_type == platform_sfp_base.SFP_PORT_TYPE_BIT_RJ45 UnboundLocalError: local variable 'port_type' referenced before assignment Invalid port 'Ethernet-Rec0'

Could you add a quick fix, I think we can remove the "if physical_port:" check

Maybe initialize port_type before try block

@stephenxs
Copy link
Collaborator

@stephenxs there is a minor issue to fix in PR #2313, following error
File "/usr/local/bin/intfutil", line 204, in port_oper_speed_get optics_type = port_optics_get(db, intf_name, PORT_OPTICS_TYPE) File "/usr/local/bin/intfutil", line 224, in port_optics_get if is_rj45_port(intf_name): File "/usr/local/lib/python3.9/dist-packages/utilities_common/platform_sfputil_helper.py", line 142, in is_rj45_port return port_type == platform_sfp_base.SFP_PORT_TYPE_BIT_RJ45 UnboundLocalError: local variable 'port_type' referenced before assignment Invalid port 'Ethernet-Rec0'
Could you add a quick fix, I think we can remove the "if physical_port:" check

Maybe initialize port_type before try block

#2323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants