aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/PapiExecutor.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-07-18 14:35:17 +0200
committerVratko Polak <vrpolak@cisco.com>2019-07-18 13:07:54 +0000
commit0041c421296a43247ba18ea03c83759fed27c751 (patch)
treea9807d9bf0cebc8eb2dd6e0fd0b227b879025044 /resources/libraries/python/PapiExecutor.py
parent264cb0e232ae9569c71fd6c7b21864447350ea0e (diff)
Papi socket: except more errors to insert err_msg
Change-Id: Ided91ee2b47dafb6aad83091126294d79f67aeac Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/PapiExecutor.py')
-rw-r--r--resources/libraries/python/PapiExecutor.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py
index 0a009b3720..77732c7b05 100644
--- a/resources/libraries/python/PapiExecutor.py
+++ b/resources/libraries/python/PapiExecutor.py
@@ -468,16 +468,20 @@ class PapiSocketExecutor(object):
api_name = command["api_name"]
papi_fn = getattr(vpp_instance.api, api_name)
try:
- reply = papi_fn(**command["api_args"])
- except IOError as err:
- # Ocassionally an error happens, try reconnect.
- logger.warn("Reconnect after error: {err!r}".format(err=err))
- self.vpp_instance.disconnect()
- # Testing showes immediate reconnect fails.
- time.sleep(1)
- self.vpp_instance.connect_sync("csit_socket")
- logger.trace("Reconnected.")
- reply = papi_fn(**command["api_args"])
+ try:
+ reply = papi_fn(**command["api_args"])
+ except IOError as err:
+ # Ocassionally an error happens, try reconnect.
+ logger.warn("Reconnect after error: {err!r}".format(
+ err=err))
+ self.vpp_instance.disconnect()
+ # Testing showes immediate reconnect fails.
+ time.sleep(1)
+ self.vpp_instance.connect_sync("csit_socket")
+ logger.trace("Reconnected.")
+ reply = papi_fn(**command["api_args"])
+ except (AttributeError, IOError) as err:
+ raise_from(AssertionError(err_msg), err, level="INFO")
# *_dump commands return list of objects, convert, ordinary reply.
if not isinstance(reply, list):
reply = [reply]