X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fvpp_papi_provider.py;h=ec2f222b54090168c3f0a85fe5de3d353298c697;hb=abc5660c6;hp=aa95010a4ea996e854aadae6900aede9e7c3419a;hpb=e64e5fff4ddea88f386657c5d95ae8dc78138d20;p=vpp.git diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index aa95010a4ea..ec2f222b540 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -53,7 +53,6 @@ defaultmapping = { 'ip_punt_redirect': {'is_add': 1, }, 'ip_route_add_del': {'is_add': 1, }, 'ipsec_interface_add_del_spd': {'is_add': 1, }, - 'ipsec_sad_entry_add_del': {'is_add': 1, }, 'ipsec_spd_add_del': {'is_add': 1, }, 'ipsec_spd_dump': {'sa_id': 4294967295, }, 'ipsec_spd_entry_add_del': {'local_port_stop': 65535, @@ -115,6 +114,10 @@ defaultmapping = { } +def as_fn_signature(d): + return ", ".join(f"{k}={v}" for k, v in d.items()) + + class CliFailedCommandError(Exception): """ cli command failed.""" @@ -289,15 +292,19 @@ class VppPapiProvider(object): reply = api_fn(**api_args) if self._expect_api_retval == self._negative: if hasattr(reply, 'retval') and reply.retval >= 0: - msg = "API call passed unexpectedly: expected negative " \ + msg = "%s(%s) passed unexpectedly: expected negative " \ "return value instead of %d in %s" % \ - (reply.retval, moves.reprlib.repr(reply)) + (api_fn.__name__, as_fn_signature(api_args), + reply.retval, + moves.reprlib.repr(reply)) self.test_class.logger.info(msg) raise UnexpectedApiReturnValueError(msg) elif self._expect_api_retval == self._zero: if hasattr(reply, 'retval') and reply.retval != expected_retval: - msg = "API call failed, expected %d return value instead " \ - "of %d in %s" % (expected_retval, reply.retval, + msg = "%s(%s) failed, expected %d return value instead " \ + "of %d in %s" % (api_fn.__name__, + as_fn_signature(api_args), + expected_retval, reply.retval, repr(reply)) self.test_class.logger.info(msg) raise UnexpectedApiReturnValueError(msg) @@ -939,60 +946,6 @@ class VppPapiProvider(object): {'spd_index': spd_index if spd_index else 0, 'spd_index_valid': 1 if spd_index else 0}) - def ipsec_sad_entry_add_del(self, - sad_id, - spi, - integrity_algorithm, - integrity_key, - crypto_algorithm, - crypto_key, - protocol, - tunnel_src_address='', - tunnel_dst_address='', - flags=0, - salt=0, - is_add=1): - """ IPSEC SA add/del - :param sad_id: security association ID - :param spi: security param index of the SA in decimal - :param integrity_algorithm: - :param integrity_key: - :param crypto_algorithm: - :param crypto_key: - :param protocol: AH(0) or ESP(1) protocol - :param tunnel_src_address: tunnel mode outer src address - :param tunnel_dst_address: tunnel mode outer dst address - :param is_add: - :param is_tunnel: - :** reference /vpp/src/vnet/ipsec/ipsec.h file for enum values of - crypto and ipsec algorithms - """ - return self.api( - self.papi.ipsec_sad_entry_add_del, - { - 'is_add': is_add, - 'entry': - { - 'sad_id': sad_id, - 'spi': spi, - 'tunnel_src': tunnel_src_address, - 'tunnel_dst': tunnel_dst_address, - 'protocol': protocol, - 'integrity_algorithm': integrity_algorithm, - 'integrity_key': { - 'length': len(integrity_key), - 'data': integrity_key, - }, - 'crypto_algorithm': crypto_algorithm, - 'crypto_key': { - 'length': len(crypto_key), - 'data': crypto_key, - }, - 'flags': flags, - 'salt': salt, - } - }) - def ipsec_sa_dump(self, sa_id=None): return self.api(self.papi.ipsec_sa_dump, {'sa_id': sa_id if sa_id else 0xffffffff})