Skip to content

Commit 93010e1

Browse files
authored
Get Vlan Id from BVID object (sonic-net#30)
1 parent f65173f commit 93010e1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/swsssdk/port_util.py

+11
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,14 @@ def get_bridge_port_map(db):
6969

7070
return if_br_oid_map
7171

72+
def get_vlan_id_from_bvid(db, bvid):
73+
"""
74+
Get the Vlan Id from Bridge Vlan Object
75+
"""
76+
db.connect('ASIC_DB')
77+
vlan_obj = db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:" + bvid)
78+
vlan_entry = db.get_all('ASIC_DB', vlan_obj[0], blocking=True)
79+
vlan_id = vlan_entry[b"SAI_VLAN_ATTR_VLAN_ID"]
80+
81+
return vlan_id
82+

0 commit comments

Comments
 (0)