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