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>
44 : checkStartTime (start),
46 checkInterval (interval),
47 ueDeviceIndex (ueIndex),
48 enbDeviceIndex (enbIndex)
74 std::list<CheckPointEvent> checkPointEventList,
75 std::string checkPointEventListName,
76 bool useUdp, std::string schedulerType,
77 std::string handoverAlgorithmType,
bool admitHo,
81 static std::string BuildNameString (uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers,
82 std::string checkPointEventListName,
83 bool useUdp, std::string schedulerType,
84 std::string handoverAlgorithmType,
bool admitHo,
86 virtual void DoRun (
void);
118 void SaveStats (uint32_t ueIndex);
119 void CheckStats (uint32_t ueIndex);
132 std::string checkPointEventListName,
133 bool useUdp, std::string schedulerType,
134 std::string handoverAlgorithmType,
bool admitHo,
137 std::ostringstream oss;
138 oss <<
"nEnbs=" << nEnbs
140 <<
" nDedicatedBearers=" << nDedicatedBearers
142 <<
" " << schedulerType
143 <<
" " << handoverAlgorithmType
144 <<
" admitHo=" << admitHo
145 <<
" hoList: " << checkPointEventListName;
148 oss <<
", ideal RRC";
158 std::list<CheckPointEvent> checkPointEventList,
159 std::string checkPointEventListName,
160 bool useUdp, std::string schedulerType,
161 std::string handoverAlgorithmType,
bool admitHo,
163 :
TestCase (BuildNameString (nEnbs, nUes, nDedicatedBearers,
164 checkPointEventListName, useUdp, schedulerType,
165 handoverAlgorithmType, admitHo, useIdealRrc)),
168 m_nDedicatedBearers (nDedicatedBearers),
169 m_checkPointEventList (checkPointEventList),
170 m_checkPointEventListName (checkPointEventListName),
173 m_schedulerType (schedulerType),
174 m_handoverAlgorithmType (handoverAlgorithmType),
176 m_useIdealRrc (useIdealRrc),
177 m_maxHoDuration (Seconds (0.1)),
178 m_statsDuration (Seconds (0.5)),
179 m_udpClientInterval (Seconds (0.01)),
180 m_udpClientPktSize (100)
229 double distance = 1000.0;
239 m_epcHelper = CreateObject<PointToPointEpcHelper> ();
246 for (uint16_t i = 0; i <
m_nEnbs; i++)
248 Vector enbPosition (distance * (i + 1), 0, 0);
249 enbPositionAlloc->
Add (enbPosition);
254 enbMobility.
Install (enbNodes);
261 for (uint16_t i = 0; i <
m_nUes; i++)
271 it != enbDevices.
End ();
290 remoteHostContainer.
Create (1);
291 remoteHost = remoteHostContainer.
Get (0);
293 internet.
Install (remoteHostContainer);
303 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
306 remoteHostAddr = internetIpIfaces.
GetAddress (1);
329 uint16_t dlPort = 10000;
330 uint16_t ulPort = 20000;
340 for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
363 clientApps.
Add (dlClientHelper.Install (remoteHost));
368 serverApps.
Add (sinkContainer);
379 serverApps.
Add (sinkContainer);
389 clientApps.
Add (dlClientHelper.
Install (remoteHost));
394 serverApps.
Add (sinkContainer);
406 serverApps.
Add (sinkContainer);
428 EpsBearer bearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT);
432 serverApps.
Start (startTime);
433 clientApps.
Start (startTime);
446 for (uint32_t u = 0; u < ueDevices.
GetN (); ++u)
462 const Time maxRrcConnectionEstablishmentDuration = Seconds (0.080);
466 Simulator::Schedule (maxRrcConnectionEstablishmentDuration,
468 this, *it, enbDevices.
Get (0));
478 for (
Time checkPointTime = checkPointEventIt->checkStartTime;
479 checkPointTime < checkPointEventIt->checkStopTime;
480 checkPointTime += checkPointEventIt->checkInterval)
483 this, ueDevices.
Get (checkPointEventIt->ueDeviceIndex),
484 enbDevices.
Get (checkPointEventIt->enbDeviceIndex));
486 Time saveStatsTime = checkPointTime;
488 this, checkPointEventIt->ueDeviceIndex);
492 this, checkPointEventIt->ueDeviceIndex);
494 if (stopTime <= checkStats)
496 stopTime = checkStats + Seconds (1);
501 Simulator::Stop (stopTime);
503 Simulator::Destroy ();
518 uint16_t rnti = ueRrc->GetRnti ();
524 NS_ASSERT_MSG (ueManagerState == UeManager::CONNECTED_NORMALLY,
"Wrong UeManager state!");
526 uint16_t ueCellId = ueRrc->GetCellId ();
527 uint16_t enbCellId = enbLteDevice->GetCellId ();
528 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
529 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
530 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
531 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
532 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
533 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
534 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
535 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
536 uint64_t ueImsi = ueLteDevice->
GetImsi ();
537 uint64_t enbImsi = ueManager->
GetImsi ();
547 ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
551 ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
556 while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
557 && ueBearerIt != ueDataRadioBearerMapValue.End ())
571 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (),
"too many bearers at eNB");
572 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (),
"too many bearers at UE");
579 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
585 it->dlOldTotalRx = it->dlSink->GetTotalRx ();
589 it->ulOldTotalRx = it->ulSink->GetTotalRx ();
599 for (std::list<BearerData>::iterator it =
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
608 dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx;
613 ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;
617 NS_LOG_LOGIC (
"expBytes " << expectedBytes <<
" dlRx " << dlRx <<
" ulRx " << ulRx);
622 NS_TEST_ASSERT_MSG_GT (dlRx, 0.500 * expectedBytes,
"too few RX bytes in DL, ue=" << ueIndex <<
", b=" << b);
626 NS_TEST_ASSERT_MSG_GT (ulRx, 0.500 * expectedBytes,
"too few RX bytes in UL, ue=" << ueIndex <<
", b=" << b);
641 :
TestSuite (
"lte-x2-handover-measures", SYSTEM)
643 Time checkInterval = Seconds (1);
645 std::string cel1name (
"ho: 0 -> 1");
646 std::list<CheckPointEvent> cel1;
647 cel1.push_back (
CheckPointEvent (Seconds (1), Seconds (10.1), checkInterval, 0, 0));
648 cel1.push_back (
CheckPointEvent (Seconds (11), Seconds (17), checkInterval, 0, 1));
650 std::string cel2name (
"ho: 0 -> 1 -> 2");
651 std::list<CheckPointEvent> cel2;
652 cel2.push_back (
CheckPointEvent (Seconds (1), Seconds (10.1), checkInterval, 0, 0));
653 cel2.push_back (
CheckPointEvent (Seconds (11), Seconds (17.1), checkInterval, 0, 1));
654 cel2.push_back (
CheckPointEvent (Seconds (18), Seconds (24), checkInterval, 0, 2));
656 std::string cel3name (
"ho: 0 -> 1 -> 2 -> 3");
657 std::list<CheckPointEvent> cel3;
658 cel3.push_back (
CheckPointEvent (Seconds (1), Seconds (10.1), checkInterval, 0, 0));
659 cel3.push_back (
CheckPointEvent (Seconds (11), Seconds (17.1), checkInterval, 0, 1));
660 cel3.push_back (
CheckPointEvent (Seconds (18), Seconds (24.1), checkInterval, 0, 2));
661 cel3.push_back (
CheckPointEvent (Seconds (25), Seconds (37), checkInterval, 0, 3));
665 std::string sched =
"ns3::PfFfMacScheduler";
666 std::string ho =
"ns3::A2A4RsrqHandoverAlgorithm";
667 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
670 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
671 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 1, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::QUICK);
672 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 2, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
673 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
674 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 1, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
675 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 2, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
676 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
677 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 1, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
678 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 2, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
681 sched =
"ns3::RrFfMacScheduler";
682 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
685 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
686 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
687 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
690 ho =
"ns3::A3RsrpHandoverAlgorithm";
691 sched =
"ns3::PfFfMacScheduler";
692 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
695 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
696 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
697 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
700 sched =
"ns3::RrFfMacScheduler";
701 for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
704 AddTestCase (
new LteX2HandoverMeasuresTestCase (2, 1, 0, cel1, cel1name,
true, sched, ho,
true, useIdealRrc), TestCase::QUICK);
705 AddTestCase (
new LteX2HandoverMeasuresTestCase (3, 1, 0, cel2, cel2name,
true, sched, ho,
true, useIdealRrc), TestCase::TAKES_FOREVER);
706 AddTestCase (
new LteX2HandoverMeasuresTestCase (4, 1, 0, cel3, cel3name,
true, sched, ho,
true, useIdealRrc), TestCase::EXTENSIVE);
holds a vector of ns3::Application pointers.
void CheckStats(uint32_t ueIndex)
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template
Simulation virtual time values and global simulation resolution.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
State
The state of the UeManager at the eNB RRC.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
create a set of eNB devices
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes...
Ptr< PointToPointEpcHelper > m_epcHelper
holds a vector of std::pair of Ptr and interface index.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
hold variables of type string
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr 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. ...
const uint32_t m_udpClientPktSize
virtual Ptr< Node > GetPgwNode()
Ptr< LteUeRrc > GetRrc() const
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
aggregate IP/TCP/UDP functionality to existing Nodes.
uint16_t localPortEnd
end of the port number range of the UE
const Time m_statsDuration
#define NS_FATAL_ERROR(msg)
fatal error handling
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
Build a set of PointToPointNetDevice objects.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Call ActivateDataRadioBearer (ueDevice, bearer) for each UE device in a given set.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetHandoverAlgorithmType(std::string type)
ApplicationContainer Install(NodeContainer c)
std::map< uint32_t, Ptr< Object > >::const_iterator Iterator
void SetSchedulerType(std::string type)
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
uint32_t GetN(void) const
Get the number of Ptr stored in this container.
Class for representing data rates.
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
This class contains the specification of EPS Bearers.
LteX2HandoverMeasuresTestCase(uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers, std::list< CheckPointEvent > checkPointEventList, std::string checkPointEventListName, bool useUdp, std::string schedulerType, std::string handoverAlgorithmType, bool admitHo, bool useIdealRrc)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
store information on active data radio bearer instance
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
set an attribute for the handover algorithm to be created
uint8_t m_logicalChannelIdentity
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
hold objects of type ns3::Time
std::list< CheckPointEvent > m_checkPointEventList
Hold an unsigned integer type.
#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.
holds a vector of ns3::NetDevice pointers
virtual void DoRun(void)
Implementation to actually run this TestCase.
std::string m_checkPointEventListName
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
LteX2HandoverMeasuresTestSuite()
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
std::string m_handoverAlgorithmType
void SaveStats(uint32_t ueIndex)
Access to the Ipv4 forwarding table, interfaces, and configuration.
uint16_t remotePortEnd
end of the port number range of the remote host
void SetDefault(std::string name, const AttributeValue &value)
std::string m_schedulerType
void ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices.
virtual Ipv4Address GetUeDefaultGatewayAddress()
static LteX2HandoverMeasuresTestSuite g_lteX2HandoverMeasuresTestSuiteInstance
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr
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())
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
Iterator Begin(void) const
void GetAttribute(std::string name, AttributeValue &value) const
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
uint64_t GetImsi(void) const
static std::string BuildNameString(uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers, std::string checkPointEventListName, bool useUdp, std::string schedulerType, std::string handoverAlgorithmType, bool admitHo, bool useIdealRrc)
std::list< BearerData > bearerDataList
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
NetDeviceContainer InstallUeDevice(NodeContainer c)
create a set of UE devices
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
Helper class used to assign positions and mobility models to nodes.
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
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< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
void SetEpcHelper(Ptr< EpcHelper > h)
Set the EpcHelper to be used to setup the EPC network in conjunction with the setup of the LTE radio ...
#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...
static void SetVelocity(Ptr< Node > node, Vector vel)
Helper class that adds ns3::Ipv4StaticRouting objects.
hold objects of type ns3::DataRate
std::vector< UeData > m_ueDataVector
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
uint32_t m_nDedicatedBearers
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
CheckPointEvent(Time start, Time stop, Time interval, uint32_t ueIndex, uint32_t enbIndex)
Mobility model for which the current speed does not change once it has been set and until it is set a...
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
const Time m_udpClientInterval
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)
Helper function used to set the underlying application attributes, not the socket attributes...
uint32_t GetN(void) const
static void SetPosition(Ptr< Node > node, Vector position)
contain a set of ns3::Object pointers.
Ptr< LteHelper > m_lteHelper
Receive and consume traffic generated to an IP address and port.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
#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.
Hold a floating point type.
void SetAttribute(std::string name, const AttributeValue &value)
The eNodeB device implementation.
const Time m_maxHoDuration
Ptr< T > GetObject(void) const
uint16_t remotePortStart
start of the port number range of the remote host
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
uint16_t localPortStart
start of the port number range of the UE
uint8_t m_epsBearerIdentity
The LteUeNetDevice class implements the UE net device.