21 #include "ns3/simulator.h"
24 #include "ns3/lte-rlc-header.h"
25 #include "ns3/lte-rlc-am.h"
27 #include "lte-test-rlc-am-transmitter.h"
28 #include "lte-test-entities.h"
40 :
TestSuite (
"lte-rlc-am-transmitter", SYSTEM)
55 LteRlcAmTransmitterTestCase::LteRlcAmTransmitterTestCase (std::string name)
60 LteRlcAmTransmitterTestCase::~LteRlcAmTransmitterTestCase ()
82 txPdcp = CreateObject<LteTestPdcp> ();
85 txRlc = CreateObject<LteRlcAm> ();
86 txRlc->SetRnti (rnti);
87 txRlc->SetLcId (lcid);
90 txMac = CreateObject<LteTestMac> ();
91 txMac->SetRlcHeaderType (LteTestMac::AM_RLC_HEADER);
94 txPdcp->SetLteRlcSapProvider (txRlc->GetLteRlcSapProvider ());
95 txRlc->SetLteRlcSapUser (txPdcp->GetLteRlcSapUser ());
97 txRlc->SetLteMacSapProvider (txMac->GetLteMacSapProvider ());
98 txMac->SetLteMacSapUser (txRlc->GetLteMacSapUser ());
103 LteRlcAmTransmitterTestCase::CheckDataReceived (
Time time, std::string shouldReceived, std::string assertMsg)
105 Simulator::Schedule (time, &LteRlcAmTransmitterTestCase::DoCheckDataReceived,
this, shouldReceived, assertMsg);
109 LteRlcAmTransmitterTestCase::DoCheckDataReceived (std::string shouldReceived, std::string assertMsg)
111 NS_TEST_ASSERT_MSG_EQ (shouldReceived, txMac->GetDataReceived (), assertMsg);
118 LteRlcAmTransmitterOneSduTestCase::LteRlcAmTransmitterOneSduTestCase (std::string name)
123 LteRlcAmTransmitterOneSduTestCase::~LteRlcAmTransmitterOneSduTestCase ()
138 txPdcp->SendData (
Seconds (0.100),
"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
140 txMac->SendTxOpportunity (
Seconds (0.150), 30);
141 CheckDataReceived (
Seconds (0.200),
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"SDU is not OK");
150 LteRlcAmTransmitterSegmentationTestCase::LteRlcAmTransmitterSegmentationTestCase (std::string name)
155 LteRlcAmTransmitterSegmentationTestCase::~LteRlcAmTransmitterSegmentationTestCase ()
170 txPdcp->SendData (
Seconds (0.100),
"ABCDEFGHIJKLMNOPQRSTUVWXYZZ");
173 txMac->SendTxOpportunity (
Seconds (0.150), 12);
174 CheckDataReceived (
Seconds (0.200),
"ABCDEFGH",
"Segment #1 is not OK");
176 txMac->SendTxOpportunity (
Seconds (0.250), 12);
177 CheckDataReceived (
Seconds (0.300),
"IJKLMNOP",
"Segment #2 is not OK");
179 txMac->SendTxOpportunity (
Seconds (0.350), 12);
180 CheckDataReceived (
Seconds (0.400),
"QRSTUVWX",
"Segment #3 is not OK");
182 txMac->SendTxOpportunity (
Seconds (0.450), 7);
183 CheckDataReceived (
Seconds (0.500),
"YZZ",
"Segment #4 is not OK");
192 LteRlcAmTransmitterConcatenationTestCase::LteRlcAmTransmitterConcatenationTestCase (std::string name)
197 LteRlcAmTransmitterConcatenationTestCase::~LteRlcAmTransmitterConcatenationTestCase ()
212 txPdcp->SendData (
Seconds (0.100),
"ABCDEFGH");
213 txPdcp->SendData (
Seconds (0.150),
"IJKLMNOPQR");
214 txPdcp->SendData (
Seconds (0.200),
"STUVWXYZ");
218 txMac->SendTxOpportunity (
Seconds (0.250), 33);
219 CheckDataReceived (
Seconds (0.300),
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"Concatenation is not OK");
228 LteRlcAmTransmitterReportBufferStatusTestCase::LteRlcAmTransmitterReportBufferStatusTestCase (std::string name)
233 LteRlcAmTransmitterReportBufferStatusTestCase::~LteRlcAmTransmitterReportBufferStatusTestCase ()
250 txPdcp->SendData (
Seconds (0.100),
"ABCDEFGHIJ");
251 txPdcp->SendData (
Seconds (0.150),
"KLMNOPQRS");
252 txPdcp->SendData (
Seconds (0.200),
"TUVWXYZ");
254 txMac->SendTxOpportunity (
Seconds (0.250), (4+2) + (10+6));
255 CheckDataReceived (
Seconds (0.300),
"ABCDEFGHIJKLMNOP",
"SDU #1 is not OK");
257 txPdcp->SendData (
Seconds (0.350),
"ABCDEFGH");
258 txPdcp->SendData (
Seconds (0.400),
"IJKLMNOPQRST");
259 txPdcp->SendData (
Seconds (0.450),
"UVWXYZ");
261 txMac->SendTxOpportunity (
Seconds (0.500), 4 + 3);
262 CheckDataReceived (
Seconds (0.550),
"QRS",
"SDU #2 is not OK");
264 txPdcp->SendData (
Seconds (0.600),
"ABCDEFGH");
265 txPdcp->SendData (
Seconds (0.650),
"IJKLMNOPQRST");
266 txPdcp->SendData (
Seconds (0.700),
"UVWXYZ");
268 txPdcp->SendData (
Seconds (0.750),
"ABCDEFGHIJ");
269 txPdcp->SendData (
Seconds (0.800),
"KLMNOPQRST");
270 txPdcp->SendData (
Seconds (0.850),
"UVWXYZ");
272 txMac->SendTxOpportunity (
Seconds (0.900), 4 + 7);
273 CheckDataReceived (
Seconds (0.950),
"TUVWXYZ",
"SDU #3 is not OK");
275 txMac->SendTxOpportunity (
Seconds (1.000), (4+2) + (8+2));
276 CheckDataReceived (
Seconds (1.050),
"ABCDEFGHIJ",
"SDU #4 is not OK");
278 txPdcp->SendData (
Seconds (1.100),
"ABCDEFGHIJ");
279 txPdcp->SendData (
Seconds (1.150),
"KLMNOPQRSTU");
280 txPdcp->SendData (
Seconds (1.200),
"VWXYZ");
282 txMac->SendTxOpportunity (
Seconds (1.250), 4 + 3);
283 CheckDataReceived (
Seconds (1.300),
"KLM",
"SDU #5 is not OK");
285 txMac->SendTxOpportunity (
Seconds (1.350), 4 + 3);
286 CheckDataReceived (
Seconds (1.400),
"NOP",
"SDU #6 is not OK");
288 txMac->SendTxOpportunity (
Seconds (1.450), 4 + 4);
289 CheckDataReceived (
Seconds (1.500),
"QRST",
"SDU #7 is not OK");
291 txMac->SendTxOpportunity (
Seconds (1.550), (4+2+1+2+1+2+1) + (6+8+12+6+10+10+3));
292 CheckDataReceived (
Seconds (1.600),
"UVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW",
"SDU #8 is not OK");
294 txMac->SendTxOpportunity (
Seconds (1.650), (4+2+1+2) + (3+10+10+7));
295 CheckDataReceived (
Seconds (1.700),
"XYZABCDEFGHIJKLMNOPQRSTUVWXYZ",
"SDU #9 is not OK");
#define NS_LOG_COMPONENT_DEFINE(name)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
virtual void DoRun(void)
Implementation to actually run this test case.
static void EnablePrinting(void)
virtual void DoRun(void)
Implementation to actually run this test case.
static void Destroy(void)
virtual void DoRun(void)
Implementation to actually run this test case.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
virtual void DoRun(void)
Implementation to actually run this test case.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
LteRlcAmTransmitterTestSuite()
virtual void DoRun(void)
Implementation to actually run this test case.