diff --git a/src/lte/test/lte-test-entities.cc b/src/lte/test/lte-test-entities.cc index 7de278df6..a2d818d5c 100644 --- a/src/lte/test/lte-test-entities.cc +++ b/src/lte/test/lte-test-entities.cc @@ -203,8 +203,26 @@ LteTestRrc::Start () p.rnti = 1111; p.lcid = 222; p.pdcpSdu = Create (m_pduSize); + + bool haveContext = false; + Ptr node; + if (m_device != 0) + { + node = m_device->GetNode (); + if (node != 0) + { + haveContext = true; + } + } + if (haveContext) + { + Simulator::ScheduleWithContext (node->GetId (), Seconds (0), &LtePdcpSapProvider::TransmitPdcpSdu, m_pdcpSapProvider, p); + } + else + { + Simulator::Schedule (Seconds (0), &LtePdcpSapProvider::TransmitPdcpSdu, m_pdcpSapProvider, p); + } - Simulator::ScheduleWithContext (m_device->GetNode ()->GetId (), Seconds (0), &LtePdcpSapProvider::TransmitPdcpSdu, m_pdcpSapProvider, p); m_nextPdu = Simulator::Schedule (m_arrivalTime, &LteTestRrc::Start, this); // Simulator::Run (); } @@ -456,7 +474,25 @@ void LteTestMac::SendTxOpportunity (Time time, uint32_t bytes) { NS_LOG_FUNCTION (this << time << bytes); - Simulator::ScheduleWithContext (m_device->GetNode ()->GetId (), time, &LteMacSapUser::NotifyTxOpportunity, m_macSapUser, bytes, 0, 0); + bool haveContext = false; + Ptr node; + if (m_device != 0) + { + node = m_device->GetNode (); + if (node != 0) + { + haveContext = true; + } + } + if (haveContext) + { + Simulator::ScheduleWithContext (node->GetId (), time, &LteMacSapUser::NotifyTxOpportunity, m_macSapUser, bytes, 0, 0); + } + else + { + Simulator::Schedule (time, &LteMacSapUser::NotifyTxOpportunity, m_macSapUser, bytes, 0, 0); + } + if (m_txOpportunityMode == RANDOM_MODE) { if (m_txOppTime != Seconds (0)) diff --git a/src/lte/test/lte-test-rlc-am-transmitter.cc b/src/lte/test/lte-test-rlc-am-transmitter.cc index 85cc9450b..73cce4edf 100644 --- a/src/lte/test/lte-test-rlc-am-transmitter.cc +++ b/src/lte/test/lte-test-rlc-am-transmitter.cc @@ -139,6 +139,7 @@ LteRlcAmTransmitterOneSduTestCase::DoRun (void) txMac->SendTxOpportunity (Seconds (0.150), 30); CheckDataReceived (Seconds (0.200), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "SDU is not OK"); + Simulator::Stop (Seconds (0.3)); Simulator::Run (); Simulator::Destroy (); } @@ -181,6 +182,7 @@ LteRlcAmTransmitterSegmentationTestCase::DoRun (void) txMac->SendTxOpportunity (Seconds (0.450), 7); CheckDataReceived (Seconds (0.500), "YZZ", "Segment #4 is not OK"); + Simulator::Stop (Seconds (0.6)); Simulator::Run (); Simulator::Destroy (); } @@ -217,6 +219,7 @@ LteRlcAmTransmitterConcatenationTestCase::DoRun (void) txMac->SendTxOpportunity (Seconds (0.250), 33); CheckDataReceived (Seconds (0.300), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "Concatenation is not OK"); + Simulator::Stop (Seconds (0.4)); Simulator::Run (); Simulator::Destroy (); } @@ -293,6 +296,7 @@ LteRlcAmTransmitterReportBufferStatusTestCase::DoRun (void) txMac->SendTxOpportunity (Seconds (1.650), (4+2+1+2) + (3+10+10+7)); CheckDataReceived (Seconds (1.700), "XYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "SDU #9 is not OK"); + Simulator::Stop (Seconds (2)); Simulator::Run (); Simulator::Destroy (); }