summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/client')
-rw-r--r--scripts/automation/trex_control_plane/client/trex_port.py4
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py17
2 files changed, 12 insertions, 9 deletions
diff --git a/scripts/automation/trex_control_plane/client/trex_port.py b/scripts/automation/trex_control_plane/client/trex_port.py
index 68d89775..5c5702dd 100644
--- a/scripts/automation/trex_control_plane/client/trex_port.py
+++ b/scripts/automation/trex_control_plane/client/trex_port.py
@@ -18,7 +18,7 @@ class Port(object):
STATE_PAUSE: "PAUSE"}
- def __init__ (self, port_id, speed, driver, user, session_id, comm_link):
+ def __init__ (self, port_id, speed, driver, user, comm_link):
self.port_id = port_id
self.state = self.STATE_IDLE
self.handler = None
@@ -26,7 +26,6 @@ class Port(object):
self.transmit = comm_link.transmit
self.transmit_batch = comm_link.transmit_batch
self.user = user
- self.session_id = session_id
self.driver = driver
self.speed = speed
self.streams = {}
@@ -48,7 +47,6 @@ class Port(object):
def acquire(self, force = False):
params = {"port_id": self.port_id,
"user": self.user,
- "session_id": self.session_id,
"force": force}
command = RpcCmdData("acquire", params)
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()