A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-test-radio-link-failure.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Fraunhofer ESK
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Vignesh Babu <ns3-dev@esk.fraunhofer.de>
7 *
8 * Modified by:
9 * Zoraze Ali <zoraze.ali@cttc.es> (included both RRC protocol, two
10 * eNB scenario and UE jump away
11 * logic)
12 */
13
15
16#include "ns3/core-module.h"
17#include "ns3/internet-module.h"
18#include "ns3/lte-module.h"
19#include "ns3/mobility-module.h"
20#include "ns3/network-module.h"
21#include "ns3/packet-sink-helper.h"
22#include "ns3/point-to-point-module.h"
23#include "ns3/udp-client-server-helper.h"
24
25#include <iomanip>
26#include <iostream>
27#include <stdio.h>
28#include <vector>
29
30using namespace ns3;
31
32NS_LOG_COMPONENT_DEFINE("LteRadioLinkFailureTest");
33
34/*
35 * Test Suite
36 */
38 : TestSuite("lte-radio-link-failure", Type::SYSTEM)
39{
40 std::vector<Vector> uePositionList;
41 std::vector<Vector> enbPositionList;
42 std::vector<Time> checkConnectedList;
43 Vector ueJumpAwayPosition;
44
45 uePositionList.emplace_back(10, 0, 0);
46 enbPositionList.emplace_back(0, 0, 0);
47 ueJumpAwayPosition = Vector(7000.0, 0.0, 0.0);
48 // check before jumping
49 checkConnectedList.push_back(Seconds(0.3));
50 // check connection after jumping but before T310 timer expiration.
51 // This is to make sure that UE stays in connected mode
52 // before the expiration of T310 timer.
53 checkConnectedList.push_back(Seconds(1));
54
55 // One eNB: Ideal RRC PROTOCOL
56 //
58 1,
59 Seconds(2),
60 true,
61 uePositionList,
62 enbPositionList,
63 ueJumpAwayPosition,
64 checkConnectedList),
66
67 // One eNB: Real RRC PROTOCOL
69 1,
70 Seconds(2),
71 false,
72 uePositionList,
73 enbPositionList,
74 ueJumpAwayPosition,
75 checkConnectedList),
77
78 // Two eNBs: Ideal RRC PROTOCOL
79
80 // We place the second eNB close to the position where the UE will jump
81 enbPositionList.emplace_back(7020, 0, 0);
82
84 1,
85 Seconds(2),
86 true,
87 uePositionList,
88 enbPositionList,
89 ueJumpAwayPosition,
90 checkConnectedList),
92
93 // Two eNBs: Ideal RRC PROTOCOL
95 1,
96 Seconds(2),
97 false,
98 uePositionList,
99 enbPositionList,
100 ueJumpAwayPosition,
101 checkConnectedList),
103
104} // end of LteRadioLinkFailureTestSuite::LteRadioLinkFailureTestSuite ()
105
106/**
107 * @ingroup lte-test
108 * Static variable for test initialization
109 */
111
112/*
113 * Test Case
114 */
115
116std::string
118{
119 std::ostringstream oss;
120 std::string rrcProtocol;
121 if (isIdealRrc)
122 {
123 rrcProtocol = "RRC Ideal";
124 }
125 else
126 {
127 rrcProtocol = "RRC Real";
128 }
129 oss << numEnbs << " eNBs, " << numUes << " UEs, " << rrcProtocol << " Protocol";
130 return oss.str();
131}
132
134 uint32_t numUes,
135 Time simTime,
136 bool isIdealRrc,
137 std::vector<Vector> uePositionList,
138 std::vector<Vector> enbPositionList,
139 Vector ueJumpAwayPosition,
140 std::vector<Time> checkConnectedList)
141 : TestCase(BuildNameString(numEnbs, numUes, isIdealRrc)),
142 m_numEnbs(numEnbs),
143 m_numUes(numUes),
144 m_simTime(simTime),
145 m_isIdealRrc(isIdealRrc),
146 m_uePositionList(uePositionList),
147 m_enbPositionList(enbPositionList),
148 m_checkConnectedList(checkConnectedList),
149 m_ueJumpAwayPosition(ueJumpAwayPosition)
150{
151 NS_LOG_FUNCTION(this << GetName());
156}
157
162
163void
165{
166 // LogLevel logLevel = (LogLevel) (LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
167 // LogComponentEnable ("LteUeRrc", logLevel);
168 // LogComponentEnable ("LteEnbRrc", logLevel);
169 // LogComponentEnable ("LteRadioLinkFailureTest", logLevel);
170 SetDataDir(NS_TEST_SOURCEDIR);
171
172 Config::SetDefault("ns3::MacStatsCalculator::DlOutputFilename",
173 StringValue(CreateTempDirFilename("DlMacStats.txt")));
174 Config::SetDefault("ns3::MacStatsCalculator::UlOutputFilename",
175 StringValue(CreateTempDirFilename("UlMacStats.txt")));
176 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlRlcOutputFilename",
177 StringValue(CreateTempDirFilename("DlRlcStats.txt")));
178 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlRlcOutputFilename",
179 StringValue(CreateTempDirFilename("UlRlcStats.txt")));
180 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlPdcpOutputFilename",
181 StringValue(CreateTempDirFilename("DlPdcpStats.txt")));
182 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlPdcpOutputFilename",
183 StringValue(CreateTempDirFilename("UlPdcpStats.txt")));
184 Config::SetDefault("ns3::PhyStatsCalculator::DlRsrpSinrFilename",
185 StringValue(CreateTempDirFilename("DlRsrpSinrStats.txt")));
186 Config::SetDefault("ns3::PhyStatsCalculator::UlSinrFilename",
187 StringValue(CreateTempDirFilename("UlSinrStats.txt")));
188 Config::SetDefault("ns3::PhyStatsCalculator::UlInterferenceFilename",
189 StringValue(CreateTempDirFilename("UlInterferenceStats.txt")));
190 Config::SetDefault("ns3::PhyRxStatsCalculator::DlRxOutputFilename",
191 StringValue(CreateTempDirFilename("DlRxPhyStats.txt")));
192 Config::SetDefault("ns3::PhyRxStatsCalculator::UlRxOutputFilename",
193 StringValue(CreateTempDirFilename("UlRxPhyStats.txt")));
194 Config::SetDefault("ns3::PhyTxStatsCalculator::DlTxOutputFilename",
195 StringValue(CreateTempDirFilename("DlTxPhyStats.txt")));
196 Config::SetDefault("ns3::PhyTxStatsCalculator::UlTxOutputFilename",
197 StringValue(CreateTempDirFilename("UlTxPhyStats.txt")));
198
199 NS_LOG_FUNCTION(this << GetName());
200 uint16_t numBearersPerUe = 1;
201 Time simTime = m_simTime;
202 double eNodeB_txPower = 43;
203
204 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(m_isIdealRrc));
205
208 lteHelper->SetEpcHelper(epcHelper);
209
210 lteHelper->SetPathlossModelType(TypeId::LookupByName("ns3::LogDistancePropagationLossModel"));
211 lteHelper->SetPathlossModelAttribute("Exponent", DoubleValue(3.9));
212 lteHelper->SetPathlossModelAttribute("ReferenceLoss",
213 DoubleValue(38.57)); // ref. loss in dB at 1m for 2.025GHz
214 lteHelper->SetPathlossModelAttribute("ReferenceDistance", DoubleValue(1));
215
216 //----power related (equal for all base stations)----
217 Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNodeB_txPower));
218 Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(23));
219 Config::SetDefault("ns3::LteUePhy::NoiseFigure", DoubleValue(7));
220 Config::SetDefault("ns3::LteEnbPhy::NoiseFigure", DoubleValue(2));
221 Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
222 Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
223 Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(true));
224
225 //----frequency related----
226 lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(100)); // 2120MHz
227 lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(18100)); // 1930MHz
228 lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(25)); // 5MHz
229 lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(25)); // 5MHz
230
231 //----others----
232 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
233 Config::SetDefault("ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
234 Config::SetDefault("ns3::LteAmc::Ber", DoubleValue(0.01));
235 Config::SetDefault("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue(true));
236
237 // Radio link failure detection parameters
238 Config::SetDefault("ns3::LteUeRrc::N310", UintegerValue(1));
239 Config::SetDefault("ns3::LteUeRrc::N311", UintegerValue(1));
240 Config::SetDefault("ns3::LteUeRrc::T310", TimeValue(Seconds(1)));
241
242 // Create the internet
243 Ptr<Node> pgw = epcHelper->GetPgwNode();
244 // Create a single RemoteHost0x18ab460
245 NodeContainer remoteHostContainer;
246 remoteHostContainer.Create(1);
247 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
248 InternetStackHelper internet;
249 internet.Install(remoteHostContainer);
251 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
252 p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
253 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
254 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
255 Ipv4AddressHelper ipv4h;
256 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
257 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
258 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
259 Ipv4StaticRoutingHelper ipv4RoutingHelper;
260 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
261 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
262 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
263
264 // Create Nodes: eNodeB and UE
265 NodeContainer enbNodes;
266 NodeContainer ueNodes;
267 enbNodes.Create(m_numEnbs);
268 ueNodes.Create(m_numUes);
269
270 // Mobility
272
273 for (auto enbPosIt = m_enbPositionList.begin(); enbPosIt != m_enbPositionList.end(); ++enbPosIt)
274 {
275 positionAllocEnb->Add(*enbPosIt);
276 }
277 MobilityHelper mobility;
278 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
279 mobility.SetPositionAllocator(positionAllocEnb);
280 mobility.Install(enbNodes);
281
283
284 for (auto uePosIt = m_uePositionList.begin(); uePosIt != m_uePositionList.end(); ++uePosIt)
285 {
286 positionAllocUe->Add(*uePosIt);
287 }
288
289 mobility.SetPositionAllocator(positionAllocUe);
290 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
291 mobility.Install(ueNodes);
292 m_ueMobility = ueNodes.Get(0)->GetObject<MobilityModel>();
293
294 // Install LTE Devices in eNB and UEs
295 NetDeviceContainer enbDevs;
296 NetDeviceContainer ueDevs;
297
298 int64_t randomStream = 1;
299 // Call AssignStreams in the EpcHelper only once by setting 'assignEpcStreams' only once
300 // Then, increment the stream value by 1000 (a magic number that should ensure that there
301 // are no overlapping stream assignments) each time that AssignStreams is called,
302 // to lessen the possibility that random variable stream assignment changes propagate
303 // to other objects.
304 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
305 lteHelper->AssignStreams(enbDevs, randomStream, false);
306 randomStream += 1000;
307 ueDevs = lteHelper->InstallUeDevice(ueNodes);
308 lteHelper->AssignStreams(ueDevs, randomStream, true);
309 randomStream += 1000;
310
311 // Install the IP stack on the UEs
312 internet.Install(ueNodes);
313 Ipv4InterfaceContainer ueIpIfaces;
314 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
315
316 // Attach a UE to a eNB
317 lteHelper->Attach(ueDevs);
318
319 // Install and start applications on UEs and remote host
320 uint16_t dlPort = 10000;
321 uint16_t ulPort = 20000;
322
323 DataRateValue dataRateValue = DataRate("18.6Mbps");
324 uint64_t bitRate = dataRateValue.Get().GetBitRate();
325 uint32_t packetSize = 1024; // bytes
326 NS_LOG_DEBUG("bit rate " << bitRate);
327 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
328 Time udpInterval = Seconds(interPacketInterval);
329
330 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S));
331
332 for (uint32_t u = 0; u < m_numUes; ++u)
333 {
334 Ptr<Node> ue = ueNodes.Get(u);
335 // Set the default gateway for the UE
336 Ptr<Ipv4StaticRouting> ueStaticRouting =
337 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
338 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
339
340 for (uint32_t b = 0; b < numBearersPerUe; ++b)
341 {
342 ApplicationContainer ulClientApps;
343 ApplicationContainer ulServerApps;
344 ApplicationContainer dlClientApps;
345 ApplicationContainer dlServerApps;
346
347 ++dlPort;
348 ++ulPort;
349
350 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
351 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
352 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
353 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
354 dlClientApps.Add(dlClientHelper.Install(remoteHost));
355
356 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
358 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
359
360 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
361 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
362 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
363 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
364 ulClientApps.Add(ulClientHelper.Install(ue));
365
366 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
368 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
369
372 dlpf.localPortStart = dlPort;
373 dlpf.localPortEnd = dlPort;
374 tft->Add(dlpf);
376 ulpf.remotePortStart = ulPort;
377 ulpf.remotePortEnd = ulPort;
378 tft->Add(ulpf);
380 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
381
382 dlServerApps.Start(Seconds(0.27));
383 dlClientApps.Start(Seconds(0.27));
384 ulServerApps.Start(Seconds(0.27));
385 ulClientApps.Start(Seconds(0.27));
386 }
387 }
388
389 lteHelper->EnableTraces();
390
391 for (uint32_t u = 0; u < m_numUes; ++u)
392 {
395 this,
396 ueDevs.Get(u),
397 enbDevs);
398 }
399
402 this,
404
405 // connect custom trace sinks
407 "/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
410 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
412 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
415 "/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
417 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
419 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
421
422 Simulator::Stop(simTime);
423
425 for (uint32_t u = 0; u < m_numUes; ++u)
426 {
429 true,
430 "Error, UE transitions to idle state for other than radio link failure");
431 CheckIdle(ueDevs.Get(u), enbDevs);
432 }
434}
435
436void
438{
439 NS_LOG_FUNCTION(this);
440 // move to a far away location so that transmission errors occur
441
442 m_ueMobility->SetPosition(UeJumpAwayPosition);
443}
444
445void
447{
448 NS_LOG_FUNCTION(ueDevice);
449
450 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
451 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
452 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!");
453 uint16_t cellId = ueRrc->GetCellId();
454
455 Ptr<LteEnbNetDevice> enbLteDevice;
456
457 for (auto enbDevIt = enbDevices.Begin(); enbDevIt != enbDevices.End(); ++enbDevIt)
458 {
459 if (((*enbDevIt)->GetObject<LteEnbNetDevice>())->HasCellId(cellId))
460 {
461 enbLteDevice = (*enbDevIt)->GetObject<LteEnbNetDevice>();
462 }
463 }
464
465 NS_TEST_ASSERT_MSG_NE(enbLteDevice, nullptr, "LTE eNB device not found");
466 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
467 uint16_t rnti = ueRrc->GetRnti();
468 Ptr<UeManager> ueManager = enbRrc->GetUeManager(rnti);
469 NS_TEST_ASSERT_MSG_NE(ueManager, nullptr, "RNTI " << rnti << " not found in eNB");
470
471 UeManager::State ueManagerState = ueManager->GetState();
472 NS_TEST_ASSERT_MSG_EQ(ueManagerState, UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
473
474 uint16_t ueCellId = ueRrc->GetCellId();
475 uint16_t enbCellId = enbLteDevice->GetCellId();
476 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
477 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
478 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
479 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
480 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
481 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
482 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
483 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
484 uint64_t ueImsi = ueLteDevice->GetImsi();
485 uint64_t enbImsi = ueManager->GetImsi();
486
487 NS_TEST_ASSERT_MSG_EQ(ueImsi, enbImsi, "inconsistent IMSI");
488 NS_TEST_ASSERT_MSG_EQ(ueCellId, enbCellId, "inconsistent CellId");
489 NS_TEST_ASSERT_MSG_EQ(ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth");
490 NS_TEST_ASSERT_MSG_EQ(ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth");
491 NS_TEST_ASSERT_MSG_EQ(ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn");
492 NS_TEST_ASSERT_MSG_EQ(ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn");
493
494 ObjectMapValue enbDataRadioBearerMapValue;
495 ueManager->GetAttribute("DataRadioBearerMap", enbDataRadioBearerMapValue);
496 NS_TEST_ASSERT_MSG_EQ(enbDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at eNB");
497
498 ObjectMapValue ueDataRadioBearerMapValue;
499 ueRrc->GetAttribute("DataRadioBearerMap", ueDataRadioBearerMapValue);
500 NS_TEST_ASSERT_MSG_EQ(ueDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at UE");
501
502 auto enbBearerIt = enbDataRadioBearerMapValue.Begin();
503 auto ueBearerIt = ueDataRadioBearerMapValue.Begin();
504 while (enbBearerIt != enbDataRadioBearerMapValue.End() &&
505 ueBearerIt != ueDataRadioBearerMapValue.End())
506 {
507 Ptr<LteDataRadioBearerInfo> enbDrbInfo =
508 enbBearerIt->second->GetObject<LteDataRadioBearerInfo>();
510 ueBearerIt->second->GetObject<LteDataRadioBearerInfo>();
511 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_epsBearerIdentity,
512 (uint32_t)ueDrbInfo->m_epsBearerIdentity,
513 "epsBearerIdentity differs");
514 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_drbIdentity,
515 (uint32_t)ueDrbInfo->m_drbIdentity,
516 "drbIdentity differs");
517 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_logicalChannelIdentity,
518 (uint32_t)ueDrbInfo->m_logicalChannelIdentity,
519 "logicalChannelIdentity differs");
520
521 ++enbBearerIt;
522 ++ueBearerIt;
523 }
524 NS_ASSERT_MSG(enbBearerIt == enbDataRadioBearerMapValue.End(), "too many bearers at eNB");
525 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.End(), "too many bearers at UE");
526}
527
528void
530{
531 NS_LOG_FUNCTION(ueDevice);
532
533 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
534 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
535 uint16_t rnti = ueRrc->GetRnti();
536 uint32_t numEnbDevices = enbDevices.GetN();
537 bool ueManagerFound = false;
538
539 switch (numEnbDevices)
540 {
541 // 1 eNB
542 case 1:
543 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
545 "Wrong LteUeRrc state!");
546 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(0));
547 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
548 false,
549 "Unexpected RNTI with value " << rnti << " found in eNB");
550 break;
551 // 2 eNBs
552 case 2:
553 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
555 "Wrong LteUeRrc state!");
556 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(1));
557 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
558 true,
559 "RNTI " << rnti << " is not attached to the eNB");
560 break;
561 default:
562 NS_FATAL_ERROR("The RRC state of the UE in more then 2 eNB scenario is not defined. "
563 "Consider creating more cases");
564 break;
565 }
566}
567
568bool
570{
571 NS_LOG_FUNCTION(this << rnti);
572 Ptr<LteEnbNetDevice> enbLteDevice = DynamicCast<LteEnbNetDevice>(enbDevice);
573 NS_ABORT_MSG_IF(!enbLteDevice, "LTE eNB device not found");
574 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
575 bool ueManagerFound = enbRrc->HasUeManager(rnti);
576 return ueManagerFound;
577}
578
579void
581 uint64_t imsi,
582 uint16_t cellId,
583 uint16_t rnti,
584 LteUeRrc::State oldState,
585 LteUeRrc::State newState)
586{
587 NS_LOG_FUNCTION(this << imsi << cellId << rnti << oldState << newState);
588 m_lastState = newState;
589}
590
591void
593 uint64_t imsi,
594 uint16_t cellId,
595 uint16_t rnti)
596{
597 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
598}
599
600void
602 uint64_t imsi,
603 uint16_t cellId,
604 uint16_t rnti)
605{
606 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
608 0,
609 "radio link failure detection should start only in RRC CONNECTED state");
611 0,
612 "radio link failure detection should start only in RRC CONNECTED state");
613}
614
615void
617 uint64_t imsi,
618 uint16_t cellId,
619 uint16_t rnti)
620{
621 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
622}
623
624void
626 uint64_t imsi,
627 uint16_t rnti,
628 uint16_t cellId,
629 std::string type,
630 uint8_t count)
631{
632 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
633 if (type == "Notify out of sync")
634 {
636 }
637 else if (type == "Notify in sync")
638 {
640 }
641}
642
643void
645 uint64_t imsi,
646 uint16_t cellId,
647 uint16_t rnti)
648{
649 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
650 NS_LOG_DEBUG("RLF at " << Simulator::Now());
652 // The value of N310 is hard coded to the default value 1
655 1,
656 "wrong number of out-of-sync indications detected, check configured value for N310");
657 // The value of N311 is hard coded to the default value 1
660 1,
661 "wrong number of out-of-sync indications detected, check configured value for N311");
662 // Reset the counter for the next RRC connection establishment.
664}
uint32_t u
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
AttributeValue implementation for Boolean.
Definition boolean.h:26
Class for representing data rates.
Definition data-rate.h:78
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition data-rate.cc:198
AttributeValue implementation for DataRate.
Definition data-rate.h:252
DataRate Get() const
Definition data-rate.cc:20
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Hold variables of type enum.
Definition enum.h:52
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
@ NGBR_IMS
Non-GBR IMS Signalling.
Definition eps-bearer.h:109
an Inet address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition ipv4.h:69
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
a class to represent an Ipv4 address mask
Helper class that adds ns3::Ipv4StaticRouting objects.
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...
store information on active data radio bearer instance
The eNodeB device implementation.
The LteUeNetDevice class implements the UE net device.
State
The states of the UE RRC entity.
Definition lte-ue-rrc.h:71
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition object.h:518
std::size_t GetN() const
Get the number of Objects.
Iterator End() const
Get an iterator to the past-the-end Object.
Iterator Begin() const
Get an iterator to the first Object.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:580
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
Hold variables of type string.
Definition string.h:45
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
@ QUICK
Fast test.
Definition test.h:1057
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
Definition test.cc:436
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
Definition test.cc:476
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
std::string GetName() const
Definition test.cc:371
Type
Type of test.
Definition test.h:1271
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Definition test.cc:494
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:408
@ S
second
Definition nstime.h:106
AttributeValue implementation for Time.
Definition nstime.h:1375
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition type-id.cc:870
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
State
The state of the UeManager at the eNB RRC.
Definition lte-enb-rrc.h:67
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Definition object-map.h:29
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...
Definition callback.h:690
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:886
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:970
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:97
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:260
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:274
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
static LteRadioLinkFailureTestSuite g_lteRadioLinkFailureTestSuite
Static variable for test initialization.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:454
#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.
Definition test.h:698
#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.
Definition test.h:133
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Definition test.h:553
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1273
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:605
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition epc-tft.h:60
uint16_t localPortEnd
end of the port number range of the UE
Definition epc-tft.h:121
uint16_t remotePortEnd
end of the port number range of the remote host
Definition epc-tft.h:119
uint16_t remotePortStart
start of the port number range of the remote host
Definition epc-tft.h:118
uint16_t localPortStart
start of the port number range of the UE
Definition epc-tft.h:120
static const uint32_t packetSize
Packet size generated at the AP.