21 #include <ns3/boolean.h>
22 #include <ns3/callback.h>
23 #include <ns3/config.h>
24 #include <ns3/data-rate.h>
25 #include <ns3/internet-stack-helper.h>
26 #include <ns3/ipv4-address-helper.h>
27 #include <ns3/ipv4-interface-container.h>
28 #include <ns3/ipv4-static-routing-helper.h>
29 #include <ns3/ipv4-static-routing.h>
31 #include <ns3/lte-helper.h>
32 #include <ns3/mobility-helper.h>
33 #include <ns3/net-device-container.h>
34 #include <ns3/node-container.h>
35 #include <ns3/nstime.h>
36 #include <ns3/point-to-point-epc-helper.h>
37 #include <ns3/point-to-point-helper.h>
38 #include <ns3/position-allocator.h>
39 #include <ns3/rng-seed-manager.h>
40 #include <ns3/simulator.h>
96 Time simulationDuration,
97 uint8_t numberOfRaPreambles,
98 uint8_t preambleTransMax,
99 uint8_t raResponseWindowSize,
100 Time handoverJoiningTimeout,
101 Time handoverLeavingTimeout,
102 uint16_t targeteNodeBPosition)
104 m_useIdealRrc(useIdealRrc),
105 m_handoverTime(handoverTime),
106 m_simulationDuration(simulationDuration),
107 m_numberOfRaPreambles(numberOfRaPreambles),
108 m_preambleTransMax(preambleTransMax),
109 m_raResponseWindowSize(raResponseWindowSize),
110 m_handoverJoiningTimeout(handoverJoiningTimeout),
111 m_handoverLeavingTimeout(handoverLeavingTimeout),
112 m_targeteNodeBPosition(targeteNodeBPosition),
113 m_hasHandoverFailureOccurred(false)
122 void DoRun()
override;
128 void DoTeardown()
override;
138 void UeHandoverStartCallback(std::string context,
140 uint16_t sourceCellId,
142 uint16_t targetCellId);
151 void HandoverFailureMaxRach(std::string context,
154 uint16_t targetCellId);
163 void HandoverFailureNoPreamble(std::string context,
166 uint16_t targetCellId);
175 void HandoverFailureJoining(std::string context,
178 uint16_t targetCellId);
187 void HandoverFailureLeaving(std::string context,
190 uint16_t targetCellId);
218 auto epcHelper = CreateObject<PointToPointEpcHelper>();
220 auto lteHelper = CreateObject<LteHelper>();
221 lteHelper->SetEpcHelper(epcHelper);
224 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(m_useIdealRrc));
236 lteHelper->SetPathlossModelAttribute(
"Exponent",
DoubleValue(3.5));
237 lteHelper->SetPathlossModelAttribute(
"ReferenceLoss",
DoubleValue(35));
250 auto ueNode = CreateObject<Node>();
253 auto posAlloc = CreateObject<ListPositionAllocator>();
254 posAlloc->Add(Vector(0, 0, 0));
255 posAlloc->Add(Vector(m_targeteNodeBPosition, 0, 0));
256 posAlloc->Add(Vector(200, 0, 0));
261 mobilityHelper.
Install(enbNodes);
262 mobilityHelper.
Install(ueNode);
267 auto enbDevs = lteHelper->InstallEnbDevice(enbNodes);
268 auto ueDev = lteHelper->InstallUeDevice(ueNode).Get(0);
274 inetStackHelper.
Install(ueNode);
276 ueIfs = epcHelper->AssignUeIpv4Address(ueDev);
281 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureMaxRach",
283 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureNoPreamble",
285 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureJoining",
287 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureLeaving",
291 lteHelper->AddX2Interface(enbNodes);
292 lteHelper->Attach(ueDev, enbDevs.Get(0));
293 lteHelper->HandoverRequest(m_handoverTime, ueDev, enbDevs.Get(0), enbDevs.Get(1));
307 uint16_t sourceCellId,
309 uint16_t targetCellId)
311 NS_LOG_FUNCTION(
this <<
" " << context <<
" IMSI-" << imsi <<
" sourceCellID-" << sourceCellId
312 <<
" RNTI-" << rnti <<
" targetCellID-" << targetCellId);
313 NS_LOG_INFO(
"HANDOVER COMMAND received through at UE "
314 << imsi <<
" to handover from " << sourceCellId <<
" to " << targetCellId);
321 uint16_t targetCellId)
324 m_hasHandoverFailureOccurred =
true;
331 uint16_t targetCellId)
334 m_hasHandoverFailureOccurred =
true;
341 uint16_t targetCellId)
344 m_hasHandoverFailureOccurred =
true;
351 uint16_t targetCellId)
354 m_hasHandoverFailureOccurred =
true;
384 "transmissions reached from UE to target eNodeB",
396 "REAL Handover failure due to non-allocation of non-contention preamble at "
397 "target eNodeB due to max number reached",
409 "REAL Handover failure due to HANDOVER JOINING timeout before reception of "
410 "RRC CONNECTION RECONFIGURATION at source eNodeB",
422 "REAL Handover failure due to HANDOVER JOINING timeout before completion "
423 "of non-contention RACH process to target eNodeB",
435 "REAL Handover failure due to HANDOVER JOINING timeout before reception of "
436 "RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
448 "REAL Handover failure due to HANDOVER LEAVING timeout before reception of "
449 "RRC CONNECTION RECONFIGURATION at source eNodeB",
461 "REAL Handover failure due to HANDOVER LEAVING timeout before completion "
462 "of non-contention RACH process to target eNodeB",
474 "REAL Handover failure due to HANDOVER LEAVING timeout before reception of "
475 "RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
489 "transmissions reached from UE to target eNodeB",
501 "IDEAL Handover failure due to non-allocation of non-contention preamble "
502 "at target eNodeB due to max number reached",
514 "IDEAL Handover failure due to HANDOVER JOINING timeout before reception "
515 "of RRC CONNECTION RECONFIGURATION at source eNodeB",
527 "IDEAL Handover failure due to HANDOVER JOINING timeout before completion "
528 "of non-contention RACH process to target eNodeB",
540 "IDEAL Handover failure due to HANDOVER JOINING timeout before reception "
541 "of RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
553 "IDEAL Handover failure due to HANDOVER LEAVING timeout before reception "
554 "of RRC CONNECTION RECONFIGURATION at source eNodeB",
566 "IDEAL Handover failure due to HANDOVER LEAVING timeout before completion "
567 "of non-contention RACH process to target eNodeB",
579 "IDEAL Handover failure due to HANDOVER LEAVING timeout before reception "
580 "of RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
Verifying that a handover failure occurs due to various causes.
LteHandoverFailureTestCase(std::string name, bool useIdealRrc, Time handoverTime, Time simulationDuration, uint8_t numberOfRaPreambles, uint8_t preambleTransMax, uint8_t raResponseWindowSize, Time handoverJoiningTimeout, Time handoverLeavingTimeout, uint16_t targeteNodeBPosition)
Constructor.
Time m_handoverTime
handover time
Time m_handoverJoiningTimeout
handover joining timeout duration at target eNodeB
Time m_handoverLeavingTimeout
handover leaving timeout duration at source eNodeB
uint8_t m_preambleTransMax
max number of RACH preambles possible from UE to eNodeB
bool m_useIdealRrc
use ideal RRC?
uint8_t m_numberOfRaPreambles
number of random access preambles for contention based RACH process
void HandoverFailureMaxRach(std::string context, uint64_t imsi, uint16_t rnti, uint16_t targetCellId)
Handover failure callback due to maximum RACH transmissions reached from UE to target eNodeB.
void DoRun() override
Run a simulation of a two eNodeB network using the parameters provided to the constructor function.
uint16_t m_targeteNodeBPosition
position of the target eNodeB
void HandoverFailureJoining(std::string context, uint64_t imsi, uint16_t rnti, uint16_t targetCellId)
Handover failure callback due to handover joining timeout at target eNodeB.
void HandoverFailureNoPreamble(std::string context, uint64_t imsi, uint16_t rnti, uint16_t targetCellId)
Handover failure callback due to non-allocation of non-contention preamble at target eNodeB.
void HandoverFailureLeaving(std::string context, uint64_t imsi, uint16_t rnti, uint16_t targetCellId)
Handover failure callback due to handover leaving timeout at source eNodeB.
bool m_hasHandoverFailureOccurred
has handover failure occurred in simulation
void UeHandoverStartCallback(std::string context, uint64_t imsi, uint16_t sourceCellId, uint16_t rnti, uint16_t targetCellId)
UE handover start callback function to indicate start of handover.
void DoTeardown() override
Called at the end of simulation and verifies that a handover and a handover failure has occurred in t...
uint8_t m_raResponseWindowSize
window length for reception of RAR
Time m_simulationDuration
the simulation duration
The following log components can be used to debug this test's behavior: LteHandoverFailureTest:LteEnb...
LteHandoverFailureTestSuite()
This class can be used to hold variables of floating point type such as 'double' or 'float'.
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...
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Helper class used to assign positions and mobility models to nodes.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void SetMobilityModel(std::string type, Ts &&... args)
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 a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
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 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.
Simulation virtual time values and global simulation resolution.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Hold an unsigned integer type.
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#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 ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
LteHandoverFailureTestSuite g_lteHandoverFailureTestSuite
end of LteHandoverFailureTestSuite ()
#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.
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.
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...