Skip to content

Commit

Permalink
Don't cache the vlan-id if it is not valid from DB (#273)
Browse files Browse the repository at this point in the history
Don't cache the vlan-id if it is not valid from DB

**- What I did**
Avoid caching the vlan-id with invalid value.

**- How I did it**
Add a check in code so if vlan-id is not valid, don't cache it.
  • Loading branch information
zhenggen-xu authored and qiluo-msft committed Nov 17, 2022
1 parent 13ddb0e commit 792afe8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc4363.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def fdb_vlanmac(self, fdb):
vlan_id = Namespace.dbs_get_vlan_id_from_bvid(self.db_conn, fdb["bvid"])
if isinstance(vlan_id, bytes):
vlan_id = vlan_id.decode()
self.bvid_vlan_map[fdb["bvid"]] = vlan_id
# only cache vlan_id if valid
if vlan_id is not None:
self.bvid_vlan_map[fdb["bvid"]] = vlan_id
else:
return None
if not isinstance(vlan_id, str):
Expand Down

0 comments on commit 792afe8

Please sign in to comment.