summaryrefslogtreecommitdiffstats
path: root/src/rpc-server
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-09-25 18:45:04 +0300
committerimarom <imarom@cisco.com>2016-09-25 18:45:04 +0300
commitf6d11f9e01e39fe2688558c7598f22ce9feb35da (patch)
tree672f5e4c5010484569edbbe8b29c4c03b2cd7ef4 /src/rpc-server
parentd94e6a00edc22a1dd4946b3603aebb29319ce5ce (diff)
merge issues with rand limit
Diffstat (limited to 'src/rpc-server')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp12
1 files changed, 10 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 3afa2457..bf48931a 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -312,6 +312,10 @@ TrexRpcCmdAddStream::check_min_max(uint8_t flow_var_size,
uint64_t max_value,
Json::Value &result){
+ if (step == 0) {
+ generate_parse_err(result, "VM: step cannot be 0");
+ }
+
if (max_value < min_value ) {
std::stringstream ss;
ss << "VM: request flow var variable '" << max_value << "' is smaller than " << min_value;
@@ -341,6 +345,7 @@ TrexRpcCmdAddStream::check_min_max(uint8_t flow_var_size,
generate_parse_err(result, ss.str());
}
}
+
}
void
@@ -360,11 +365,11 @@ TrexRpcCmdAddStream::parse_vm_instr_flow_var_rand_limit(const Json::Value &inst,
generate_parse_err(result, ss.str());
}
- check_min_max(flow_var_size, 0, 0, min_value, max_value, result);
+ check_min_max(flow_var_size, 0, 1, min_value, max_value, result);
stream->m_vm.add_instruction(new StreamVmInstructionFlowRandLimit(flow_var_name,
flow_var_size,
- (int)limit,
+ limit,
min_value,
max_value,
seed)
@@ -400,6 +405,9 @@ TrexRpcCmdAddStream::parse_vm_instr_flow_var(const Json::Value &inst, std::uniqu
check_min_max(flow_var_size, init_value, step, min_value, max_value, result);
+ /* implicit range padding if possible */
+ handle_range_padding(max_value,min_value,step, op_type, result);
+
stream->m_vm.add_instruction(new StreamVmInstructionFlowMan(flow_var_name,
flow_var_size,
op_type,