summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client/trex_stateless_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/client/trex_stateless_client.py')
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_client.py b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
index 43ebea9d..6907c9c2 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -54,7 +54,6 @@ class CTRexStatelessClient(object):
super(CTRexStatelessClient, self).__init__()
self.user = username
- self.session_id = random.getrandbits(32)
self.comm_link = CTRexStatelessClient.CCommLink(server, sync_port, virtual)
@@ -85,10 +84,6 @@ class CTRexStatelessClient(object):
self.connected = False
- # when the client gets out
- def shutdown (self):
- self.release(self.get_acquired_ports())
-
# returns the port object
def get_port (self, port_id):
@@ -296,6 +291,9 @@ class CTRexStatelessClient(object):
# connection sequence
def connect(self, force = False):
+ if self.is_connected():
+ self.disconnect()
+
# clear this flag
self.connected = False
@@ -335,7 +333,7 @@ class CTRexStatelessClient(object):
speed = self.system_info['ports'][port_id]['speed']
driver = self.system_info['ports'][port_id]['driver']
- self.ports[port_id] = Port(port_id, speed, driver, self.user, self.session_id, self.comm_link)
+ self.ports[port_id] = Port(port_id, speed, driver, self.user, self.comm_link)
# sync the ports
@@ -365,8 +363,15 @@ class CTRexStatelessClient(object):
def disconnect(self):
+ # release any previous acquired ports
+ if self.is_connected():
+ self.release(self.get_acquired_ports())
+
self.comm_link.disconnect()
self.async_client.disconnect()
+
+ self.connected = False
+
return RC_OK()