24 #include <ns3/nstime.h>
25 #include <ns3/callback.h>
26 #include <ns3/config.h>
27 #include <ns3/boolean.h>
28 #include <ns3/simulator.h>
30 #include <ns3/node-container.h>
31 #include <ns3/net-device-container.h>
32 #include <ns3/ipv4-interface-container.h>
34 #include <ns3/lte-helper.h>
35 #include <ns3/point-to-point-epc-helper.h>
36 #include <ns3/internet-stack-helper.h>
37 #include <ns3/point-to-point-helper.h>
38 #include <ns3/ipv4-address-helper.h>
39 #include <ns3/ipv4-static-routing-helper.h>
40 #include <ns3/mobility-helper.h>
42 #include <ns3/data-rate.h>
43 #include <ns3/ipv4-static-routing.h>
44 #include <ns3/position-allocator.h>
59 Time delayThreshold,
Time simulationDuration)
60 :
TestCase (
"Verifying that the time needed for handover is under a specified threshold"),
61 m_useIdealRrc (useIdealRrc),
62 m_handoverTime (handoverTime),
63 m_delayThreshold (delayThreshold),
64 m_simulationDuration (simulationDuration),
65 m_ueHandoverStart (
Seconds (0)),
66 m_enbHandoverStart (
Seconds (0))
70 virtual void DoRun (
void);
72 void UeHandoverStartCallback (std::string context, uint64_t imsi,
73 uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
74 void UeHandoverEndOkCallback (std::string context, uint64_t imsi,
75 uint16_t cellid, uint16_t rnti);
76 void EnbHandoverStartCallback (std::string context, uint64_t imsi,
77 uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
78 void EnbHandoverEndOkCallback (std::string context, uint64_t imsi,
79 uint16_t cellid, uint16_t rnti);
94 NS_LOG_INFO (
"-----test case: ideal RRC = " << m_useIdealRrc
95 <<
" handover time = " << m_handoverTime.GetSeconds () <<
"-----");
99 lteHelper->SetEpcHelper (epcHelper);
107 inetStackHelper.
Install (remoteHosts);
118 remoteHosts.
Get (0));
121 addrHelper.
SetBase (
"10.1.1.0",
"255.255.255.0");
123 inetIfs = addrHelper.
Assign (inetDevs);
150 posAlloc->
Add (Vector (0, 0, 0));
151 posAlloc->
Add (Vector (1000, 0, 0));
152 posAlloc->
Add (Vector (500, 0, 0));
157 mobilityHelper.
Install (enbNodes);
158 mobilityHelper.
Install (ueNodes);
164 enbDevs = lteHelper->InstallEnbDevice (enbNodes);
165 ueDevs = lteHelper->InstallUeDevice (ueNodes);
169 inetStackHelper.
Install(ueNodes);
171 ueIfs = epcHelper->AssignUeIpv4Address (ueDevs);
177 ueStaticRouting->
SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (),
194 lteHelper->AddX2Interface (enbNodes);
195 lteHelper->Attach (ueDevs.
Get(0), enbDevs.
Get(0));
196 lteHelper->HandoverRequest (m_handoverTime, ueDevs.
Get (0), enbDevs.
Get (0),
210 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
218 uint64_t imsi, uint16_t cellid, uint16_t rnti)
225 "UE handover delay is higher than the allowed threshold "
226 <<
"(ideal RRC = " << m_useIdealRrc
227 <<
" handover time = " << m_handoverTime.GetSeconds () <<
")");
233 uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
241 uint64_t imsi, uint16_t cellid, uint16_t rnti)
248 "eNodeB handover delay is higher than the allowed threshold "
249 <<
"(ideal RRC = " << m_useIdealRrc
250 <<
" handover time = " << m_handoverTime.GetSeconds () <<
")");
272 handoverTime +=
Seconds (0.001))
282 for (
Time handoverTime = Seconds (0.100); handoverTime <
Seconds (0.110);
283 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 and interface index.
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
#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)
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Build a set of PointToPointNetDevice objects.
void Connect(std::string path, const CallbackBase &cb)
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void EnbHandoverEndOkCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Class for representing data rates.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
AttributeValue implementation for Time.
Hold an unsigned integer type.
virtual void DoRun(void)
Implementation to actually run this TestCase.
holds a vector of ns3::NetDevice pointers
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
LteHandoverDelayTestSuite()
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Access to the Ipv4 forwarding table, interfaces, and configuration.
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())
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
static Time Now(void)
Return the current simulation virtual time.
LteHandoverDelayTestSuite g_lteHandoverDelayTestSuite
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
Helper class used to assign positions and mobility models to nodes.
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table.
Ipv4 addresses are stored in host order in this class.
LteHandoverDelayTestCase(bool useIdealRrc, Time handoverTime, Time delayThreshold, Time simulationDuration)
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
Helper class that adds ns3::Ipv4StaticRouting objects.
AttributeValue implementation for DataRate.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
#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.
void Add(Vector v)
Add a position to the list of positions.
void UeHandoverStartCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
void UeHandoverEndOkCallback(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Time m_simulationDuration
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
#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.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.