summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-11-19 09:08:28 +0200
committerHanoh Haim <hhaim@cisco.com>2015-11-19 09:08:28 +0200
commita2625fbfa24a812b950c1a95ef067e6fa169a3cf (patch)
tree9d8cf199af0912f17011703425b8a747a97435f1
parent0e8c9ae666d61897cb405c469a71be09d54a649b (diff)
add a test for stream program
-rw-r--r--.gitignore2
-rw-r--r--scripts/exp/stl_simple_prog1-0-ex.erfbin0 -> 880 bytes
-rw-r--r--src/gtest/trex_stateless_gtest.cpp63
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp7
4 files changed, 69 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index e35015d6..2f3d1759 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,8 @@ scripts/exp/stl_multi_pkt2-0.erf
scripts/exp/stl_single_pkt_burst1-0.erf
scripts/exp/stl_single_sctp_pkt-0.erf
scripts/exp/stl_single_stream-0.erf
+scripts/exp/stl_simple_prog1-0.erf
+
*.pyc
diff --git a/scripts/exp/stl_simple_prog1-0-ex.erf b/scripts/exp/stl_simple_prog1-0-ex.erf
new file mode 100644
index 00000000..374256c2
--- /dev/null
+++ b/scripts/exp/stl_simple_prog1-0-ex.erf
Binary files differ
diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp
index 46fe22d3..cf80a50c 100644
--- a/src/gtest/trex_stateless_gtest.cpp
+++ b/src/gtest/trex_stateless_gtest.cpp
@@ -225,6 +225,69 @@ TEST_F(basic_stl, load_pcap_file) {
}
+
+TEST_F(basic_stl, simple_prog1) {
+
+ CBasicStl t1;
+ CParserOption * po =&CGlobalInfo::m_options;
+ po->preview.setVMode(7);
+ po->preview.setFileWrite(true);
+ po->out_file ="exp/stl_simple_prog1";
+
+ TrexStreamsCompiler compile;
+
+
+ std::vector<TrexStream *> streams;
+
+ /* stream1 */
+ TrexStream * stream1 = new TrexStream(TrexStream::stSINGLE_BURST, 0,100);
+ stream1->set_pps(1.0);
+ stream1->set_single_burst(5);
+ stream1->m_enabled = true;
+ stream1->m_self_start = true;
+ stream1->m_next_stream_id=200;
+
+ CPcapLoader pcap;
+ pcap.load_pcap_file("cap2/udp_64B.pcap",0);
+ pcap.update_ip_src(0x10000001);
+ pcap.clone_packet_into_stream(stream1);
+
+ streams.push_back(stream1);
+
+
+ /* stream1 */
+
+ TrexStream * stream2 = new TrexStream(TrexStream::stSINGLE_BURST, 0,200);
+ stream2->set_pps(1.0);
+ stream2->set_single_burst(5);
+ stream2->m_enabled = true;
+ stream2->m_self_start = false;
+
+ pcap.load_pcap_file("cap2/udp_64B.pcap",0);
+ pcap.update_ip_src(0x10000002);
+ pcap.clone_packet_into_stream(stream2);
+ streams.push_back(stream2);
+
+
+ TrexStreamsCompiledObj comp_obj(0,1.0);
+
+ EXPECT_TRUE(compile.compile(streams, comp_obj) );
+
+ TrexStatelessDpStart * lpstart = new TrexStatelessDpStart( comp_obj.clone(), 10.0 );
+
+
+ t1.m_msg = lpstart;
+
+ bool res=t1.init();
+
+ delete stream1 ;
+ delete stream2 ;
+
+ EXPECT_EQ_UINT32(1, res?1:0)<< "pass";
+}
+
+
+
TEST_F(basic_stl, single_pkt_burst1) {
CBasicStl t1;
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 640fdb4d..c4fdd44b 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -435,9 +435,10 @@ TrexStatelessDpCore::add_cont_stream(TrexStatelessDpPerPort * lp_port,
lp_port->m_active_nodes.push_back(one_stream);
- /* schedule */
- m_core->m_node_gen.add_node((CGenNode *)node);
-
+ /* schedule only if active */
+ if (node->m_state == CGenNodeStateless::ss_ACTIVE) {
+ m_core->m_node_gen.add_node((CGenNode *)node);
+ }
}
void