16#include "ns3/core-module.h"
17#include "ns3/internet-module.h"
18#include "ns3/lte-module.h"
19#include "ns3/mobility-module.h"
20#include "ns3/network-module.h"
21#include "ns3/packet-sink-helper.h"
22#include "ns3/point-to-point-module.h"
23#include "ns3/udp-client-server-helper.h"
40 std::vector<Vector> uePositionList;
41 std::vector<Vector> enbPositionList;
42 std::vector<Time> checkConnectedList;
43 Vector ueJumpAwayPosition;
45 uePositionList.emplace_back(10, 0, 0);
46 enbPositionList.emplace_back(0, 0, 0);
47 ueJumpAwayPosition = Vector(7000.0, 0.0, 0.0);
49 checkConnectedList.push_back(
Seconds(0.3));
53 checkConnectedList.push_back(
Seconds(1));
65 TestCase::Duration::QUICK);
76 TestCase::Duration::QUICK);
81 enbPositionList.emplace_back(7020, 0, 0);
91 TestCase::Duration::QUICK);
102 TestCase::Duration::QUICK);
119 std::ostringstream oss;
120 std::string rrcProtocol;
123 rrcProtocol =
"RRC Ideal";
127 rrcProtocol =
"RRC Real";
129 oss << numEnbs <<
" eNBs, " << numUes <<
" UEs, " << rrcProtocol <<
" Protocol";
137 std::vector<Vector> uePositionList,
138 std::vector<Vector> enbPositionList,
139 Vector ueJumpAwayPosition,
140 std::vector<Time> checkConnectedList)
141 :
TestCase(BuildNameString(numEnbs, numUes, isIdealRrc)),
145 m_isIdealRrc(isIdealRrc),
146 m_uePositionList(uePositionList),
147 m_enbPositionList(enbPositionList),
148 m_checkConnectedList(checkConnectedList),
149 m_ueJumpAwayPosition(ueJumpAwayPosition)
199 uint16_t numBearersPerUe = 1;
201 double eNodeB_txPower = 43;
207 lteHelper->SetEpcHelper(epcHelper);
210 lteHelper->SetPathlossModelAttribute(
"Exponent",
DoubleValue(3.9));
211 lteHelper->SetPathlossModelAttribute(
"ReferenceLoss",
213 lteHelper->SetPathlossModelAttribute(
"ReferenceDistance",
DoubleValue(1));
225 lteHelper->SetEnbDeviceAttribute(
"DlEarfcn",
UintegerValue(100));
226 lteHelper->SetEnbDeviceAttribute(
"UlEarfcn",
UintegerValue(18100));
227 lteHelper->SetEnbDeviceAttribute(
"DlBandwidth",
UintegerValue(25));
228 lteHelper->SetEnbDeviceAttribute(
"UlBandwidth",
UintegerValue(25));
231 lteHelper->SetSchedulerType(
"ns3::PfFfMacScheduler");
245 remoteHostContainer.
Create(1);
248 internet.Install(remoteHostContainer);
255 ipv4h.
SetBase(
"1.0.0.0",
"255.0.0.0");
261 remoteHostStaticRouting->AddNetworkRouteTo(
Ipv4Address(
"7.0.0.0"),
Ipv4Mask(
"255.0.0.0"), 1);
274 positionAllocEnb->Add(*enbPosIt);
277 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
278 mobility.SetPositionAllocator(positionAllocEnb);
279 mobility.Install(enbNodes);
285 positionAllocUe->Add(*uePosIt);
288 mobility.SetPositionAllocator(positionAllocUe);
289 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
290 mobility.Install(ueNodes);
297 int64_t randomStream = 1;
298 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
299 randomStream += lteHelper->AssignStreams(enbDevs, randomStream);
300 ueDevs = lteHelper->InstallUeDevice(ueNodes);
301 randomStream += lteHelper->AssignStreams(ueDevs, randomStream);
304 internet.Install(ueNodes);
309 lteHelper->Attach(ueDevs);
312 uint16_t dlPort = 10000;
313 uint16_t ulPort = 20000;
319 double interPacketInterval =
static_cast<double>(
packetSize * 8) / bitRate;
330 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
332 for (
uint32_t b = 0; b < numBearersPerUe; ++b)
346 dlClientApps.
Add(dlClientHelper.
Install(remoteHost));
350 dlServerApps.
Add(dlPacketSinkHelper.
Install(ue));
360 ulServerApps.
Add(ulPacketSinkHelper.
Install(remoteHost));
372 lteHelper->ActivateDedicatedEpsBearer(ueDevs.
Get(u), bearer, tft);
382 lteHelper->EnableTraces();
400 "/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
403 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
408 "/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
423 "Error, UE transitions to idle state for other than radio link failure");
446 uint16_t cellId = ueRrc->GetCellId();
450 for (
auto enbDevIt = enbDevices.
Begin(); enbDevIt != enbDevices.
End(); ++enbDevIt)
460 uint16_t rnti = ueRrc->GetRnti();
468 uint16_t ueCellId = ueRrc->GetCellId();
469 uint16_t enbCellId = enbLteDevice->GetCellId();
470 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
471 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
472 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
473 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
474 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
475 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
476 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
477 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
478 uint64_t ueImsi = ueLteDevice->GetImsi();
479 uint64_t enbImsi = ueManager->GetImsi();
489 ueManager->GetAttribute(
"DataRadioBearerMap", enbDataRadioBearerMapValue);
493 ueRrc->GetAttribute(
"DataRadioBearerMap", ueDataRadioBearerMapValue);
496 auto enbBearerIt = enbDataRadioBearerMapValue.
Begin();
497 auto ueBearerIt = ueDataRadioBearerMapValue.
Begin();
498 while (enbBearerIt != enbDataRadioBearerMapValue.
End() &&
499 ueBearerIt != ueDataRadioBearerMapValue.
End())
506 (
uint32_t)ueDrbInfo->m_epsBearerIdentity,
507 "epsBearerIdentity differs");
510 "drbIdentity differs");
512 (
uint32_t)ueDrbInfo->m_logicalChannelIdentity,
513 "logicalChannelIdentity differs");
518 NS_ASSERT_MSG(enbBearerIt == enbDataRadioBearerMapValue.
End(),
"too many bearers at eNB");
519 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.
End(),
"too many bearers at UE");
529 uint16_t rnti = ueRrc->GetRnti();
531 bool ueManagerFound =
false;
533 switch (numEnbDevices)
539 "Wrong LteUeRrc state!");
543 "Unexpected RNTI with value " << rnti <<
" found in eNB");
549 "Wrong LteUeRrc state!");
553 "RNTI " << rnti <<
" is not attached to the eNB");
556 NS_FATAL_ERROR(
"The RRC state of the UE in more then 2 eNB scenario is not defined. "
557 "Consider creating more cases");
569 bool ueManagerFound = enbRrc->HasUeManager(rnti);
570 return ueManagerFound;
581 NS_LOG_FUNCTION(
this << imsi << cellId << rnti << oldState << newState);
603 "radio link failure detection should start only in RRC CONNECTED state");
606 "radio link failure detection should start only in RRC CONNECTED state");
627 if (type ==
"Notify out of sync")
631 else if (type ==
"Notify in sync")
650 "wrong number of out-of-sync indications detected, check configured value for N310");
655 "wrong number of out-of-sync indications detected, check configured value for N311");
Testing the cell reselection procedure by UE at IDLE state.
uint32_t m_numOfInSyncIndications
number of in-sync indications detected
bool m_radioLinkFailureDetected
true if radio link fails
void JumpAway(Vector UeJumpAwayPositionList)
Jump away 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.
void CheckIdle(Ptr< NetDevice > ueDevice, NetDeviceContainer enbDevices)
Check if the UE is in idle state.
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_numEnbs
number of eNodeBs
bool m_isIdealRrc
whether the LTE is configured to use ideal RRC
bool CheckUeExistAtEnb(uint16_t rnti, Ptr< NetDevice > enbDevice)
Check if the UE exist at the eNB.
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.
std::vector< Vector > m_enbPositionList
Position of the eNodeBs.
void CheckConnected(Ptr< NetDevice > ueDevice, NetDeviceContainer enbDevices)
Check connected function.
void DoRun() override
Setup the simulation according to the configuration set by the class constructor, run it,...
Vector m_ueJumpAwayPosition
Position where the UE(s) would jump.
Ptr< MobilityModel > m_ueMobility
UE mobility model.
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.
~LteRadioLinkFailureTestCase() override
std::vector< Vector > m_uePositionList
Position of the UEs.
LteUeRrc::State m_lastState
The current UE RRC state.
std::vector< Time > m_checkConnectedList
the time at which UEs should have an active RRC connection
std::string BuildNameString(uint32_t numEnbs, uint32_t numUes, bool isIdealRrc)
Builds the test name string based on provided parameter values.
Time m_simTime
simulation time
void ConnectionEstablishedEnbCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established at eNodeB callback function.
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 ConnectionEstablishedUeCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established at UE callback function.
uint32_t m_numUes
number of UEs
uint32_t m_numOfOutOfSyncIndications
number of out-of-sync indications detected
LteRadioLinkFailureTestSuite()
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
AttributeValue implementation for Boolean.
Class for representing data rates.
uint64_t GetBitRate() const
Get the underlying bitrate.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
This class contains the specification of EPS Bearers.
@ NGBR_IMS
Non-GBR IMS Signalling.
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.
State
The states of the UE RRC entity.
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.
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.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Container for a set of ns3::Object pointers.
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.
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 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 Time Now()
Return the current simulation virtual time.
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.
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
std::string GetName() const
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
AttributeValue implementation for Time.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
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 SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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 ",...
static LteRadioLinkFailureTestSuite g_lteRadioLinkFailureTestSuite
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_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
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 const uint32_t packetSize
Packet size generated at the AP.