summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py5
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp3
-rw-r--r--src/rpc-server/commands/trex_rpc_cmds.h2
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp4
-rw-r--r--src/stateless/cp/trex_stateless_port.h2
-rw-r--r--src/stateless/cp/trex_streams_compiler.cpp4
-rw-r--r--src/stateless/cp/trex_streams_compiler.h3
7 files changed, 13 insertions, 10 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 9e1c7cf3..8231fe33 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -264,7 +264,7 @@ class CTRexStatelessClient(object):
if isinstance(port_id, list) or isinstance(port_id, set):
# handle as batch mode
port_ids = set(port_id) # convert to set to avoid duplications
- commands = [RpcCmdData("start_traffic", {"handler": self._conn_handler.get(p_id), "port_id": p_id})
+ commands = [RpcCmdData("start_traffic", {"handler": self._conn_handler.get(p_id), "port_id": p_id, "mul": 1.0})
for p_id in port_ids]
rc, resp_list = self.transmit_batch(commands)
if rc:
@@ -272,7 +272,8 @@ class CTRexStatelessClient(object):
success_test=self.ack_success_test)
else:
params = {"handler": self._conn_handler.get(port_id),
- "port_id": port_id}
+ "port_id": port_id,
+ "mul": 1.0}
command = RpcCmdData("start_traffic", params)
return self._handle_start_traffic_response(command,
self.transmit(command.method, command.params),
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index 634f7ddb..9854cad7 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -432,6 +432,7 @@ trex_rpc_cmd_rc_e
TrexRpcCmdStartTraffic::_run(const Json::Value &params, Json::Value &result) {
uint8_t port_id = parse_byte(params, "port_id", result);
+ double mul = parse_double(params, "mul", result);
if (port_id >= get_stateless_obj()->get_port_count()) {
std::stringstream ss;
@@ -441,7 +442,7 @@ TrexRpcCmdStartTraffic::_run(const Json::Value &params, Json::Value &result) {
TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);
- TrexStatelessPort::rc_e rc = port->start_traffic();
+ TrexStatelessPort::rc_e rc = port->start_traffic(mul);
if (rc == TrexStatelessPort::RC_OK) {
result["result"] = "ACK";
diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h
index 5926a8d8..51db3f40 100644
--- a/src/rpc-server/commands/trex_rpc_cmds.h
+++ b/src/rpc-server/commands/trex_rpc_cmds.h
@@ -102,7 +102,7 @@ TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStreamList, "get_stream_list", 1, true);
TREX_RPC_CMD_DEFINE(TrexRpcCmdGetStream, "get_stream", 2, true);
-TREX_RPC_CMD_DEFINE(TrexRpcCmdStartTraffic, "start_traffic", 1, true);
+TREX_RPC_CMD_DEFINE(TrexRpcCmdStartTraffic, "start_traffic", 2, true);
TREX_RPC_CMD_DEFINE(TrexRpcCmdStopTraffic, "stop_traffic", 1, true);
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index feea5ed5..a0b57b63 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -53,7 +53,7 @@ TrexStatelessPort::TrexStatelessPort(uint8_t port_id) : m_port_id(port_id) {
*
*/
TrexStatelessPort::rc_e
-TrexStatelessPort::start_traffic(void) {
+TrexStatelessPort::start_traffic(double mul) {
if (m_port_state != PORT_STATE_UP_IDLE) {
return (RC_ERR_BAD_STATE_FOR_OP);
@@ -69,7 +69,7 @@ TrexStatelessPort::start_traffic(void) {
/* compiler it */
TrexStreamsCompiler compiler;
- TrexStreamsCompiledObj *compiled_obj = new TrexStreamsCompiledObj(m_port_id);
+ TrexStreamsCompiledObj *compiled_obj = new TrexStreamsCompiledObj(m_port_id, mul);
bool rc = compiler.compile(streams, *compiled_obj);
if (!rc) {
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 4851a4b5..79bde01b 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -56,7 +56,7 @@ public:
* start traffic
*
*/
- rc_e start_traffic(void);
+ rc_e start_traffic(double mul);
/**
* stop traffic
diff --git a/src/stateless/cp/trex_streams_compiler.cpp b/src/stateless/cp/trex_streams_compiler.cpp
index 2e544995..5e2602ec 100644
--- a/src/stateless/cp/trex_streams_compiler.cpp
+++ b/src/stateless/cp/trex_streams_compiler.cpp
@@ -26,7 +26,7 @@ limitations under the License.
/**************************************
* stream compiled object
*************************************/
-TrexStreamsCompiledObj::TrexStreamsCompiledObj(uint8_t port_id) : m_port_id(port_id) {
+TrexStreamsCompiledObj::TrexStreamsCompiledObj(uint8_t port_id, double mul) : m_port_id(port_id), m_mul(mul) {
}
TrexStreamsCompiledObj::~TrexStreamsCompiledObj() {
@@ -41,7 +41,7 @@ TrexStreamsCompiledObj::add_compiled_stream(double pps, uint8_t *pkt, uint16_t p
obj_st obj;
obj.m_port_id = m_port_id;
- obj.m_pps = pps;
+ obj.m_pps = pps * m_mul;
obj.m_pkt_len = pkt_len;
obj.m_pkt = new uint8_t[pkt_len];
diff --git a/src/stateless/cp/trex_streams_compiler.h b/src/stateless/cp/trex_streams_compiler.h
index 82318dec..06f992ed 100644
--- a/src/stateless/cp/trex_streams_compiler.h
+++ b/src/stateless/cp/trex_streams_compiler.h
@@ -36,7 +36,7 @@ class TrexStreamsCompiledObj {
friend class TrexStreamsCompiler;
public:
- TrexStreamsCompiledObj(uint8_t port_id);
+ TrexStreamsCompiledObj(uint8_t port_id, double m_mul);
~TrexStreamsCompiledObj();
struct obj_st {
@@ -55,6 +55,7 @@ private:
std::vector<obj_st> m_objs;
uint8_t m_port_id;
+ double m_mul;
};
class TrexStreamsCompiler {