From a0364d85d9f9b28917168a0dde9c67ca5af4a6f8 Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Mon, 6 Sep 2021 12:54:35 +0200 Subject: API: Use newer message versions Based on latest common ancestor of master and stable/2106: 1372178e0e674143bfec14b17050d5e92e4fcf1a Only ipsec_sad_entry_add_del_v3 needs non-trivial argument edits. Change-Id: I813367292a830e5a1fac765e9f24057b6b0192ee Signed-off-by: Vratko Polak --- resources/api/vpp/supported_crcs.yaml | 22 ++++---- resources/libraries/python/IPsecUtil.py | 78 +++++++++++++++++------------ resources/libraries/python/InterfaceUtil.py | 5 +- resources/libraries/python/TestConfig.py | 2 +- resources/libraries/python/VhostUser.py | 2 +- 5 files changed, 61 insertions(+), 48 deletions(-) diff --git a/resources/api/vpp/supported_crcs.yaml b/resources/api/vpp/supported_crcs.yaml index 02e252d58d..16c263becc 100644 --- a/resources/api/vpp/supported_crcs.yaml +++ b/resources/api/vpp/supported_crcs.yaml @@ -77,20 +77,20 @@ create_subif_reply: '0x5383d31f' # perf # ^^ tc01-64B-1c-dot1ad-l2xcbase-mrr # ^ 3n: dot1adANDl2xcfwd - create_vhost_user_if: '0xc785c6fc' # dev - create_vhost_user_if_reply: '0x5383d31f' # dev + create_vhost_user_if_v2: '0xdba1cc1d' # dev + create_vhost_user_if_v2_reply: '0x5383d31f' # dev create_vlan_subif: '0xaf34ac8b' # dev create_vlan_subif_reply: '0x5383d31f' # dev crypto_sw_scheduler_set_worker: '0xb4274502' #perf crypto_sw_scheduler_set_worker_reply: '0xe8d4e804' #perf det44_add_del_map: '0x1150a190' # perf + det44_add_del_map_reply: '0xe8d4e804' # perf teardown det44_interface_add_del_feature: '0xdc17a836' # perf det44_interface_add_del_feature_reply: '0xe8d4e804' # perf det44_interface_details: '0xe60cc5be' # perf teardown det44_interface_dump: '0x51077d14' # perf teardown det44_map_details: '0xad91dc83' # perf teardown det44_map_dump: '0x51077d14' # perf teardown - det44_add_del_map_reply: '0xe8d4e804' # perf teardown det44_plugin_enable_disable: '0x617b6bf8' # perf det44_plugin_enable_disable_reply: '0xe8d4e804' # perf det44_session_dump: '0xe45a3af7' # perf teardown @@ -123,10 +123,10 @@ ipip_add_tunnel_reply: '0x5383d31f' # dev ipsec_interface_add_del_spd: '0x80f80cbb' # dev ipsec_interface_add_del_spd_reply: '0xe8d4e804' # dev - ipsec_sa_v2_details: '0xe2130051' # dev - ipsec_sa_v2_dump: '0x2076c2f4' # dev - ipsec_sad_entry_add_del_v2: '0xaca78b27' # dev - ipsec_sad_entry_add_del_v2_reply: '0x9ffac24b' # dev + ipsec_sa_v3_details: '0x2fc991ee' # dev + ipsec_sa_v3_dump: '0x2076c2f4' # dev + ipsec_sad_entry_add_del_v3: '0xc77ebd92' # dev + ipsec_sad_entry_add_del_v3_reply: '0x9ffac24b' # dev ipsec_select_backend: '0x5bcfd3b7' # perf ipsec_select_backend_reply: '0xe8d4e804' # perf # ^^ tc01-64B-1c-ethip4ipsec1tnlsw-ip4base-int-aes256gcm-mrr @@ -225,8 +225,8 @@ policer_classify_set_interface: '0xde7ad708' # dev policer_classify_set_interface_reply: '0xe8d4e804' # dev # 4x^ tc01-64B-ethip4-ip4base-ipolicemarkbase-dev - rdma_create_v2: '0x5826a4f3' # perf - rdma_create_v2_reply: '0x5383d31f' # perf + rdma_create_v3: '0xc6287ea8' # perf + rdma_create_v3_reply: '0x5383d31f' # perf # 2x^ Any test with drv_rdma. Currently only available on 2n-clx. # - Not testable by devicetest (until we have environment with right NICs). show_threads: '0x51077d14' # dev @@ -293,8 +293,8 @@ # ^^ see bond_* tap_create_v2: '0x2d0d6570' # dev tap_create_v2_reply: '0x5383d31f' # dev - vxlan_add_del_tunnel: '0x0c09dc80' # dev - vxlan_add_del_tunnel_reply: '0x5383d31f' # dev + vxlan_add_del_tunnel_v3: '0x0072b037' # dev + vxlan_add_del_tunnel_v3_reply: '0x5383d31f' # dev # vxlan_gpe_tunnel_dump / details # honeycomb # vxlan_tunnel_dump /details # unused L2 keyword: Get VXLAN dump # Please keep alphabetic order. diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py index 2efc70eab6..acae5bd91d 100644 --- a/resources/libraries/python/IPsecUtil.py +++ b/resources/libraries/python/IPsecUtil.py @@ -437,7 +437,7 @@ class IPsecUtil: src_addr = u"" dst_addr = u"" - cmd = u"ipsec_sad_entry_add_del_v2" + cmd = u"ipsec_sad_entry_add_del_v3" err_msg = f"Failed to add Security Association Database entry " \ f"on host {node[u'host']}" sad_entry = dict( @@ -448,12 +448,15 @@ class IPsecUtil: integrity_algorithm=integ_alg.alg_int_repr if integ_alg else 0, integrity_key=ikey, flags=flags, - tunnel_src=str(src_addr), - tunnel_dst=str(dst_addr), - tunnel_flags=int( - TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + tunnel=dict( + src=str(src_addr), + dst=str(dst_addr), + table_id=0, + encap_decap_flags=int( + TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + ), + dscp=int(IpDscp.IP_API_DSCP_CS0), ), - 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 @@ -551,7 +554,7 @@ class IPsecUtil: IPsecSadFlags.IPSEC_API_SAD_FLAG_IS_TUNNEL_V6 ) - cmd = u"ipsec_sad_entry_add_del_v2" + cmd = u"ipsec_sad_entry_add_del_v3" err_msg = f"Failed to add Security Association Database entry " \ f"on host {node[u'host']}" @@ -563,12 +566,15 @@ class IPsecUtil: integrity_algorithm=integ_alg.alg_int_repr if integ_alg else 0, integrity_key=ikey, flags=flags, - tunnel_src=str(src_addr), - tunnel_dst=str(dst_addr), - tunnel_flags=int( - TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + tunnel=dict( + src=str(src_addr), + dst=str(dst_addr), + table_id=0, + encap_decap_flags=int( + TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + ), + dscp=int(IpDscp.IP_API_DSCP_CS0), ), - 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 @@ -581,10 +587,14 @@ class IPsecUtil: for i in range(n_entries): args[u"entry"][u"sad_id"] = int(sad_id) + i args[u"entry"][u"spi"] = int(spi) + i - args[u"entry"][u"tunnel_src"] = str(src_addr + i * addr_incr) \ + args[u"entry"][u"tunnel"][u"src"] = ( + str(src_addr + i * addr_incr) if tunnel_src and tunnel_dst else src_addr - args[u"entry"][u"tunnel_dst"] = str(dst_addr + i * addr_incr) \ + ) + args[u"entry"][u"tunnel"][u"dst"] = ( + str(dst_addr + i * addr_incr) if tunnel_src and tunnel_dst else dst_addr + ) history = bool(not 1 < i < n_entries - 2) papi_exec.add(cmd, history=history, **args) papi_exec.get_replies(err_msg) @@ -1439,7 +1449,7 @@ class IPsecUtil: # Configure IPSec SAD entries ckeys = [bytes()] * existing_tunnels ikeys = [bytes()] * existing_tunnels - cmd = u"ipsec_sad_entry_add_del_v2" + cmd = u"ipsec_sad_entry_add_del_v3" c_key = dict( length=0, data=None @@ -1457,16 +1467,18 @@ class IPsecUtil: integrity_algorithm=integ_alg.alg_int_repr if integ_alg else 0, integrity_key=i_key, flags=None, - tunnel_src=0, - tunnel_dst=0, - tunnel_flags=int( - TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + tunnel=dict( + src=0, + dst=0, + table_id=0, + encap_decap_flags=int( + TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + ), + dscp=int(IpDscp.IP_API_DSCP_CS0), ), - dscp=int(IpDscp.IP_API_DSCP_CS0), - table_id=0, salt=0, udp_src_port=IPSEC_UDP_PORT_NONE, - udp_dst_port=IPSEC_UDP_PORT_NONE + udp_dst_port=IPSEC_UDP_PORT_NONE, ) args = dict( is_add=True, @@ -1679,7 +1691,7 @@ class IPsecUtil: ] ) # Configure IPSec SAD entries - cmd = u"ipsec_sad_entry_add_del_v2" + cmd = u"ipsec_sad_entry_add_del_v3" c_key = dict( length=0, data=None @@ -1692,23 +1704,23 @@ class IPsecUtil: sad_id=None, spi=None, protocol=int(IPsecProto.IPSEC_API_PROTO_ESP), - crypto_algorithm=crypto_alg.alg_int_repr, crypto_key=c_key, integrity_algorithm=integ_alg.alg_int_repr if integ_alg else 0, integrity_key=i_key, - flags=None, - tunnel_src=0, - tunnel_dst=0, - tunnel_flags=int( - TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + tunnel=dict( + src=0, + dst=0, + table_id=0, + encap_decap_flags=int( + TunnelEncpaDecapFlags.TUNNEL_API_ENCAP_DECAP_FLAG_NONE + ), + dscp=int(IpDscp.IP_API_DSCP_CS0), ), - dscp=int(IpDscp.IP_API_DSCP_CS0), - table_id=0, salt=0, udp_src_port=IPSEC_UDP_PORT_NONE, - udp_dst_port=IPSEC_UDP_PORT_NONE + udp_dst_port=IPSEC_UDP_PORT_NONE, ) args = dict( is_add=True, @@ -2230,6 +2242,6 @@ class IPsecUtil: :type node: dict """ cmds = [ - u"ipsec_sa_v2_dump" + u"ipsec_sa_v3_dump" ] PapiSocketExecutor.dump_and_log(node, cmds) diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 4cd7cf10b6..ebbd4f25fa 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -849,7 +849,7 @@ class InterfaceUtil: :raises RuntimeError: if it is unable to create VxLAN interface on the node. """ - cmd = u"vxlan_add_del_tunnel" + cmd = u"vxlan_add_del_tunnel_v3" args = dict( is_add=True, instance=Constants.BITWISE_NON_ZERO, @@ -1359,7 +1359,7 @@ class InterfaceUtil: node, u"set logging class rdma level debug" ) - cmd = u"rdma_create_v2" + cmd = u"rdma_create_v3" pci_addr = Topology.get_interface_pci_addr(node, if_key) args = dict( name=InterfaceUtil.pci_to_eth(node, pci_addr), @@ -1371,6 +1371,7 @@ class InterfaceUtil: # Note: Set True for non-jumbo packets. no_multi_seg=False, max_pktlen=0, + # TODO: Apply desired RSS flags. ) err_msg = f"Failed to create RDMA interface on host {node[u'host']}" with PapiSocketExecutor(node) as papi_exec: diff --git a/resources/libraries/python/TestConfig.py b/resources/libraries/python/TestConfig.py index c1b7b1b600..28c740e42e 100644 --- a/resources/libraries/python/TestConfig.py +++ b/resources/libraries/python/TestConfig.py @@ -156,7 +156,7 @@ class TestConfig: del_all=False, prefix=None ) - cmd2 = u"vxlan_add_del_tunnel" + cmd2 = u"vxlan_add_del_tunnel_v3" args2 = dict( is_add=True, instance=Constants.BITWISE_NON_ZERO, diff --git a/resources/libraries/python/VhostUser.py b/resources/libraries/python/VhostUser.py index c6b9185e14..e868938cd1 100644 --- a/resources/libraries/python/VhostUser.py +++ b/resources/libraries/python/VhostUser.py @@ -62,7 +62,7 @@ class VhostUser: :returns: SW interface index. :rtype: int """ - cmd = u"create_vhost_user_if" + cmd = u"create_vhost_user_if_v2" err_msg = f"Failed to create Vhost-user interface " \ f"on host {node[u'host']}" if virtio_feature_mask is None: -- cgit 1.2.3-korg