Skip to content

Commit 4389ffe

Browse files
authored
[intfutil] set speed to 0 when interface speed is not available (sonic-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 <[email protected]>
1 parent 45c6c68 commit 4389ffe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/intfutil

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def po_speed_dict(po_int_dict, appl_db):
276276
elif len(value) > 1:
277277
for intf in value:
278278
temp_speed = appl_db.get(appl_db.APPL_DB, "PORT_TABLE:" + intf, "speed")
279-
temp_speed = int(temp_speed)
279+
temp_speed = int(temp_speed) if temp_speed else 0
280280
agg_speed_list.append(temp_speed)
281281
interface_speed = sum(agg_speed_list)
282282
interface_speed = str(interface_speed)

0 commit comments

Comments
 (0)