aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/IPsecUtil.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2023-01-16 12:45:25 +0100
committerVratko Polak <vrpolak@cisco.com>2023-01-16 12:45:25 +0100
commit5302eeabb757ccf710568a66b8f6435c1894cd4d (patch)
tree608819c1937f532d50fa02efaa1ea9a82a4cda9d /resources/libraries/python/IPsecUtil.py
parentbea132b6da5c016a18755a90151caf100c2a8568 (diff)
feat(papi): add async mode, use it in scale calls
+ Introduce two explicit handling modes to save memory in scale test. + Connect in async mode for both handling modes (to avoid reconnects). + Support both pre- and post-37758 VPP PAPI async behavior. + Use control-ping in dumps to emulate sync mode. + Do not use it for single reply to avoid VPP-2033. + Fix call sites to get their replies with correct handling mode. + Drain enqueued replies to avoid subsequent errors. + Retry if read returns None too early. + Update docstrings. - Complexity issues reported by pylint postponed, needs larger refactor. - Explicit replace of VAT is done in subsequent changes. Ticket: CSIT-1547 CSIT-1671 Change-Id: I3c63fa5c578975cc4dd7fce0babe3ab04ec15ed3 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/IPsecUtil.py')
-rw-r--r--resources/libraries/python/IPsecUtil.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py
index 86bed716d1..d7f2136138 100644
--- a/resources/libraries/python/IPsecUtil.py
+++ b/resources/libraries/python/IPsecUtil.py
@@ -1,5 +1,5 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
-# Copyright (c) 2022 PANTHEON.tech s.r.o.
+# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2023 PANTHEON.tech s.r.o.
# 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:
@@ -585,7 +585,7 @@ class IPsecUtil:
udp_dst_port=4500, # default value in api
)
args = dict(entry=sad_entry)
- with PapiSocketExecutor(node) as papi_exec:
+ with PapiSocketExecutor(node, is_async=True) as papi_exec:
for i in range(n_entries):
args[u"entry"][u"sad_id"] = int(sad_id) + i
args[u"entry"][u"spi"] = int(spi) + i
@@ -689,7 +689,7 @@ class IPsecUtil:
else f"Failed to configure IP addresses and IP routes " \
f"on interface {interface} on host {node[u'host']}"
- with PapiSocketExecutor(node) as papi_exec:
+ with PapiSocketExecutor(node, is_async=True) as papi_exec:
for i in range(n_tunnels):
tunnel_dst_addr = tunnel_dst + i * addr_incr
args1[u"prefix"] = IPUtil.create_prefix_object(
@@ -1409,7 +1409,7 @@ class IPsecUtil:
loop_sw_if_idx = InterfaceUtil.vpp_get_interface_sw_index(
nodes[u"DUT1"], u"loop0"
)
- with PapiSocketExecutor(nodes[u"DUT1"]) as papi_exec:
+ with PapiSocketExecutor(nodes[u"DUT1"], is_async=True) as papi_exec:
# Configure IP addresses on loop0 interface
cmd = u"sw_interface_add_del_address"
args = dict(
@@ -1649,7 +1649,7 @@ class IPsecUtil:
:type spi_d: dict
:type existing_tunnels: int
"""
- with PapiSocketExecutor(nodes[u"DUT2"]) as papi_exec:
+ with PapiSocketExecutor(nodes[u"DUT2"], is_async=True) as papi_exec:
if not existing_tunnels:
# Set IP address on VPP node 2 interface
cmd = u"sw_interface_add_del_address"
@@ -1666,7 +1666,7 @@ class IPsecUtil:
)
err_msg = f"Failed to set IP address on interface {if2_key} " \
f"on host {nodes[u'DUT2'][u'host']}"
- papi_exec.add(cmd, **args).get_reply(err_msg)
+ papi_exec.add(cmd, **args).get_replies(err_msg)
# Configure IPIP tunnel interfaces
cmd = u"ipip_add_tunnel"
ipip_tunnel = dict(