summaryrefslogtreecommitdiffstats
path: root/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
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/rpc-server/commands/trex_rpc_cmd_stream.cpp
parent9c225132ef8dcbb6dff9aa0221a5b76328a7f75f (diff)
add tuple gen command and yaml example
Diffstat (limited to 'src/rpc-server/commands/trex_rpc_cmd_stream.cpp')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp28
1 files changed, 27 insertions, 1 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");