From b0d433978bd48509894a296cdbb8f390b5c9ca4e Mon Sep 17 00:00:00 2001 From: Maxime Peim Date: Tue, 9 Apr 2024 09:08:00 +0200 Subject: 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 --- test/vpp_ip_route.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py index 06a963cfd88..9b3a138a81c 100644 --- a/test/vpp_ip_route.py +++ b/test/vpp_ip_route.py @@ -75,7 +75,9 @@ def address_proto(ip_addr): 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 @@ def find_route(test, addr, len, table_id=0, sw_if_index=None): 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 @@ class VppIpRoute(VppObject): self.prefix.network_address, self.prefix.prefixlen, self.table_id, + ignore_default_route=True, ) def object_id(self): @@ -716,6 +725,7 @@ class VppIpRouteV2(VppObject): self.prefix.network_address, self.prefix.prefixlen, self.table_id, + ignore_default_route=True, ) def object_id(self): -- cgit 1.2.3-korg