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 LteX2HandoverTestCase (uint32_t nUes, uint32_t nDedicatedBearers, std::list<HandoverEvent> handoverEventList, std::string handoverEventListName,
bool useUdp, std::string schedulerType,
bool admitHo,
bool useIdealRrc);
61 static std::string
BuildNameString (uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName,
bool useUdp, std::string schedulerType,
bool admitHo,
bool useIdealRrc);
62 virtual void DoRun (
void);
103 std::string
LteX2HandoverTestCase::BuildNameString (uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName,
bool useUdp, std::string schedulerType,
bool admitHo,
bool useIdealRrc)
105 std::ostringstream oss;
106 oss <<
" nUes=" << nUes
107 <<
" nDedicatedBearers=" << nDedicatedBearers
109 <<
" " << schedulerType
110 <<
" admitHo=" << admitHo
111 <<
" hoList: " << handoverEventListName;
114 oss <<
", ideal RRC";
123 LteX2HandoverTestCase::LteX2HandoverTestCase (uint32_t nUes, uint32_t nDedicatedBearers, std::list<HandoverEvent> handoverEventList, std::string handoverEventListName,
bool useUdp, std::string schedulerType,
bool admitHo,
bool useIdealRrc)
124 :
TestCase (BuildNameString (nUes, nDedicatedBearers, handoverEventListName, useUdp, schedulerType, admitHo, useIdealRrc)),
126 m_nDedicatedBearers (nDedicatedBearers),
127 m_handoverEventList (handoverEventList),
128 m_handoverEventListName (handoverEventListName),
131 m_schedulerType (schedulerType),
133 m_useIdealRrc (useIdealRrc),
134 m_maxHoDuration (
Seconds (0.1)),
135 m_statsDuration (
Seconds (0.5))
169 positionAlloc->Add (
Vector (-3000, 0, 0));
170 positionAlloc->Add (
Vector ( 3000, 0, 0));
171 for (uint16_t i = 0; i <
m_nUes; i++)
173 positionAlloc->Add (
Vector (0, 0, 0));
185 it != enbDevices.
End ();
204 remoteHostContainer.
Create (1);
205 remoteHost = remoteHostContainer.
Get (0);
207 internet.
Install (remoteHostContainer);
217 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
220 remoteHostAddr = internetIpIfaces.
GetAddress (1);
243 uint16_t dlPort = 10000;
244 uint16_t ulPort = 20000;
254 for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
277 clientApps.
Add (dlClientHelper.Install (remoteHost));
282 serverApps.
Add (sinkContainer);
293 serverApps.
Add (sinkContainer);
303 clientApps.
Add (dlClientHelper.
Install (remoteHost));
308 serverApps.
Add (sinkContainer);
320 serverApps.
Add (sinkContainer);
346 serverApps.
Start (startTime);
347 clientApps.
Start (startTime);
360 for (uint32_t u = 0; u < ueDevices.
GetN (); ++u)
376 const Time maxRrcConnectionEstablishmentDuration =
Seconds (0.080);
381 this, *it, enbDevices.
Get (0));
394 ueDevices.
Get (hoEventIt->ueDeviceIndex),
395 enbDevices.
Get (hoEventIt->sourceEnbDeviceIndex));
397 ueDevices.
Get (hoEventIt->ueDeviceIndex),
398 enbDevices.
Get (hoEventIt->sourceEnbDeviceIndex),
399 enbDevices.
Get (hoEventIt->targetEnbDeviceIndex));
404 ueDevices.
Get (hoEventIt->ueDeviceIndex),
405 enbDevices.
Get (
m_admitHo ? hoEventIt->targetEnbDeviceIndex : hoEventIt->sourceEnbDeviceIndex));
407 this, hoEventIt->ueDeviceIndex);
410 this, hoEventIt->ueDeviceIndex);
411 if (stopTime <= hoEndTime)
442 uint16_t rnti = ueRrc->GetRnti ();
450 uint16_t ueCellId = ueRrc->GetCellId ();
451 uint16_t enbCellId = enbLteDevice->GetCellId ();
452 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
453 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
454 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
455 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
456 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
457 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
458 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
459 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
460 uint64_t ueImsi = ueLteDevice->GetImsi ();
461 uint64_t enbImsi = ueManager->
GetImsi ();
471 ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
475 ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
480 while (enbBearerIt != enbDataRadioBearerMapValue.
End () &&
481 ueBearerIt != ueDataRadioBearerMapValue.End ())
495 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (),
"too many bearers at eNB");
496 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (),
"too many bearers at UE");
502 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
506 it->dlOldTotalRx = it->dlSink->GetTotalRx ();
507 it->ulOldTotalRx = it->ulSink->GetTotalRx ();
515 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
519 uint32_t dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx;
520 uint32_t ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;
524 NS_TEST_ASSERT_MSG_GT (dlRx, 0.500 * expectedBytes,
"too few RX bytes in DL, ue=" << ueIndex <<
", b=" << b);
525 NS_TEST_ASSERT_MSG_GT (ulRx, 0.500 * expectedBytes,
"too few RX bytes in UL, ue=" << ueIndex <<
", b=" << b);
575 std::string hel0name (
"none");
576 std::list<HandoverEvent> hel0;
578 std::string hel1name (
"1 fwd");
579 std::list<HandoverEvent> hel1;
580 hel1.push_back (ue1fwd);
582 std::string hel2name (
"1 fwd & bwd");
583 std::list<HandoverEvent> hel2;
584 hel2.push_back (ue1fwd);
585 hel2.push_back (ue1bwd);
587 std::string hel3name (
"1 fwd & bwd & fwd");
588 std::list<HandoverEvent> hel3;
589 hel3.push_back (ue1fwd);
590 hel3.push_back (ue1bwd);
591 hel3.push_back (ue1fwdagain);
593 std::string hel4name (
"1+2 fwd");
594 std::list<HandoverEvent> hel4;
595 hel4.push_back (ue1fwd);
596 hel4.push_back (ue2fwd);
598 std::string hel5name (
"1+2 fwd & bwd");
599 std::list<HandoverEvent> hel5;
600 hel5.push_back (ue1fwd);
601 hel5.push_back (ue1bwd);
602 hel5.push_back (ue2fwd);
603 hel5.push_back (ue2bwd);
605 std::string hel6name (
"2 fwd");
606 std::list<HandoverEvent> hel6;
607 hel6.push_back (ue2fwd);
609 std::string hel7name (
"2 fwd & bwd");
610 std::list<HandoverEvent> hel7;
611 hel7.push_back (ue2fwd);
612 hel7.push_back (ue2bwd);
614 std::vector<std::string> schedulers;
615 schedulers.push_back (
"ns3::RrFfMacScheduler");
616 schedulers.push_back (
"ns3::PfFfMacScheduler");
617 for (std::vector<std::string>::iterator schedIt = schedulers.begin (); schedIt != schedulers.end (); ++schedIt)
619 for (int32_t useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)