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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Vignesh Babu <ns3-dev@esk.fraunhofer.de>
18 *
19 * Modified by:
20 * Zoraze Ali <zoraze.ali@cttc.es> (included both RRC protocol, two
21 * eNB scenario and UE jump away
22 * logic)
23 */
24
26
27#include "ns3/core-module.h"
28#include "ns3/internet-module.h"
29#include "ns3/lte-module.h"
30#include "ns3/mobility-module.h"
31#include "ns3/network-module.h"
32#include "ns3/packet-sink-helper.h"
33#include "ns3/point-to-point-module.h"
34#include "ns3/udp-client-server-helper.h"
35
36#include <iomanip>
37#include <iostream>
38#include <stdio.h>
39#include <vector>
40
41using namespace ns3;
42
43NS_LOG_COMPONENT_DEFINE("LteRadioLinkFailureTest");
44
45/*
46 * Test Suite
47 */
49 : TestSuite("lte-radio-link-failure", Type::SYSTEM)
50{
51 std::vector<Vector> uePositionList;
52 std::vector<Vector> enbPositionList;
53 std::vector<Time> checkConnectedList;
54 Vector ueJumpAwayPosition;
55
56 uePositionList.emplace_back(10, 0, 0);
57 enbPositionList.emplace_back(0, 0, 0);
58 ueJumpAwayPosition = Vector(7000.0, 0.0, 0.0);
59 // check before jumping
60 checkConnectedList.push_back(Seconds(0.3));
61 // check connection after jumping but before T310 timer expiration.
62 // This is to make sure that UE stays in connected mode
63 // before the expiration of T310 timer.
64 checkConnectedList.push_back(Seconds(1));
65
66 // One eNB: Ideal RRC PROTOCOL
67 //
69 1,
70 Seconds(2),
71 true,
72 uePositionList,
73 enbPositionList,
74 ueJumpAwayPosition,
75 checkConnectedList),
76 TestCase::Duration::QUICK);
77
78 // One eNB: Real RRC PROTOCOL
80 1,
81 Seconds(2),
82 false,
83 uePositionList,
84 enbPositionList,
85 ueJumpAwayPosition,
86 checkConnectedList),
87 TestCase::Duration::QUICK);
88
89 // Two eNBs: Ideal RRC PROTOCOL
90
91 // We place the second eNB close to the position where the UE will jump
92 enbPositionList.emplace_back(7020, 0, 0);
93
95 1,
96 Seconds(2),
97 true,
98 uePositionList,
99 enbPositionList,
100 ueJumpAwayPosition,
101 checkConnectedList),
102 TestCase::Duration::QUICK);
103
104 // Two eNBs: Ideal RRC PROTOCOL
106 1,
107 Seconds(2),
108 false,
109 uePositionList,
110 enbPositionList,
111 ueJumpAwayPosition,
112 checkConnectedList),
113 TestCase::Duration::QUICK);
114
115} // end of LteRadioLinkFailureTestSuite::LteRadioLinkFailureTestSuite ()
116
117/**
118 * \ingroup lte-test
119 * Static variable for test initialization
120 */
122
123/*
124 * Test Case
125 */
126
127std::string
129{
130 std::ostringstream oss;
131 std::string rrcProtocol;
132 if (isIdealRrc)
133 {
134 rrcProtocol = "RRC Ideal";
135 }
136 else
137 {
138 rrcProtocol = "RRC Real";
139 }
140 oss << numEnbs << " eNBs, " << numUes << " UEs, " << rrcProtocol << " Protocol";
141 return oss.str();
142}
143
145 uint32_t numUes,
146 Time simTime,
147 bool isIdealRrc,
148 std::vector<Vector> uePositionList,
149 std::vector<Vector> enbPositionList,
150 Vector ueJumpAwayPosition,
151 std::vector<Time> checkConnectedList)
152 : TestCase(BuildNameString(numEnbs, numUes, isIdealRrc)),
153 m_numEnbs(numEnbs),
154 m_numUes(numUes),
155 m_simTime(simTime),
156 m_isIdealRrc(isIdealRrc),
157 m_uePositionList(uePositionList),
158 m_enbPositionList(enbPositionList),
159 m_checkConnectedList(checkConnectedList),
160 m_ueJumpAwayPosition(ueJumpAwayPosition)
161{
162 NS_LOG_FUNCTION(this << GetName());
167}
168
170{
171 NS_LOG_FUNCTION(this << GetName());
172}
173
174void
176{
177 // LogLevel logLevel = (LogLevel) (LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
178 // LogComponentEnable ("LteUeRrc", logLevel);
179 // LogComponentEnable ("LteEnbRrc", logLevel);
180 // LogComponentEnable ("LteRadioLinkFailureTest", logLevel);
181
182 Config::SetDefault("ns3::MacStatsCalculator::DlOutputFilename",
183 StringValue(CreateTempDirFilename("DlMacStats.txt")));
184 Config::SetDefault("ns3::MacStatsCalculator::UlOutputFilename",
185 StringValue(CreateTempDirFilename("UlMacStats.txt")));
186 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlRlcOutputFilename",
187 StringValue(CreateTempDirFilename("DlRlcStats.txt")));
188 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlRlcOutputFilename",
189 StringValue(CreateTempDirFilename("UlRlcStats.txt")));
190 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlPdcpOutputFilename",
191 StringValue(CreateTempDirFilename("DlPdcpStats.txt")));
192 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlPdcpOutputFilename",
193 StringValue(CreateTempDirFilename("UlPdcpStats.txt")));
194 Config::SetDefault("ns3::PhyStatsCalculator::DlRsrpSinrFilename",
195 StringValue(CreateTempDirFilename("DlRsrpSinrStats.txt")));
196 Config::SetDefault("ns3::PhyStatsCalculator::UlSinrFilename",
197 StringValue(CreateTempDirFilename("UlSinrStats.txt")));
198 Config::SetDefault("ns3::PhyStatsCalculator::UlInterferenceFilename",
199 StringValue(CreateTempDirFilename("UlInterferenceStats.txt")));
200 Config::SetDefault("ns3::PhyRxStatsCalculator::DlRxOutputFilename",
201 StringValue(CreateTempDirFilename("DlRxPhyStats.txt")));
202 Config::SetDefault("ns3::PhyRxStatsCalculator::UlRxOutputFilename",
203 StringValue(CreateTempDirFilename("UlRxPhyStats.txt")));
204 Config::SetDefault("ns3::PhyTxStatsCalculator::DlTxOutputFilename",
205 StringValue(CreateTempDirFilename("DlTxPhyStats.txt")));
206 Config::SetDefault("ns3::PhyTxStatsCalculator::UlTxOutputFilename",
207 StringValue(CreateTempDirFilename("UlTxPhyStats.txt")));
208
209 NS_LOG_FUNCTION(this << GetName());
210 uint16_t numBearersPerUe = 1;
211 Time simTime = m_simTime;
212 double eNodeB_txPower = 43;
213
214 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(m_isIdealRrc));
215
216 Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
217 Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper>();
218 lteHelper->SetEpcHelper(epcHelper);
219
220 lteHelper->SetPathlossModelType(TypeId::LookupByName("ns3::LogDistancePropagationLossModel"));
221 lteHelper->SetPathlossModelAttribute("Exponent", DoubleValue(3.9));
222 lteHelper->SetPathlossModelAttribute("ReferenceLoss",
223 DoubleValue(38.57)); // ref. loss in dB at 1m for 2.025GHz
224 lteHelper->SetPathlossModelAttribute("ReferenceDistance", DoubleValue(1));
225
226 //----power related (equal for all base stations)----
227 Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNodeB_txPower));
228 Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(23));
229 Config::SetDefault("ns3::LteUePhy::NoiseFigure", DoubleValue(7));
230 Config::SetDefault("ns3::LteEnbPhy::NoiseFigure", DoubleValue(2));
231 Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
232 Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
233 Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(true));
234
235 //----frequency related----
236 lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(100)); // 2120MHz
237 lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(18100)); // 1930MHz
238 lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(25)); // 5MHz
239 lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(25)); // 5MHz
240
241 //----others----
242 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
243 Config::SetDefault("ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
244 Config::SetDefault("ns3::LteAmc::Ber", DoubleValue(0.01));
245 Config::SetDefault("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue(true));
246
247 // Radio link failure detection parameters
248 Config::SetDefault("ns3::LteUeRrc::N310", UintegerValue(1));
249 Config::SetDefault("ns3::LteUeRrc::N311", UintegerValue(1));
250 Config::SetDefault("ns3::LteUeRrc::T310", TimeValue(Seconds(1)));
251
252 // Create the internet
253 Ptr<Node> pgw = epcHelper->GetPgwNode();
254 // Create a single RemoteHost0x18ab460
255 NodeContainer remoteHostContainer;
256 remoteHostContainer.Create(1);
257 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
258 InternetStackHelper internet;
259 internet.Install(remoteHostContainer);
261 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
262 p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
263 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
264 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
265 Ipv4AddressHelper ipv4h;
266 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
267 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
268 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
269 Ipv4StaticRoutingHelper ipv4RoutingHelper;
270 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
271 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
272 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
273
274 // Create Nodes: eNodeB and UE
275 NodeContainer enbNodes;
276 NodeContainer ueNodes;
277 enbNodes.Create(m_numEnbs);
278 ueNodes.Create(m_numUes);
279
280 // Mobility
281 Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator>();
282
283 for (auto enbPosIt = m_enbPositionList.begin(); enbPosIt != m_enbPositionList.end(); ++enbPosIt)
284 {
285 positionAllocEnb->Add(*enbPosIt);
286 }
287 MobilityHelper mobility;
288 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
289 mobility.SetPositionAllocator(positionAllocEnb);
290 mobility.Install(enbNodes);
291
292 Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator>();
293
294 for (auto uePosIt = m_uePositionList.begin(); uePosIt != m_uePositionList.end(); ++uePosIt)
295 {
296 positionAllocUe->Add(*uePosIt);
297 }
298
299 mobility.SetPositionAllocator(positionAllocUe);
300 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
301 mobility.Install(ueNodes);
302 m_ueMobility = ueNodes.Get(0)->GetObject<MobilityModel>();
303
304 // Install LTE Devices in eNB and UEs
305 NetDeviceContainer enbDevs;
306 NetDeviceContainer ueDevs;
307
308 int64_t randomStream = 1;
309 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
310 randomStream += lteHelper->AssignStreams(enbDevs, randomStream);
311 ueDevs = lteHelper->InstallUeDevice(ueNodes);
312 randomStream += lteHelper->AssignStreams(ueDevs, randomStream);
313
314 // Install the IP stack on the UEs
315 internet.Install(ueNodes);
316 Ipv4InterfaceContainer ueIpIfaces;
317 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
318
319 // Attach a UE to a eNB
320 lteHelper->Attach(ueDevs);
321
322 // Install and start applications on UEs and remote host
323 uint16_t dlPort = 10000;
324 uint16_t ulPort = 20000;
325
326 DataRateValue dataRateValue = DataRate("18.6Mbps");
327 uint64_t bitRate = dataRateValue.Get().GetBitRate();
328 uint32_t packetSize = 1024; // bytes
329 NS_LOG_DEBUG("bit rate " << bitRate);
330 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
331 Time udpInterval = Seconds(interPacketInterval);
332
333 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S));
334
335 for (uint32_t u = 0; u < m_numUes; ++u)
336 {
337 Ptr<Node> ue = ueNodes.Get(u);
338 // Set the default gateway for the UE
339 Ptr<Ipv4StaticRouting> ueStaticRouting =
340 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
341 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
342
343 for (uint32_t b = 0; b < numBearersPerUe; ++b)
344 {
345 ApplicationContainer ulClientApps;
346 ApplicationContainer ulServerApps;
347 ApplicationContainer dlClientApps;
348 ApplicationContainer dlServerApps;
349
350 ++dlPort;
351 ++ulPort;
352
353 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
354 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
355 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
356 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
357 dlClientApps.Add(dlClientHelper.Install(remoteHost));
358
359 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
361 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
362
363 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
364 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
365 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
366 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
367 ulClientApps.Add(ulClientHelper.Install(ue));
368
369 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
371 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
372
373 Ptr<EpcTft> tft = Create<EpcTft>();
375 dlpf.localPortStart = dlPort;
376 dlpf.localPortEnd = dlPort;
377 tft->Add(dlpf);
379 ulpf.remotePortStart = ulPort;
380 ulpf.remotePortEnd = ulPort;
381 tft->Add(ulpf);
383 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
384
385 dlServerApps.Start(Seconds(0.27));
386 dlClientApps.Start(Seconds(0.27));
387 ulServerApps.Start(Seconds(0.27));
388 ulClientApps.Start(Seconds(0.27));
389
390 } // end for b
391 }
392
393 lteHelper->EnableTraces();
394
395 for (uint32_t u = 0; u < m_numUes; ++u)
396 {
399 this,
400 ueDevs.Get(u),
401 enbDevs);
402 }
403
406 this,
408
409 // connect custom trace sinks
411 "/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
414 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
416 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
419 "/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
421 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
423 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
425
426 Simulator::Stop(simTime);
427
429 for (uint32_t u = 0; u < m_numUes; ++u)
430 {
433 true,
434 "Error, UE transitions to idle state for other than radio link failure");
435 CheckIdle(ueDevs.Get(u), enbDevs);
436 }
438} // end of void LteRadioLinkFailureTestCase::DoRun ()
439
440void
442{
443 NS_LOG_FUNCTION(this);
444 // move to a far away location so that transmission errors occur
445
446 m_ueMobility->SetPosition(UeJumpAwayPosition);
447}
448
449void
451{
452 NS_LOG_FUNCTION(ueDevice);
453
454 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
455 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
456 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!");
457 uint16_t cellId = ueRrc->GetCellId();
458
459 Ptr<LteEnbNetDevice> enbLteDevice;
460
461 for (auto enbDevIt = enbDevices.Begin(); enbDevIt != enbDevices.End(); ++enbDevIt)
462 {
463 if (((*enbDevIt)->GetObject<LteEnbNetDevice>())->HasCellId(cellId))
464 {
465 enbLteDevice = (*enbDevIt)->GetObject<LteEnbNetDevice>();
466 }
467 }
468
469 NS_TEST_ASSERT_MSG_NE(enbLteDevice, nullptr, "LTE eNB device not found");
470 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
471 uint16_t rnti = ueRrc->GetRnti();
472 Ptr<UeManager> ueManager = enbRrc->GetUeManager(rnti);
473 NS_TEST_ASSERT_MSG_NE(ueManager, nullptr, "RNTI " << rnti << " not found in eNB");
474
475 UeManager::State ueManagerState = ueManager->GetState();
476 NS_TEST_ASSERT_MSG_EQ(ueManagerState, UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
477 NS_ASSERT_MSG(ueManagerState == UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
478
479 uint16_t ueCellId = ueRrc->GetCellId();
480 uint16_t enbCellId = enbLteDevice->GetCellId();
481 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
482 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
483 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
484 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
485 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
486 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
487 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
488 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
489 uint64_t ueImsi = ueLteDevice->GetImsi();
490 uint64_t enbImsi = ueManager->GetImsi();
491
492 NS_TEST_ASSERT_MSG_EQ(ueImsi, enbImsi, "inconsistent IMSI");
493 NS_TEST_ASSERT_MSG_EQ(ueCellId, enbCellId, "inconsistent CellId");
494 NS_TEST_ASSERT_MSG_EQ(ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth");
495 NS_TEST_ASSERT_MSG_EQ(ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth");
496 NS_TEST_ASSERT_MSG_EQ(ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn");
497 NS_TEST_ASSERT_MSG_EQ(ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn");
498
499 ObjectMapValue enbDataRadioBearerMapValue;
500 ueManager->GetAttribute("DataRadioBearerMap", enbDataRadioBearerMapValue);
501 NS_TEST_ASSERT_MSG_EQ(enbDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at eNB");
502
503 ObjectMapValue ueDataRadioBearerMapValue;
504 ueRrc->GetAttribute("DataRadioBearerMap", ueDataRadioBearerMapValue);
505 NS_TEST_ASSERT_MSG_EQ(ueDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at UE");
506
507 auto enbBearerIt = enbDataRadioBearerMapValue.Begin();
508 auto ueBearerIt = ueDataRadioBearerMapValue.Begin();
509 while (enbBearerIt != enbDataRadioBearerMapValue.End() &&
510 ueBearerIt != ueDataRadioBearerMapValue.End())
511 {
512 Ptr<LteDataRadioBearerInfo> enbDrbInfo =
513 enbBearerIt->second->GetObject<LteDataRadioBearerInfo>();
515 ueBearerIt->second->GetObject<LteDataRadioBearerInfo>();
516 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_epsBearerIdentity,
517 (uint32_t)ueDrbInfo->m_epsBearerIdentity,
518 "epsBearerIdentity differs");
519 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_drbIdentity,
520 (uint32_t)ueDrbInfo->m_drbIdentity,
521 "drbIdentity differs");
522 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_logicalChannelIdentity,
523 (uint32_t)ueDrbInfo->m_logicalChannelIdentity,
524 "logicalChannelIdentity differs");
525
526 ++enbBearerIt;
527 ++ueBearerIt;
528 }
529 NS_ASSERT_MSG(enbBearerIt == enbDataRadioBearerMapValue.End(), "too many bearers at eNB");
530 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.End(), "too many bearers at UE");
531}
532
533void
535{
536 NS_LOG_FUNCTION(ueDevice);
537
538 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
539 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
540 uint16_t rnti = ueRrc->GetRnti();
541 uint32_t numEnbDevices = enbDevices.GetN();
542 bool ueManagerFound = false;
543
544 switch (numEnbDevices)
545 {
546 // 1 eNB
547 case 1:
548 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
550 "Wrong LteUeRrc state!");
551 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(0));
552 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
553 false,
554 "Unexpected RNTI with value " << rnti << " found in eNB");
555 break;
556 // 2 eNBs
557 case 2:
558 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
560 "Wrong LteUeRrc state!");
561 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(1));
562 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
563 true,
564 "RNTI " << rnti << " is not attached to the eNB");
565 break;
566 default:
567 NS_FATAL_ERROR("The RRC state of the UE in more then 2 eNB scenario is not defined. "
568 "Consider creating more cases");
569 break;
570 }
571}
572
573bool
575{
576 NS_LOG_FUNCTION(this << rnti);
577 Ptr<LteEnbNetDevice> enbLteDevice = DynamicCast<LteEnbNetDevice>(enbDevice);
578 NS_ABORT_MSG_IF(!enbLteDevice, "LTE eNB device not found");
579 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
580 bool ueManagerFound = enbRrc->HasUeManager(rnti);
581 return ueManagerFound;
582}
583
584void
586 uint64_t imsi,
587 uint16_t cellId,
588 uint16_t rnti,
589 LteUeRrc::State oldState,
590 LteUeRrc::State newState)
591{
592 NS_LOG_FUNCTION(this << imsi << cellId << rnti << oldState << newState);
593 m_lastState = newState;
594}
595
596void
598 uint64_t imsi,
599 uint16_t cellId,
600 uint16_t rnti)
601{
602 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
603}
604
605void
607 uint64_t imsi,
608 uint16_t cellId,
609 uint16_t rnti)
610{
611 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
613 0,
614 "radio link failure detection should start only in RRC CONNECTED state");
616 0,
617 "radio link failure detection should start only in RRC CONNECTED state");
618}
619
620void
622 uint64_t imsi,
623 uint16_t cellId,
624 uint16_t rnti)
625{
626 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
627}
628
629void
631 uint64_t imsi,
632 uint16_t rnti,
633 uint16_t cellId,
634 std::string type,
635 uint8_t count)
636{
637 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
638 if (type == "Notify out of sync")
639 {
641 }
642 else if (type == "Notify in sync")
643 {
645 }
646}
647
648void
650 uint64_t imsi,
651 uint16_t cellId,
652 uint16_t rnti)
653{
654 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
655 NS_LOG_DEBUG("RLF at " << Simulator::Now());
657 // The value of N310 is hard coded to the default value 1
660 1,
661 "wrong number of out-of-sync indications detected, check configured value for N310");
662 // The value of N311 is hard coded to the default value 1
665 1,
666 "wrong number of out-of-sync indications detected, check configured value for N311");
667 // Reset the counter for the next RRC connection establishment.
669}
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:37
Class for representing data rates.
Definition: data-rate.h:89
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:305
AttributeValue implementation for DataRate.
Definition: data-rate.h:296
DataRate Get() const
Definition: data-rate.cc:31
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Hold variables of type enum.
Definition: enum.h:62
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
@ NGBR_IMS
Non-GBR IMS Signalling.
Definition: eps-bearer.h:120
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.
Definition: ipv4-address.h:42
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:80
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
Definition: ipv4-address.h:257
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...
@ PiroEW2010
Definition: lte-amc.h:63
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:99
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
void SetPosition(const Vector &position)
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:522
Container for a set of ns3::Object pointers.
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:77
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static void Run()
Run the simulation.
Definition: simulator.cc:178
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
Hold variables of type string.
Definition: string.h:56
encapsulates test code
Definition: test.h:1061
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
Definition: test.cc:438
std::string GetName() const
Definition: test.cc:373
A suite of tests to run.
Definition: test.h:1268
Type
Type of test.
Definition: test.h:1275
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:415
@ S
second
Definition: nstime.h:116
AttributeValue implementation for Time.
Definition: nstime.h:1413
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:836
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:78
Hold an unsigned integer type.
Definition: uinteger.h:45
#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:86
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:894
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:978
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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.
#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:710
#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:145
#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:565
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
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...
Definition: callback.h:704
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:71
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:132
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:130
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:129
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:131
static const uint32_t packetSize
Packet size generated at the AP.