28 #include "ns3/core-module.h"    29 #include "ns3/network-module.h"    30 #include "ns3/internet-module.h"    31 #include "ns3/mobility-module.h"    32 #include "ns3/lte-module.h"    33 #include "ns3/applications-module.h"    34 #include "ns3/point-to-point-module.h"    35 #include "ns3/config-store-module.h"    36 #include "ns3/config-store.h"    50   : 
TestSuite (
"lte-radio-link-failure", SYSTEM)
    52   std::vector<Vector> uePositionList;
    53   std::vector<Vector> enbPositionList;
    54   std::vector<Time> checkConnectedList;
    55   Vector ueJumpAwayPosition;
    57   uePositionList.push_back (Vector (10, 0, 0));
    58   enbPositionList.push_back (Vector (0, 0, 0));
    59   ueJumpAwayPosition = Vector (7000.0, 0.0, 0.0);
    61   checkConnectedList.push_back (
Seconds (0.3));
    65   checkConnectedList.push_back (
Seconds (1));
    70                                                 uePositionList, enbPositionList,
    77                                                 uePositionList, enbPositionList,
    85   enbPositionList.push_back (Vector (7020, 0, 0));
    88                                                 uePositionList, enbPositionList,
    95                                                 uePositionList, enbPositionList,
   112   std::ostringstream oss;
   113   std::string rrcProtocol;
   116       rrcProtocol = 
"RRC Ideal";
   120       rrcProtocol = 
"RRC Real";
   122   oss << numEnbs << 
" eNBs, " << numUes << 
" UEs, " << rrcProtocol << 
" Protocol";
   127   uint32_t numEnbs, uint32_t numUes, 
Time simTime, 
bool isIdealRrc,
   128   std::vector<Vector> uePositionList, std::vector<Vector> enbPositionList,
   129   Vector ueJumpAwayPosition, std::vector<Time> checkConnectedList)
   130   : 
TestCase (BuildNameString (numEnbs, numUes, isIdealRrc)),
   134     m_isIdealRrc (isIdealRrc),
   135     m_uePositionList (uePositionList),
   136     m_enbPositionList (enbPositionList),
   137     m_checkConnectedList (checkConnectedList),
   138     m_ueJumpAwayPosition (ueJumpAwayPosition)
   177   uint16_t numBearersPerUe = 1;
   179   double eNodeB_txPower = 43;
   187   lteHelper->
SetPathlossModelType (TypeId::LookupByName (
"ns3::LogDistancePropagationLossModel"));
   219   Ptr<Node> pgw = epcHelper->GetPgwNode ();
   222   remoteHostContainer.
Create (1);
   225   internet.
Install (remoteHostContainer);
   232   ipv4h.
SetBase (
"1.0.0.0", 
"255.0.0.0");
   251       positionAllocEnb->
Add (*enbPosIt);
   254   mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
   255   mobility.SetPositionAllocator (positionAllocEnb);
   263       positionAllocUe->
Add (*uePosIt);
   266   mobility.SetPositionAllocator (positionAllocUe);
   267   mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
   275   int64_t randomStream = 1;
   277   randomStream += lteHelper->
AssignStreams (enbDevs, randomStream);
   279   randomStream += lteHelper->
AssignStreams (ueDevs, randomStream);
   287   lteHelper->
Attach (ueDevs);
   290   uint16_t dlPort = 10000;
   291   uint16_t ulPort = 20000;
   297   double interPacketInterval = 
static_cast<double> (
packetSize * 8) / bitRate;
   300   NS_LOG_DEBUG (
"UDP will use application interval " << udpInterval.
As (Time::S));
   302   for (uint32_t u = 0; u < 
m_numUes; ++u)
   307       ueStaticRouting->
SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
   309       for (uint32_t b = 0; b < numBearersPerUe; ++b)
   319           NS_LOG_LOGIC (
"installing UDP DL app for UE " << u + 1);
   322           dlClientHelper.SetAttribute (
"MaxPackets", 
UintegerValue (1000000));
   323           dlClientApps.
Add (dlClientHelper.Install (remoteHost));
   326           dlServerApps.
Add (dlPacketSinkHelper.
Install (ue));
   328           NS_LOG_LOGIC (
"installing UDP UL app for UE " << u + 1);
   332           ulClientApps.
Add (ulClientHelper.
Install (ue));
   335           ulServerApps.
