22 #include <ns3/core-module.h>
23 #include <ns3/network-module.h>
24 #include <ns3/mobility-module.h>
25 #include <ns3/lte-module.h>
26 #include <ns3/internet-module.h>
27 #include <ns3/applications-module.h>
28 #include <ns3/point-to-point-module.h>
58 : checkStartTime (
start),
60 checkInterval (interval),
61 ueDeviceIndex (ueIndex),
62 enbDeviceIndex (enbIndex)
94 std::list<CheckPointEvent> checkPointEventList,
95 std::string checkPointEventListName,
96 bool useUdp, std::string schedulerType,
97 std::string handoverAlgorithmType,
bool admitHo,
114 static std::string BuildNameString (uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers,
115 std::string checkPointEventListName,
116 bool useUdp, std::string schedulerType,
117 std::string handoverAlgorithmType,
bool admitHo,
119 virtual void DoRun (
void);
172 void SaveStats (uint32_t ueIndex);
177 void CheckStats (uint32_t ueIndex);
190 std::string checkPointEventListName,
191 bool useUdp, std::string schedulerType,
192 std::string handoverAlgorithmType,
bool admitHo,
195 std::ostringstream oss;
196 oss <<
"nEnbs=" << nEnbs
198 <<
" nDedicatedBearers=" << nDedicatedBearers
200 <<
" " << schedulerType
201 <<
" " << handoverAlgorithmType
202 <<
" admitHo=" << admitHo
203 <<
" hoList: " << checkPointEventListName;
206 oss <<
", ideal RRC";
216 std::list<CheckPointEvent> checkPointEventList,
217 std::string checkPointEventListName,
218 bool useUdp, std::string schedulerType,
219 std::string handoverAlgorithmType,
bool admitHo,
221 :
TestCase (BuildNameString (nEnbs, nUes, nDedicatedBearers,
222 checkPointEventListName, useUdp, schedulerType,
223 handoverAlgorithmType, admitHo, useIdealRrc)),
226 m_nDedicatedBearers (nDedicatedBearers),
227 m_checkPointEventList (checkPointEventList),
228 m_checkPointEventListName (checkPointEventListName),
231 m_schedulerType (schedulerType),
232 m_handoverAlgorithmType (handoverAlgorithmType),
234 m_useIdealRrc (useIdealRrc),
235 m_maxHoDuration (
Seconds (0.1)),
236 m_statsDuration (
Seconds (0.5)),
237 m_udpClientInterval (
Seconds (0.01)),
238 m_udpClientPktSize (100)
288 double distance = 1000.0;
298 m_epcHelper = CreateObject<PointToPointEpcHelper> ();
305 for (uint16_t i = 0; i <
m_nEnbs; i++)
307 Vector enbPosition (distance * (i + 1), 0, 0);
308 enbPositionAlloc->
Add (enbPosition);
313 enbMobility.
Install (enbNodes);
320 for (uint16_t i = 0; i <
m_nUes; i++)
330 it != enbDevices.
End ();
349 remoteHostContainer.
Create (1);
350 remoteHost = remoteHostContainer.
Get (0);
352 internet.
Install (remoteHostContainer);
362 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
365 remoteHostAddr = internetIpIfaces.
GetAddress (1);
388 uint16_t dlPort = 10000;
389 uint16_t ulPort = 20000;
399 for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
487 EpsBearer bearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT);
505 for (uint32_t u = 0; u < ueDevices.
GetN (); ++u)
521 const Time maxRrcConnectionEstablishmentDuration =
Seconds (0.080);
525 Simulator::Schedule (maxRrcConnectionEstablishmentDuration,
527 this, *it, enbDevices.
Get (0));
537 for (
Time checkPointTime = checkPointEventIt->checkStartTime;
538 checkPointTime < checkPointEventIt->checkStopTime;
539 checkPointTime += checkPointEventIt->checkInterval)
542 this, ueDevices.
Get (checkPointEventIt->ueDeviceIndex),
543 enbDevices.
Get (checkPointEventIt->enbDeviceIndex));
545 Time saveStatsTime = checkPointTime;
547 this, checkPointEventIt->ueDeviceIndex);
551 this, checkPointEventIt->ueDeviceIndex);
562 Simulator::Destroy ();
577 uint16_t rnti = ueRrc->GetRnti ();
583 NS_ASSERT_MSG (ueManagerState == UeManager::CONNECTED_NORMALLY,
"Wrong UeManager state!");
585 uint16_t ueCellId = ueRrc->GetCellId ();
586 uint16_t enbCellId = enbLteDevice->
GetCellId ();
587 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
589 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
591 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
592 uint8_t enbDlEarfcn = enbLteDevice->
GetDlEarfcn ();
593 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
594 uint8_t enbUlEarfcn = enbLteDevice->
GetUlEarfcn ();
595 uint64_t ueImsi = ueLteDevice->
GetImsi ();
596 uint64_t enbImsi = ueManager->
GetImsi ();
606 ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
610 ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
615 while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
616 && ueBearerIt != ueDataRadioBearerMapValue.
End ())
630 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (),
"too many bearers at eNB");
631 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.
End (),
"too many bearers at UE");
638 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
644 it->dlOldTotalRx = it->dlSink->GetTotalRx ();
648 it->ulOldTotalRx = it->ulSink->GetTotalRx ();
658 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
667 dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx;
672 ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;
676 NS_LOG_LOGIC (
"expBytes " << expectedBytes <<
" dlRx " << dlRx <<
" ulRx " << ulRx);
681 NS_TEST_ASSERT_MSG_GT (dlRx, 0.500 * expectedBytes,
"too few RX bytes in DL, ue=" << ueIndex <<
", b=" << b);
685 NS_TEST_ASSERT_MSG_GT (ulRx, 0.500 * expectedBytes,
"too few RX bytes in UL, ue=" << ueIndex <<
", b=" << b);
706 :
TestSuite (
"lte-x2-handover-measures", SYSTEM)
710 std::string cel1name (
"ho: 0 -> 1");
711 std::list<CheckPointEvent> cel1;
715 std::string cel2name (
"ho: 0 -> 1 -> 2");
716 std::list<CheckPointEvent> cel2;
721 std::string cel3name (
"ho: 0 -> 1 -> 2 -> 3");
722 std::list<CheckPointEvent> cel3;
730 std::string sched =
"ns3::PfFfMacScheduler";
731 std::string ho =
"ns3::A2A4RsrqHandoverAlgorithm";
732 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
735 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
736 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 1, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::QUICK);
737 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 2, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
738 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
739 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 1, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
740 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 2, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
741 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
742 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 1, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
743 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 2, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
746 sched =
"ns3::RrFfMacScheduler";
747 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
750 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
751 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
752 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
755 ho =
"ns3::A3RsrpHandoverAlgorithm";
756 sched =
"ns3::PfFfMacScheduler";
757 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
760 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
761 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
762 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
765 sched =
"ns3::RrFfMacScheduler";
766 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
769 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::QUICK);
770 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
771 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);