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> 
   70                                  std::list<CheckPointEvent> checkPointEventList, std::string checkPointEventListName,
 
   71                                  bool useUdp, std::string schedulerType, 
bool admitHo, 
bool useIdealRrc);
 
   74   static std::string 
BuildNameString (uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers,
 
   75                                       std::string checkPointEventListName,
 
   76                                       bool useUdp, std::string schedulerType, 
bool admitHo, 
bool useIdealRrc);
 
   77   virtual void DoRun (
void);
 
  122                                                 std::string checkPointEventListName,
 
  123                                                 bool useUdp, std::string schedulerType, 
bool admitHo, 
bool useIdealRrc)
 
  125   std::ostringstream oss;
 
  126   oss << 
"nEnbs=" << nEnbs
 
  128       << 
" nDedicatedBearers=" << nDedicatedBearers
 
  130       << 
" " << schedulerType
 
  131       << 
" admitHo=" << admitHo
 
  132       << 
" hoList: " << checkPointEventListName;
 
  135       oss << 
", ideal RRC";
 
  145                                                               std::list<CheckPointEvent> checkPointEventList, std::string checkPointEventListName,
 
  146                                                               bool useUdp, std::string schedulerType, 
bool admitHo, 
bool useIdealRrc)
 
  147   : 
TestCase (BuildNameString (nEnbs, nUes, nDedicatedBearers, checkPointEventListName, useUdp, schedulerType, admitHo, useIdealRrc)),
 
  150     m_nDedicatedBearers (nDedicatedBearers),
 
  151     m_checkPointEventList (checkPointEventList),
 
  152     m_checkPointEventListName (checkPointEventListName),
 
  155     m_schedulerType (schedulerType),
 
  157     m_useIdealRrc (useIdealRrc),
 
  158     m_maxHoDuration (Seconds (0.1)),
 
  159     m_statsDuration (Seconds (0.5)),
 
  160     m_udpClientInterval (Seconds (0.01)),
 
  161     m_udpClientPktSize (100)
 
  190   double distance = 1000.0; 
 
  207   for (uint16_t i = 0; i < 
m_nEnbs; i++)
 
  209       Vector enbPosition (distance * (i + 1), 0, 0);
 
  210       enbPositionAlloc->Add (enbPosition);
 
  227   enbDevices = 
m_lteHelper->InstallEnbDevice (enbNodes);
 
  228   stream += 
m_lteHelper->AssignStreams (enbDevices, stream);
 
  230        it != enbDevices.End ();
 
  238   ueDevices = 
m_lteHelper->InstallUeDevice (ueNodes);
 
  239   stream += 
m_lteHelper->AssignStreams (ueDevices, stream);
 
  249       remoteHostContainer.
Create (1);
 
  250       remoteHost = remoteHostContainer.
Get (0);
 
  252       internet.
Install (remoteHostContainer);
 
  262       ipv4h.
SetBase (
"1.0.0.0", 
"255.0.0.0");
 
  265       remoteHostAddr = internetIpIfaces.
GetAddress (1);
 
  269       remoteHostStaticRouting->AddNetworkRouteTo (
Ipv4Address (
"7.0.0.0"), 
Ipv4Mask (
"255.0.0.0"), 1);
 
  288       uint16_t dlPort = 10000;
 
  289       uint16_t ulPort = 20000;
 
  299       for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
 
  304           ueStaticRouting->SetDefaultRoute (
m_epcHelper->GetUeDefaultGatewayAddress (), 1);
 
  322                       clientApps.
Add (dlClientHelper.Install (remoteHost));
 
  327                       serverApps.
Add (sinkContainer);
 
  338                       serverApps.
Add (sinkContainer);
 
  348                       clientApps.
Add (dlClientHelper.
Install (remoteHost));
 
  353                       serverApps.
Add (sinkContainer);
 
  365                       serverApps.
