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));
187 enbDevices =
m_lteHelper->InstallEnbDevice (enbNodes);
188 stream +=
m_lteHelper->AssignStreams (enbDevices, stream);
190 it != enbDevices.
End ();
198 ueDevices =
m_lteHelper->InstallUeDevice (ueNodes);
199 stream +=
m_lteHelper->AssignStreams (ueDevices, stream);
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);
229 remoteHostStaticRouting->AddNetworkRouteTo (
Ipv4Address (
"7.0.0.0"),
Ipv4Mask (
"255.0.0.0"), 1);
248 uint16_t dlPort = 10000;
249 uint16_t ulPort = 20000;
259 for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
264 ueStaticRouting->SetDefaultRoute (
m_epcHelper->GetUeDefaultGatewayAddress (), 1);
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);
348 m_lteHelper->ActivateDedicatedEpsBearer (ueDevices.
Get (u), bearer, tft);
351 serverApps.
Start (startTime);
352 clientApps.
Start (startTime);
365 for (uint32_t u = 0; u < ueDevices.
GetN (); ++u)
372 m_lteHelper->ActivateDataRadioBearer (ueDev, bearer);
381 const Time maxRrcConnectionEstablishmentDuration = Seconds (0.080);
386 this, *it, enbDevices.
Get (0));
399 ueDevices.
Get (hoEventIt->ueDeviceIndex),
400 enbDevices.
Get (hoEventIt->sourceEnbDeviceIndex));
401 m_lteHelper->HandoverRequest (hoEventIt->startTime,
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 ())
489 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity,
"epsBearerIdentity differs");
490 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity,
"drbIdentity differs");
492 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity,
"logicalChannelIdentity differs");
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)
holds a vector of ns3::Application pointers.
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
const uint32_t m_udpClientPktSize
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
keep track of time values and allow control of global simulation resolution
static Ipv4Address GetAny(void)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
std::list< HandoverEvent > m_handoverEventList
const Time m_maxHoDuration
#define NS_LOG_COMPONENT_DEFINE(name)
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not...
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
static LteX2HandoverTestSuite g_lteX2HandoverTestSuiteInstance
Build a set of PointToPointNetDevice objects.
void CheckStatsAWhileAfterHandover(uint32_t ueIndex)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
std::string m_handoverEventListName
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Ptr< LteHelper > m_lteHelper
ApplicationContainer Install(NodeContainer c)
std::list< BearerData > bearerDataList
std::map< uint32_t, Ptr< Object > >::const_iterator Iterator
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
uint32_t m_nDedicatedBearers
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
Class for representing data rates.
const Time m_udpClientInterval
double GetSeconds(void) const
ApplicationContainer Install(NodeContainer c) const
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
Create a client application which sends udp packets carrying a 32bit sequence number and a 64 bit tim...
hold objects of type ns3::Time
Hold an unsigned integer type.
holds a vector of ns3::NetDevice pointers
std::string m_schedulerType
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
virtual void DoRun(void)
Implementation to actually run this TestCase.
std::vector< UeData > m_ueDataVector
static void Destroy(void)
Access to the Ipv4 forwarding table, interfaces, and configuration.
void SetDefault(std::string name, const AttributeValue &value)
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
uint32_t targetEnbDeviceIndex
void Install(std::string nodeName) const
Iterator Begin(void) const
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
void SetChannelAttribute(std::string name, const AttributeValue &value)
#define NS_ASSERT_MSG(condition, message)
Helper class used to assign positions and mobility models to nodes.
Ipv4 addresses are stored in host order in this class.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ptr< EpcHelper > m_epcHelper
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
uint32_t sourceEnbDeviceIndex
void SaveStatsAfterHandover(uint32_t ueIndex)
Helper class that adds ns3::Ipv4StaticRouting objects.
hold objects of type ns3::DataRate
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
LteX2HandoverTestCase(uint32_t nUes, uint32_t nDedicatedBearers, std::list< HandoverEvent > handoverEventList, std::string handoverEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc)
ApplicationContainer Install(NodeContainer c) const
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetAttribute(std::string name, const AttributeValue &value)
uint32_t GetN(void) const
static std::string BuildNameString(uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc)
contain a set of ns3::Object pointers.
Receive and consume traffic generated to an IP address and port.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Hold an floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
Ptr< T > GetObject(void) const
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
const Time m_statsDuration
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const