From 6dc62d10b1e6a6b5eee09f6d42e750de273a464b Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Wed, 17 Feb 2021 20:04:36 +0100 Subject: API: Use newer messages The mesages are the newest present in last common ancestor of master and rls2101 (so not yet ipsec_sad_entry_add_del_v3). Added a TODO for the RDMA create improvement, to be implemented in a separate change. Change-Id: I94bcd2f1bc109fb995c4dd6df44f8928865634f5 Signed-off-by: Vratko Polak --- resources/libraries/python/IPsecUtil.py | 20 +++++++++++++++----- resources/libraries/python/InterfaceUtil.py | 13 +++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'resources/libraries/python') diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py index 3c3997ab53..99a470d934 100644 --- a/resources/libraries/python/IPsecUtil.py +++ b/resources/libraries/python/IPsecUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -372,7 +372,7 @@ class IPsecUtil: src_addr = u"" dst_addr = u"" - cmd = u"ipsec_sad_entry_add_del" + cmd = u"ipsec_sad_entry_add_del_v2" err_msg = f"Failed to add Security Association Database entry " \ f"on host {node[u'host']}" sad_entry = dict( @@ -385,6 +385,10 @@ class IPsecUtil: flags=flags, tunnel_src=str(src_addr), tunnel_dst=str(dst_addr), + tunnel_flags=int( + TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + ), + dscp=int(IpDscp.IP_API_DSCP_CS0), protocol=int(IPsecProto.IPSEC_API_PROTO_ESP), udp_src_port=4500, # default value in api udp_dst_port=4500 # default value in api @@ -482,7 +486,7 @@ class IPsecUtil: IPsecSadFlags.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 ) - cmd = u"ipsec_sad_entry_add_del" + cmd = u"ipsec_sad_entry_add_del_v2" err_msg = f"Failed to add Security Association Database entry " \ f"on host {node[u'host']}" @@ -496,6 +500,10 @@ class IPsecUtil: flags=flags, tunnel_src=str(src_addr), tunnel_dst=str(dst_addr), + tunnel_flags=int( + TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + ), + dscp=int(IpDscp.IP_API_DSCP_CS0), protocol=int(IPsecProto.IPSEC_API_PROTO_ESP), udp_src_port=4500, # default value in api udp_dst_port=4500 # default value in api @@ -1045,9 +1053,11 @@ class IPsecUtil: """ with PapiSocketExecutor(nodes[u"DUT1"]) as papi_exec: # Create loopback interface on DUT1, set it to up state - cmd = u"create_loopback" + cmd = u"create_loopback_instance" args = dict( - mac_address=0 + mac_address=0, + is_specified=False, + user_instance=0, ) err_msg = f"Failed to create loopback interface " \ f"on host {nodes[u'DUT1'][u'host']}" diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 10778ed49a..04fdff7cac 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -1029,9 +1029,11 @@ class InterfaceUtil: :raises RuntimeError: If it is not possible to create loopback on the node. """ - cmd = u"create_loopback" + cmd = u"create_loopback_instance" args = dict( - mac_address=L2Util.mac_to_bin(mac) if mac else 0 + mac_address=L2Util.mac_to_bin(mac) if mac else 0, + is_specified=False, + user_instance=0, ) err_msg = f"Failed to create loopback interface on host {node[u'host']}" with PapiSocketExecutor(node) as papi_exec: @@ -1207,7 +1209,7 @@ class InterfaceUtil: node, u"set logging class rdma level debug" ) - cmd = u"rdma_create" + cmd = u"rdma_create_v2" pci_addr = Topology.get_interface_pci_addr(node, if_key) args = dict( name=InterfaceUtil.pci_to_eth(node, pci_addr), @@ -1216,6 +1218,9 @@ class InterfaceUtil: rxq_size=rxq_size, txq_size=txq_size, mode=getattr(RdmaMode, f"RDMA_API_MODE_{mode.upper()}").value, + # TODO: Set True for non-jumbo packets. + no_multi_seg=False, + max_pktlen=0, ) err_msg = f"Failed to create RDMA interface on host {node[u'host']}" with PapiSocketExecutor(node) as papi_exec: -- cgit 1.2.3-korg