25 #include <ns3/nstime.h> 26 #include <ns3/callback.h> 27 #include <ns3/config.h> 28 #include <ns3/boolean.h> 29 #include <ns3/simulator.h> 31 #include <ns3/node-container.h> 32 #include <ns3/net-device-container.h> 33 #include <ns3/ipv4-interface-container.h> 35 #include <ns3/lte-helper.h> 36 #include <ns3/point-to-point-epc-helper.h> 37 #include <ns3/internet-stack-helper.h> 38 #include <ns3/point-to-point-helper.h> 39 #include <ns3/ipv4-address-helper.h> 40 #include <ns3/ipv4-static-routing-helper.h> 41 #include <ns3/mobility-helper.h> 43 #include <ns3/data-rate.h> 44 #include <ns3/ipv4-static-routing.h> 45 #include <ns3/position-allocator.h> 73 Time delayThreshold,
Time simulationDuration)
74 :
TestCase (
"Verifying that the time needed for handover is under a specified threshold"),
75 m_numberOfComponentCarriers (numberOfComponentCarriers),
76 m_useIdealRrc (useIdealRrc),
77 m_handoverTime (handoverTime),
78 m_delayThreshold (delayThreshold),
79 m_simulationDuration (simulationDuration),
80 m_ueHandoverStart (
Seconds (0)),
81 m_enbHandoverStart (
Seconds (0))
85 virtual void DoRun (
void);
95 void UeHandoverStartCallback (std::string context, uint64_t imsi,
96 uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
104 void UeHandoverEndOkCallback (std::string context, uint64_t imsi,
105 uint16_t cellid, uint16_t rnti);
114 void EnbHandoverStartCallback (std::string context, uint64_t imsi,
115 uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
123 void EnbHandoverEndOkCallback (std::string context, uint64_t imsi,
124 uint16_t cellid, uint16_t rnti);
140 NS_LOG_INFO (
"-----test case: ideal RRC = " << m_useIdealRrc
141 <<
" handover time = " << m_handoverTime.GetSeconds () <<
"-----");
146 auto epcHelper = CreateObject<PointToPointEpcHelper> ();
148 auto lteHelper = CreateObject<LteHelper> ();
149 lteHelper->SetEpcHelper (epcHelper);
150 lteHelper->SetAttribute (
"UseIdealRrc",
BooleanValue (m_useIdealRrc));
151 lteHelper->SetAttribute (
"NumberOfComponentCarriers",
UintegerValue (m_numberOfComponentCarriers));
153 auto ccHelper = CreateObject<CcHelper> ();
154 ccHelper->SetUlEarfcn (100 + 18000);
155 ccHelper->SetDlEarfcn (100);
156 ccHelper->SetUlBandwidth (25);
157 ccHelper->SetDlBandwidth (25);
158 ccHelper->SetNumberOfComponentCarriers (m_numberOfComponentCarriers);
171 auto ueNode = CreateObject<Node> ();
174 auto posAlloc = CreateObject<ListPositionAllocator> ();
175 posAlloc->Add (Vector (0, 0, 0));
176 posAlloc->Add (Vector (1000, 0, 0));
177 posAlloc->Add (Vector (500, 0, 0));
182 mobilityHelper.
Install (enbNodes);
183 mobilityHelper.
Install (ueNode);
188 auto enbDevs = lteHelper->InstallEnbDevice (enbNodes);
189 auto ueDev = lteHelper->InstallUeDevice (ueNode).Get (0);
195 inetStackHelper.
Install (ueNode);
197 ueIfs = epcHelper->AssignUeIpv4Address (ueDev);
211 lteHelper->AddX2Interface (enbNodes);
212 lteHelper->Attach (ueDev, enbDevs.Get(0));
213 lteHelper->HandoverRequest (m_handoverTime, ueDev, enbDevs.Get (0), enbDevs.Get (1));
225 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
233 uint64_t imsi, uint16_t cellid, uint16_t rnti)
240 "UE handover delay is higher than the allowed threshold " 241 <<
"(ideal RRC = " << m_useIdealRrc
242 <<
" handover time = " << m_handoverTime.GetSeconds () <<
")");
248 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
256 uint64_t imsi, uint16_t cellid, uint16_t rnti)
263 "eNodeB handover delay is higher than the allowed threshold " 264 <<
"(ideal RRC = " << m_useIdealRrc
265 <<
" handover time = " << m_handoverTime.GetSeconds () <<
")");
290 handoverTime +=
Seconds (0.001))
301 handoverTime +=
Seconds (0.001))
Simulation virtual time values and global simulation resolution.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Lte Handover Delay Test Suite.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
static void Run(void)
Run the simulation.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void EnbHandoverStartCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
ENB handover start callback function.
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
bool m_useIdealRrc
use ideal RRC?
void EnbHandoverEndOkCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
ENB handover end OK callback function.
LteHandoverDelayTestSuite g_lteHandoverDelayTestSuite
the test suite
Hold an unsigned integer type.
Time m_handoverTime
handover time
virtual void DoRun(void)
Implementation to actually run this TestCase.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Time m_enbHandoverStart
ENB handover start time.
LteHandoverDelayTestSuite()
void Connect(std::string path, const CallbackBase &cb)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Verifying that the time needed for handover is under a specified threshold.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
static Time Now(void)
Return the current simulation virtual time.
Time m_delayThreshold
the delay threshold
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Helper class used to assign positions and mobility models to nodes.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time m_ueHandoverStart
UE handover start time.
void UeHandoverStartCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
UE handover start callback function.
void UeHandoverEndOkCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
UE handover end OK callback function.
Time m_simulationDuration
the simulation duration
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
uint8_t m_numberOfComponentCarriers
Number of component carriers.
LteHandoverDelayTestCase(uint8_t numberOfComponentCarriers, bool useIdealRrc, Time handoverTime, Time delayThreshold, Time simulationDuration)
Constructor.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
#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.