From 24a2e8238c4ad287ff518f8981067764b88b6a3a Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 17 Mar 2020 18:29:49 +0000 Subject: [PATCH] [intfutil] set speed to 0 when interface speed is not available 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 --- scripts/intfutil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/intfutil b/scripts/intfutil index bad72f27c4..1794399890 100755 --- a/scripts/intfutil +++ b/scripts/intfutil @@ -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)