summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-19 13:01:39 +0200
committerimarom <imarom@cisco.com>2015-11-19 13:01:39 +0200
commitf3d60d71ccd9275ac42b7c9dc619cc6797e1fb12 (patch)
tree794882ccfc100a276642f97b357c7b3757e94e2e /src
parent76248b13906f575f709ed2270d63ec41131f4bdf (diff)
parent9c69a86ed94732196c2b62209f61da783cda1386 (diff)
Merge branch 'master' of csi-sceasr-b45:/auto/proj-pcube-b/apps/PL-b/tools/repo//trex-core
Diffstat (limited to 'src')
-rw-r--r--src/gtest/trex_stateless_gtest.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/gtest/trex_stateless_gtest.cpp b/src/gtest/trex_stateless_gtest.cpp
index 65bafe83..432c7382 100644
--- a/src/gtest/trex_stateless_gtest.cpp
+++ b/src/gtest/trex_stateless_gtest.cpp
@@ -225,6 +225,89 @@ TEST_F(basic_stl, load_pcap_file) {
+TEST_F(basic_stl, simple_prog4) {
+
+ CBasicStl t1;
+ CParserOption * po =&CGlobalInfo::m_options;
+ po->preview.setVMode(7);
+ po->preview.setFileWrite(true);
+ po->out_file ="exp/stl_simple_prog4";
+
+ TrexStreamsCompiler compile;
+
+
+ std::vector<TrexStream *> streams;
+
+
+ /* stream0 */
+ TrexStream * stream0 = new TrexStream(TrexStream::stCONTINUOUS, 0,300);
+ stream0->set_pps(1.0);
+ stream0->m_enabled = true;
+ stream0->m_self_start = true;
+
+ CPcapLoader pcap;
+ pcap.load_pcap_file("cap2/udp_64B.pcap",0);
+ pcap.update_ip_src(0x10000000);
+ pcap.clone_packet_into_stream(stream0);
+ streams.push_back(stream0);
+
+
+ /* 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;
+
+ 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::stMULTI_BURST, 0,200);
+ stream2->set_pps(1.0);
+ stream2->m_isg_usec = 1000000; /*time betwean stream 1 to stream 2 */
+ stream2->m_enabled = true;
+ stream2->m_self_start = false;
+ stream2->set_multi_burst(5,
+ 3,
+ 2000000.0);
+
+ // next stream is 100 - loop
+ stream2->m_next_stream_id=100;
+
+
+ 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(), 20.0 );
+
+
+ t1.m_msg = lpstart;
+
+ bool res=t1.init();
+
+ delete stream0 ;
+ delete stream1 ;
+ delete stream2 ;
+
+ EXPECT_EQ_UINT32(1, res?1:0)<< "pass";
+}
+
+
+
TEST_F(basic_stl, simple_prog3) {
CBasicStl t1;