10#include <ns3/boolean.h>
11#include <ns3/callback.h>
12#include <ns3/config.h>
13#include <ns3/data-rate.h>
14#include <ns3/internet-stack-helper.h>
15#include <ns3/ipv4-address-helper.h>
16#include <ns3/ipv4-interface-container.h>
17#include <ns3/ipv4-static-routing-helper.h>
18#include <ns3/ipv4-static-routing.h>
20#include <ns3/lte-helper.h>
21#include <ns3/lte-ue-net-device.h>
22#include <ns3/mobility-helper.h>
23#include <ns3/net-device-container.h>
24#include <ns3/node-container.h>
25#include <ns3/nstime.h>
26#include <ns3/point-to-point-epc-helper.h>
27#include <ns3/point-to-point-helper.h>
28#include <ns3/position-allocator.h>
29#include <ns3/rng-seed-manager.h>
30#include <ns3/simulator.h>
86 Time simulationDuration,
87 uint8_t numberOfRaPreambles,
88 uint8_t preambleTransMax,
89 uint8_t raResponseWindowSize,
90 Time handoverJoiningTimeout,
91 Time handoverLeavingTimeout,
92 uint16_t targeteNodeBPosition)
112 void DoRun()
override;
130 uint16_t sourceCellId,
132 uint16_t targetCellId);
144 uint16_t targetCellId);
156 uint16_t targetCellId);
168 uint16_t targetCellId);
180 uint16_t targetCellId);
211 lteHelper->SetEpcHelper(epcHelper);
226 lteHelper->SetPathlossModelAttribute(
"Exponent",
DoubleValue(3.5));
227 lteHelper->SetPathlossModelAttribute(
"ReferenceLoss",
DoubleValue(35));
244 posAlloc->Add(Vector(0, 0, 0));
246 posAlloc->Add(Vector(200, 0, 0));
251 mobilityHelper.
Install(enbNodes);
252 mobilityHelper.
Install(ueNode);
257 auto enbDevs = lteHelper->InstallEnbDevice(enbNodes);
258 auto ueDev = lteHelper->InstallUeDevice(ueNode).Get(0);
262 castedUeDev->GetPhy()->GetDlSpectrumPhy()->AssignStreams(175);
268 inetStackHelper.
Install(ueNode);
270 ueIfs = epcHelper->AssignUeIpv4Address(ueDev);
275 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureMaxRach",
277 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureNoPreamble",
279 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureJoining",
281 Config::Connect(
"/NodeList/*/DeviceList/*/LteEnbRrc/HandoverFailureLeaving",
285 lteHelper->AddX2Interface(enbNodes);
286 lteHelper->Attach(ueDev, enbDevs.Get(0));
287 lteHelper->HandoverRequest(
m_handoverTime, ueDev, enbDevs.Get(0), enbDevs.Get(1));
301 uint16_t sourceCellId,
303 uint16_t targetCellId)
305 NS_LOG_FUNCTION(
this <<
" " << context <<
" IMSI-" << imsi <<
" sourceCellID-" << sourceCellId
306 <<
" RNTI-" << rnti <<
" targetCellID-" << targetCellId);
307 NS_LOG_INFO(
"HANDOVER COMMAND received through at UE "
308 << imsi <<
" to handover from " << sourceCellId <<
" to " << targetCellId);
315 uint16_t targetCellId)
325 uint16_t targetCellId)
335 uint16_t targetCellId)
345 uint16_t targetCellId)
378 "transmissions reached from UE to target eNodeB",
388 TestCase::Duration::QUICK);
390 "REAL Handover failure due to non-allocation of non-contention preamble at "
391 "target eNodeB due to max number reached",
401 TestCase::Duration::QUICK);
403 "REAL Handover failure due to HANDOVER JOINING timeout before reception of "
404 "RRC CONNECTION RECONFIGURATION at source eNodeB",
414 TestCase::Duration::QUICK);
416 "REAL Handover failure due to HANDOVER JOINING timeout before completion "
417 "of non-contention RACH process to target eNodeB",
427 TestCase::Duration::QUICK);
429 "REAL Handover failure due to HANDOVER JOINING timeout before reception of "
430 "RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
440 TestCase::Duration::QUICK);
442 "REAL Handover failure due to HANDOVER LEAVING timeout before reception of "
443 "RRC CONNECTION RECONFIGURATION at source eNodeB",
453 TestCase::Duration::QUICK);
455 "REAL Handover failure due to HANDOVER LEAVING timeout before completion "
456 "of non-contention RACH process to target eNodeB",
466 TestCase::Duration::QUICK);
468 "REAL Handover failure due to HANDOVER LEAVING timeout before reception of "
469 "RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
479 TestCase::Duration::QUICK);
483 "transmissions reached from UE to target eNodeB",
493 TestCase::Duration::QUICK);
495 "IDEAL Handover failure due to non-allocation of non-contention preamble "
496 "at target eNodeB due to max number reached",
506 TestCase::Duration::QUICK);
508 "IDEAL Handover failure due to HANDOVER JOINING timeout before reception "
509 "of RRC CONNECTION RECONFIGURATION at source eNodeB",
519 TestCase::Duration::QUICK);
521 "IDEAL Handover failure due to HANDOVER JOINING timeout before completion "
522 "of non-contention RACH process to target eNodeB",
532 TestCase::Duration::QUICK);
534 "IDEAL Handover failure due to HANDOVER JOINING timeout before reception "
535 "of RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
545 TestCase::Duration::QUICK);
547 "IDEAL Handover failure due to HANDOVER LEAVING timeout before reception "
548 "of RRC CONNECTION RECONFIGURATION at source eNodeB",
558 TestCase::Duration::QUICK);
560 "IDEAL Handover failure due to HANDOVER LEAVING timeout before completion "
561 "of non-contention RACH process to target eNodeB",
571 TestCase::Duration::QUICK);
573 "IDEAL Handover failure due to HANDOVER LEAVING timeout before reception "
574 "of RRC CONNECTION RECONFIGURATION COMPLETE at target eNodeB",
584 TestCase::Duration::QUICK);
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()
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.
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.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
std::string GetName() const
static constexpr auto SYSTEM
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
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 ()
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#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...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.