Add (ulPacketSinkHelper.
Install (remoteHost));
   340           dlpf.localPortEnd = dlPort;
   359   for (uint32_t u = 0; u < 
m_numUes; ++u)
   367   Config::Connect (
"/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
   369   Config::Connect (
"/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
   373   Config::Connect (
"/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
   380   Simulator::Stop (simTime);
   383   for (uint32_t u = 0; u < 
m_numUes; ++u)
   386                              "Error, UE transitions to idle state for other than radio link failure");
   389   Simulator::Destroy ();
   409   uint16_t cellId = ueRrc->GetCellId ();
   414        enbDevIt != enbDevices.
End (); ++enbDevIt)
   424   uint16_t rnti = ueRrc->GetRnti ();
   430   NS_ASSERT_MSG (ueManagerState == UeManager::CONNECTED_NORMALLY, 
"Wrong UeManager state!");
   432   uint16_t ueCellId = ueRrc->GetCellId ();
   433   uint16_t enbCellId = enbLteDevice->
GetCellId ();
   434   uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
   436   uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
   438   uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
   439   uint8_t enbDlEarfcn = enbLteDevice->
GetDlEarfcn ();
   440   uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
   441   uint8_t enbUlEarfcn = enbLteDevice->
GetUlEarfcn ();
   442   uint64_t ueImsi = ueLteDevice->
GetImsi ();
   443   uint64_t enbImsi = ueManager->
GetImsi ();
   453   ueManager->
GetAttribute (
"DataRadioBearerMap", enbDataRadioBearerMapValue);
   457   ueRrc->GetAttribute (
"DataRadioBearerMap", ueDataRadioBearerMapValue);
   462   while (enbBearerIt != enbDataRadioBearerMapValue.
End ()
   463          && ueBearerIt != ueDataRadioBearerMapValue.End ())
   474   NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.
End (), 
"too many bearers at eNB");
   475   NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (), 
"too many bearers at UE");
   485   uint16_t rnti = ueRrc->GetRnti ();
   486   uint32_t numEnbDevices = enbDevices.
GetN ();
   487   bool ueManagerFound = 
false;
   489   switch (numEnbDevices)
   495         NS_TEST_ASSERT_MSG_EQ (ueManagerFound, 
false, 
"Unexpected RNTI with value " << rnti << 
" found in eNB");
   504         NS_FATAL_ERROR (
"The RRC state of the UE in more then 2 eNB scenario is not defined. Consider creating more cases");
   517   return ueManagerFound;
   522                                                         uint64_t imsi, uint16_t cellId,
   526   NS_LOG_FUNCTION (
this << imsi << cellId << rnti << oldState << newState);
   532   std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
   539   std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
   543                          "radio link failure detection should start only in RRC CONNECTED state");
   545                          "radio link failure detection should start only in RRC CONNECTED state");
   550                                                              uint16_t cellId, uint16_t rnti)
   559   if (type == 
"Notify out of sync")
   563   else if (type == 
"Notify in sync")
   577                          "wrong number of out-of-sync indications detected, check configured value for N310");
   580                          "wrong number of out-of-sync indications detected, check configured value for N311");
 LteRadioLinkFailureTestSuite()
holds a vector of ns3::Application pointers. 
uint32_t GetDlEarfcn() const
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit. 
uint8_t Add(PacketFilter f)
add a PacketFilter to the Traffic Flow Template 
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index. 
void RadioLinkFailureCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
This callback function is executed when radio link failure is detected. 
uint32_t m_numOfOutOfSyncIndications
number of out-of-sync indications detected 
Simulation virtual time values and global simulation resolution. 
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created. 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
State
The state of the UeManager at the eNB RRC. 
  AttributeValue implementation for Boolean. 
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices. 
holds a vector of std::pair of Ptr<Ipv4> and interface index. 
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table. 
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container. 
Hold variables of type string. 
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask 
static const uint32_t packetSize
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
void JumpAway(Vector UeJumpAwayPositionList)
Jump away function. 
void ConnectionEstablishedEnbCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established at eNodeB callback function. 
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. 
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
aggregate IP/TCP/UDP functionality to existing Nodes. 
uint64_t GetImsi(void) const
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
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. 
Time m_simTime
simulation time 
std::vector< Vector > m_uePositionList
Position of the UEs. 
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper. 
bool CheckUeExistAtEnb(uint16_t rnti, Ptr< NetDevice > enbDevice)
Check if the UE exist at the eNB. 
uint8_t ActivateDedicatedEpsBearer(NetDeviceContainer ueDevices, EpsBearer bearer, Ptr< EpcTft > tft)
Activate a dedicated EPS bearer on a given set of UE devices. 
uint32_t m_numOfInSyncIndications
number of in-sync indications detected 
uint64_t GetBitRate() const
Get the underlying bitrate. 
ApplicationContainer Install(NodeContainer c)
bool m_radioLinkFailureDetected
true if radio link fails 
void UeStateTransitionCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::State oldState, LteUeRrc::State newState)
State transition callback function. 
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices. 
Class for representing data rates. 
Keep track of the current position and velocity of an object. 
Ptr< UeManager > GetUeManager(uint16_t rnti)
uint64_t GetImsi() const
Get the IMSI. 
store information on active data radio bearer instance 
Hold variables of type enum. 
uint8_t m_logicalChannelIdentity
logical channel identity 
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
void CheckConnected(Ptr< NetDevice > ueDevice, NetDeviceContainer enbDevices)
Check connected function. 
  AttributeValue implementation for Time. 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
