diff options
author | Neale Ranns <nranns@cisco.com> | 2019-07-02 14:33:29 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-07-03 11:27:44 +0000 |
commit | c2ac2357fb0ff598ca1cb650a5766a552e017833 (patch) | |
tree | f487a2b96ed9c9d8586c95df2b5472159832d630 /test/vpp_ip_route.py | |
parent | eaacce4753c33342a6512039fe4153b15b476fb3 (diff) |
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>
Diffstat (limited to 'test/vpp_ip_route.py')
-rw-r--r-- | test/vpp_ip_route.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py index 031415e9ee0..864a39aeb34 100644 --- a/test/vpp_ip_route.py +++ b/test/vpp_ip_route.py @@ -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, |