diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-09-20 17:34:55 +0300 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-09-20 17:34:55 +0300 |
commit | 3fe28431157f7b2ed2ed8184ed85017c42a4cb6c (patch) | |
tree | 41fa17684842885e1664cc63ff1520157f191261 /scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py | |
parent | 588bb20e9c8f8438db4eb3e8db85111f41bd7306 (diff) | |
parent | 28fef018f75b5a54ac69ac7c919127bf47f5b61f (diff) |
Merge branch 'master' of csi-sceasr-b45:/auto/proj-pcube-b/apps/PL-b/tools/repo//trex-core into wen
Diffstat (limited to 'scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py')
-rw-r--r-- | scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py b/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py index b44b1268..c6b22218 100644 --- a/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py +++ b/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py @@ -63,16 +63,16 @@ class JsonRpcClient(object): print "[verbose] " + msg - def create_jsonrpc_v2 (self, method_name, params = {}, id = None): + def create_jsonrpc_v2 (self, method_name, params = {}): msg = {} msg["jsonrpc"] = "2.0" msg["method"] = method_name msg["params"] = params - msg["id"] = id + msg["id"] = self.id_gen.next() - return json.dumps(msg) + return id, json.dumps(msg) def invoke_rpc_method (self, method_name, params = {}, block = False): rc, msg = self._invoke_rpc_method(method_name, params, block) @@ -85,8 +85,7 @@ class JsonRpcClient(object): if not self.connected: return False, "Not connected to server" - id = self.id_gen.next() - msg = self.create_jsonrpc_v2(method_name, params, id = id) + id, msg = self.create_jsonrpc_v2(method_name, params) self.verbose_msg("Sending Request To Server:\n\n" + self.pretty_json(msg) + "\n") @@ -145,7 +144,7 @@ class JsonRpcClient(object): return self.invoke_rpc_method("get_status") def query_rpc_server(self): - return self.invoke_rpc_method("get_reg_cmds") + return self.invoke_rpc_method("get_supported_cmds") def set_verbose(self, mode): @@ -209,7 +208,8 @@ class JsonRpcClient(object): def __del__(self): print "Shutting down RPC client\n" - self.context.destroy(linger=0) + if hasattr(self, "context"): + self.context.destroy(linger=0) if __name__ == "__main__": pass |