Add (sinkContainer);
 
  388                   m_lteHelper->ActivateDedicatedEpsBearer (ueDevices.
Get (u), bearer, tft);
 
  391               serverApps.
Start (startTime);
 
  392               clientApps.
Start (startTime);
 
  405       for (uint32_t u = 0; u < ueDevices.
GetN (); ++u)
 
  412               m_lteHelper->ActivateDataRadioBearer (ueDev, bearer);
 
  421   const Time maxRrcConnectionEstablishmentDuration = Seconds (0.080);
 
  427                            this, *it, enbDevices.Get (0));
 
  437       for (
Time checkPointTime = checkPointEventIt->checkStartTime;
 
  438            checkPointTime < checkPointEventIt->checkStopTime;
 
  439            checkPointTime += checkPointEventIt->checkInterval)
 
  442                                this, ueDevices.
Get (checkPointEventIt->ueDeviceIndex),
 
  443                                enbDevices.Get (checkPointEventIt->enbDeviceIndex));
 
  445           Time saveStatsTime = checkPointTime;
 
  447                                this, checkPointEventIt->ueDeviceIndex);
 
  451                                this, checkPointEventIt->ueDeviceIndex);
 
  453           if (stopTime <= checkStats)
 
  455               stopTime = checkStats + Seconds (1);
 
  477   uint16_t rnti = ueRrc->GetRnti ();
 
  485   uint16_t ueCellId = ueRrc->GetCellId ();
 
  486   uint16_t enbCellId = enbLteDevice->GetCellId ();
 
  487   uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
 
  488   uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
 
  489   uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
 
  490   uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
 
  491   uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
 
  492   uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
 
  493   uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
 
  494   uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
 
  495   uint64_t ueImsi = ueLteDevice->GetImsi ();
 
  496   uint64_t enbImsi = ueManager->GetImsi ();
 
  506   ueManager->GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
 
  510   ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
 
  515   while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
 
  516          && ueBearerIt != ueDataRadioBearerMapValue.End ())
 
  521       NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity, 
"epsBearerIdentity differs");
 
  522       NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity, 
"drbIdentity differs");
 
  524       NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity, 
"logicalChannelIdentity differs");
 
  530   NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (), 
"too many bearers at eNB");
 
  531   NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (), 
