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
119
120/*
121 * Test Case
122 */
123
124std::string
126{
127 std::ostringstream oss;
128 std::string rrcProtocol;
129 if (isIdealRrc)
130 {
131 rrcProtocol = "RRC Ideal";
132 }
133 else
134 {
135 rrcProtocol = "RRC Real";
136 }
137 oss << numEnbs << " eNBs, " << numUes << " UEs, " << rrcProtocol << " Protocol";
138 return oss.str();
139}
140
142 uint32_t numUes,
143 Time simTime,
144 bool isIdealRrc,
145 std::vector<Vector> uePositionList,
146 std::vector<Vector> enbPositionList,
147 Vector ueJumpAwayPosition,
148 std::vector<Time> checkConnectedList)
149 : TestCase(BuildNameString(numEnbs, numUes, isIdealRrc)),
150 m_numEnbs(numEnbs),
151 m_numUes(numUes),
152 m_simTime(simTime),
153 m_isIdealRrc(isIdealRrc),
154 m_uePositionList(uePositionList),
155 m_enbPositionList(enbPositionList),
156 m_checkConnectedList(checkConnectedList),
157 m_ueJumpAwayPosition(ueJumpAwayPosition)
158{
159 NS_LOG_FUNCTION(this << GetName());
160 m_lastState = LteUeRrc::NUM_STATES;
164}
165
167{
168 NS_LOG_FUNCTION(this << GetName());
169}
170
171void
173{
174 // LogLevel logLevel = (LogLevel) (LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
175 // LogComponentEnable ("LteUeRrc", logLevel);
176 // LogComponentEnable ("LteEnbRrc", logLevel);
177 // LogComponentEnable ("LteRadioLinkFailureTest", logLevel);
178
179 Config::SetDefault("ns3::MacStatsCalculator::DlOutputFilename",
180 StringValue(CreateTempDirFilename("DlMacStats.txt")));
181 Config::SetDefault("ns3::MacStatsCalculator::UlOutputFilename",
182 StringValue(CreateTempDirFilename("UlMacStats.txt")));
183 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlRlcOutputFilename",
184 StringValue(CreateTempDirFilename("DlRlcStats.txt")));
185 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlRlcOutputFilename",
186 StringValue(CreateTempDirFilename("UlRlcStats.txt")));
187 Config::SetDefault("ns3::RadioBearerStatsCalculator::DlPdcpOutputFilename",
188 StringValue(CreateTempDirFilename("DlPdcpStats.txt")));
189 Config::SetDefault("ns3::RadioBearerStatsCalculator::UlPdcpOutputFilename",
190 StringValue(CreateTempDirFilename("UlPdcpStats.txt")));
191 Config::SetDefault("ns3::PhyStatsCalculator::DlRsrpSinrFilename",
192 StringValue(CreateTempDirFilename("DlRsrpSinrStats.txt")));
193 Config::SetDefault("ns3::PhyStatsCalculator::UlSinrFilename",
194 StringValue(CreateTempDirFilename("UlSinrStats.txt")));
195 Config::SetDefault("ns3::PhyStatsCalculator::UlInterferenceFilename",
196 StringValue(CreateTempDirFilename("UlInterferenceStats.txt")));
197 Config::SetDefault("ns3::PhyRxStatsCalculator::DlRxOutputFilename",
198 StringValue(CreateTempDirFilename("DlRxPhyStats.txt")));
199 Config::SetDefault("ns3::PhyRxStatsCalculator::UlRxOutputFilename",
200 StringValue(CreateTempDirFilename("UlRxPhyStats.txt")));
201 Config::SetDefault("ns3::PhyTxStatsCalculator::DlTxOutputFilename",
202 StringValue(CreateTempDirFilename("DlTxPhyStats.txt")));
203 Config::SetDefault("ns3::PhyTxStatsCalculator::UlTxOutputFilename",
204 StringValue(CreateTempDirFilename("UlTxPhyStats.txt")));
205
206 NS_LOG_FUNCTION(this << GetName());
207 uint16_t numBearersPerUe = 1;
208 Time simTime = m_simTime;
209 double eNodeB_txPower = 43;
210
211 Config::SetDefault("ns3::LteHelper::UseIdealRrc", BooleanValue(m_isIdealRrc));
212
213 Ptr<LteHelper> lteHelper = CreateObject<LteHelper>();
214 Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper>();
215 lteHelper->SetEpcHelper(epcHelper);
216
217 lteHelper->SetPathlossModelType(TypeId::LookupByName("ns3::LogDistancePropagationLossModel"));
218 lteHelper->SetPathlossModelAttribute("Exponent", DoubleValue(3.9));
219 lteHelper->SetPathlossModelAttribute("ReferenceLoss",
220 DoubleValue(38.57)); // ref. loss in dB at 1m for 2.025GHz
221 lteHelper->SetPathlossModelAttribute("ReferenceDistance", DoubleValue(1));
222
223 //----power related (equal for all base stations)----
224 Config::SetDefault("ns3::LteEnbPhy::TxPower", DoubleValue(eNodeB_txPower));
225 Config::SetDefault("ns3::LteUePhy::TxPower", DoubleValue(23));
226 Config::SetDefault("ns3::LteUePhy::NoiseFigure", DoubleValue(7));
227 Config::SetDefault("ns3::LteEnbPhy::NoiseFigure", DoubleValue(2));
228 Config::SetDefault("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue(true));
229 Config::SetDefault("ns3::LteUePowerControl::ClosedLoop", BooleanValue(true));
230 Config::SetDefault("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue(true));
231
232 //----frequency related----
233 lteHelper->SetEnbDeviceAttribute("DlEarfcn", UintegerValue(100)); // 2120MHz
234 lteHelper->SetEnbDeviceAttribute("UlEarfcn", UintegerValue(18100)); // 1930MHz
235 lteHelper->SetEnbDeviceAttribute("DlBandwidth", UintegerValue(25)); // 5MHz
236 lteHelper->SetEnbDeviceAttribute("UlBandwidth", UintegerValue(25)); // 5MHz
237
238 //----others----
239 lteHelper->SetSchedulerType("ns3::PfFfMacScheduler");
240 Config::SetDefault("ns3::LteAmc::AmcModel", EnumValue(LteAmc::PiroEW2010));
241 Config::SetDefault("ns3::LteAmc::Ber", DoubleValue(0.01));
242 Config::SetDefault("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue(true));
243
244 // Radio link failure detection parameters
245 Config::SetDefault("ns3::LteUeRrc::N310", UintegerValue(1));
246 Config::SetDefault("ns3::LteUeRrc::N311", UintegerValue(1));
247 Config::SetDefault("ns3::LteUeRrc::T310", TimeValue(Seconds(1)));
248
249 // Create the internet
250 Ptr<Node> pgw = epcHelper->GetPgwNode();
251 // Create a single RemoteHost0x18ab460
252 NodeContainer remoteHostContainer;
253 remoteHostContainer.Create(1);
254 Ptr<Node> remoteHost = remoteHostContainer.Get(0);
255 InternetStackHelper internet;
256 internet.Install(remoteHostContainer);
258 p2ph.SetDeviceAttribute("DataRate", DataRateValue(DataRate("100Gb/s")));
259 p2ph.SetDeviceAttribute("Mtu", UintegerValue(1500));
260 p2ph.SetChannelAttribute("Delay", TimeValue(Seconds(0.010)));
261 NetDeviceContainer internetDevices = p2ph.Install(pgw, remoteHost);
262 Ipv4AddressHelper ipv4h;
263 ipv4h.SetBase("1.0.0.0", "255.0.0.0");
264 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign(internetDevices);
265 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress(1);
266 Ipv4StaticRoutingHelper ipv4RoutingHelper;
267 Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
268 ipv4RoutingHelper.GetStaticRouting(remoteHost->GetObject<Ipv4>());
269 remoteHostStaticRouting->AddNetworkRouteTo(Ipv4Address("7.0.0.0"), Ipv4Mask("255.0.0.0"), 1);
270
271 // Create Nodes: eNodeB and UE
272 NodeContainer enbNodes;
273 NodeContainer ueNodes;
274 enbNodes.Create(m_numEnbs);
275 ueNodes.Create(m_numUes);
276
277 // Mobility
278 Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator>();
279
280 for (std::vector<Vector>::iterator enbPosIt = m_enbPositionList.begin();
281 enbPosIt != m_enbPositionList.end();
282 ++enbPosIt)
283 {
284 positionAllocEnb->Add(*enbPosIt);
285 }
287 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
288 mobility.SetPositionAllocator(positionAllocEnb);
289 mobility.Install(enbNodes);
290
291 Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator>();
292
293 for (std::vector<Vector>::iterator uePosIt = m_uePositionList.begin();
294 uePosIt != m_uePositionList.end();
295 ++uePosIt)
296 {
297 positionAllocUe->Add(*uePosIt);
298 }
299
300 mobility.SetPositionAllocator(positionAllocUe);
301 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
302 mobility.Install(ueNodes);
303 m_ueMobility = ueNodes.Get(0)->GetObject<MobilityModel>();
304
305 // Install LTE Devices in eNB and UEs
306 NetDeviceContainer enbDevs;
307 NetDeviceContainer ueDevs;
308
309 int64_t randomStream = 1;
310 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
311 randomStream += lteHelper->AssignStreams(enbDevs, randomStream);
312 ueDevs = lteHelper->InstallUeDevice(ueNodes);
313 randomStream += lteHelper->AssignStreams(ueDevs, randomStream);
314
315 // Install the IP stack on the UEs
316 internet.Install(ueNodes);
317 Ipv4InterfaceContainer ueIpIfaces;
318 ueIpIfaces = epcHelper->AssignUeIpv4Address(NetDeviceContainer(ueDevs));
319
320 // Attach a UE to a eNB
321 lteHelper->Attach(ueDevs);
322
323 // Install and start applications on UEs and remote host
324 uint16_t dlPort = 10000;
325 uint16_t ulPort = 20000;
326
327 DataRateValue dataRateValue = DataRate("18.6Mbps");
328 uint64_t bitRate = dataRateValue.Get().GetBitRate();
329 uint32_t packetSize = 1024; // bytes
330 NS_LOG_DEBUG("bit rate " << bitRate);
331 double interPacketInterval = static_cast<double>(packetSize * 8) / bitRate;
332 Time udpInterval = Seconds(interPacketInterval);
333
334 NS_LOG_DEBUG("UDP will use application interval " << udpInterval.As(Time::S));
335
336 for (uint32_t u = 0; u < m_numUes; ++u)
337 {
338 Ptr<Node> ue = ueNodes.Get(u);
339 // Set the default gateway for the UE
340 Ptr<Ipv4StaticRouting> ueStaticRouting =
341 ipv4RoutingHelper.GetStaticRouting(ue->GetObject<Ipv4>());
342 ueStaticRouting->SetDefaultRoute(epcHelper->GetUeDefaultGatewayAddress(), 1);
343
344 for (uint32_t b = 0; b < numBearersPerUe; ++b)
345 {
346 ApplicationContainer ulClientApps;
347 ApplicationContainer ulServerApps;
348 ApplicationContainer dlClientApps;
349 ApplicationContainer dlServerApps;
350
351 ++dlPort;
352 ++ulPort;
353
354 NS_LOG_LOGIC("installing UDP DL app for UE " << u + 1);
355 UdpClientHelper dlClientHelper(ueIpIfaces.GetAddress(u), dlPort);
356 dlClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
357 dlClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
358 dlClientApps.Add(dlClientHelper.Install(remoteHost));
359
360 PacketSinkHelper dlPacketSinkHelper("ns3::UdpSocketFactory",
361 InetSocketAddress(Ipv4Address::GetAny(), dlPort));
362 dlServerApps.Add(dlPacketSinkHelper.Install(ue));
363
364 NS_LOG_LOGIC("installing UDP UL app for UE " << u + 1);
365 UdpClientHelper ulClientHelper(remoteHostAddr, ulPort);
366 ulClientHelper.SetAttribute("Interval", TimeValue(udpInterval));
367 ulClientHelper.SetAttribute("MaxPackets", UintegerValue(1000000));
368 ulClientApps.Add(ulClientHelper.Install(ue));
369
370 PacketSinkHelper ulPacketSinkHelper("ns3::UdpSocketFactory",
371 InetSocketAddress(Ipv4Address::GetAny(), ulPort));
372 ulServerApps.Add(ulPacketSinkHelper.Install(remoteHost));
373
374 Ptr<EpcTft> tft = Create<EpcTft>();
376 dlpf.localPortStart = dlPort;
377 dlpf.localPortEnd = dlPort;
378 tft->Add(dlpf);
380 ulpf.remotePortStart = ulPort;
381 ulpf.remotePortEnd = ulPort;
382 tft->Add(ulpf);
383 EpsBearer bearer(EpsBearer::NGBR_IMS);
384 lteHelper->ActivateDedicatedEpsBearer(ueDevs.Get(u), bearer, tft);
385
386 dlServerApps.Start(Seconds(0.27));
387 dlClientApps.Start(Seconds(0.27));
388 ulServerApps.Start(Seconds(0.27));
389 ulClientApps.Start(Seconds(0.27));
390
391 } // end for b
392 }
393
394 lteHelper->EnableTraces();
395
396 for (uint32_t u = 0; u < m_numUes; ++u)
397 {
398 Simulator::Schedule(m_checkConnectedList.at(u),
400 this,
401 ueDevs.Get(u),
402 enbDevs);
403 }
404
405 Simulator::Schedule(Seconds(0.4),
407 this,
409
410 // connect custom trace sinks
412 "/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
415 "/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
417 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
420 "/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
422 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
424 Config::Connect("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
426
427 Simulator::Stop(simTime);
428
429 Simulator::Run();
430 for (uint32_t u = 0; u < m_numUes; ++u)
431 {
434 true,
435 "Error, UE transitions to idle state for other than radio link failure");
436 CheckIdle(ueDevs.Get(u), enbDevs);
437 }
438 Simulator::Destroy();
439} // end of void LteRadioLinkFailureTestCase::DoRun ()
440
441void
443{
444 NS_LOG_FUNCTION(this);
445 // move to a far away location so that transmission errors occur
446
447 m_ueMobility->SetPosition(UeJumpAwayPosition);
448}
449
450void
452{
453 NS_LOG_FUNCTION(ueDevice);
454
455 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
456 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
457 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!");
458 uint16_t cellId = ueRrc->GetCellId();
459
460 Ptr<LteEnbNetDevice> enbLteDevice;
461
462 for (std::vector<Ptr<NetDevice>>::const_iterator enbDevIt = enbDevices.Begin();
463 enbDevIt != enbDevices.End();
464 ++enbDevIt)
465 {
466 if (((*enbDevIt)->GetObject<LteEnbNetDevice>())->HasCellId(cellId))
467 {
468 enbLteDevice = (*enbDevIt)->GetObject<LteEnbNetDevice>();
469 }
470 }
471
472 NS_TEST_ASSERT_MSG_NE(enbLteDevice, nullptr, "LTE eNB device not found");
473 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
474 uint16_t rnti = ueRrc->GetRnti();
475 Ptr<UeManager> ueManager = enbRrc->GetUeManager(rnti);
476 NS_TEST_ASSERT_MSG_NE(ueManager, nullptr, "RNTI " << rnti << " not found in eNB");
477
478 UeManager::State ueManagerState = ueManager->GetState();
479 NS_TEST_ASSERT_MSG_EQ(ueManagerState, UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
480 NS_ASSERT_MSG(ueManagerState == UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
481
482 uint16_t ueCellId = ueRrc->GetCellId();
483 uint16_t enbCellId = enbLteDevice->GetCellId();
484 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth();
485 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth();
486 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth();
487 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth();
488 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn();
489 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn();
490 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn();
491 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn();
492 uint64_t ueImsi = ueLteDevice->GetImsi();
493 uint64_t enbImsi = ueManager->GetImsi();
494
495 NS_TEST_ASSERT_MSG_EQ(ueImsi, enbImsi, "inconsistent IMSI");
496 NS_TEST_ASSERT_MSG_EQ(ueCellId, enbCellId, "inconsistent CellId");
497 NS_TEST_ASSERT_MSG_EQ(ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth");
498 NS_TEST_ASSERT_MSG_EQ(ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth");
499 NS_TEST_ASSERT_MSG_EQ(ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn");
500 NS_TEST_ASSERT_MSG_EQ(ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn");
501
502 ObjectMapValue enbDataRadioBearerMapValue;
503 ueManager->GetAttribute("DataRadioBearerMap", enbDataRadioBearerMapValue);
504 NS_TEST_ASSERT_MSG_EQ(enbDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at eNB");
505
506 ObjectMapValue ueDataRadioBearerMapValue;
507 ueRrc->GetAttribute("DataRadioBearerMap", ueDataRadioBearerMapValue);
508 NS_TEST_ASSERT_MSG_EQ(ueDataRadioBearerMapValue.GetN(), 1 + 1, "wrong num bearers at UE");
509
510 ObjectMapValue::Iterator enbBearerIt = enbDataRadioBearerMapValue.Begin();
511 ObjectMapValue::Iterator ueBearerIt = ueDataRadioBearerMapValue.Begin();
512 while (enbBearerIt != enbDataRadioBearerMapValue.End() &&
513 ueBearerIt != ueDataRadioBearerMapValue.End())
514 {
515 Ptr<LteDataRadioBearerInfo> enbDrbInfo =
516 enbBearerIt->second->GetObject<LteDataRadioBearerInfo>();
518 ueBearerIt->second->GetObject<LteDataRadioBearerInfo>();
519 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_epsBearerIdentity,
520 (uint32_t)ueDrbInfo->m_epsBearerIdentity,
521 "epsBearerIdentity differs");
522 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_drbIdentity,
523 (uint32_t)ueDrbInfo->m_drbIdentity,
524 "drbIdentity differs");
525 NS_TEST_ASSERT_MSG_EQ((uint32_t)enbDrbInfo->m_logicalChannelIdentity,
526 (uint32_t)ueDrbInfo->m_logicalChannelIdentity,
527 "logicalChannelIdentity differs");
528
529 ++enbBearerIt;
530 ++ueBearerIt;
531 }
532 NS_ASSERT_MSG(enbBearerIt == enbDataRadioBearerMapValue.End(), "too many bearers at eNB");
533 NS_ASSERT_MSG(ueBearerIt == ueDataRadioBearerMapValue.End(), "too many bearers at UE");
534}
535
536void
538{
539 NS_LOG_FUNCTION(ueDevice);
540
541 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice>();
542 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc();
543 uint16_t rnti = ueRrc->GetRnti();
544 uint32_t numEnbDevices = enbDevices.GetN();
545 bool ueManagerFound = false;
546
547 switch (numEnbDevices)
548 {
549 // 1 eNB
550 case 1:
551 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
552 LteUeRrc::IDLE_CELL_SEARCH,
553 "Wrong LteUeRrc state!");
554 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(0));
555 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
556 false,
557 "Unexpected RNTI with value " << rnti << " found in eNB");
558 break;
559 // 2 eNBs
560 case 2:
561 NS_TEST_ASSERT_MSG_EQ(ueRrc->GetState(),
562 LteUeRrc::CONNECTED_NORMALLY,
563 "Wrong LteUeRrc state!");
564 ueManagerFound = CheckUeExistAtEnb(rnti, enbDevices.Get(1));
565 NS_TEST_ASSERT_MSG_EQ(ueManagerFound,
566 true,
567 "RNTI " << rnti << " is not attached to the eNB");
568 break;
569 default:
570 NS_FATAL_ERROR("The RRC state of the UE in more then 2 eNB scenario is not defined. "
571 "Consider creating more cases");
572 break;
573 }
574}
575
576bool
578{
579 NS_LOG_FUNCTION(this << rnti);
580 Ptr<LteEnbNetDevice> enbLteDevice = DynamicCast<LteEnbNetDevice>(enbDevice);
581 NS_ABORT_MSG_IF(!enbLteDevice, "LTE eNB device not found");
582 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc();
583 bool ueManagerFound = enbRrc->HasUeManager(rnti);
584 return ueManagerFound;
585}
586
587void
589 uint64_t imsi,
590 uint16_t cellId,
591 uint16_t rnti,
592 LteUeRrc::State oldState,
593 LteUeRrc::State newState)
594{
595 NS_LOG_FUNCTION(this << imsi << cellId << rnti << oldState << newState);
596 m_lastState = newState;
597}
598
599void
601 uint64_t imsi,
602 uint16_t cellId,
603 uint16_t rnti)
604{
605 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
606}
607
608void
610 uint64_t imsi,
611 uint16_t cellId,
612 uint16_t rnti)
613{
614 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
616 0,
617 "radio link failure detection should start only in RRC CONNECTED state");
619 0,
620 "radio link failure detection should start only in RRC CONNECTED state");
621}
622
623void
625 uint64_t imsi,
626 uint16_t cellId,
627 uint16_t rnti)
628{
629 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
630}
631
632void
634 uint64_t imsi,
635 uint16_t rnti,
636 uint16_t cellId,
637 std::string type,
638 uint8_t count)
639{
640 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
641 if (type == "Notify out of sync")
642 {
644 }
645 else if (type == "Notify in sync")
646 {
648 }
649}
650
651void
653 uint64_t imsi,
654 uint16_t cellId,
655 uint16_t rnti)
656{
657 NS_LOG_FUNCTION(this << imsi << cellId << rnti);
658 NS_LOG_DEBUG("RLF at " << Simulator::Now());
660 // The value of N310 is hard coded to the default value 1
663 1,
664 "wrong number of out-of-sync indications detected, check configured value for N310");
665 // The value of N311 is hard coded to the default value 1
668 1,
669 "wrong number of out-of-sync indications detected, check configured value for N311");
670 // Reset the counter for the next RRC connection establishment.
672}
holds a vector of ns3::Application pointers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the 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:42
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 enum 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:1425
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 ",...
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:1338
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.