summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-12-16 20:54:04 +0200
committerHanoh Haim <hhaim@cisco.com>2015-12-16 20:54:04 +0200
commit3f6e247e9ed29e9dbf61dffadfb2a86c2284987e (patch)
tree37d6f894ba5714fc261090f318959f076c1fe4ca /src
parent9c225132ef8dcbb6dff9aa0221a5b76328a7f75f (diff)
add tuple gen command and yaml example
Diffstat (limited to 'src')
-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
3 files changed, 32 insertions, 2 deletions
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();