"too many bearers at UE");
 
  538   for (std::list<BearerData>::iterator it = 
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
 
  544           it->dlOldTotalRx = it->dlSink->GetTotalRx ();
 
  548           it->ulOldTotalRx = it->ulSink->GetTotalRx ();
 
  558   for (std::list<BearerData>::iterator it = 
m_ueDataVector.at (ueIndex).bearerDataList.begin ();
 
  567           dlRx = it->dlSink->GetTotalRx () - it->dlOldTotalRx;
 
  572           ulRx = it->ulSink->GetTotalRx () - it->ulOldTotalRx;
 
  576       NS_LOG_LOGIC (
"expBytes " << expectedBytes << 
" dlRx " << dlRx << 
" ulRx " << ulRx);
 
  581           NS_TEST_ASSERT_MSG_GT (dlRx,   0.500 * expectedBytes, 
"too few RX bytes in DL, ue=" << ueIndex << 
", b=" << b);
 
  585           NS_TEST_ASSERT_MSG_GT (ulRx,   0.500 * expectedBytes, 
"too few RX bytes in UL, ue=" << ueIndex << 
", b=" << b);
 
  600   : 
TestSuite (
"lte-x2-handover-measures", SYSTEM)
 
  602   Time checkInterval = Seconds (1);
 
  604   std::string cel1name (
"ho: 0 -> 1");
 
  605   std::list<CheckPointEvent> cel1;
 
  606   cel1.push_back (
CheckPointEvent (Seconds (1), Seconds (10.1), checkInterval, 0, 0));
 
  607   cel1.push_back (
CheckPointEvent (Seconds (11), Seconds (37), checkInterval, 0, 1));
 
  609   std::string cel2name (
"ho: 0 -> 1 -> 2");
 
  610   std::list<CheckPointEvent> cel2;
 
  611   cel2.push_back (
CheckPointEvent (Seconds (1), Seconds (10.1), Seconds (1), 0, 0));
 
  612   cel2.push_back (
CheckPointEvent (Seconds (11), Seconds (17.1), Seconds (1), 0, 1));
 
  613   cel2.push_back (
CheckPointEvent (Seconds (18), Seconds (37), Seconds (1), 0, 2));
 
  615   std::string cel3name (
"ho: 0 -> 1 -> 2 -> 3");
 
  616   std::list<CheckPointEvent> cel3;
 
  617   cel3.push_back (
CheckPointEvent (Seconds (1), Seconds (10.1), Seconds (1),  0, 0));
 
  618   cel3.push_back (
CheckPointEvent (Seconds (11), Seconds (17.1), Seconds (1), 0, 1));
 
  619   cel3.push_back (
CheckPointEvent (Seconds (18), Seconds (24.1), Seconds (1), 0, 2));
 
  620   cel3.push_back (
CheckPointEvent (Seconds (25), Seconds (37), Seconds (1), 0, 3));
 
  624   std::vector<std::string> schedulers;
 
  625   schedulers.push_back (
"ns3::PfFfMacScheduler");
 
  626   for (std::vector<std::string>::iterator schedIt = schedulers.begin (); schedIt != schedulers.end (); ++schedIt)
 
  628       for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
 
  643   schedulers.resize (0);
 
  644   schedulers.push_back (
"ns3::RrFfMacScheduler");
 
  645   for (std::vector<std::string>::iterator schedIt = schedulers.begin (); schedIt != schedulers.end (); ++schedIt)
 
  647       for (useIdealRrc = 1; useIdealRrc >= 0; --useIdealRrc)
 
static std::string BuildNameString(uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers, std::string checkPointEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc)
holds a vector of ns3::Application pointers. 
void SaveStats(uint32_t ueIndex)
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 
std::list< CheckPointEvent > m_checkPointEventList
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. 
Ptr< LteHelper > m_lteHelper
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. 
std::string m_checkPointEventListName
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::vector< UeData > m_ueDataVector
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void DoRun(void)
Implementation to actually run this TestCase. 
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...
const Time m_statsDuration
Build a set of PointToPointNetDevice objects. 
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
void SetDeviceAttribute(std::string name, const AttributeValue &value)
ApplicationContainer Install(NodeContainer c)
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 GetN(void) const 
Get the number of Ptr<NetDevice> 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 
#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 
void CheckStats(uint32_t ueIndex)
Hold an unsigned integer type. 
holds a vector of ns3::NetDevice pointers 
uint32_t m_nDedicatedBearers
LteX2HandoverMeasuresTestCase(uint32_t nEnbs, uint32_t nUes, uint32_t nDedicatedBearers, std::list< CheckPointEvent > checkPointEventList, std::string checkPointEventListName, bool useUdp, std::string schedulerType, bool admitHo, bool useIdealRrc)
const uint32_t m_udpClientPktSize
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
CheckPointEvent(Time start, Time stop, Time interval, uint32_t ueIndex, uint32_t enbIndex)
#define NS_LOG_LOGIC(msg)
static void Destroy(void)
Access to the Ipv4 forwarding table, interfaces, and configuration. 
void SetDefault(std::string name, const AttributeValue &value)
std::string m_schedulerType
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. 
const Time m_maxHoDuration
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 
static LteX2HandoverMeasuresTestSuite g_lteX2HandoverMeasuresTestSuiteInstance
Iterator Begin(void) const 
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
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. 
std::list< BearerData > bearerDataList
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 
static void SetVelocity(Ptr< Node > node, Vector vel)
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
LteX2HandoverMeasuresTestSuite()
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 
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 void SetPosition(Ptr< Node > node, Vector position)
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 
const Time m_udpClientInterval
Ptr< EpcHelper > m_epcHelper
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. 
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const