summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-02-17 03:12:52 -0500
committerimarom <imarom@cisco.com>2016-02-17 03:13:39 -0500
commitd9b8bb0ba62d750ab13a1cda5f33bbfcb1f30358 (patch)
treeddf7ee72cbcd56cdd008632bca7b3f1aad0430bd /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
parent100cdc5edaebde24fc9508266b807c072049aca1 (diff)
timeout connection error message was broken
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
index 96d1854d..7b284cb5 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py
@@ -150,8 +150,8 @@ class JsonRpcClient(object):
else:
response = self.send_raw_msg(msg)
- if response == None:
- return RC_ERR("*** [RPC] - Failed to decode response from server")
+ if not response:
+ return response
# print after
@@ -159,8 +159,10 @@ class JsonRpcClient(object):
self.verbose_msg("Server Response:\n\n" + self.pretty_json(response) + "\n")
# process response (batch and regular)
-
- response_json = json.loads(response)
+ try:
+ response_json = json.loads(response)
+ except (TypeError, ValueError):
+ return RC_ERR("*** [RPC] - Failed to decode response from server")
if isinstance(response_json, list):
return self.process_batch_response(response_json)