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);
369 remoteHostStaticRouting->AddNetworkRouteTo (
Ipv4Address (
"7.0.0.0"),
Ipv4Mask (
"255.0.0.0"), 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 ())
621 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity,
"epsBearerIdentity differs");
622 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity,
"drbIdentity differs");
624 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity,
"logicalChannelIdentity differs");
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);
Test different X2 handover measures and algorithms, e.g.
Ptr< PointToPointEpcHelper > m_epcHelper
EPC helper.
std::list< CheckPointEvent > m_checkPointEventList
check point event list
std::string m_schedulerType
scheduler type
std::string m_handoverAlgorithmType
handover algorithm type
bool m_admitHo
whether to configure to admit handover
bool m_useUdp
whether to use UDP traffic
Ptr< LteHelper > m_lteHelper
LTE helper.
const Time m_udpClientInterval
UDP client interval.
void CheckStats(uint32_t ueIndex)
Check stats function.
virtual void DoRun(void)
Implementation to actually run this TestCase.
const Time m_statsDuration
stats duration
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)
bool m_useIdealRrc
whether to use ideal RRC
uint32_t m_nEnbs
number of eNBs in the test
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)
Build name string.
std::string m_checkPointEventListName
check point event list name
bool m_epc
whether to use EPC
void SaveStats(uint32_t ueIndex)
Save stats function.
uint32_t m_nDedicatedBearers
number of UEs in the test
uint32_t m_nUes
number of UEs in the test
std::vector< UeData > m_ueDataVector
UE data vector.
const uint32_t m_udpClientPktSize
UDP client packet size.
const Time m_maxHoDuration
maximum HO duration
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check connected function.
Lte X2 Handover Measures Test Suite.
LteX2HandoverMeasuresTestSuite()
holds a vector of ns3::Application pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
AttributeValue implementation for Boolean.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
Mobility model for which the current speed does not change once it has been set and until it is set a...
Class for representing data rates.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
This class contains the specification of EPS Bearers.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Helper class that adds ns3::Ipv4StaticRouting objects.
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...
store information on active data radio bearer instance
The eNodeB device implementation.
uint16_t GetDlBandwidth() const
uint32_t GetUlEarfcn() const
uint32_t GetDlEarfcn() const
Ptr< LteEnbRrc > GetRrc() const
uint16_t GetUlBandwidth() const
uint16_t GetCellId() const
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 ...
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the handover algorithm to be created.
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices.
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
void ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices.
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
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(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
virtual Ipv4Address GetUeDefaultGatewayAddress()
virtual Ptr< Node > GetPgwNode() const
Get the PGW node.
virtual Ipv4InterfaceContainer AssignUeIpv4Address(NetDeviceContainer ueDevices)
Assign IPv4 addresses to UE devices.
keep track of a set of node pointers.
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Container for a set of ns3::Object pointers.
std::size_t GetN(void) const
Get the number of Objects.
Iterator Begin(void) const
Get an iterator to the first Object.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
Iterator End(void) const
Get an iterator to the past-the-end Object.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
Receive and consume traffic generated to an IP address and port.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
ApplicationContainer Install(NodeContainer c)
State
The state of the UeManager at the eNB RRC.
Hold an unsigned integer type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
void SetDefault(std::string name, const AttributeValue &value)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
#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.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
CheckPointEvent structure.
CheckPointEvent(Time start, Time stop, Time interval, uint32_t ueIndex, uint32_t enbIndex)
Constructor.
Time checkStopTime
check stop time
uint32_t enbDeviceIndex
ENB device index.
Time checkStartTime
check start time
Time checkInterval
check interval
uint32_t ueDeviceIndex
UE device index.
uint32_t ulOldTotalRx
UL old total receive.
uint32_t dlOldTotalRx
DL old total receive.
Ptr< PacketSink > dlSink
DL sink.
Ptr< PacketSink > ulSink
UL sink.
std::list< BearerData > bearerDataList
bearer ID list
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
uint16_t localPortEnd
end of the port number range of the UE
uint16_t remotePortEnd
end of the port number range of the remote host
uint16_t remotePortStart
start of the port number range of the remote host
uint16_t localPortStart
start of the port number range of the UE
static LteX2HandoverMeasuresTestSuite g_lteX2HandoverMeasuresTestSuiteInstance
static void SetPosition(Ptr< Node > node, Vector position)