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);
105 std::string
LteX2HandoverTestCase::BuildNameString (uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName,
bool useUdp, std::string schedulerType,
bool admitHo,
bool useIdealRrc)
107 std::ostringstream oss;
108 oss <<
" nUes=" << nUes
109 <<
" nDedicatedBearers=" << nDedicatedBearers
111 <<
" " << schedulerType
112 <<
" admitHo=" << admitHo
113 <<
" hoList: " << handoverEventListName;
116 oss <<
", ideal RRC";
125 LteX2HandoverTestCase::LteX2HandoverTestCase (uint32_t nUes, uint32_t nDedicatedBearers, std::list<HandoverEvent> handoverEventList, std::string handoverEventListName,
bool useUdp, std::string schedulerType,
bool admitHo,
bool useIdealRrc)
126 :
TestCase (BuildNameString (nUes, nDedicatedBearers, handoverEventListName, useUdp, schedulerType, admitHo, useIdealRrc)),
128 m_nDedicatedBearers (nDedicatedBearers),
129 m_handoverEventList (handoverEventList),
130 m_handoverEventListName (handoverEventListName),
133 m_schedulerType (schedulerType),
135 m_useIdealRrc (useIdealRrc),
136 m_maxHoDuration (Seconds (0.1)),
137 m_statsDuration (Seconds (0.1)),
138 m_udpClientInterval (Seconds (0.01)),
139 m_udpClientPktSize (100)
174 positionAlloc->Add (
Vector (-3000, 0, 0));
175 positionAlloc->Add (
Vector ( 3000, 0, 0));
176 for (uint16_t i = 0; i <
m_nUes; i++)
178 positionAlloc->Add (
Vector (0, 0, 0));
190 it != enbDevices.
End ();
209 remoteHostContainer.
Create (1);
210 remoteHost = remoteHostContainer.
Get (0);
212 internet.
Install (remoteHostContainer);
222 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
225 remoteHostAddr = internetIpIfaces.
GetAddress (1);
248 uint16_t dlPort = 10000;
249 uint16_t ulPort = 20000;
259 for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
282 clientApps.
Add (dlClientHelper.Install (remoteHost));
287 serverApps.
Add (sinkContainer);
298 serverApps.
Add (sinkContainer);
308 clientApps.
Add (dlClientHelper.
Install (remoteHost));
313 serverApps.
Add (sinkContainer);
325 serverApps.
Add (sinkContainer);
351 serverApps.
Start (startTime);
352 clientApps.
Start (startTime);
365 for (uint32_t u = 0; u < ueDevices.
GetN (); ++u)
381 const Time maxRrcConnectionEstablishmentDuration = Seconds (0.080);
386 this, *it, enbDevices.
Get (0));
399 ueDevices.
Get (hoEventIt->ueDeviceIndex),
400 enbDevices.
Get (hoEventIt->sourceEnbDeviceIndex));
402 ueDevices.
Get (hoEventIt->ueDeviceIndex),
403 enbDevices.
Get (hoEventIt->sourceEnbDeviceIndex),
404 enbDevices.
Get (hoEventIt->targetEnbDeviceIndex));
409 ueDevices.
Get (hoEventIt->ueDeviceIndex),
410 enbDevices.
Get (
m_admitHo ? hoEventIt->targetEnbDeviceIndex : hoEventIt->sourceEnbDeviceIndex));
412 this, hoEventIt->ueDeviceIndex);
416 this, hoEventIt->ueDeviceIndex);
417 if (stopTime <= checkStatsAfterHoTime)
419 stopTime = checkStatsAfterHoTime + MilliSeconds (1);
445 uint16_t rnti = ueRrc->GetRnti ();
453 uint16_t ueCellId = ueRrc->GetCellId ();
454 uint16_t enbCellId = enbLteDevice->GetCellId ();
455 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
456 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
457 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
458 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
459 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
460 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
461 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
462 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
463 uint64_t ueImsi = ueLteDevice->GetImsi ();
464 uint64_t enbImsi = ueManager->
GetImsi ();
474 ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
478 ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
483 while (enbBearerIt != enbDataRadioBearerMapValue.
End () &&
484 ueBearerIt != ueDataRadioBearerMapValue.End ())
498 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (),
"too many bearers at eNB");
499 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (),
"too many bearers at UE");
505 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
509 it->dlOldTotalRx = it->dlSink->GetTotalRx ();
510 it->ulOldTotalRx = it->ulSink->GetTotalRx ();
518 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
522 uint32_t dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx;
523 uint32_t ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;
526 NS_TEST_ASSERT_MSG_GT (dlRx, 0.500 * expectedBytes,
"too few RX bytes in DL, ue=" << ueIndex <<
", b=" << b);
527 NS_TEST_ASSERT_MSG_GT (ulRx, 0.500 * expectedBytes,
"too few RX bytes in UL, ue=" << ueIndex <<
", b=" << b);
560 ue1fwdagain.
startTime = MilliSeconds (500);
577 std::string hel0name (
"none");
578 std::list<HandoverEvent> hel0;
580 std::string hel1name (
"1 fwd");
581 std::list<HandoverEvent> hel1;
582 hel1.push_back (ue1fwd);
584 std::string hel2name (
"1 fwd & bwd");
585 std::list<HandoverEvent> hel2;
586 hel2.push_back (ue1fwd);
587 hel2.push_back (ue1bwd);
589 std::string hel3name (
"1 fwd & bwd & fwd");
590 std::list<HandoverEvent> hel3;
591 hel3.push_back (ue1fwd);
592 hel3.push_back (ue1bwd);
593 hel3.push_back (ue1fwdagain);
595 std::string hel4name (
"1+2 fwd");
596 std::list<HandoverEvent> hel4;
597 hel4.push_back (ue1fwd);
598 hel4.push_back (ue2fwd);
600 std::string hel5name (
"1+2 fwd & bwd");
601 std::list<HandoverEvent> hel5;
602 hel5.push_back (ue1fwd);
603 hel5.push_back (ue1bwd);
604 hel5.push_back (ue2fwd);
605 hel5.push_back (ue2bwd);
607 std::string hel6name (
"2 fwd");
608 std::list<HandoverEvent> hel6;
609 hel6.push_back (ue2fwd);
611 std::string hel7name (
"2 fwd & bwd");
612 std::list<HandoverEvent> hel7;
613 hel7.push_back (ue2fwd);
614 hel7.push_back (ue2bwd);
616 std::vector<std::string> schedulers;
617 schedulers.push_back (
"ns3::RrFfMacScheduler");
618 schedulers.push_back (
"ns3::PfFfMacScheduler");
619 for (std::vector<std::string>::iterator schedIt = schedulers.begin (); schedIt != schedulers.end (); ++schedIt)
621 for (int32_t useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)