summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaxime Peim <mpeim@cisco.com>2024-04-09 09:08:00 +0200
committerDave Wallace <dwallacelf@gmail.com>2024-04-09 17:30:57 +0000
commitb0d433978bd48509894a296cdbb8f390b5c9ca4e (patch)
treed06e1ff1951e9857c7ddf47c2323ea72436f9d6f /test
parentbfbe7a8c9a8b830619c532381f30681c563f6ad9 (diff)
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>
Diffstat (limited to 'test')
-rw-r--r--test/vpp_ip_route.py14
1 files 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):