Skip to content
Merged
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions src/sonic_ax_impl/mibs/ietf/rfc4363.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
from ax_interface.util import mac_decimals
from bisect import bisect_right

def fdb_vlanmac(fdb):
return (int(fdb["vlan"]),) + mac_decimals(fdb["mac"])
def fdb_vlanmac(db_conn, fdb):
if 'vlan' in fdb:
return (int(fdb["vlan"]),) + mac_decimals(fdb["mac"])
elif 'bvid' in fdb:
vlan_id = port_util.get_vlan_id_from_bvid(db_conn, fdb["bvid"])
return (int(vlan_id),) + mac_decimals(fdb["mac"])
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.

I don't feel this is a must-change;

I would assign vlan_id in both if and elif branches and return the vlanmac from a same statement, for the sake of consistency.


class FdbUpdater(MIBUpdater):
def __init__(self):
Expand Down Expand Up @@ -65,7 +69,7 @@ def update_data(self):
continue
port_id = self.if_bpid_map[bridge_port_id]

vlanmac = fdb_vlanmac(fdb)
vlanmac = fdb_vlanmac(self.db_conn, fdb)
self.vlanmac_ifindex_map[vlanmac] = mibs.get_index(self.if_id_map[port_id])
self.vlanmac_ifindex_list.append(vlanmac)
self.vlanmac_ifindex_list.sort()
Expand Down