aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/NATUtil.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/NATUtil.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/NATUtil.py')
-rw-r--r--resources/libraries/python/NATUtil.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/resources/libraries/python/NATUtil.py b/resources/libraries/python/NATUtil.py
index 5d3d131c80..e5f530ab46 100644
--- a/resources/libraries/python/NATUtil.py
+++ b/resources/libraries/python/NATUtil.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
+# Copyright (c) 2023 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:
@@ -182,10 +182,9 @@ class NATUtil:
"""Delete and re-add the NAT range setting."""
with PapiSocketExecutor(node) as papi_exec:
args_in[u"is_add"] = False
- papi_exec.add(cmd, **args_in)
+ papi_exec.add(cmd, **args_in).get_reply(err_msg)
args_in[u"is_add"] = True
- papi_exec.add(cmd, **args_in)
- papi_exec.get_replies(err_msg)
+ papi_exec.add(cmd, **args_in).get_reply(err_msg)
return resetter
@@ -427,10 +426,9 @@ class NATUtil:
"""Delete and re-add the deterministic NAT mapping."""
with PapiSocketExecutor(node) as papi_exec:
args_in[u"is_add"] = False
- papi_exec.add(cmd, **args_in)
+ papi_exec.add(cmd, **args_in).get_reply(err_msg)
args_in[u"is_add"] = True
- papi_exec.add(cmd, **args_in)
- papi_exec.get_replies(err_msg)
+ papi_exec.add(cmd, **args_in).get_reply(err_msg)
return resetter