diff options
author | imarom <imarom@cisco.com> | 2015-08-18 13:22:53 +0300 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2015-08-18 13:22:53 +0300 |
commit | 65b3e045334ce93162fadc85ea241b8b7667482d (patch) | |
tree | 3a42b818455da4a2ce81fa9456f450c4dc83ba81 /src/console/trex_rpc_client.py | |
parent | f88f9364a3a608bd60cf797e36b371cbc217336e (diff) |
draft
Diffstat (limited to 'src/console/trex_rpc_client.py')
-rw-r--r-- | src/console/trex_rpc_client.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/console/trex_rpc_client.py b/src/console/trex_rpc_client.py index e6ff5fee..ac4aa298 100644 --- a/src/console/trex_rpc_client.py +++ b/src/console/trex_rpc_client.py @@ -50,13 +50,15 @@ class RpcClient(): response_json = json.loads(response)
if (response_json.get("jsonrpc") != "2.0"):
- return False, "Bad Server Response: " + str(response)
+ return False, "Malfromed Response ({0})".format(str(response))
+ # error reported by server
if ("error" in response_json):
- return False, "Server Has Reported An Error: " + str(response)
+ return False, response_json["error"]["message"]
+ # if no error there should be a result
if ("result" not in response_json):
- return False, "Bad Server Response: " + str(response)
+ return False, "Malfromed Response ({0})".format(str(response))
return True, response_json["result"]
@@ -97,5 +99,9 @@ class RpcClient(): print "[SUCCESS]\n"
+ def __del__ (self):
+ print "Shutting down RPC client\n"
+ self.context.destroy(linger = 0)
+
|