X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FIPsecUtil.py;h=36e984923b9f727dd8f79aad2423749b86290c01;hb=3289b49cd2f08f9aae43959e0d5778617379388f;hp=a22a54a9c84701ae25c9f1de760e86ca8b9195a2;hpb=aada4992a8d0de65707df858a274a3f2e024748d;p=csit.git diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py index a22a54a9c8..36e984923b 100644 --- a/resources/libraries/python/IPsecUtil.py +++ b/resources/libraries/python/IPsecUtil.py @@ -263,6 +263,25 @@ class IPsecUtil: with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) + @staticmethod + def vpp_ipsec_set_async_mode(node, async_enable=1): + """Set IPsec async mode on|off. + + :param node: VPP node to set IPsec async mode. + :param async_enable: Async mode on or off. + :type node: dict + :type async_enable: int + :raises RuntimeError: If failed to set IPsec async mode or if no API + reply received. + """ + cmd = u"ipsec_set_async_mode" + err_msg = f"Failed to set IPsec async mode on host {node[u'host']}" + args = dict( + async_enable=async_enable + ) + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_reply(err_msg) + @staticmethod def vpp_ipsec_add_sad_entry( node, sad_id, spi, crypto_alg, crypto_key, integ_alg=None, @@ -328,7 +347,9 @@ class IPsecUtil: flags=flags, tunnel_src=str(src_addr), tunnel_dst=str(dst_addr), - protocol=int(IPsecProto.IPSEC_API_PROTO_ESP) + protocol=int(IPsecProto.IPSEC_API_PROTO_ESP), + udp_src_port=4500, # default value in api + udp_dst_port=4500 # default value in api ) args = dict( is_add=True, @@ -437,7 +458,9 @@ class IPsecUtil: flags=flags, tunnel_src=str(src_addr), tunnel_dst=str(dst_addr), - protocol=int(IPsecProto.IPSEC_API_PROTO_ESP) + protocol=int(IPsecProto.IPSEC_API_PROTO_ESP), + udp_src_port=4500, # default value in api + udp_dst_port=4500 # default value in api ) args = dict( is_add=True,