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>
97 Time simulationDuration,
98 uint8_t numberOfRaPreambles,
99 uint8_t preambleTransMax,
100 uint8_t raResponseWindowSize,
101 Time handoverJoiningTimeout,
102 Time handoverLeavingTimeout,
103 uint16_t targeteNodeBPosition)
123 void DoRun()
override;
141 uint16_t sourceCellId,
143 uint16_t targetCellId);
155 uint16_t targetCellId);
167 uint16_t targetCellId);
179 uint16_t targetCellId);
191 uint16_t targetCellId);
211 uint32_t previousSeed = RngSeedManager::GetSeed();
212 uint64_t previousRun = RngSeedManager::GetRun();
213 RngSeedManager::SetSeed(1);
214 RngSeedManager::SetRun(2);
219 auto epcHelper = CreateObject<PointToPointEpcHelper>();
221 auto lteHelper = CreateObject<LteHelper>();
222 lteHelper->SetEpcHelper(epcHelper);
236 lteHelper->SetPathlossModelType(TypeId::LookupByName(
"ns3::LogDistancePropagationLossModel"));
237 lteHelper->SetPathlossModelAttribute(
"Exponent",
DoubleValue(3.5));
238 lteHelper->SetPathlossModelAttribute(
"ReferenceLoss",
DoubleValue(35));
251 auto ueNode = CreateObject<Node>();
254 auto posAlloc = CreateObject<ListPositionAllocator>();
255 posAlloc->Add(Vector(0, 0, 0));
257 posAlloc->Add(Vector(200, 0, 0));
262 mobilityHelper.
Install(enbNodes);
263 mobilityHelper.
Install(ueNode);
268 auto enbDevs = lteHelper->InstallEnbDevice(enbNodes);
269 auto ueDev = lteHelper->InstallUeDevice(ueNode).Get(0);
275 inetStackHelper.
Install(ueNode);
277 ueIfs = epcHelper->AssignUeIpv4Address(ueDev);
282 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureMaxRach",
284 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureNoPreamble",
286 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureJoining",
288 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureLeaving",
292 lteHelper->AddX2Interface(enbNodes);
293 lteHelper->Attach(ueDev, enbDevs.Get(0));
294 lteHelper->HandoverRequest(
m_handoverTime, ueDev, enbDevs.Get(0), enbDevs.Get(1));
299 Simulator::Destroy();
301 RngSeedManager::SetSeed(previousSeed);
302 RngSeedManager::SetRun(previousRun);
308 uint16_t sourceCellId,
310 uint16_t targetCellId)
312 NS_LOG_FUNCTION(
this <<
" " << context <<
" IMSI-" << imsi <<
" sourceCellID-" << sourceCellId
313 <<
" RNTI-" << rnti <<
" targetCellID-" << targetCellId);
314 NS_LOG_INFO(
"HANDOVER COMMAND received through at UE "
315 << imsi <<
" to handover from " << sourceCellId <<
" to " << targetCellId);
322 uint16_t targetCellId)
332 uint16_t targetCellId)
342 uint16_t targetCellId)
352 uint16_t targetCellId)
386 "transmissions reached from UE to target eNodeB",
398 "REAL Handover failure due to non-allocation of non-contention preamble at "
399 "target eNodeB due to max number reached",
411 "REAL Handover failure due to HANDOVER JOINING timeout before reception of "
412 "RRC CONNECTION RECONFIGURATION at source eNodeB",
424 "REAL Handover failure due to HANDOVER JOINING timeout before completion "
425 "of non-contention RACH process to target eNodeB",
437 "REAL Handover failure due to HANDOVER JOINING timeout before reception of "
438 "RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
450 "REAL Handover failure due to HANDOVER LEAVING timeout before reception of "
451 "RRC CONNECTION RECONFIGURATION at source eNodeB",
463 "REAL Handover failure due to HANDOVER LEAVING timeout before completion "
464 "of non-contention RACH process to target eNodeB",
476 "REAL Handover failure due to HANDOVER LEAVING timeout before reception of "
477 "RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
491 "transmissions reached from UE to target eNodeB",
503 "IDEAL Handover failure due to non-allocation of non-contention preamble "
504 "at target eNodeB due to max number reached",
516 "IDEAL Handover failure due to HANDOVER JOINING timeout before reception "
517 "of RRC CONNECTION RECONFIGURATION at source eNodeB",
529 "IDEAL Handover failure due to HANDOVER JOINING timeout before completion "
530 "of non-contention RACH process to target eNodeB",
542 "IDEAL Handover failure due to HANDOVER JOINING timeout before reception "
543 "of RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
555 "IDEAL Handover failure due to HANDOVER LEAVING timeout before reception "
556 "of RRC CONNECTION RECONFIGURATION at source eNodeB",
568 "IDEAL Handover failure due to HANDOVER LEAVING timeout before completion "
569 "of non-contention RACH process to target eNodeB",
581 "IDEAL Handover failure due to HANDOVER LEAVING timeout before reception "
582 "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.
bool m_hasHandoverFailureOccured
has handover failure occured in simulation
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.
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 occured in th...
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()
AttributeValue implementation for Boolean.
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.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
std::string GetName() const
@ SYSTEM
This test suite implements a System Test.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
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.
#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.
LteHandoverFailureTestSuite g_lteHandoverFailureTestSuite
end of LteHandoverFailureTestSuite ()
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...