summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-05-02 15:09:02 +0300
committerimarom <imarom@cisco.com>2016-05-02 15:09:37 +0300
commita9af319885a9416dc11d036b19921c7fdadc26e7 (patch)
tree332aeb7aae2b344d1cd15f8b5c8943ae35cc4b82
parent3f03ff0525f81e7b9c6cdc73f5c8983c58350bb1 (diff)
Python circular object reference - fix
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py10
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_jsonrpc_client.py4
2 files changed, 8 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index 77fa40bb..864e00ad 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -497,6 +497,11 @@ class STLClient(object):
self.session_id = random.getrandbits(32)
self.connected = False
+ # API classes
+ self.api_vers = [ {'type': 'core', 'major': 1, 'minor':2 }
+ ]
+ self.api_h = {'core': None}
+
# logger
self.logger = DefaultLogger() if not logger else logger
@@ -540,10 +545,7 @@ class STLClient(object):
self.flow_stats)
- # API classes
- self.api_vers = [ {'type': 'core', 'major': 1, 'minor':2 }
- ]
- self.api_h = {'core': None}
+
############# private functions - used by the class itself ###########
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 bd5ba8e7..fa04b9f6 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
@@ -47,7 +47,7 @@ class JsonRpcClient(object):
MSG_COMPRESS_HEADER_MAGIC = 0xABE85CEA
def __init__ (self, default_server, default_port, client):
- self.client = client
+ self.client_api = client.api_h
self.logger = client.logger
self.connected = False
@@ -104,7 +104,7 @@ class JsonRpcClient(object):
# if this RPC has an API class - add it's handler
if api_class:
- msg["params"]["api_h"] = self.client.api_h[api_class]
+ msg["params"]["api_h"] = self.client_api[api_class]
if encode: