summaryrefslogtreecommitdiffstats
path: root/test/vpp_ip_route.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2020-04-28 00:27:38 -0400
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2020-04-28 15:43:28 +0000
commite64e5fff4ddea88f386657c5d95ae8dc78138d20 (patch)
treea4b91682810f8d64dfe2ae0934c21d1f67b94f9d /test/vpp_ip_route.py
parent58db6e16cf4f3bb1740ca2f62d7d887baad58d63 (diff)
tests: implement ipaddress convenience methods
Add vpp specific properties to ip addresses for use in the api. .vapi_af -- returns [ADDRESS_IP4, ADDRESS_IP6] .vapi_af_name -- returns the string ['ip4', 'ip6'] Update tests to demonstrate usage. Type: feature Change-Id: I43447a1522769d99f89debdc714c51700068d771 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/vpp_ip_route.py')
-rw-r--r--test/vpp_ip_route.py50
1 files changed, 23 insertions, 27 deletions
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index 4bb6c9320d3..88388221363 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -639,41 +639,39 @@ class VppIpMRoute(VppObject):
for path in self.paths:
self.encoded_paths.append(path.encode())
+ def encode(self, paths=None):
+ _paths = self.encoded_paths if paths is None else paths
+ return {'table_id': self.table_id,
+ 'entry_flags': self.e_flags,
+ 'rpf_id': self.rpf_id,
+ 'prefix': self.prefix.encode(),
+ 'n_paths': len(_paths),
+ 'paths': _paths,
+ }
+
def add_vpp_config(self):
- r = self._test.vapi.ip_mroute_add_del(self.table_id,
- self.prefix.encode(),
- self.e_flags,
- self.rpf_id,
- self.encoded_paths,
+ r = self._test.vapi.ip_mroute_add_del(route=self.encode(),
+ is_multipath=1,
is_add=1)
self.stats_index = r.stats_index
self._test.registry.register(self, self._test.logger)
return self
def remove_vpp_config(self):
- self._test.vapi.ip_mroute_add_del(self.table_id,
- self.prefix.encode(),
- self.e_flags,
- self.rpf_id,
- self.encoded_paths,
+ self._test.vapi.ip_mroute_add_del(route=self.encode(),
+ is_multipath=1,
is_add=0)
def update_entry_flags(self, flags):
self.e_flags = flags
- self._test.vapi.ip_mroute_add_del(self.table_id,
- self.prefix.encode(),
- self.e_flags,
- self.rpf_id,
- [],
+ self._test.vapi.ip_mroute_add_del(route=self.encode(paths=[]),
+ is_multipath=1,
is_add=1)
def update_rpf_id(self, rpf_id):
self.rpf_id = rpf_id
- self._test.vapi.ip_mroute_add_del(self.table_id,
- self.prefix.encode(),
- self.e_flags,
- self.rpf_id,
- [],
+ self._test.vapi.ip_mroute_add_del(route=self.encode(paths=[]),
+ is_multipath=1,
is_add=1)
def update_path_flags(self, itf, flags):
@@ -683,13 +681,11 @@ class VppIpMRoute(VppObject):
self.encoded_paths[p] = self.paths[p].encode()
break
- self._test.vapi.ip_mroute_add_del(self.table_id,
- self.prefix.encode(),
- self.e_flags,
- self.rpf_id,
- [self.encoded_paths[p]],
- is_add=1,
- is_multipath=0)
+ self._test.vapi.ip_mroute_add_del(
+ route=self.encode(
+ paths=[self.encoded_paths[p]]),
+ is_add=1,
+ is_multipath=0)
def query_vpp_config(self):
return find_mroute(self._test,