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] Fix int status when portchannel is in the system #1376

Merged
merged 2 commits into from
Feb 5, 2021

Conversation

d-dashkov
Copy link
Contributor

@d-dashkov d-dashkov commented Jan 21, 2021

- What I did
Fixed crash of "show int status" command when there are portchannels in system.

Traceback (most recent call last):
  File "/usr/local/bin/intfutil", line 521, in <module>
    main()
  File "/usr/local/bin/intfutil", line 513, in main
    interface_stat.display_intf_status()
  File "/usr/local/bin/intfutil", line 354, in display_intf_status
    self.get_intf_status()
  File "/usr/local/lib/python3.7/dist-packages/utilities_common/multi_asic.py", line 137, in wrapped_run_on_all_asics
    func(self,  *args, **kwargs)
  File "/usr/local/bin/intfutil", line 435, in get_intf_status
    self.portchannel_speed_dict = po_speed_dict(self.po_int_dict, self.db)
  File "/usr/local/bin/intfutil", line 249, in po_speed_dict
    interface_speed = '{}G'.format(interface_speed[:-3])
TypeError: 'NoneType' object is not subscriptable

fixes sonic-net/sonic-buildimage#6520
Also this might fix this issue:
fixes #1082

- How I did it
Added check of return value from db in inftutil.
If value is None, append N/A to the output instead of formatting incorrect type.

- How to verify it

  1. Create portchannel
    $ sudo config portchannel add PortChannel0011
  2. Execute interface status command
    $ show int status

Signed-off-by: d-dashkov Dmytro_Dashkov@Jabil.com

Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
@d-dashkov d-dashkov changed the title [show] Fix int status [show] Fix int status when portchannel is in the system Jan 22, 2021
@d-dashkov
Copy link
Contributor Author

retest this please

Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
@lguohan lguohan merged commit 5cff775 into sonic-net:master Feb 5, 2021
daall pushed a commit that referenced this pull request Feb 6, 2021
* Fixed int stat with portchannel
* Replace N/A with None

Fixed crash of "show int status" command when there are portchannels in system.

Traceback (most recent call last):
  File "/usr/local/bin/intfutil", line 521, in <module>
    main()
  File "/usr/local/bin/intfutil", line 513, in main
    interface_stat.display_intf_status()
  File "/usr/local/bin/intfutil", line 354, in display_intf_status
    self.get_intf_status()
  File "/usr/local/lib/python3.7/dist-packages/utilities_common/multi_asic.py", line 137, in wrapped_run_on_all_asics
    func(self,  *args, **kwargs)
  File "/usr/local/bin/intfutil", line 435, in get_intf_status
    self.portchannel_speed_dict = po_speed_dict(self.po_int_dict, self.db)
  File "/usr/local/bin/intfutil", line 249, in po_speed_dict
    interface_speed = '{}G'.format(interface_speed[:-3])
TypeError: 'NoneType' object is not subscriptable

Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
* Fixed int stat with portchannel
* Replace N/A with None

Fixed crash of "show int status" command when there are portchannels in system.

Traceback (most recent call last):
  File "/usr/local/bin/intfutil", line 521, in <module>
    main()
  File "/usr/local/bin/intfutil", line 513, in main
    interface_stat.display_intf_status()
  File "/usr/local/bin/intfutil", line 354, in display_intf_status
    self.get_intf_status()
  File "/usr/local/lib/python3.7/dist-packages/utilities_common/multi_asic.py", line 137, in wrapped_run_on_all_asics
    func(self,  *args, **kwargs)
  File "/usr/local/bin/intfutil", line 435, in get_intf_status
    self.portchannel_speed_dict = po_speed_dict(self.po_int_dict, self.db)
  File "/usr/local/bin/intfutil", line 249, in po_speed_dict
    interface_speed = '{}G'.format(interface_speed[:-3])
TypeError: 'NoneType' object is not subscriptable

Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants