9#include "ns3/core-module.h" 
   10#include "ns3/internet-module.h" 
   11#include "ns3/lte-module.h" 
   12#include "ns3/mobility-module.h" 
   13#include "ns3/network-module.h" 
   14#include "ns3/packet-sink-helper.h" 
   15#include "ns3/packet-sink.h" 
   16#include "ns3/point-to-point-module.h" 
   17#include "ns3/udp-client-server-helper.h" 
   58                          std::list<HandoverEvent> handoverEventList,
 
   59                          std::string handoverEventListName,
 
   60                          std::string schedulerType,
 
   77                                       std::string handoverEventListName,
 
   78                                       std::string schedulerType,
 
   81    void DoRun() 
override;
 
 
  160                                       std::string handoverEventListName,
 
  161                                       std::string schedulerType,
 
  165    std::ostringstream oss;
 
  166    oss << 
" nUes=" << nUes << 
" nDedicatedBearers=" << nDedicatedBearers << 
" " << schedulerType
 
  167        << 
" admitHo=" << admitHo << 
" hoList: " << handoverEventListName;
 
  170        oss << 
", ideal RRC";
 
 
  181                                             std::list<HandoverEvent> handoverEventList,
 
  182                                             std::string handoverEventListName,
 
  183                                             std::string schedulerType,
 
  188                               handoverEventListName,
 
 
  235                              StringValue(
"ns3::FriisSpectrumPropagationLossModel"));
 
  238        "ns3::NoOpHandoverAlgorithm"); 
 
  253    positionAlloc->Add(Vector(-3000, 0, 0)); 
 
  254    positionAlloc->Add(Vector(3000, 0, 0));  
 
  257        positionAlloc->Add(Vector(-3000, 100, 0));
 
  260    mobility.SetPositionAllocator(positionAlloc);
 
  261    mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
 
  262    mobility.Install(enbNodes);
 
  263    mobility.Install(ueNodes);
 
  266    enbDevices = 
m_lteHelper->InstallEnbDevice(enbNodes);
 
  267    stream += 
m_lteHelper->AssignStreams(enbDevices, stream);
 
  268    for (
auto it = enbDevices.
Begin(); it != enbDevices.
End(); ++it)
 
  276    stream += 
m_lteHelper->AssignStreams(ueDevices, stream);
 
  286        remoteHostContainer.
Create(1);
 
  287        remoteHost = remoteHostContainer.
Get(0);
 
  289        internet.Install(remoteHostContainer);
 
  299        ipv4h.
SetBase(
"1.0.0.0", 
"255.0.0.0");
 
  302        remoteHostAddr = internetIpIfaces.
GetAddress(1);
 
  307        remoteHostStaticRouting->AddNetworkRouteTo(
Ipv4Address(
"7.0.0.0"),
 
  312        internet.Install(ueNodes);
 
  327        uint16_t dlPort = 10000;
 
  328        uint16_t ulPort = 20000;
 
  334        startTimeSeconds->SetAttribute(
"Min", 
DoubleValue(0));
 
  335        startTimeSeconds->SetAttribute(
"Max", 
DoubleValue(0.010));
 
  336        startTimeSeconds->SetStream(stream++);
 
  344            ueStaticRouting->SetDefaultRoute(
m_epcHelper->GetUeDefaultGatewayAddress(), 1);
 
  360                    clientApps.Add(dlClientHelper.
Install(remoteHost));
 
  362                        "ns3::UdpSocketFactory",
 
  366                    serverApps.Add(sinkContainer);
 
  371                    clientApps.Add(ulClientHelper.
Install(ue));
 
  373                        "ns3::UdpSocketFactory",
 
  377                    serverApps.Add(sinkContainer);
 
  399                    m_lteHelper->ActivateDedicatedEpsBearer(ueDevices.
Get(u), bearer, tft);
 
  401                double d = startTimeSeconds->GetValue();
 
  403                serverApps.Start(startTime);
 
  404                clientApps.Start(startTime);
 
  422                m_lteHelper->ActivateDataRadioBearer(ueDev, bearer);
 
  430    const Time maxRrcConnectionEstablishmentDuration = 
Seconds(0.080);
 
  431    for (
auto it = ueDevices.
Begin(); it != ueDevices.
End(); ++it)
 
  450                            ueNodes.
Get(hoEventIt->ueDeviceIndex));
 
  455                            ueDevices.
Get(hoEventIt->ueDeviceIndex),
 
  456                            enbDevices.
Get(hoEventIt->sourceEnbDeviceIndex));
 
  459                                     ueDevices.
Get(hoEventIt->ueDeviceIndex),
 
  460                                     enbDevices.
Get(hoEventIt->sourceEnbDeviceIndex),
 
  461                                     enbDevices.
Get(hoEventIt->targetEnbDeviceIndex));
 
  467                            ueNodes.
Get(hoEventIt->ueDeviceIndex),
 
  468                            enbNodes.
Get(
m_admitHo ? hoEventIt->targetEnbDeviceIndex
 
  469                                                   : hoEventIt->sourceEnbDeviceIndex));
 
  475                            ueDevices.
Get(hoEventIt->ueDeviceIndex),
 
  476                            enbDevices.
Get(
m_admitHo ? hoEventIt->targetEnbDeviceIndex
 
  477                                                     : hoEventIt->sourceEnbDeviceIndex));
 
  481                            hoEventIt->ueDeviceIndex);
 
  487                            hoEventIt->ueDeviceIndex);
 
  488        if (
stopTime <= checkStatsAfterHoTime)
 
 
  519    uint16_t rnti = ueRrc->GetRnti();
 
  527    uint16_t ueCellId = ueRrc->GetCellId();
 
  528    uint16_t enbCellId = enbLteDevice->GetCellId();
 
  529    uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
 
  530    uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
 
  531    uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
 
  532    uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
 
  533    uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
 
  534    uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
 
  535    uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
 
  536    uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
 
  537    uint64_t ueImsi = ueLteDevice->GetImsi();
 
  538    uint64_t enbImsi = ueManager->GetImsi();
 
  548    ueManager->GetAttribute(
"DataRadioBearerMap", enbDataRadioBearerMapValue);
 
  551                          "wrong num bearers at eNB");
 
  554    ueRrc->GetAttribute(
"DataRadioBearerMap", ueDataRadioBearerMapValue);
 
  557                          "wrong num bearers at UE");
 
  559    auto enbBearerIt = enbDataRadioBearerMapValue.
Begin();
 
  560    auto ueBearerIt = ueDataRadioBearerMapValue.
Begin();
 
  561    while (enbBearerIt != enbDataRadioBearerMapValue.
End() &&
 
  562           ueBearerIt != ueDataRadioBearerMapValue.
End())
 
  571                              (
uint32_t)ueDrbInfo->m_epsBearerIdentity,
 
  572                              "epsBearerIdentity differs");
 
  575                              "drbIdentity differs");
 
  579                              (
uint32_t)ueDrbInfo->m_logicalChannelIdentity,
 
  580                              "logicalChannelIdentity differs");
 
  587    NS_ASSERT_MSG(enbBearerIt == enbDataRadioBearerMapValue.
End(), 
"too many bearers at eNB");
 
  588    NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.
End(), 
"too many bearers at UE");
 
 
  595    ueMobility->SetPosition(Vector(0.0, 0.0, 0.0));
 
 
  602    Vector pos = enbMobility->GetPosition();
 
  605    ueMobility->SetPosition(pos + Vector(0.0, 100.0, 0.0));
 
 
  615        it->dlOldTotalRx = it->dlSink->GetTotalRx();
 
  616        it->ulOldTotalRx = it->ulSink->GetTotalRx();
 
 
  628        uint32_t dlRx = it->dlSink->GetTotalRx() - it->dlOldTotalRx;
 
  629        uint32_t ulRx = it->ulSink->GetTotalRx() - it->ulOldTotalRx;
 
  635                              "too few RX bytes in DL, ue=" << ueIndex << 
", b=" << b);
 
  638                              "too few RX bytes in UL, ue=" << ueIndex << 
", b=" << b);
 
 
  700    std::string handoverEventList0name(
"none");
 
  701    std::list<HandoverEvent> handoverEventList0;
 
  703    std::string handoverEventList1name(
"1 fwd");
 
  704    const std::list<HandoverEvent> handoverEventList1{
 
  708    std::string handoverEventList2name(
"1 fwd & bwd");
 
  709    const std::list<HandoverEvent> handoverEventList2{
 
  714    std::string handoverEventList3name(
"1 fwd & bwd & fwd");
 
  715    const std::list<HandoverEvent> handoverEventList3{
 
  721    std::string handoverEventList4name(
"1+2 fwd");
 
  722    const std::list<HandoverEvent> handoverEventList4{
 
  727    std::string handoverEventList5name(
"1+2 fwd & bwd");
 
  728    const std::list<HandoverEvent> handoverEventList5{
 
  746    std::vector<std::string> schedulers{
 
  747        "ns3::RrFfMacScheduler",
 
  748        "ns3::PfFfMacScheduler",
 
  751    for (
auto schedIt = schedulers.begin(); schedIt != schedulers.end(); ++schedIt)
 
  753        for (
auto useIdealRrc : {
true, 
false})
 
  759                                                  handoverEventList0name,
 
  767                                                  handoverEventList0name,
 
  775                                                  handoverEventList0name,
 
  783                                                  handoverEventList0name,
 
  791                                                  handoverEventList1name,
 
  799                                                  handoverEventList1name,
 
  807                                                  handoverEventList1name,
 
  815                                                  handoverEventList1name,
 
  823                                                  handoverEventList1name,
 
  831                                                  handoverEventList1name,
 
  839                                                  handoverEventList1name,
 
  847                                                  handoverEventList1name,
 
  855                                                  handoverEventList1name,
 
  863                                                  handoverEventList1name,
 
  871                                                  handoverEventList1name,
 
  879                                                  handoverEventList1name,
 
  887                                                  handoverEventList2name,
 
  895                                                  handoverEventList2name,
 
  903                                                  handoverEventList2name,
 
  911                                                  handoverEventList3name,
 
  919                                                  handoverEventList3name,
 
  927                                                  handoverEventList3name,
 
  935                                                  handoverEventList3name,
 
  943                                                  handoverEventList3name,
 
  951                                                  handoverEventList3name,
 
  959                                                  handoverEventList4name,
 
  967                                                  handoverEventList4name,
 
  975                                                  handoverEventList4name,
 
  983                                                  handoverEventList5name,
 
  991                                                  handoverEventList5name,
 
  999                                                  handoverEventList5name,
 
 1007                                                  handoverEventList3name,
 
 1015                                                  handoverEventList3name,
 
 1023                                                  handoverEventList3name,
 
 1031                                                  handoverEventList4name,
 
 1039                                                  handoverEventList4name,
 
 1047                                                  handoverEventList4name,
 
 1055                                                  handoverEventList5name,
 
 1063                                                  handoverEventList5name,
 
 1071                                                  handoverEventList5name,
 
 
static std::string BuildNameString(uint32_t nUes, uint32_t nDedicatedBearers, std::string handoverEventListName, std::string schedulerType, bool admitHo, bool useIdealRrc)
Build name string.
 
void DoRun() override
Implementation to actually run this TestCase.
 
Ptr< PointToPointEpcHelper > m_epcHelper
EPC helper.
 
uint32_t m_nUes
number of UEs in the test
 
std::string m_handoverEventListName
handover event list name
 
std::string m_schedulerType
scheduler type
 
const uint32_t m_udpClientPktSize
UDP client packet size.
 
bool m_useIdealRrc
whether to use the ideal RRC
 
const Time m_statsDuration
stats duration
 
std::vector< UeData > m_ueDataVector
UE data vector.
 
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check connected function.
 
LteX2HandoverTestCase(uint32_t nUes, uint32_t nDedicatedBearers, std::list< HandoverEvent > handoverEventList, std::string handoverEventListName, std::string schedulerType, bool admitHo, bool useIdealRrc)
 
void TeleportUeNearTargetEnb(Ptr< Node > ueNode, Ptr< Node > enbNode)
Teleport UE near the target eNB of the handover.
 
bool m_admitHo
whether to admit the handover request
 
bool m_epc
whether to use EPC
 
void SaveStatsAfterHandover(uint32_t ueIndex)
Save stats after handover function.
 
const Time m_maxHoDuration
maximum HO duration
 
std::list< HandoverEvent > m_handoverEventList
handover event list
 
void CheckStatsAWhileAfterHandover(uint32_t ueIndex)
Check stats a while after handover function.
 
uint32_t m_nDedicatedBearers
number of UEs in the test
 
const Time m_udpClientInterval
UDP client interval.
 
void TeleportUeToMiddle(Ptr< Node > ueNode)
Teleport UE between both eNBs of the test.
 
Ptr< LteHelper > m_lteHelper
LTE helper.
 
LTE X2 Handover Test Suite.
 
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.
 
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
 
Class for representing data rates.
 
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.
 
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
 
aggregate IP/TCP/UDP functionality to existing Nodes.
 
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.
 
static Ipv4Address GetAny()
 
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.
 
The LteUeNetDevice class implements the UE net device.
 
Helper class used to assign positions and mobility models to nodes.
 
Keep track of the current position and velocity of an object.
 
holds a vector of ns3::NetDevice pointers
 
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
 
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
 
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
 
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
 
keep track of a set of node pointers.
 
uint32_t GetN() 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.
 
std::size_t GetN() const
Get the number of Objects.
 
Iterator End() const
Get an iterator to the past-the-end Object.
 
Iterator Begin() const
Get an iterator to the first Object.
 
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
 
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)
 
Smart pointer class similar to boost::intrusive_ptr.
 
static void SetRun(uint64_t run)
Set the run number of simulation.
 
static void SetSeed(uint32_t seed)
Set the seed.
 
static uint64_t GetRun()
Get the current run number.
 
static uint32_t GetSeed()
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
 
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
 
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
 
static void Run()
Run the simulation.
 
static void Stop()
Tell the Simulator the calling event should be the last one executed.
 
Hold variables of type string.
 
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
 
@ EXTENSIVE
Medium length test.
 
TestCase(const TestCase &)=delete
 
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
 
static constexpr auto SYSTEM
 
Simulation virtual time values and global simulation resolution.
 
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
 
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()
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_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
 
static LteX2HandoverTestSuite g_lteX2HandoverTestSuiteInstance
Static variable for test initialization.
 
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
 
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
 
#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.
 
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.
 
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
 
uint32_t ueDeviceIndex
UE device index.
 
uint32_t targetEnbDeviceIndex
target ENB device index
 
uint32_t sourceEnbDeviceIndex
source ENB device index
 
uint32_t dlOldTotalRx
DL old total receive.
 
uint32_t ulOldTotalRx
UL 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