From b5a280521e97afce86f0778c4ef59d53c9072dbd Mon Sep 17 00:00:00 2001 From: d-dashkov Date: Thu, 21 Jan 2021 17:20:54 +0200 Subject: [PATCH 1/2] Fixed int stat with portchannel Signed-off-by: d-dashkov --- scripts/intfutil | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/intfutil b/scripts/intfutil index 8ba3a9bb6b..d857884235 100755 --- a/scripts/intfutil +++ b/scripts/intfutil @@ -247,8 +247,12 @@ def po_speed_dict(po_int_dict, appl_db): po_list.append(key) if len(value) == 1: interface_speed = appl_db.get(appl_db.APPL_DB, "PORT_TABLE:" + value[0], "speed") - interface_speed = '{}G'.format(interface_speed[:-3]) - po_list.append(interface_speed) + if interface_speed is None: + # If no speed was returned, set the value as N/A + po_list.append("N/A") + else: + interface_speed = '{}G'.format(interface_speed[:-3]) + po_list.append(interface_speed) elif len(value) > 1: for intf in value: temp_speed = appl_db.get(appl_db.APPL_DB, "PORT_TABLE:" + intf, "speed") From 01fb0412a424e9d993b08700f6788cd08c871f18 Mon Sep 17 00:00:00 2001 From: d-dashkov Date: Tue, 26 Jan 2021 14:52:06 +0200 Subject: [PATCH 2/2] Replace N/A with None Signed-off-by: d-dashkov --- scripts/intfutil | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/intfutil b/scripts/intfutil index d857884235..83038d4f67 100755 --- a/scripts/intfutil +++ b/scripts/intfutil @@ -248,8 +248,8 @@ def po_speed_dict(po_int_dict, appl_db): if len(value) == 1: interface_speed = appl_db.get(appl_db.APPL_DB, "PORT_TABLE:" + value[0], "speed") if interface_speed is None: - # If no speed was returned, set the value as N/A - po_list.append("N/A") + # If no speed was returned, append None without format + po_list.append(None) else: interface_speed = '{}G'.format(interface_speed[:-3]) po_list.append(interface_speed) @@ -277,6 +277,8 @@ def appl_db_portchannel_status_get(appl_db, config_db, po_name, status_type, por #print(full_table_id) if status_type == "speed": status = portchannel_speed_dict[po_name] + if status is None: + return "N/A" return status if status_type == "vlan": if combined_int_to_vlan_po_dict and po_name in combined_int_to_vlan_po_dict.keys():