summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py118
-rw-r--r--scripts/automation/trex_control_plane/console/old_console.py12
-rwxr-xr-xscripts/automation/trex_control_plane/console/trex_console.py10
-rw-r--r--scripts/exp/stl_basic_pause_resume0-0-ex.erfbin0 -> 704 bytes
-rw-r--r--scripts/exp/stl_bb_start_stop_delay1-0-ex.erfbin0 -> 440 bytes
-rw-r--r--scripts/exp/stl_bb_start_stop_delay2-0-ex.erfbin0 -> 1496 bytes
-rw-r--r--scripts/stl/burst_1000_pkt.yaml36
7 files changed, 176 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 164cdb90..7bcbf2c7 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -331,6 +331,40 @@ class Port(object):
return self.ok()
+ def pause (self):
+
+ if (self.state != self.STATE_TX) :
+ return self.err("port is not transmitting")
+
+ params = {"handler": self.handler,
+ "port_id": self.port_id}
+
+ rc, data = self.transmit("pause_traffic", params)
+ if not rc:
+ return self.err(data)
+
+ # only valid state after stop
+ self.state = self.STATE_PAUSE
+
+ return self.ok()
+
+ def resume (self):
+
+ if (self.state != self.STATE_PAUSE) :
+ return self.err("port is not in pause mode")
+
+ params = {"handler": self.handler,
+ "port_id": self.port_id}
+
+ rc, data = self.transmit("resume_traffic", params)
+ if not rc:
+ return self.err(data)
+
+ # only valid state after stop
+ self.state = self.STATE_TX
+
+ return self.ok()
+
################# events handler ######################
def async_event_port_stopped (self):
self.state = self.STATE_STREAMS
@@ -615,6 +649,25 @@ class CTRexStatelessClient(object):
return rc
+ def resume_traffic (self, 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].resume())
+
+ return rc
+
+ def pause_traffic (self, 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].pause())
+
+ return rc
def stop_traffic (self, port_id_list = None, force = False):
@@ -707,6 +760,71 @@ class CTRexStatelessClient(object):
return RC_OK()
+ # pause cmd
+ def cmd_pause (self, port_id_list):
+
+ # find the relveant ports
+ active_ports = list(set(self.get_active_ports()).intersection(port_id_list))
+
+ if not active_ports:
+ msg = "No active traffic on porvided ports"
+ print format_text(msg, 'bold')
+ return RC_ERR(msg)
+
+ rc = self.pause_traffic(active_ports)
+ rc.annotate("Pausing traffic on port(s) {0}:".format(port_id_list))
+ if rc.bad():
+ return rc
+
+ return RC_OK()
+
+ def cmd_pause_line (self, line):
+ '''Pause active traffic in specified ports on TRex\n'''
+ parser = parsing_opts.gen_parser(self,
+ "pause",
+ self.cmd_stop_line.__doc__,
+ parsing_opts.PORT_LIST_WITH_ALL)
+
+ opts = parser.parse_args(line.split())
+ if opts is None:
+ return RC_ERR("bad command line paramters")
+
+ return self.cmd_pause(opts.ports)
+
+
+ # resume cmd
+ def cmd_resume (self, port_id_list):
+
+ # find the relveant ports
+ active_ports = list(set(self.get_active_ports()).intersection(port_id_list))
+
+ if not active_ports:
+ msg = "No active traffic on porvided ports"
+ print format_text(msg, 'bold')
+ return RC_ERR(msg)
+
+ rc = self.resume_traffic(active_ports)
+ rc.annotate("Resume traffic on port(s) {0}:".format(port_id_list))
+ if rc.bad():
+ return rc
+
+ return RC_OK()
+
+
+ def cmd_resume_line (self, line):
+ '''Resume active traffic in specified ports on TRex\n'''
+ parser = parsing_opts.gen_parser(self,
+ "resume",
+ self.cmd_stop_line.__doc__,
+ parsing_opts.PORT_LIST_WITH_ALL)
+
+ opts = parser.parse_args(line.split())
+ if opts is None:
+ return RC_ERR("bad command line paramters")
+
+ return self.cmd_resume(opts.ports)
+
+
# start cmd
def cmd_start (self, port_id_list, stream_list, mult, force, duration):
diff --git a/scripts/automation/trex_control_plane/console/old_console.py b/scripts/automation/trex_control_plane/console/old_console.py
index 93c7e3f4..9d61a3a6 100644
--- a/scripts/automation/trex_control_plane/console/old_console.py
+++ b/scripts/automation/trex_control_plane/console/old_console.py
@@ -636,6 +636,18 @@ class TRexConsole1(cmd.Cmd):
res_ok = self.stop_traffic(port_list)
return
+ def do_pause(self, line):
+ '''Pause active traffic in specified ports on TRex\n'''
+ parser = parsing_opts.gen_parser("stop", self.do_stop.__doc__,
+ parsing_opts.PORT_LIST_WITH_ALL)
+ opts = parser.parse_args(line.split())
+ if opts is None:
+ # avoid further processing in this command
+ return
+ port_list = self.extract_port_list(opts)
+ res_ok = self.stop_traffic(port_list)
+ return
+
def help_stop(self):
self.do_stop("-h")
diff --git a/scripts/automation/trex_control_plane/console/trex_console.py b/scripts/automation/trex_control_plane/console/trex_console.py
index 995965fd..2a6fd2eb 100755
--- a/scripts/automation/trex_control_plane/console/trex_console.py
+++ b/scripts/automation/trex_control_plane/console/trex_console.py
@@ -263,6 +263,16 @@ class TRexConsole(TRexGeneralCmd):
'''stops port(s) transmitting traffic\n'''
self.stateless_client.cmd_stop_line(line)
+ ############# pause
+ def do_pause(self, line):
+ '''pause port(s) transmitting traffic\n'''
+ self.stateless_client.cmd_pause_line(line)
+
+ ############# resume
+ def do_resume(self, line):
+ '''resume port(s) transmitting traffic\n'''
+ self.stateless_client.cmd_resume_line(line)
+
def help_stop(self):
diff --git a/scripts/exp/stl_basic_pause_resume0-0-ex.erf b/scripts/exp/stl_basic_pause_resume0-0-ex.erf
new file mode 100644
index 00000000..7f833920
--- /dev/null
+++ b/scripts/exp/stl_basic_pause_resume0-0-ex.erf
Binary files differ
diff --git a/scripts/exp/stl_bb_start_stop_delay1-0-ex.erf b/scripts/exp/stl_bb_start_stop_delay1-0-ex.erf
new file mode 100644
index 00000000..08afdf4b
--- /dev/null
+++ b/scripts/exp/stl_bb_start_stop_delay1-0-ex.erf
Binary files differ
diff --git a/scripts/exp/stl_bb_start_stop_delay2-0-ex.erf b/scripts/exp/stl_bb_start_stop_delay2-0-ex.erf
new file mode 100644
index 00000000..01a77466
--- /dev/null
+++ b/scripts/exp/stl_bb_start_stop_delay2-0-ex.erf
Binary files differ
diff --git a/scripts/stl/burst_1000_pkt.yaml b/scripts/stl/burst_1000_pkt.yaml
new file mode 100644
index 00000000..a2c3a908
--- /dev/null
+++ b/scripts/stl/burst_1000_pkt.yaml
@@ -0,0 +1,36 @@
+### Single stream UDP packet, 64B ###
+#####################################
+- name: stream0
+ stream:
+ self_start: True
+ next_stream_id: stream1
+ packet:
+ binary: cap2/udp_64B.pcap
+ mode:
+ type: single_burst
+ pps: 100
+ total_pkts : 10000
+ rx_stats: []
+
+- name: stream1
+ stream:
+ self_start: False
+ next_stream_id: stream2
+ packet:
+ binary: cap2/udp_64B.pcap
+ mode:
+ type: single_burst
+ pps: 100
+ total_pkts : 10000
+ rx_stats: []
+
+- name: stream2
+ stream:
+ self_start: False
+ packet:
+ binary: cap2/udp_64B.pcap
+ mode:
+ type: single_burst
+ pps: 100
+ total_pkts : 10000
+ rx_stats: [] \ No newline at end of file