summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-09-05 10:32:08 +0300
committerimarom <imarom@cisco.com>2016-09-07 14:02:57 +0300
commit0d4c9932591a46d5e2398dd1049001e107130f44 (patch)
tree71bbf0b7f287d721459132cefc91c104b989e4ef
parentd508420652d613fdc87f6af746fd1372cd2ae7d2 (diff)
dual mode : code review fixes
-rw-r--r--scripts/automation/regression/stateless_tests/stl_client_test.py23
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py10
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py2
-rwxr-xr-xsrc/common/erf.cpp2
-rwxr-xr-xsrc/common/pcap.h4
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_general.cpp11
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp4
-rw-r--r--src/stateless/dp/trex_stream_node.h1
8 files changed, 41 insertions, 16 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_client_test.py b/scripts/automation/regression/stateless_tests/stl_client_test.py
index 1984e49d..22fd99ed 100644
--- a/scripts/automation/regression/stateless_tests/stl_client_test.py
+++ b/scripts/automation/regression/stateless_tests/stl_client_test.py
@@ -323,3 +323,26 @@ class STLClient_Test(CStlGeneral_Test):
except STLError as e:
assert False , '{0}'.format(e)
+
+
+ def test_pcap_remote (self):
+ try:
+ master = self.tx_port
+ slave = master ^ 0x1
+
+ self.c.reset(ports = [master, slave])
+ self.c.clear_stats()
+ self.c.push_remote('pcap_dual_test.erf',
+ ports = [master],
+ ipg_usec = 100,
+ is_dual = True)
+ self.c.wait_on_traffic(ports = [0])
+
+ stats = self.c.get_stats()
+
+ self.verify(stats[master]['opackets'], 52)
+ self.verify(stats[slave]['opackets'], 48)
+
+ except STLError as e:
+ assert False , '{0}'.format(e)
+
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index 5664343a..12a69c56 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -753,7 +753,13 @@ class STLClient(object):
# for dual, provide the slave handler as well
slave_handler = self.ports[port_id ^ 0x1].handler if is_dual else ""
- rc.add(self.ports[port_id].push_remote(pcap_filename, ipg_usec, speedup, count, duration, is_dual, slave_handler))
+ rc.add(self.ports[port_id].push_remote(pcap_filename,
+ ipg_usec,
+ speedup,
+ count,
+ duration,
+ is_dual,
+ slave_handler))
return rc
@@ -2245,7 +2251,7 @@ class STLClient(object):
raise STLError("dual mode: cannot provide adjacent ports ({0}, {1}) in a batch".format(master, slave))
if not slave in self.get_acquired_ports():
- raise STLError("dual mode: port {0} must be owned as well".format(slave))
+ raise STLError("dual mode: adjacent port {0} must be owned during dual mode".format(slave))
self.logger.pre_cmd("Pushing remote PCAP on port(s) {0}:".format(ports))
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
index 779f35db..e1de6b55 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/parsing_opts.py
@@ -39,7 +39,7 @@ REMOTE_FILE = 23
LOCKED = 24
PIN_CORES = 25
CORE_MASK = 26
-DUAL = 28
+DUAL = 27
GLOBAL_STATS = 50
PORT_STATS = 51
diff --git a/src/common/erf.cpp b/src/common/erf.cpp
index c4c14998..ae256a6b 100755
--- a/src/common/erf.cpp
+++ b/src/common/erf.cpp
@@ -450,7 +450,7 @@ bool CErfFileReader::ReadPacket(CCapPktRaw * lpPacket){
&interface);
if ( length >0 ) {
lpPacket->pkt_len =(uint16_t)length;
- lpPacket->pkt_cnt++;
+ lpPacket->pkt_cnt++;
lpPacket->setInterface(interface);
return (true);
}
diff --git a/src/common/pcap.h b/src/common/pcap.h
index 01c981d7..3f8dfd21 100755
--- a/src/common/pcap.h
+++ b/src/common/pcap.h
@@ -69,7 +69,7 @@ public:
*
* @return bool
*/
- bool isValid() { return m_is_valid; }
+ bool isValid() { return m_is_valid; }
/**
* Fill the structure with the new packet.
@@ -78,7 +78,7 @@ public:
* @return bool - return true if packet were read and false
* otherwise (reached eof)
*/
- virtual bool ReadPacket(CCapPktRaw *lpPacket);
+ virtual bool ReadPacket(CCapPktRaw *lpPacket);
virtual void Rewind();
diff --git a/src/rpc-server/commands/trex_rpc_cmd_general.cpp b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
index 85f77a7f..342ec594 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_general.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
@@ -519,21 +519,12 @@ TrexRpcCmdPushRemote::_run(const Json::Value &params, Json::Value &result) {
TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);
+ /* for dual mode - make sure slave_handler matches */
if (is_dual) {
TrexStatelessPort *slave = get_stateless_obj()->get_port_by_id(port_id ^ 0x1);
-
if (!slave->get_owner().verify(slave_handler)) {
generate_execute_err(result, "incorrect or missing slave port handler");
}
-
- std::stringstream ss;
- CCapReaderBase *reader = CCapReaderFactory::CreateReader((char *)pcap_filename.c_str(), 0, ss);
- if (!reader) {
- generate_execute_err(result, ss.str());
- }
- if (reader->get_type() != ERF) {
- generate_execute_err(result, "dual mode is only supported on ERF format");
- }
}
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 5162c477..58410fea 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -509,6 +509,10 @@ TrexStatelessPort::push_remote(const std::string &pcap_filename,
if (!reader) {
throw TrexException(ss.str());
}
+
+ if ( (is_dual) && (reader->get_type() != ERF) ) {
+ throw TrexException("dual mode is only supported on ERF format");
+ }
delete reader;
/* only one core gets to play */
diff --git a/src/stateless/dp/trex_stream_node.h b/src/stateless/dp/trex_stream_node.h
index b4910fce..5da10d4b 100644
--- a/src/stateless/dp/trex_stream_node.h
+++ b/src/stateless/dp/trex_stream_node.h
@@ -510,6 +510,7 @@ public:
}
}
+ /* for dual mode - choose the right interface (even or odd) */
if (is_dual()) {
uint8_t dir = m_raw_packet->getInterface() & 0x1;
set_mbuf_dir(dir);