diff options
author | 2015-10-06 02:40:42 +0300 | |
---|---|---|
committer | 2015-10-06 02:42:15 +0300 | |
commit | 54fb5cd69e0166073acac1eec08bd29341dbd6be (patch) | |
tree | d49cee17f20d7013771a3570890a07c4c4859faf /scripts/automation/trex_control_plane/client | |
parent | 25c528e867b13d8ddaee19f208ddedd8a2e505ca (diff) | |
parent | ddad1117a1bdc616eb1a5fc4e4e5ef2b8dcf6938 (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.py | 54 |
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={}): |