From 4389ffedda0708eb999417567e43e6185bb4113e Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Tue, 17 Mar 2020 14:38:00 -0700 Subject: [PATCH] [intfutil] set speed to 0 when interface speed is not available (#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 --- scripts/intfutil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/intfutil b/scripts/intfutil index bad72f27c408..179439989006 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)