Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/fdbshow
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ class FdbShow(object):
continue
port_id = self.if_br_oid_map[br_port_id]
if_name = self.if_oid_map[port_id]

self.bridge_mac_list.append((int(fdb["vlan"]),) + (fdb["mac"],) + (if_name,))
if 'vlan' in fdb:
vlan_id = fdb["vlan"]
elif 'bvid' in fdb:
vlan_id = port_util.get_vlan_id_from_bvid(self.db, fdb["bvid"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vlan_id [](start = 16, length = 7)

If neither exists, vlan_id will be not defined, do you need protection?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no actually for lag interfaces there are no if_oid_map in this map, self.if_oid_map[port_id]. that cause it bails out

self.bridge_mac_list.append((int(vlan_id),) + (fdb["mac"],) + (if_name,))

self.bridge_mac_list.sort(key = lambda x: x[0])
return
Expand Down