diff options
Diffstat (limited to 'scripts')
3 files changed, 77 insertions, 3 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 75c1c06f..a76b1f9f 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -899,6 +899,7 @@ class CTRexStatelessClient(object): opts = parser.parse_args(line.split()) + if opts is None: return RC_ERR("bad command line parameters") @@ -915,7 +916,15 @@ class CTRexStatelessClient(object): else: # load streams from file - stream_list = self.streams_db.load_yaml_file(opts.file[0]) + stream_list = None; + try: + stream_list = self.streams_db.load_yaml_file(opts.file[0]) + except Exception as e: + s = str(e) + rc=RC_ERR("Failed to load stream pack") + rc.annotate() + return rc + rc = RC(stream_list != None) rc.annotate("Load stream pack (from file):") if stream_list == None: diff --git a/scripts/automation/trex_control_plane/console/trex_console.py b/scripts/automation/trex_control_plane/console/trex_console.py index 1d94afb7..a3ea6693 100755 --- a/scripts/automation/trex_control_plane/console/trex_console.py +++ b/scripts/automation/trex_control_plane/console/trex_console.py @@ -164,8 +164,8 @@ class TRexConsole(TRexGeneralCmd): print format_text("\n'{0}' cannot be executed on read only mode\n".format(func_name), 'bold') return - ret = f(*args) - return ret + rc = f(*args) + return rc return wrap @@ -349,6 +349,8 @@ class TRexConsole(TRexGeneralCmd): self.stateless_client.cmd_start_line(line) + + def help_start(self): self.do_start("-h") diff --git a/scripts/stl/imix_1pkt_tuple_gen.yaml b/scripts/stl/imix_1pkt_tuple_gen.yaml new file mode 100644 index 00000000..78156e5c --- /dev/null +++ b/scripts/stl/imix_1pkt_tuple_gen.yaml @@ -0,0 +1,63 @@ +### Single stream UDP packet, 64B ### +##################################### +- name: udp_64B + stream: + self_start: True + packet: + binary: stl/udp_64B_no_crc.pcap # pcap should not include CRC + mode: + type: continuous + pps: 100 + rx_stats: [] + + # program that define 1M flows with IP range 16.0.0.1-16.0.0.254 + # we will create a script that do that for you + # this is the low level instructions + vm: [ + { + "type" : "tuple_flow_var", # name of the command + + "name" : "tuple_gen", # tuple_gen.ip tuple_gen.port can be used + + "ip_min" : 0x10000001, # min ip 16.0.0.1 + "ip_max" : 0x100000fe, # max ip 16.0.0.254 + + "port_min" : 1025, # min port 1025 + "port_max" : 65500, # max port 65500 + + "limit_flows" : 1000000, # number of flows + "flags" : 0, # 1 - for unlimited + }, + + { + "type" : "write_flow_var", # command name + + "name" : "tuple_gen.ip", # varible to write + + "add_value" : 0, # no need to add value + + "is_big_endian" : true, # write as big edian + + "pkt_offset" : 26, # write tuple_gen.ip into ipv4.src_ip + }, + + { + "type" : "fix_checksum_ipv4", # fix ipv4 header checksum + + "pkt_offset" : 14, # offset of ipv4 header + + }, + + { + "type" : "write_flow_var", # command name + + "name" : "tuple_gen.port", # varible to write + + "add_value" : 0, # no need to add value + + "is_big_endian" : true, # write as big edian + + "pkt_offset" : 34, # write tuple_gen.port into udp.src_port + } + + ] |