fib: allow route delete with no paths and multipath=0 to remove the

whole route

Type: fix
Fixes: 097fa66b

Change-Id: I017ab5797670eb278c27c6e306cd8cadaacddf9d
Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
Neale Ranns
2019-07-02 14:33:29 +00:00
committed by Dave Barach
parent eaacce4753
commit c2ac2357fb
6 changed files with 79 additions and 59 deletions

View File

@ -428,6 +428,7 @@ class VppIpRoute(VppObject):
self.prefix = VppIpPrefix(dest_addr, dest_addr_len)
self.register = register
self.stats_index = None
self.modified = False
self.encoded_paths = []
for path in self.paths:
@ -444,6 +445,7 @@ class VppIpRoute(VppObject):
self.encoded_paths = []
for path in self.paths:
self.encoded_paths.append(path.encode())
self.modified = True
self._test.vapi.ip_route_add_del(route={'table_id': self.table_id,
'prefix': self.prefix.encode(),
@ -468,14 +470,26 @@ class VppIpRoute(VppObject):
self._test.registry.register(self, self._test.logger)
def remove_vpp_config(self):
self._test.vapi.ip_route_add_del(route={'table_id': self.table_id,
'prefix': self.prefix.encode(),
'n_paths': len(
self.encoded_paths),
'paths': self.encoded_paths,
},
is_add=0,
is_multipath=0)
# there's no need to issue different deletes for modified routes
# we do this only to test the two different ways to delete routes
# eiter by passing all the paths to remove and mutlipath=1 or
# passing no paths and multipath=0
if self.modified:
self._test.vapi.ip_route_add_del(
route={'table_id': self.table_id,
'prefix': self.prefix.encode(),
'n_paths': len(
self.encoded_paths),
'paths': self.encoded_paths},
is_add=0,
is_multipath=1)
else:
self._test.vapi.ip_route_add_del(
route={'table_id': self.table_id,
'prefix': self.prefix.encode(),
'n_paths': 0},
is_add=0,
is_multipath=0)
def query_vpp_config(self):
return find_route(self._test,