diff options
author | 2015-10-07 13:49:28 +0300 | |
---|---|---|
committer | 2015-10-07 13:49:28 +0300 | |
commit | c3ced9cd49c609d8a25933012f9aa2e5db9298d9 (patch) | |
tree | bbace23ac6d787cfb558d1ce22d66965fbb93f3f /scripts/automation/trex_control_plane/client | |
parent | 4f286bfefa6bbb0be4cdcf1fb004c82fc334c21f (diff) |
Applied port validity on port_id relevant methods
Diffstat (limited to 'scripts/automation/trex_control_plane/client')
-rwxr-xr-x | scripts/automation/trex_control_plane/client/trex_stateless_client.py | 18 |
1 files changed, 18 insertions, 0 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 412bdc09..95ed8522 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -98,6 +98,8 @@ class CTRexStatelessClient(object): @force_status(owned=True) def release(self, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") if isinstance(port_id, list) or isinstance(port_id, set): # handle as batch mode port_ids = set(port_id) # convert to set to avoid duplications @@ -113,6 +115,8 @@ class CTRexStatelessClient(object): @force_status(owned=True) def add_stream(self, stream_id, stream_obj, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") assert isinstance(stream_obj, CStream) params = {"handler": self._conn_handler.get(port_id), "port_id": port_id, @@ -122,6 +126,8 @@ class CTRexStatelessClient(object): @force_status(owned=True) def remove_stream(self, stream_id, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") params = {"handler": self._conn_handler.get(port_id), "port_id": port_id, "stream_id": stream_id} @@ -129,12 +135,16 @@ class CTRexStatelessClient(object): @force_status(owned=True, active_and_owned=True) def get_stream_id_list(self, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") params = {"handler": self._conn_handler.get(port_id), "port_id": port_id} return self.transmit("get_stream_list", params) @force_status(owned=True, active_and_owned=True) def get_stream(self, stream_id, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") params = {"handler": self._conn_handler.get(port_id), "port_id": port_id, "stream_id": stream_id} @@ -142,6 +152,8 @@ class CTRexStatelessClient(object): @force_status(owned=True) def start_traffic(self, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") if isinstance(port_id, list) or isinstance(port_id, set): # handle as batch mode port_ids = set(port_id) # convert to set to avoid duplications @@ -156,6 +168,8 @@ class CTRexStatelessClient(object): @force_status(owned=False, active_and_owned=True) def stop_traffic(self, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") if isinstance(port_id, list) or isinstance(port_id, set): # handle as batch mode port_ids = set(port_id) # convert to set to avoid duplications @@ -173,6 +187,8 @@ class CTRexStatelessClient(object): @force_status(owned=True, active_and_owned=True) def get_port_stats(self, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") if isinstance(port_id, list) or isinstance(port_id, set): # handle as batch mode port_ids = set(port_id) # convert to set to avoid duplications @@ -187,6 +203,8 @@ class CTRexStatelessClient(object): @force_status(owned=True, active_and_owned=True) def get_stream_stats(self, port_id=None): + if not CTRexStatelessClient._is_ports_valid(port_id): + raise ValueError("Provided illegal port id input") if isinstance(port_id, list) or isinstance(port_id, set): # handle as batch mode port_ids = set(port_id) # convert to set to avoid duplications |