From 748dbbf94e9050fb1a390df457a7b393ce63cf09 Mon Sep 17 00:00:00 2001 From: maksymbelei95 <75987222+maksymbelei95@users.noreply.github.com> Date: Thu, 4 Mar 2021 09:40:22 +0200 Subject: [PATCH] [show] Fix 'show mac' output, when FDB entry with Vlan 1 is present (#1368) * Skip records of FDB entries, which are linked to default Vlan 1, to prevent exception throwing while performing command 'show mac' or 'fdbshow'. Signed-off-by: Maksym Belei --- scripts/fdbshow | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/fdbshow b/scripts/fdbshow index 169bf7cf3c..53badedc69 100755 --- a/scripts/fdbshow +++ b/scripts/fdbshow @@ -87,6 +87,10 @@ class FdbShow(object): elif 'bvid' in fdb: try: vlan_id = port_util.get_vlan_id_from_bvid(self.db, fdb["bvid"]) + if vlan_id is None: + # the situation could be faced if the system has an FDB entries, + # which are linked to default Vlan(caused by untagged trafic) + continue except Exception: vlan_id = fdb["bvid"] print("Failed to get Vlan id for bvid {}\n".format(fdb["bvid"]))