From b87ac8e2af727598b3120510b221244c9c499e56 Mon Sep 17 00:00:00 2001 From: imarom Date: Sun, 24 Jan 2016 11:35:41 -0500 Subject: added support for L1 B/W check both start/update now enforce this and it can be bypassed by providing 'force' --- .../trex_control_plane/client/trex_port.py | 16 +++++++++------- .../client/trex_stateless_client.py | 21 +++++++++++---------- 2 files changed, 20 insertions(+), 17 deletions(-) (limited to 'scripts/automation/trex_control_plane/client') diff --git a/scripts/automation/trex_control_plane/client/trex_port.py b/scripts/automation/trex_control_plane/client/trex_port.py index d32d2a01..dcb03da3 100644 --- a/scripts/automation/trex_control_plane/client/trex_port.py +++ b/scripts/automation/trex_control_plane/client/trex_port.py @@ -249,7 +249,7 @@ class Port(object): return self.streams # start traffic - def start (self, mul, duration): + def start (self, mul, duration, force): if not self.is_acquired(): return self.err("port is not owned") @@ -263,10 +263,11 @@ class Port(object): if self.state == self.STATE_TX: return self.err("Unable to start traffic - port is already transmitting") - params = {"handler": self.handler, - "port_id": self.port_id, - "mul": mul, - "duration": duration} + params = {"handler": self.handler, + "port_id": self.port_id, + "mul": mul, + "duration": duration, + "force": force} rc = self.transmit("start_traffic", params) if rc.bad(): @@ -344,7 +345,7 @@ class Port(object): return self.ok() - def update (self, mul): + def update (self, mul, force): if not self.is_acquired(): return self.err("port is not owned") @@ -354,7 +355,8 @@ class Port(object): params = {"handler": self.handler, "port_id": self.port_id, - "mul": mul} + "mul": mul, + "force": force} rc = self.transmit("update_traffic", params) if rc.bad(): 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 c59da7b4..32618a05 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -605,14 +605,14 @@ class STLClient(object): return self.ports[port_id].get_stream_id_list() - def __start_traffic (self, multiplier, duration, port_id_list = None): + def __start_traffic (self, multiplier, duration, port_id_list = None, force = False): port_id_list = self.__ports(port_id_list) rc = RC() for port_id in port_id_list: - rc.add(self.ports[port_id].start(multiplier, duration)) + rc.add(self.ports[port_id].start(multiplier, duration, force)) return rc @@ -655,7 +655,7 @@ class STLClient(object): rc = RC() for port_id in port_id_list: - rc.add(self.ports[port_id].update(mult)) + rc.add(self.ports[port_id].update(mult, force)) return rc @@ -786,7 +786,7 @@ class STLClient(object): if not dry: self.logger.pre_cmd("Starting traffic on port(s) {0}:".format(port_id_list)) - rc = self.__start_traffic(mult, duration, port_id_list) + rc = self.__start_traffic(mult, duration, port_id_list, force) self.logger.post_cmd(rc) return rc @@ -815,10 +815,10 @@ class STLClient(object): return RC_OK() #update cmd - def __update (self, port_id_list, mult): + def __update (self, port_id_list, mult, force): self.logger.pre_cmd("Updating traffic on port(s) {0}:".format(port_id_list)) - rc = self.__update_traffic(mult, port_id_list) + rc = self.__update_traffic(mult, port_id_list, force) self.logger.post_cmd(rc) return rc @@ -1365,7 +1365,7 @@ class STLClient(object): # update traffic @__api_check(True) - def update (self, ports = None, mult = "1", total = False): + def update (self, ports = None, mult = "1", total = False, force = False): # by default the user means all the active ports if ports == None: @@ -1389,7 +1389,7 @@ class STLClient(object): # call low level functions - rc = self.__update(ports, mult_obj) + rc = self.__update(ports, mult_obj, force) if not rc: raise STLError(rc) @@ -1638,7 +1638,8 @@ class STLClient(object): self.update_line.__doc__, parsing_opts.PORT_LIST_WITH_ALL, parsing_opts.MULTIPLIER, - parsing_opts.TOTAL) + parsing_opts.TOTAL, + parsing_opts.FORCE) opts = parser.parse_args(line.split()) if opts is None: @@ -1651,7 +1652,7 @@ class STLClient(object): self.logger.log(format_text("No ports in valid state to update\n", 'bold')) return - self.update(ports, opts.mult, opts.total) + self.update(ports, opts.mult, opts.total, opts.force) # true means print time return True -- cgit 1.2.3-korg