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/config-store-module.h"
28#include "ns3/config-store.h"
29#include "ns3/core-module.h"
30#include "ns3/internet-module.h"
31#include "ns3/lte-module.h"
32#include "ns3/mobility-module.h"
33#include "ns3/network-module.h"
34#include "ns3/packet-sink-helper.h"
35#include "ns3/point-to-point-module.h"
36#include "ns3/udp-client-server-helper.h"
37
38#include <iomanip>
39#include <iostream>
40#include <stdio.h>
41#include <vector>
42
43using namespace ns3;
44
45NS_LOG_COMPONENT_DEFINE("LteRadioLinkFailureTest");
46
47/*
48 * Test Suite
49 */
51 : TestSuite("lte-radio-link-failure", SYSTEM)
52{
53 std::vector<Vector> uePositionList;
54 std::vector<Vector> enbPositionList;
55 std::vector<Time> checkConnectedList;
56 Vector ueJumpAwayPosition;
57
58 uePositionList.emplace_back(10, 0, 0);
59 enbPositionList.emplace_back(0, 0, 0);
60 ueJumpAwayPosition = Vector(7000.0, 0.0, 0.0);
61 // check before jumping
62 checkConnectedList.push_back(Seconds(0.3));
63 // check connection after jumping but before T310 timer expiration.
64 // This is to make sure that UE stays in connected mode
65 // before the expiration of T310 timer.
66 checkConnectedList.push_back(Seconds(1));
67
68 // One eNB: Ideal RRC PROTOCOL
69 //
71 1,
72 Seconds(2),
73 true,
74 uePositionList,
75 enbPositionList,
76 ueJumpAwayPosition,
77 checkConnectedList),
79
80 // One eNB: Real RRC PROTOCOL
82 1,
83 Seconds(2),
84 false,
85 uePositionList,
86 enbPositionList,
87 ueJumpAwayPosition,
88 checkConnectedList),
90
91 // Two eNBs: Ideal RRC PROTOCOL
92
93 // We place the second eNB close to the position where the UE will jump
94 enbPositionList.emplace_back(7020, 0, 0);
95
97 1,
98 Seconds(2),
99 true,
100 uePositionList,
101 enbPositionList,
102 ueJumpAwayPosition,
103 checkConnectedList),
105
106 // Two eNBs: Ideal RRC PROTOCOL
108 1,
109 Seconds(2),
110 false,
111 uePositionList,
112 enbPositionList,
113 ueJumpAwayPosition,
114 checkConnectedList),
116
117} // end of LteRadioLinkFailureTestSuite::LteRadioLinkFailureTestSuite ()
118
124
125/*
126 * Test Case
127 */
128
129std::string
131{
132 std::ostringstream oss;
133 std::string rrcProtocol;
134 if (isIdealRrc)
135 {
136 rrcProtocol = "RRC Ideal";
137 }
138 else
139 {
140 rrcProtocol = "RRC Real";
141 }
142 oss << numEnbs << " eNBs, " << numUes << " UEs, " << rrcProtocol << " Protocol";
143 return oss.str();
144}
145
147 uint32_t numUes,
148 Time simTime,
149 bool isIdealRrc,
150 std::vector<Vector> uePositionList,
151 std::vector<Vector> enbPositionList,
152 Vector ueJumpAwayPosition,
153 std::vector<Time> checkConnectedList)
154 : TestCase(BuildNameString(numEnbs, numUes, isIdealRrc)),
155 m_numEnbs(numEnbs),
156 m_numUes(numUes),
157 m_simTime(simTime),
158 m_isIdealRrc(isIdealRrc),
159 m_uePositionList(uePositionList),
160 m_enbPositionList(enbPositionList),
161 m_checkConnectedList(checkConnectedList),
162 m_ueJumpAwayPosition(ueJumpAwayPosition)
163{
164 NS_LOG_FUNCTION(this << GetName());
169}
170
172{
173 NS_LOG_FUNCTION(this << GetName());
174}
175
176void
178{
179 // LogLevel logLevel = (LogLevel) (LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
180 // LogComponentEnable ("LteUeRrc", logLevel);
181 // LogComponentEnable ("LteEnbRrc", logLevel);
182 // LogComponentEnable ("LteRadioLinkFailureTest", logLevel);
183
184 Config::SetDefault("ns3::MacStatsCalculator::DlOutputFilename",
185 StringValue(CreateTempDirFilename("DlMacStats.txt")));
186 Config::SetDefault("ns3::MacStatsCalculator::UlOutputFilename",
187 StringValue(CreateTempDirFilename("UlMacStats.txt")));
188 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlRlcOutputFilename",
189 StringValue(CreateTempDirFilename("DlRlcStats.txt")));
190 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlRlcOutputFilename",
191 StringValue(CreateTempDirFilename("UlRlcStats.txt")));
192 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlPdcpOutputFilename",
193 StringValue(CreateTempDirFilename("DlPdcpStats.txt")));
194 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlPdcpOutputFilename",
195 StringValue(CreateTempDirFilename("UlPdcpStats.txt")));
196 Config::SetDefault("ns3::PhyStatsCalculator::DlRsrpSinrFilename",
197 StringValue(CreateTempDirFilename("DlRsrpSinrStats.txt")));
198 Config::SetDefault("ns3::PhyStatsCalculator::UlSinrFilename",
199 StringValue(CreateTempDirFilename("UlSinrStats.txt")));
200 Config::SetDefault("ns3::PhyStatsCalculator::UlInterferenceFilename",
201 StringValue(CreateTempDirFilename("UlInterferenceStats.txt")));
202 Config::SetDefault("ns3::PhyRxStatsCalculator::DlRxOutputFilename",
203 StringValue(CreateTempDirFilename("DlRxPhyStats.txt")));
204 Config::SetDefault("ns3::PhyRxStatsCalculator::UlRxOutputFilename",
205 StringValue(CreateTempDirFilename("UlRxPhyStats.txt")));
206 Config::SetDefault("ns3::PhyTxStatsCalculator::DlTxOutputFilename",
207 StringValue(CreateTempDirFilename("DlTxPhyStats.txt")));
208 Config::SetDefault("ns3::PhyTxStatsCalculator::UlTxOutputFilename",
209 StringValue(CreateTempDirFilename("UlTxPhyStats.txt")));
210
211 NS_LOG_FUNCTION(this << GetName());
212 uint16_t numBearersPerUe = 1;
213 Time simTime = m_simTime;
214 double eNodeB_txPower = 43;
215
216 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(m_isIdealRrc));
217
218 Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
219 Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper>();
220 lteHelper->SetEpcHelper(epcHelper);
221
222 lteHelper->SetPathlossModelType(TypeId::LookupByName("ns3::LogDistancePropagationLossModel"));
223 lteHelper->SetPathlossModelAttribute("Exponent", DoubleValue(3.9));
224 lteHelper->SetPathlossModelAttribute("ReferenceLoss",
225 DoubleValue(38.57)); // ref. loss in dB at 1m for 2.025GHz
226 lteHelper->SetPathlossModelAttribute("ReferenceDistance", DoubleValue(1));
227
228 //----power related (equal for all base stations)----
229 Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNodeB_txPower));
230 Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(23));
231 Config::SetDefault("ns3::LteUePhy::NoiseFigure", DoubleValue(7));
232 Config::SetDefault("ns3::LteEnbPhy::NoiseFigure", DoubleValue(2));
233 Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
234 Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
235 Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(true));
236
237 //----frequency related----
238 lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(100)); // 2120MHz
239 lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(18100)); // 1930MHz
240 lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(25)); // 5MHz
241 lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(25)); // 5MHz
242
243 //----others----
244 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
245 Config::SetDefault("ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
246 Config::SetDefault("ns3::LteAmc::Ber", DoubleValue(0.01));
247 Config::SetDefault("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue(true));
248
249 // Radio link failure detection parameters
250 Config::SetDefault("ns3::LteUeRrc::N310", UintegerValue(1));
251 Config::SetDefault("ns3::LteUeRrc::N311", UintegerValue(1));
252 Config::SetDefault("ns3::LteUeRrc::T310", TimeValue(Seconds(1)));
253
254 // Create the internet
255 Ptr<Node> pgw = epcHelper->GetPgwNode();
256 // Create a single RemoteHost0x18ab460
257 NodeContainer remoteHostContainer;
258 remoteHostContainer.Create(1);
259 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
260 InternetStackHelper internet;
261 internet.Install(remoteHostContainer);
263 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
264 p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
265 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
266 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
267 Ipv4AddressHelper ipv4h;
268 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
269 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
270 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
271 Ipv4StaticRoutingHelper ipv4RoutingHelper;
272 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
273 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
274 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
275
276 // Create Nodes: eNodeB and UE
277 NodeContainer enbNodes;
278 NodeContainer ueNodes;
279 enbNodes.Create(m_numEnbs);
280 ueNodes.Create(m_numUes);
281
282 // Mobility
283 Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator>();
284
285 for (auto enbPosIt = m_enbPositionList.begin(); enbPosIt != m_enbPositionList.end(); ++enbPosIt)
286 {
287 positionAllocEnb->Add(*enbPosIt);
288 }
289 MobilityHelper mobility;
290 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
291 mobility.SetPositionAllocator(positionAllocEnb);
292 mobility.Install(enbNodes);
293
294 Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator>();
295
296 for (auto uePosIt = m_uePositionList.begin(); uePosIt != m_uePositionList.end(); ++uePosIt)
297 {
298 positionAllocUe->Add(*uePosIt);
299 }
300
301 mobility.SetPositionAllocator(positionAllocUe);
302 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
303 mobility.Install(ueNodes);
304 m_ueMobility = ueNodes.Get(0)->GetObject<MobilityModel>();
305
306 // Install LTE Devices in eNB and UEs
307 NetDeviceContainer enbDevs;
308 NetDeviceContainer ueDevs;
309
310 int64_t randomStream = 1;
311 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
312 randomStream += lteHelper->AssignStreams(enbDevs, randomStream);
313 ueDevs = lteHelper->InstallUeDevice(ueNodes);
314 randomStream += lteHelper->AssignStreams(ueDevs, randomStream);
315
316 // Install the IP stack on the UEs
317 internet.Install(ueNodes);
318 Ipv4InterfaceContainer ueIpIfaces;
319 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
320
321 // Attach a UE to a eNB
322 lteHelper->Attach(ueDevs);
323
324 // Install and start applications on UEs and remote host
325 uint16_t dlPort = 10000;
326 uint16_t ulPort = 20000;
327
328 DataRateValue dataRateValue = DataRate("18.6Mbps");
329 uint64_t bitRate = dataRateValue.Get().GetBitRate();
330 uint32_t packetSize = 1024; // bytes
331 NS_LOG_DEBUG("bit rate " << bitRate);
332 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
333 Time udpInterval = Seconds(interPacketInterval);
334
335 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S));
336
337 for (uint32_t u = 0; u < m_numUes; ++u)
338 {
339 Ptr<Node> ue = ueNodes.Get(u);
340 // Set the default gateway for the UE
341 Ptr<Ipv4StaticRouting> ueStaticRouting =
342 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
343 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
344
345 for (uint32_t b = 0; b < numBearersPerUe; ++b)
346 {
347 ApplicationContainer ulClientApps;
348 ApplicationContainer ulServerApps;
349 ApplicationContainer dlClientApps;
350 ApplicationContainer dlServerApps;
351
352 ++dlPort;
353 ++ulPort;
354
355 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
356 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
357 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
358 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
359 dlClientApps.Add(dlClientHelper.Install(remoteHost));
360
361 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
363 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
364
365 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
366 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
367 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
368 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
369 ulClientApps.Add(ulClientHelper.Install(ue));
370
371 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
373 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
374
375 Ptr<EpcTft> tft = Create<EpcTft>();
377 dlpf.localPortStart = dlPort;
378 dlpf.localPortEnd = dlPort;
379 tft->Add(dlpf);
381 ulpf.remotePortStart = ulPort;
382 ulpf.remotePortEnd = ulPort;
383 tft->Add(ulpf);
385 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
386
387 dlServerApps.Start(Seconds(0.27));
388 dlClientApps.Start(Seconds(0.27));
389 ulServerApps.Start(Seconds(0.27));
390 ulClientApps.Start(Seconds(0.27));
391
392 } // end for b
393 }
394
395 lteHelper->EnableTraces();
396
397 for (uint32_t u = 0; u < m_numUes; ++u)
398 {
401 this,
402 ueDevs.Get(u),
403 enbDevs);
404 }
405
408 this,
410
411 // connect custom trace sinks
413 "/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
416 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
418 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
421 "/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
423 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
425 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
427
428 Simulator::Stop(simTime);
429
431 for (uint32_t u = 0; u < m_numUes; ++u)
432 {
435 true,
436 "Error, UE transitions to idle state for other than radio link failure");
437 CheckIdle(ueDevs.Get(u), enbDevs);
438 }
440} // end of void LteRadioLinkFailureTestCase::DoRun ()
441
442void
444{
445 NS_LOG_FUNCTION(this);
446 // move to a far away location so that transmission errors occur
447
448 m_ueMobility->SetPosition(UeJumpAwayPosition);
449}
450
451void
453{
454 NS_LOG_FUNCTION(ueDevice);
455
456 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
457 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
458 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!");
459 uint16_t cellId = ueRrc->GetCellId();
460
461 Ptr<LteEnbNetDevice> enbLteDevice;
462
463 for (auto enbDevIt = enbDevices.Begin(); enbDevIt != enbDevices.End(); ++enbDevIt)
464 {
465 if (((*enbDevIt)->GetObject<LteEnbNetDevice>())->HasCellId(cellId))
466 {
467 enbLteDevice = (*enbDevIt)->GetObject<LteEnbNetDevice>();
468 }
469 }
470
471 NS_TEST_ASSERT_MSG_NE(enbLteDevice, nullptr, "LTE eNB device not found");
472 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
473 uint16_t rnti = ueRrc->GetRnti();
474 Ptr<UeManager> ueManager = enbRrc->GetUeManager(rnti);
475 NS_TEST_ASSERT_MSG_NE(ueManager, nullptr, "RNTI " << rnti << " not found in eNB");
476
477 UeManager::State ueManagerState = ueManager->GetState();
478 NS_TEST_ASSERT_MSG_EQ(ueManagerState, UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
479 NS_ASSERT_MSG(ueManagerState == UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
480
481 uint16_t ueCellId = ueRrc->GetCellId();
482 uint16_t enbCellId = enbLteDevice->GetCellId();
483 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
484 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
485 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
486 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
487 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
488 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
489 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
490 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
491 uint64_t ueImsi = ueLteDevice->GetImsi();
492 uint64_t enbImsi = ueManager->GetImsi();
493
494 NS_TEST_ASSERT_MSG_EQ(ueImsi, enbImsi, "inconsistent IMSI");
495 NS_TEST_ASSERT_MSG_EQ(ueCellId, enbCellId, "inconsistent CellId");
496 NS_TEST_ASSERT_MSG_EQ(ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth");
497 NS_TEST_ASSERT_MSG_EQ(ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth");
498 NS_TEST_ASSERT_MSG_EQ(ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn");
499 NS_TEST_ASSERT_MSG_EQ(ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn");
500
501 ObjectMapValue enbDataRadioBearerMapValue;
502 ueManager->GetAttribute("DataRadioBearerMap", enbDataRadioBearerMapValue);
503 NS_TEST_ASSERT_MSG_EQ(enbDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at eNB");
504
505 ObjectMapValue ueDataRadioBearerMapValue;
506 ueRrc->GetAttribute("DataRadioBearerMap", ueDataRadioBearerMapValue);
507 NS_TEST_ASSERT_MSG_EQ(ueDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at UE");
508
509 auto enbBearerIt = enbDataRadioBearerMapValue.Begin();
510 auto ueBearerIt = ueDataRadioBearerMapValue.Begin();
511 while (enbBearerIt != enbDataRadioBearerMapValue.End() &&
512 ueBearerIt != ueDataRadioBearerMapValue.End())
513 {
514 Ptr<LteDataRadioBearerInfo> enbDrbInfo =
515 enbBearerIt->second->GetObject<LteDataRadioBearerInfo>();
517 ueBearerIt->second->GetObject<LteDataRadioBearerInfo>();
518 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_epsBearerIdentity,
519 (uint32_t)ueDrbInfo->m_epsBearerIdentity,
520 "epsBearerIdentity differs");
521 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_drbIdentity,
522 (uint32_t)ueDrbInfo->m_drbIdentity,
523 "drbIdentity differs");
524 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_logicalChannelIdentity,
525 (uint32_t)ueDrbInfo->m_logicalChannelIdentity,
526 "logicalChannelIdentity differs");
527
528 ++enbBearerIt;
529 ++ueBearerIt;
530 }
531 NS_ASSERT_MSG(enbBearerIt == enbDataRadioBearerMapValue.End(), "too many bearers at eNB");
532 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.End(), "too many bearers at UE");
533}
534
535void
537{
538 NS_LOG_FUNCTION(ueDevice);
539
540 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
541 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
542 uint16_t rnti = ueRrc->GetRnti();
543 uint32_t numEnbDevices = enbDevices.GetN();
544 bool ueManagerFound = false;
545
546 switch (numEnbDevices)
547 {
548 // 1 eNB
549 case 1:
550 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
552 "Wrong LteUeRrc state!");
553 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(0));
554 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
555 false,
556 "Unexpected RNTI with value " << rnti << " found in eNB");
557 break;
558 // 2 eNBs
559 case 2:
560 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
562 "Wrong LteUeRrc state!");
563 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(1));
564 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
565 true,
566 "RNTI " << rnti << " is not attached to the eNB");
567 break;
568 default:
569 NS_FATAL_ERROR("The RRC state of the UE in more then 2 eNB scenario is not defined. "
570 "Consider creating more cases");
571 break;
572 }
573}
574
575bool
577{
578 NS_LOG_FUNCTION(this << rnti);
579 Ptr<LteEnbNetDevice> enbLteDevice = DynamicCast<LteEnbNetDevice>(enbDevice);
580 NS_ABORT_MSG_IF(!enbLteDevice, "LTE eNB device not found");
581 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
582 bool ueManagerFound = enbRrc->HasUeManager(rnti);
583 return ueManagerFound;
584}
585
586void
588 uint64_t imsi,
589 uint16_t cellId,
590 uint16_t rnti,
591 LteUeRrc::State oldState,
592 LteUeRrc::State newState)
593{
594 NS_LOG_FUNCTION(this << imsi << cellId << rnti << oldState << newState);
595 m_lastState = newState;
596}
597
598void
600 uint64_t imsi,
601 uint16_t cellId,
602 uint16_t rnti)
603{
604 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
605}
606
607void
609 uint64_t imsi,
610 uint16_t cellId,
611 uint16_t rnti)
612{
613 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
615 0,
616 "radio link failure detection should start only in RRC CONNECTED state");
618 0,
619 "radio link failure detection should start only in RRC CONNECTED state");
620}
621
622void
624 uint64_t imsi,
625 uint16_t cellId,
626 uint16_t rnti)
627{
628 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
629}
630
631void
633 uint64_t imsi,
634 uint16_t rnti,
635 uint16_t cellId,
636 std::string type,
637 uint8_t count)
638{
639 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
640 if (type == "Notify out of sync")
641 {
643 }
644 else if (type == "Notify in sync")
645 {
647 }
648}
649
650void
652 uint64_t imsi,
653 uint16_t cellId,
654 uint16_t rnti)
655{
656 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
657 NS_LOG_DEBUG("RLF at " << Simulator::Now());
659 // The value of N310 is hard coded to the default value 1
662 1,
663 "wrong number of out-of-sync indications detected, check configured value for N310");
664 // The value of N311 is hard coded to the default value 1
667 1,
668 "wrong number of out-of-sync indications detected, check configured value for N311");
669 // Reset the counter for the next RRC connection establishment.
671}
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.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Class for representing data rates.
Definition: data-rate.h:89
AttributeValue implementation for DataRate.
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:56
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:79
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:471
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.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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:78
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:558
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:140
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static void Run()
Run the simulation.
Definition: simulator.cc:176
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:184
Hold variables of type string.
Definition: string.h:56
encapsulates test code
Definition: test.h:1060
@ QUICK
Fast test.
Definition: test.h:1065
void AddTestCase(TestCase *testCase, TestDuration 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:1256
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:1412
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:834
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
void SetAttribute(std::string name, const AttributeValue &value)
Record an attribute to be set in each Application after it is is created.
ApplicationContainer Install(NodeContainer c)
State
The state of the UeManager at the eNB RRC.
Definition: lte-enb-rrc.h:77
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:890
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:974
#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:709
#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:144
#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:564
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1325
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.