summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xVERSION2
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py11
-rwxr-xr-xscripts/automation/trex_control_plane/console/trex_console.py6
-rw-r--r--scripts/stl/imix_1pkt_tuple_gen.yaml63
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp28
-rw-r--r--src/rpc-server/commands/trex_rpc_cmds.h1
-rw-r--r--src/stateless/cp/trex_stream.cpp5
7 files changed, 110 insertions, 6 deletions
diff --git a/VERSION b/VERSION
index 1f7c07a0..a8d9f812 100755
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-v1.82-vm
+v1.83
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
+ }
+
+ ]
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index a1c3bb99..d8f7e772 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -176,6 +176,30 @@ TrexRpcCmdAddStream::parse_vm_instr_checksum(const Json::Value &inst, TrexStream
}
void
+TrexRpcCmdAddStream::parse_vm_instr_tuple_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result){
+
+
+ std::string flow_var_name = parse_string(inst, "name", result);
+
+ uint32_t ip_min = parse_uint32(inst, "ip_min", result);
+ uint32_t ip_max = parse_uint32(inst, "ip_max", result);
+ uint16_t port_min = parse_uint16(inst, "port_min", result);
+ uint16_t port_max = parse_uint16(inst, "port_max", result);
+ uint32_t limit_flows = parse_uint32(inst, "limit_flows", result);
+ uint16_t flags = parse_uint16(inst, "flags", result);
+
+ stream->m_vm.add_instruction(new StreamVmInstructionFlowClient(flow_var_name,
+ ip_min,
+ ip_max,
+ port_min,
+ port_max,
+ limit_flows,
+ flags
+ ));
+}
+
+
+void
TrexRpcCmdAddStream::parse_vm_instr_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result) {
std::string flow_var_name = parse_string(inst, "name", result);
@@ -229,7 +253,7 @@ TrexRpcCmdAddStream::parse_vm(const Json::Value &vm, TrexStream *stream, Json::V
for (int i = 0; i < vm.size(); i++) {
const Json::Value & inst = parse_object(vm, i, result);
- auto vm_types = {"fix_checksum_ipv4", "flow_var", "write_flow_var"};
+ auto vm_types = {"fix_checksum_ipv4", "flow_var", "write_flow_var","tuple_flow_var"};
std::string vm_type = parse_choice(inst, "type", vm_types, result);
// checksum instruction
@@ -242,6 +266,8 @@ TrexRpcCmdAddStream::parse_vm(const Json::Value &vm, TrexStream *stream, Json::V
} else if (vm_type == "write_flow_var") {
parse_vm_instr_write_flow_var(inst, stream, result);
+ } else if (vm_type == "tuple_flow_var") {
+ parse_vm_instr_tuple_flow_var(inst, stream, result);
} else {
/* internal error */
throw TrexRpcException("internal error");
diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h
index b9be1fbe..f4651d7b 100644
--- a/src/rpc-server/commands/trex_rpc_cmds.h
+++ b/src/rpc-server/commands/trex_rpc_cmds.h
@@ -95,6 +95,7 @@ void validate_stream(const TrexStream *stream, Json::Value &result);
void parse_vm(const Json::Value &vm, TrexStream *stream, Json::Value &result);
void parse_vm_instr_checksum(const Json::Value &inst, TrexStream *stream, Json::Value &result);
void parse_vm_instr_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result);
+void parse_vm_instr_tuple_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result);
void parse_vm_instr_write_flow_var(const Json::Value &inst, TrexStream *stream, Json::Value &result);
);
diff --git a/src/stateless/cp/trex_stream.cpp b/src/stateless/cp/trex_stream.cpp
index 72e72c7c..02f43a3a 100644
--- a/src/stateless/cp/trex_stream.cpp
+++ b/src/stateless/cp/trex_stream.cpp
@@ -68,8 +68,11 @@ TrexStream::compile() {
m_vm.compile();
- m_vm_dp = m_vm.cloneAsVmDp();
+ #if 0
+ m_vm.Dump(stdout);
+ #endif
+ m_vm_dp = m_vm.cloneAsVmDp();
/* calc m_vm_prefix_size which is the size of the writable packet */
uint16_t max_pkt_offset = m_vm_dp->get_max_packet_update_offset();