summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client
diff options
context:
space:
mode:
authorDan Klein <danklei@cisco.com>2015-10-06 02:40:42 +0300
committerDan Klein <danklei@cisco.com>2015-10-06 02:42:15 +0300
commit54fb5cd69e0166073acac1eec08bd29341dbd6be (patch)
treed49cee17f20d7013771a3570890a07c4c4859faf /scripts/automation/trex_control_plane/client
parent25c528e867b13d8ddaee19f208ddedd8a2e505ca (diff)
parentddad1117a1bdc616eb1a5fc4e4e5ef2b8dcf6938 (diff)
Merge branch 'master' into dan_stateless
Diffstat (limited to 'scripts/automation/trex_control_plane/client')
-rwxr-xr-x[-rw-r--r--]scripts/automation/trex_control_plane/client/trex_stateless_client.py54
1 files changed, 41 insertions, 13 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 b7580531..b25d5cd5 100644..100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -19,7 +19,7 @@ class CTRexStatelessClient(object):
self._conn_handler = {}
def owned(func):
- def wrapper(self, *args, **kwargs ) :
+ def wrapper(self, *args, **kwargs):
if self._conn_handler.get(kwargs.get("port_id")):
return func(self, *args, **kwargs)
else:
@@ -37,38 +37,66 @@ class CTRexStatelessClient(object):
@owned
def release(self, port_id=None):
self._conn_handler.pop(port_id)
- params = {"handler":self._conn_handler.get(port_id),
+ params = {"handler": self._conn_handler.get(port_id),
"port_id": port_id}
return self.transmit("release", params)
@owned
def add_stream(self, stream_id, stream_obj, port_id=None):
assert isinstance(stream_obj, CStream)
- params = {"handler":self._conn_handler.get(port_id),
- "port_id":port_id,
- "stream_id":stream_id,
- "stream":stream_obj.dump()}
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id,
+ "stream_id": stream_id,
+ "stream": stream_obj.dump()}
return self.transmit("add_stream", params)
@owned
def remove_stream(self, stream_id, port_id=None):
- params = {"handler":self._conn_handler.get(port_id),
- "port_id":port_id,
- "stream_id":stream_id}
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id,
+ "stream_id": stream_id}
return self.transmit("remove_stream", params)
@owned
def get_stream_list(self, port_id=None):
- params = {"handler":self._conn_handler.get(port_id),
- "port_id":port_id}
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id}
return self.transmit("get_stream_list", params)
@owned
def get_stream(self, stream_id, port_id=None):
- params = {"handler":self._conn_handler.get(port_id),
- "port_id":port_id}
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id,
+ "stream_id": stream_id}
return self.transmit("get_stream_list", params)
+ @owned
+ def start_traffic(self, port_id=None):
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id}
+ return self.transmit("start_traffic", params)
+
+ @owned
+ def stop_traffic(self, port_id=None):
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id}
+ return self.transmit("stop_traffic", params)
+
+ def get_global_stats(self):
+ return self.transmit("get_global_stats")
+
+ @owned
+ def stop_traffic(self, port_id=None):
+ params = {"handler": self._conn_handler.get(port_id),
+ "port_id": port_id}
+ return self.transmit("stop_traffic", params)
+
+
+
+
+
+
+
def transmit(self, method_name, params={}):