diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/framework.py | 5 | ||||
-rw-r--r-- | test/vpp_ip.py | 37 | ||||
-rw-r--r-- | test/vpp_ip_route.py | 50 | ||||
-rw-r--r-- | test/vpp_neighbor.py | 7 | ||||
-rw-r--r-- | test/vpp_papi_provider.py | 26 |
5 files changed, 40 insertions, 85 deletions
diff --git a/test/framework.py b/test/framework.py index 19834026ef9..c73b46c491b 100644 --- a/test/framework.py +++ b/test/framework.py @@ -582,9 +582,12 @@ class VppTestCase(unittest.TestCase): "VPP-API connection failed, did you forget " "to 'continue' VPP from within gdb?", RED)) raise + except vpp_papi.VPPRuntimeError as e: + cls.logger.debug("%s" % e) + cls.quit() + raise except Exception as e: cls.logger.debug("Exception connecting to VPP: %s" % e) - cls.quit() raise diff --git a/test/vpp_ip.py b/test/vpp_ip.py index 43af5e09c07..3c01ba5e4b8 100644 --- a/test/vpp_ip.py +++ b/test/vpp_ip.py @@ -93,29 +93,16 @@ class VppIpMPrefix(): 'same address family.') def encode(self): - if 6 == self.version: - prefix = { - 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP6, - 'grp_address': { - 'ip6': self.gaddr - }, - 'src_address': { - 'ip6': self.saddr - }, - 'grp_address_length': self.glen, - } - else: - prefix = { - 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP4, - 'grp_address': { - 'ip4': self.gaddr - }, - 'src_address': { - 'ip4': self.saddr - }, - 'grp_address_length': self.glen, - } - return prefix + return { + 'af': ip_address(self.gaddr).vapi_af, + 'grp_address': { + ip_address(self.gaddr).vapi_af_name: self.gaddr + }, + 'src_address': { + ip_address(self.saddr).vapi_af_name: self.saddr + }, + 'grp_address_length': self.glen, + } @property def length(self): @@ -145,6 +132,4 @@ class VppIpMPrefix(): return (self.glen == other.grp_address_length and self.gaddr == str(other.grp_address.ip6) and self.saddr == str(other.src_address.ip6)) - raise Exception("Comparing VppIpMPrefix:%s with unknown type: %s" % - (self, other)) - return False + return NotImplemented 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, diff --git a/test/vpp_neighbor.py b/test/vpp_neighbor.py index 6172d8f871d..ffe87d93b58 100644 --- a/test/vpp_neighbor.py +++ b/test/vpp_neighbor.py @@ -16,11 +16,8 @@ except NameError: def find_nbr(test, sw_if_index, nbr_addr, is_static=0, mac=None): ip_addr = ip_address(text_type(nbr_addr)) e = VppEnum.vl_api_ip_neighbor_flags_t - if 6 == ip_addr.version: - af = VppEnum.vl_api_address_family_t.ADDRESS_IP6 - else: - af = VppEnum.vl_api_address_family_t.ADDRESS_IP4 - nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index, af=af) + nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index, + af=ip_addr.vapi_af) for n in nbrs: if ip_addr == n.neighbor.ip_address and \ diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 92820b0586e..aa95010a4ea 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -675,32 +675,6 @@ class VppPapiProvider(object): 'udp_checksum': udp_checksum, }) - def ip_mroute_add_del(self, - table_id, - prefix, - e_flags, - rpf_id, - paths, - is_add=1, - is_multipath=1): - """ - IP Multicast Route add/del - """ - return self.api( - self.papi.ip_mroute_add_del, - { - 'is_add': is_add, - 'is_multipath': is_multipath, - 'route': { - 'table_id': table_id, - 'entry_flags': e_flags, - 'rpf_id': rpf_id, - 'prefix': prefix, - 'n_paths': len(paths), - 'paths': paths, - } - }) - def mfib_signal_dump(self): return self.api(self.papi.mfib_signal_dump, {}) |