+ @staticmethod
+ def ipsec_proto_esp():
+ """Return IPSec protocol ESP.
+
+ :returns: IPsecProto enum ESP object.
+ :rtype: IPsecProto
+ """
+ return int(IPsecProto.ESP)
+
+ @staticmethod
+ def ipsec_proto_ah():
+ """Return IPSec protocol AH.
+
+ :returns: IPsecProto enum AH object.
+ :rtype: IPsecProto
+ """
+ return int(IPsecProto.SEC_AH)
+
+ @staticmethod
+ def vpp_ipsec_select_backend(node, protocol, index=1):
+ """Select IPsec backend.
+
+ :param node: VPP node to select IPsec backend on.
+ :param protocol: IPsec protocol.
+ :param index: Backend index.
+ :type node: dict
+ :type protocol: IPsecProto
+ :type index: int
+ :raises RuntimeError: If failed to select IPsec backend or if no API
+ reply received.
+ """
+
+ cmd = 'ipsec_select_backend'
+ cmd_reply = 'ipsec_select_backend_reply'
+ err_msg = 'Failed to select IPsec backend on host {host}'.format(
+ host=node['host'])
+ args = dict(protocol=protocol, index=index)
+ with PapiExecutor(node) as papi_exec:
+ papi_resp = papi_exec.add(cmd, **args).execute_should_pass(err_msg)
+ data = papi_resp.reply[0]['api_reply'][cmd_reply]
+ if data['retval'] != 0:
+ raise RuntimeError('Failed to select IPsec backend on host {host}'.
+ format(host=node['host']))
+
+ @staticmethod
+ def vpp_ipsec_backend_dump(node):
+ """Dump IPsec backends.
+
+ :param node: VPP node to dump IPsec backend on.
+ :type node: dict
+ """
+
+ err_msg = 'Failed to dump IPsec backends on host {host}'.format(
+ host=node['host'])
+ with PapiExecutor(node) as papi_exec:
+ papi_exec.add('ipsec_backend_dump').execute_should_pass(
+ err_msg, process_reply=False)
+