-
Notifications
You must be signed in to change notification settings - Fork 672
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
[intfutil] set speed to 0 when interface speed is not available #839
Conversation
This is not an issue with normal and correct configuration. The issue was exposed when there is an incorrect configuration, e.g. contain wrong port names. These wrong port names will still get populated to the app_db but will not have speed associated. Lack of speed entry will cause "show interface status" to throw exception. Signed-off-by: Ying Xie <ying.xie@microsoft.com>
@@ -276,7 +276,7 @@ def po_speed_dict(po_int_dict, appl_db): | |||
elif len(value) > 1: | |||
for intf in value: | |||
temp_speed = appl_db.get(appl_db.APPL_DB, "PORT_TABLE:" + intf, "speed") | |||
temp_speed = int(temp_speed) | |||
temp_speed = int(temp_speed) if temp_speed else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processing of the exception should protect from both empty speed and invalid speed string (e.g, 1000o)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolute right.
But I think app_db's speed is populated by SONiC, it could be missing, but shouldn't have format issue. If we did cause such a code bug, I think we should fix the formatting code.
This is not an issue with normal and correct configuration. The issue was exposed when there is an incorrect configuration, e.g. contain wrong port names. These wrong port names will still get populated to the app_db but will not have speed associated. Lack of speed entry will cause "show interface status" to throw exception. Signed-off-by: Ying Xie <ying.xie@microsoft.com>
…c-net#839) This is not an issue with normal and correct configuration. The issue was exposed when there is an incorrect configuration, e.g. contain wrong port names. These wrong port names will still get populated to the app_db but will not have speed associated. Lack of speed entry will cause "show interface status" to throw exception. Signed-off-by: Ying Xie <ying.xie@microsoft.com>
#### Why I did it To pick up fixes from submodule sonic-sairedis which include the following fixes: ``` commit 1027eef3a331e84560827c7584ee8009baf434d5 (HEAD -> 202012, origin/202012) Author: gechiang <62408185+gechiang@users.noreply.github.com> Date: Wed Dec 8 03:13:34 2021 -0800 [202012] Prevent other notification event storms to keep enqueue unchecked and drained all memory that leads to crashing the switch router (sonic-net#976) commit 94455e50d3444dcd60093b7a39c7f427337a94d2 Author: VenkatCisco <77468614+VenkatCisco@users.noreply.github.com> Date: Tue Jun 15 03:23:20 2021 -0700 Add cisco-8000 checks to syncd_init_common (sonic-net#839) commit 2df539483ed68519c3c9c6df958d3ed2f31dd629 Author: Kamil Cudnik <kcudnik@gmail.com> Date: Mon Dec 6 20:50:23 2021 +0100 [lgtm] Add gmock libs to lgtm (sonic-net#979) ```
[fwutil]: Use overlay driver when mounting next image filesystem (sonic-net#825) Fix for adding L3 interface to Vlan group (sonic-net#826)Fix for adding L3 interface to Vlan group (sonic-net#826) [db_migrator]Do DB migration for buffer pool size change on Mellanox platform (sonic-net#833) explicitly specify command with underscores (sonic-net#846) [intfutil] set speed to 0 when interface speed is not available (sonic-net#839)
- What I did
This is not an issue with normal and correct configuration. The
issue was exposed when there is an incorrect configuration, e.g.
contain wrong port names. These wrong port names will still get
populated to the app_db but will not have speed associated.
Lack of speed entry will cause "show interface status" to throw
exception.
Signed-off-by: Ying Xie ying.xie@microsoft.com
- How to verify it
Without change, when speed is not available:
admin@str-dcfx-t1-2-03:~$ show interfaces status
Traceback (most recent call last):
File "/usr/bin/intfutil", line 424, in
main(sys.argv[1:])
File "/usr/bin/intfutil", line 417, in main
interface_stat = IntfStatus(intf_name)
File "/usr/bin/intfutil", line 345, in init
self.portchannel_speed_dict = po_speed_dict(self.po_int_dict, self.appl_db)
File "/usr/bin/intfutil", line 236, in po_speed_dict
temp_speed = int(temp_speed)
TypeError: int() argument must be a string or a number, not 'NoneType'
With change command works fine.