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)
122 void DoRun()
override;
140 uint16_t sourceCellId,
142 uint16_t targetCellId);
154 uint16_t targetCellId);
166 uint16_t targetCellId);
178 uint16_t targetCellId);
190 uint16_t targetCellId);
210 uint32_t previousSeed = RngSeedManager::GetSeed();
211 uint64_t previousRun = RngSeedManager::GetRun();
212 RngSeedManager::SetSeed(1);
213 RngSeedManager::SetRun(2);
218 auto epcHelper = CreateObject<PointToPointEpcHelper>();
220 auto lteHelper = CreateObject<LteHelper>();
221 lteHelper->SetEpcHelper(epcHelper);
235 lteHelper->SetPathlossModelType(TypeId::LookupByName(
"ns3::LogDistancePropagationLossModel"));
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));
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));
298 Simulator::Destroy();
300 RngSeedManager::SetSeed(previousSeed);
301 RngSeedManager::SetRun(previousRun);
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)
331 uint16_t targetCellId)
341 uint16_t targetCellId)
351 uint16_t targetCellId)
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.
bool m_hasHandoverFailureOccured
has handover failure occurred 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 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.
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.
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...