From a9af319885a9416dc11d036b19921c7fdadc26e7 Mon Sep 17 00:00:00 2001
From: imarom <imarom@cisco.com>
Date: Mon, 2 May 2016 15:09:02 +0300
Subject: Python circular object reference - fix

---
 .../trex_control_plane/stl/trex_stl_lib/trex_stl_client.py     | 10 ++++++----
 .../stl/trex_stl_lib/trex_stl_jsonrpc_client.py                |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

(limited to 'scripts/automation/trex_control_plane/stl')

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:
-- 
cgit