Skip to content

Commit 12bc0e0

Browse files
authored
Get Vlan Id from ASIC_STATE Vlan Object if bvid present (#62)
* Get Vlan Id from ASIC_STATE Vlan Object if bvid present * Address review comments
1 parent 9a7a70c commit 12bc0e0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sonic_ax_impl/mibs/ietf/rfc4363.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
from ax_interface.util import mac_decimals
88
from bisect import bisect_right
99

10-
def fdb_vlanmac(fdb):
11-
return (int(fdb["vlan"]),) + mac_decimals(fdb["mac"])
10+
def fdb_vlanmac(db_conn, fdb):
11+
if 'vlan' in fdb:
12+
vlan_id = fdb["vlan"]
13+
elif 'bvid' in fdb:
14+
vlan_id = port_util.get_vlan_id_from_bvid(db_conn, fdb["bvid"])
15+
return (int(vlan_id),) + mac_decimals(fdb["mac"])
1216

1317
class FdbUpdater(MIBUpdater):
1418
def __init__(self):
@@ -65,7 +69,7 @@ def update_data(self):
6569
continue
6670
port_id = self.if_bpid_map[bridge_port_id]
6771

68-
vlanmac = fdb_vlanmac(fdb)
72+
vlanmac = fdb_vlanmac(self.db_conn, fdb)
6973
self.vlanmac_ifindex_map[vlanmac] = mibs.get_index(self.if_id_map[port_id])
7074
self.vlanmac_ifindex_list.append(vlanmac)
7175
self.vlanmac_ifindex_list.sort()

0 commit comments

Comments
 (0)