Skip to content

Commit

Permalink
Get Vlan Id from BVID object (sonic-net#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny authored Jan 30, 2018
1 parent f65173f commit 93010e1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/swsssdk/port_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,14 @@ def get_bridge_port_map(db):

return if_br_oid_map

def get_vlan_id_from_bvid(db, bvid):
"""
Get the Vlan Id from Bridge Vlan Object
"""
db.connect('ASIC_DB')
vlan_obj = db.keys('ASIC_DB', "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:" + bvid)
vlan_entry = db.get_all('ASIC_DB', vlan_obj[0], blocking=True)
vlan_id = vlan_entry[b"SAI_VLAN_ATTR_VLAN_ID"]

return vlan_id

0 comments on commit 93010e1

Please sign in to comment.