uint16_t GetCellId() const
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container. 
Iterator Begin(void) const
Get an iterator to the first Object. 
void EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP. 
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. 
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container. 
bool HasUeManager(uint16_t rnti) const
holds a vector of ns3::NetDevice pointers 
void SetPathlossModelType(TypeId type)
Set the type of path loss model to be used for both DL and UL channels. 
uint32_t m_numEnbs
number of eNodeBs 
Iterator End(void) const
Get an iterator to the past-the-end Object. 
void ConnectionEstablishedUeCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established at UE callback function. 
void PhySyncDetectionCallback(std::string context, uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint8_t count)
This callback function is executed when UE RRC receives an in-sync or out-of-sync indication...
uint32_t m_numUes
number of UEs 
std::size_t GetN(void) const
Get the number of Objects. 
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC. 
void Connect(std::string path, const CallbackBase &cb)
uint16_t GetUlBandwidth() const
Access to the IPv4 forwarding table, interfaces, and configuration. 
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created. 
uint16_t remotePortEnd
end of the port number range of the remote host 
virtual void DoRun()
Setup the simulation according to the configuration set by the class constructor, run it...
bool m_isIdealRrc
whether the LTE is configured to use ideal RRC 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
keep track of a set of node pointers. 
uint32_t GetUlEarfcn() const
Ptr< MobilityModel > m_ueMobility
UE mobility model. 
uint16_t GetDlBandwidth() const
This class contains the specification of EPS Bearers. 
std::vector< Vector > m_enbPositionList
Position of the eNodeBs. 
void SetPosition(const Vector &position)
Vector m_ueJumpAwayPosition
Position where the UE(s) would jump. 
std::vector< Time > m_checkConnectedList
the time at which UEs should have an active RRC connection 
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper. 
Testing the cell reselection procedure by UE at IDLE state. 
#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 Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices. 
State
The states of the UE RRC entity. 
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...
std::string GetName(void) 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 ...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message. 
#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...
uint8_t m_drbIdentity
DRB identity. 
Helper class that adds ns3::Ipv4StaticRouting objects. 
  AttributeValue implementation for DataRate. 
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory. 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container. 
void SetDefault(std::string name, const AttributeValue &value)
void Add(Vector v)
Add a position to the list of positions. 
Ptr< LteUeRrc > GetRrc() const
Get the RRC. 
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index. 
LteRadioLinkFailureTestCase(uint32_t numEnbs, uint32_t numUes, Time simTime, bool isIdealRrc, std::vector< Vector > uePositionList, std::vector< Vector > enbPositionList, Vector ueJumpAwayPosition, std::vector< Time > checkConnectedList)
Creates an instance of the radio link failure test case. 
A helper class to make life easier while doing simple IPv4 address assignment in scripts. 
Time Now(void)
create an ns3::Time instance which contains the current simulation time. 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
Container for a set of ns3::Object pointers. 
static LteRadioLinkFailureTestSuite g_lteRadioLinkFailureTestSuite
void ConnectionReleaseAtEnbCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
This callback function is executed when UE context is removed at eNodeB. 
This class can be used to hold variables of floating point type such as 'double' or 'float'...
The eNodeB device implementation. 
Ptr< LteEnbRrc > GetRrc() const
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful. 
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate. 
virtual ~LteRadioLinkFailureTestCase()
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not. 
std::string BuildNameString(uint32_t numEnbs, uint32_t numUes, bool isIdealRrc)
Builds the test name string based on provided parameter values. 
uint16_t remotePortStart
start of the port number range of the remote host 
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 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. 
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created. 
uint16_t localPortStart
start of the port number range of the UE 
void CheckIdle(Ptr< NetDevice > ueDevice, NetDeviceContainer enbDevices)
Check if the UE is in idle state. 
LteUeRrc::State m_lastState
The current UE RRC state. 
uint8_t m_epsBearerIdentity
EPS bearer identity. 
The LteUeNetDevice class implements the UE net device.