Skip to content

Commit

Permalink
Get Vlan Id from ASIC_STATE Vlan Object if bvid present (sonic-net#62)
Browse files Browse the repository at this point in the history
* Get Vlan Id from ASIC_STATE Vlan Object if bvid present

* Address review comments
  • Loading branch information
prsunny authored Jan 30, 2018
1 parent 9a7a70c commit 12bc0e0
Showing 1 changed file with 7 additions and 3 deletions.
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:
vlan_id = fdb["vlan"]
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"])

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

0 comments on commit 12bc0e0

Please sign in to comment.