Skip to content

Commit 2dd5ef4

Browse files
committed
Fixed the return value of Table::get function.
Signed-off-by: Mahdi Ramezani <[email protected]>
1 parent b30a43a commit 2dd5ef4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

scripts/vnet_route_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ def filter_active_vnet_routes(vnet_routes: dict):
370370
active_routes = []
371371
for prefix in vnet_info["routes"]:
372372
key = f"{vnet_name}|{prefix}"
373-
status, fvs = vnet_route_tunnel_table.get(key)
374-
if not status:
373+
exists, fvs = vnet_route_tunnel_table.get(key)
374+
if not exists:
375375
print_message(syslog.LOG_WARNING, f"VNET_ROUTE_TUNNEL_TABLE|{key} does not exist in STATE DB.")
376376
active_routes.append(prefix) # Treating "prefix" as an active route
377377
continue

tests/vnet_route_check_test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@
605605
}
606606
},
607607
"13": {
608-
DESCR: "A VNET route is missing in ASIC DB and STATE DB, and another inactive route is missing in ASIC DB",
608+
DESCR: "A VNET route is missing in STATE DB and another inactive route is missing in ASIC DB",
609609
ARGS: "vnet_route_check",
610610
PRE: {
611611
APPL_DB: {
@@ -672,8 +672,13 @@ def getKeys(self):
672672
return list(self.data.keys())
673673

674674
def get(self, key):
675-
ret = copy.deepcopy(self.data.get(key, self.data))
676-
return (True, ret)
675+
result = self.data.get(key)
676+
if result:
677+
ret = copy.deepcopy(result)
678+
return (True, ret)
679+
else:
680+
ret = copy.deepcopy(self.data)
681+
return (False, ret)
677682

678683

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

0 commit comments

Comments
 (0)