Skip to content

Commit

Permalink
Fixed the return value of Table::get function.
Browse files Browse the repository at this point in the history
Signed-off-by: Mahdi Ramezani <[email protected]>
  • Loading branch information
mramezani95 committed Feb 18, 2025
1 parent b30a43a commit 2dd5ef4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions scripts/vnet_route_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ def filter_active_vnet_routes(vnet_routes: dict):
active_routes = []
for prefix in vnet_info["routes"]:
key = f"{vnet_name}|{prefix}"
status, fvs = vnet_route_tunnel_table.get(key)
if not status:
exists, fvs = vnet_route_tunnel_table.get(key)
if not exists:
print_message(syslog.LOG_WARNING, f"VNET_ROUTE_TUNNEL_TABLE|{key} does not exist in STATE DB.")
active_routes.append(prefix) # Treating "prefix" as an active route
continue
Expand Down
11 changes: 8 additions & 3 deletions tests/vnet_route_check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@
}
},
"13": {
DESCR: "A VNET route is missing in ASIC DB and STATE DB, and another inactive route is missing in ASIC DB",
DESCR: "A VNET route is missing in STATE DB and another inactive route is missing in ASIC DB",
ARGS: "vnet_route_check",
PRE: {
APPL_DB: {
Expand Down Expand Up @@ -672,8 +672,13 @@ def getKeys(self):
return list(self.data.keys())

def get(self, key):
ret = copy.deepcopy(self.data.get(key, self.data))
return (True, ret)
result = self.data.get(key)
if result:
ret = copy.deepcopy(result)
return (True, ret)
else:
ret = copy.deepcopy(self.data)
return (False, ret)


db_conns = {"APPL_DB": APPL_DB, "ASIC_DB": ASIC_DB, "COUNTERS_DB": CNTR_DB, "STATE_DB": STATE_DB}
Expand Down

0 comments on commit 2dd5ef4

Please sign in to comment.