tests: allow to add paths to default route
After adding a path to the default route, the prefix still be there
in the table as it is a mandatory prefix. However, the registry hence
fail to remove the route from VPP.
Type: fix
Change-Id: Ic4ad72455ac7a1a2f1d8baba59a7a3afe1610726
Signed-off-by: Maxime Peim <mpeim@cisco.com>
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index 06a963c..9b3a138 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -75,7 +75,9 @@
return FibPathProto.FIB_PATH_NH_PROTO_IP6
-def find_route(test, addr, len, table_id=0, sw_if_index=None):
+def find_route(
+ test, addr, len, table_id=0, sw_if_index=None, ignore_default_route=False
+):
prefix = mk_network(addr, len)
if 4 == prefix.version:
@@ -86,7 +88,13 @@
for e in routes:
if table_id == e.route.table_id and str(e.route.prefix) == str(prefix):
if not sw_if_index:
- return True
+ # if the route is a default one of the table:
+ # 0.0.0.0/0, 0.0.0.0/32, 240.0.0.0/4, 255.255.255.255/32
+ return not (
+ ignore_default_route
+ and e.route.n_paths == 1
+ and e.route.paths[0].type == FibPathType.FIB_PATH_TYPE_DROP
+ )
else:
# should be only one path if the user is looking
# for the interface the route is reachable through
@@ -601,6 +609,7 @@
self.prefix.network_address,
self.prefix.prefixlen,
self.table_id,
+ ignore_default_route=True,
)
def object_id(self):
@@ -716,6 +725,7 @@
self.prefix.network_address,
self.prefix.prefixlen,
self.table_id,
+ ignore_default_route=True,
)
def object_id(self):