Skip to content

Commit

Permalink
[intfutil] set speed to 0 when interface speed is not available (soni…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
yxieca committed Mar 17, 2020
1 parent 45c6c68 commit 4389ffe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/intfutil
Original file line number Diff line number Diff line change
Expand Up @@ -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
agg_speed_list.append(temp_speed)
interface_speed = sum(agg_speed_list)
interface_speed = str(interface_speed)
Expand Down

0 comments on commit 4389ffe

Please sign in to comment.