21 #include <ns3/boolean.h>
22 #include <ns3/callback.h>
23 #include <ns3/cc-helper.h>
24 #include <ns3/config.h>
25 #include <ns3/data-rate.h>
26 #include <ns3/internet-stack-helper.h>
27 #include <ns3/ipv4-address-helper.h>
28 #include <ns3/ipv4-interface-container.h>
29 #include <ns3/ipv4-static-routing-helper.h>
30 #include <ns3/ipv4-static-routing.h>
32 #include <ns3/lte-helper.h>
33 #include <ns3/mobility-helper.h>
34 #include <ns3/net-device-container.h>
35 #include <ns3/node-container.h>
36 #include <ns3/nstime.h>
37 #include <ns3/point-to-point-epc-helper.h>
38 #include <ns3/point-to-point-helper.h>
39 #include <ns3/position-allocator.h>
40 #include <ns3/simulator.h>
70 Time simulationDuration)
71 :
TestCase(
"Verifying that the time needed for handover is under a specified threshold"),
72 m_numberOfComponentCarriers(numberOfComponentCarriers),
73 m_useIdealRrc(useIdealRrc),
74 m_handoverTime(handoverTime),
75 m_delayThreshold(delayThreshold),
76 m_simulationDuration(simulationDuration),
83 void DoRun()
override;
93 void UeHandoverStartCallback(std::string context,
97 uint16_t targetCellId);
105 void UeHandoverEndOkCallback(std::string context,
117 void EnbHandoverStartCallback(std::string context,
121 uint16_t targetCellId);
129 void EnbHandoverEndOkCallback(std::string context,
147 NS_LOG_INFO(
"-----test case: ideal RRC = " << m_useIdealRrc <<
" handover time = "
148 << m_handoverTime.As(
Time::S) <<
"-----");
153 auto epcHelper = CreateObject<PointToPointEpcHelper>();
155 auto lteHelper = CreateObject<LteHelper>();
156 lteHelper->SetEpcHelper(epcHelper);
157 lteHelper->SetAttribute(
"UseIdealRrc",
BooleanValue(m_useIdealRrc));
158 lteHelper->SetAttribute(
"NumberOfComponentCarriers",
161 auto ccHelper = CreateObject<CcHelper>();
162 ccHelper->SetUlEarfcn(100 + 18000);
163 ccHelper->SetDlEarfcn(100);
164 ccHelper->SetUlBandwidth(25);
165 ccHelper->SetDlBandwidth(25);
166 ccHelper->SetNumberOfComponentCarriers(m_numberOfComponentCarriers);
179 auto ueNode = CreateObject<Node>();
182 auto posAlloc = CreateObject<ListPositionAllocator>();
183 posAlloc->Add(Vector(0, 0, 0));
184 posAlloc->Add(Vector(1000, 0, 0));
185 posAlloc->Add(Vector(500, 0, 0));
190 mobilityHelper.
Install(enbNodes);
191 mobilityHelper.
Install(ueNode);
196 auto enbDevs = lteHelper->InstallEnbDevice(enbNodes);
197 auto ueDev = lteHelper->InstallUeDevice(ueNode).Get(0);
203 inetStackHelper.
Install(ueNode);
205 ueIfs = epcHelper->AssignUeIpv4Address(ueDev);
219 lteHelper->AddX2Interface(enbNodes);
220 lteHelper->Attach(ueDev, enbDevs.Get(0));
221 lteHelper->HandoverRequest(m_handoverTime, ueDev, enbDevs.Get(0), enbDevs.Get(1));
235 uint16_t targetCellId)
254 "UE handover delay is higher than the allowed threshold "
255 <<
"(ideal RRC = " << m_useIdealRrc
256 <<
" handover time = " << m_handoverTime.
As(
Time::S) <<
")");
264 uint16_t targetCellId)
283 "eNodeB handover delay is higher than the allowed threshold "
284 <<
"(ideal RRC = " << m_useIdealRrc
285 <<
" handover time = " << m_handoverTime.
As(
Time::S) <<
")");
307 handoverTime +=
Seconds(0.001))
324 handoverTime +=
Seconds(0.001))
Verifying that the time needed for handover is under a specified threshold.
void EnbHandoverStartCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
ENB handover start callback function.
Time m_simulationDuration
the simulation duration
void DoRun() override
Implementation to actually run this TestCase.
bool m_useIdealRrc
use ideal RRC?
uint8_t m_numberOfComponentCarriers
Number of component carriers.
void UeHandoverEndOkCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
UE handover end OK callback function.
Time m_handoverTime
handover time
void UeHandoverStartCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
UE handover start callback function.
Time m_delayThreshold
the delay threshold
void EnbHandoverEndOkCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
ENB handover end OK callback function.
Time m_ueHandoverStart
UE handover start time.
LteHandoverDelayTestCase(uint8_t numberOfComponentCarriers, bool useIdealRrc, Time handoverTime, Time delayThreshold, Time simulationDuration)
Constructor.
Time m_enbHandoverStart
ENB handover start time.
Lte Handover Delay Test Suite.
LteHandoverDelayTestSuite()
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 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.
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.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
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_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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.
LteHandoverDelayTestSuite g_lteHandoverDelayTestSuite
the test suite
#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.
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...