Skip to content

Commit

Permalink
Fix: SonicV2Connector behavior change: get_all will return empty dict…
Browse files Browse the repository at this point in the history
… if (#226)

the hash does not exist in Redis

- What I did
Fixes sonic-net/sonic-buildimage#8140
ref: swsssdk implementation returns None, and the library will be deprecated
libswsscommon implementation returns empty dict
- How I did it
Relax the condition check to accept both representations
- How to verify it
Unit test
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
  • Loading branch information
qiluo-msft authored Jul 12, 2021
1 parent 0813b42 commit 21d7d97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc1213.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _update_from_db(self):
neigh_str = neigh_key
db_index = self.neigh_key_list[neigh_key]
neigh_info = self.db_conn[db_index].get_all(mibs.APPL_DB, neigh_key, blocking=False)
if neigh_info is None:
if not neigh_info:
continue
ip_family = neigh_info['family']
if ip_family == "IPv4":
Expand Down
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/ietf/rfc4292.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def update_data(self):
continue
port_table = multi_asic.get_port_table_for_asic(db_conn.namespace)
ent = db_conn.get_all(mibs.APPL_DB, route_str, blocking=False)
if ent is None:
if not ent:
continue
nexthops = ent["nexthop"]
ifnames = ent["ifname"]
Expand Down

0 comments on commit 21d7d97

Please sign in to comment.