summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuldeep Kashyap <kashyapk@vmware.com>2022-07-04 18:01:28 -0700
committerKuldeep Kashyap <kashyapk@vmware.com>2022-07-04 23:00:31 -0700
commit296b75ed2ab0a2d3beee4b043b13bbf1589ad2ce (patch)
tree7b095ab2356bb538ca072a4afdefa50bbad35277
parentda82615d4bbfe671441828e6af57c8b397c23340 (diff)
tests: Fix for multicast_pim_bsm_topo1 key error
Issue was reported by Donald, we were hitting with key not found error and execution was stopped, which is fixed by this PR. Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
-rw-r--r--tests/topotests/lib/common_config.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index 0e9e0ba403..4afa86f740 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -3437,8 +3437,23 @@ def verify_rib(
found_hops = [
rib_r["ip"]
for rib_r in rib_routes_json[st_rt][0]["nexthops"]
+ if "ip" in rib_r
]
+ # If somehow key "ip" is not found in nexthops JSON
+ # then found_hops would be 0, this particular
+ # situation will be handled here
+ if not len(found_hops):
+ errormsg = (
+ "Nexthop {} is Missing for "
+ "route {} in RIB of router {}\n".format(
+ next_hop,
+ st_rt,
+ dut,
+ )
+ )
+ return errormsg
+
# Check only the count of nexthops
if count_only:
if len(next_hop) == len(found_hops):