A Discrete-Event Network Simulator
API
lte-test-radio-link-failure.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2018 Fraunhofer ESK
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Vignesh Babu <ns3-dev@esk.fraunhofer.de>
19 *
20 * Modified by:
21 * Zoraze Ali <zoraze.ali@cttc.es> (included both RRC protocol, two
22 * eNB scenario and UE jump away
23 * logic)
24 */
25
27
28#include "ns3/core-module.h"
29#include "ns3/network-module.h"
30#include "ns3/internet-module.h"
31#include "ns3/mobility-module.h"
32#include "ns3/lte-module.h"
33#include "ns3/applications-module.h"
34#include "ns3/point-to-point-module.h"
35#include "ns3/config-store-module.h"
36#include "ns3/config-store.h"
37#include <iostream>
38#include <vector>
39#include <stdio.h>
40#include <iomanip>
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.push_back (Vector (10, 0, 0));
58 enbPositionList.push_back (Vector (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 uePositionList, enbPositionList,
71 ueJumpAwayPosition,
72 checkConnectedList),
73 TestCase::QUICK);
74
75 // One eNB: Real RRC PROTOCOL
76 AddTestCase (new LteRadioLinkFailureTestCase (1, 1, Seconds (2), false,
77 uePositionList, enbPositionList,
78 ueJumpAwayPosition,
79 checkConnectedList),
80 TestCase::QUICK);
81
82 // Two eNBs: Ideal RRC PROTOCOL
83
84 // We place the second eNB close to the position where the UE will jump
85 enbPositionList.push_back (Vector (7020, 0, 0));
86
88 uePositionList, enbPositionList,
89 ueJumpAwayPosition,
90 checkConnectedList),
91 TestCase::QUICK);
92
93 // Two eNBs: Ideal RRC PROTOCOL
94 AddTestCase (new LteRadioLinkFailureTestCase (2, 1, Seconds (2), false,
95 uePositionList, enbPositionList,
96 ueJumpAwayPosition,
97 checkConnectedList),
98 TestCase::QUICK);
99
100} // end of LteRadioLinkFailureTestSuite::LteRadioLinkFailureTestSuite ()
101
102
104
105/*
106 * Test Case
107 */
108
109std::string
111{
112 std::ostringstream oss;
113 std::string rrcProtocol;
114 if (isIdealRrc)
115 {
116 rrcProtocol = "RRC Ideal";
117 }
118 else
119 {
120 rrcProtocol = "RRC Real";
121 }
122 oss << numEnbs << " eNBs, " << numUes << " UEs, " << rrcProtocol << " Protocol";
123 return oss.str ();
124}
125
127 uint32_t numEnbs, uint32_t numUes, Time simTime, bool isIdealRrc,
128 std::vector<Vector> uePositionList, std::vector<Vector> enbPositionList,
129 Vector ueJumpAwayPosition, std::vector<Time> checkConnectedList)
130 : TestCase (BuildNameString (numEnbs, numUes, isIdealRrc)),
131 m_numEnbs (numEnbs),
132 m_numUes (numUes),
133 m_simTime (simTime),
134 m_isIdealRrc (isIdealRrc),
135 m_uePositionList (uePositionList),
136 m_enbPositionList (enbPositionList),
137 m_checkConnectedList (checkConnectedList),
138 m_ueJumpAwayPosition (ueJumpAwayPosition)
139{
140 NS_LOG_FUNCTION (this << GetName ());
141 m_lastState = LteUeRrc::NUM_STATES;
145}
146
147
149{
150 NS_LOG_FUNCTION (this << GetName ());
151}
152
153
154void
156{
157 // LogLevel logLevel = (LogLevel) (LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL);
158 // LogComponentEnable ("LteUeRrc", logLevel);
159 // LogComponentEnable ("LteEnbRrc", logLevel);
160 // LogComponentEnable ("LteRadioLinkFailureTest", logLevel);
161
162 Config::SetDefault ("ns3::MacStatsCalculator::DlOutputFilename", StringValue (CreateTempDirFilename ("DlMacStats.txt")));
163 Config::SetDefault ("ns3::MacStatsCalculator::UlOutputFilename", StringValue (CreateTempDirFilename ("UlMacStats.txt")));
164 Config::SetDefault ("ns3::RadioBearerStatsCalculator::DlRlcOutputFilename", StringValue (CreateTempDirFilename ("DlRlcStats.txt")));
165 Config::SetDefault ("ns3::RadioBearerStatsCalculator::UlRlcOutputFilename", StringValue (CreateTempDirFilename ("UlRlcStats.txt")));
166 Config::SetDefault ("ns3::RadioBearerStatsCalculator::DlPdcpOutputFilename", StringValue (CreateTempDirFilename ("DlPdcpStats.txt")));
167 Config::SetDefault ("ns3::RadioBearerStatsCalculator::UlPdcpOutputFilename", StringValue (CreateTempDirFilename ("UlPdcpStats.txt")));
168 Config::SetDefault ("ns3::PhyStatsCalculator::DlRsrpSinrFilename", StringValue (CreateTempDirFilename ("DlRsrpSinrStats.txt")));
169 Config::SetDefault ("ns3::PhyStatsCalculator::UlSinrFilename", StringValue (CreateTempDirFilename ("UlSinrStats.txt")));
170 Config::SetDefault ("ns3::PhyStatsCalculator::UlInterferenceFilename", StringValue (CreateTempDirFilename ("UlInterferenceStats.txt")));
171 Config::SetDefault ("ns3::PhyRxStatsCalculator::DlRxOutputFilename", StringValue (CreateTempDirFilename ("DlRxPhyStats.txt")));
172 Config::SetDefault ("ns3::PhyRxStatsCalculator::UlRxOutputFilename", StringValue (CreateTempDirFilename ("UlRxPhyStats.txt")));
173 Config::SetDefault ("ns3::PhyTxStatsCalculator::DlTxOutputFilename", StringValue (CreateTempDirFilename ("DlTxPhyStats.txt")));
174 Config::SetDefault ("ns3::PhyTxStatsCalculator::UlTxOutputFilename", StringValue (CreateTempDirFilename ("UlTxPhyStats.txt")));
175
176 NS_LOG_FUNCTION (this << GetName ());
177 uint16_t numBearersPerUe = 1;
178 Time simTime = m_simTime;
179 double eNodeB_txPower = 43;
180
181 Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (m_isIdealRrc));
182
183 Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
184 Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
185 lteHelper->SetEpcHelper (epcHelper);
186
187 lteHelper->SetPathlossModelType (TypeId::LookupByName ("ns3::LogDistancePropagationLossModel"));
188 lteHelper->SetPathlossModelAttribute ("Exponent", DoubleValue (3.9));
189 lteHelper->SetPathlossModelAttribute ("ReferenceLoss", DoubleValue (38.57)); //ref. loss in dB at 1m for 2.025GHz
190 lteHelper->SetPathlossModelAttribute ("ReferenceDistance", DoubleValue (1));
191
192 //----power related (equal for all base stations)----
193 Config::SetDefault ("ns3::LteEnbPhy::TxPower", DoubleValue (eNodeB_txPower));
194 Config::SetDefault ("ns3::LteUePhy::TxPower", DoubleValue (23));
195 Config::SetDefault ("ns3::LteUePhy::NoiseFigure", DoubleValue (7));
196 Config::SetDefault ("ns3::LteEnbPhy::NoiseFigure", DoubleValue (2));
197 Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (true));
198 Config::SetDefault ("ns3::LteUePowerControl::ClosedLoop", BooleanValue (true));
199 Config::SetDefault ("ns3::LteUePowerControl::AccumulationEnabled", BooleanValue (true));
200
201 //----frequency related----
202 lteHelper->SetEnbDeviceAttribute ("DlEarfcn", UintegerValue (100)); //2120MHz
203 lteHelper->SetEnbDeviceAttribute ("UlEarfcn", UintegerValue (18100)); //1930MHz
204 lteHelper->SetEnbDeviceAttribute ("DlBandwidth", UintegerValue (25)); //5MHz
205 lteHelper->SetEnbDeviceAttribute ("UlBandwidth", UintegerValue (25)); //5MHz
206
207 //----others----
208 lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler");
209 Config::SetDefault ("ns3::LteAmc::AmcModel", EnumValue (LteAmc::PiroEW2010));
210 Config::SetDefault ("ns3::LteAmc::Ber", DoubleValue (0.01));
211 Config::SetDefault ("ns3::PfFfMacScheduler::HarqEnabled", BooleanValue (true));
212
213 //Radio link failure detection parameters
214 Config::SetDefault ("ns3::LteUeRrc::N310", UintegerValue (1));
215 Config::SetDefault ("ns3::LteUeRrc::N311", UintegerValue (1));
216 Config::SetDefault ("ns3::LteUeRrc::T310", TimeValue (Seconds (1)));
217
218 // Create the internet
219 Ptr<Node> pgw = epcHelper->GetPgwNode ();
220 // Create a single RemoteHost0x18ab460
221 NodeContainer remoteHostContainer;
222 remoteHostContainer.Create (1);
223 Ptr<Node> remoteHost = remoteHostContainer.Get (0);
224 InternetStackHelper internet;
225 internet.Install (remoteHostContainer);
227 p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
228 p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
229 p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
230 NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
231 Ipv4AddressHelper ipv4h;
232 ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
233 Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
234 Ipv4Address remoteHostAddr = internetIpIfaces.GetAddress (1);
235 Ipv4StaticRoutingHelper ipv4RoutingHelper;
236 Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject <Ipv4> ());
237 remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
238
239 // Create Nodes: eNodeB and UE
240 NodeContainer enbNodes;
241 NodeContainer ueNodes;
242 enbNodes.Create (m_numEnbs);
243 ueNodes.Create (m_numUes);
244
245 //Mobility
246 Ptr<ListPositionAllocator> positionAllocEnb = CreateObject<ListPositionAllocator> ();
247
248 for (std::vector<Vector>::iterator enbPosIt = m_enbPositionList.begin ();
249 enbPosIt != m_enbPositionList.end (); ++enbPosIt)
250 {
251 positionAllocEnb->Add (*enbPosIt);
252 }
254 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
255 mobility.SetPositionAllocator (positionAllocEnb);
256 mobility.Install (enbNodes);
257
258 Ptr<ListPositionAllocator> positionAllocUe = CreateObject<ListPositionAllocator> ();
259
260 for (std::vector<Vector>::iterator uePosIt = m_uePositionList.begin ();
261 uePosIt != m_uePositionList.end (); ++uePosIt)
262 {
263 positionAllocUe->Add (*uePosIt);
264 }
265
266 mobility.SetPositionAllocator (positionAllocUe);
267 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
268 mobility.Install (ueNodes);
269 m_ueMobility = ueNodes.Get (0)->GetObject<MobilityModel> ();
270
271 // Install LTE Devices in eNB and UEs
272 NetDeviceContainer enbDevs;
273 NetDeviceContainer ueDevs;
274
275 int64_t randomStream = 1;
276 enbDevs = lteHelper->InstallEnbDevice (enbNodes);
277 randomStream += lteHelper->AssignStreams (enbDevs, randomStream);
278 ueDevs = lteHelper->InstallUeDevice (ueNodes);
279 randomStream += lteHelper->AssignStreams (ueDevs, randomStream);
280
281 // Install the IP stack on the UEs
282 internet.Install (ueNodes);
283 Ipv4InterfaceContainer ueIpIfaces;
284 ueIpIfaces = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueDevs));
285
286 // Attach a UE to a eNB
287 lteHelper->Attach (ueDevs);
288
289 // Install and start applications on UEs and remote host
290 uint16_t dlPort = 10000;
291 uint16_t ulPort = 20000;
292
293 DataRateValue dataRateValue = DataRate ("18.6Mbps");
294 uint64_t bitRate = dataRateValue.Get ().GetBitRate ();
295 uint32_t packetSize = 1024; //bytes
296 NS_LOG_DEBUG ("bit rate " << bitRate);
297 double interPacketInterval = static_cast<double> (packetSize * 8) / bitRate;
298 Time udpInterval = Seconds (interPacketInterval);
299
300 NS_LOG_DEBUG ("UDP will use application interval " << udpInterval.As (Time::S));
301
302 for (uint32_t u = 0; u < m_numUes; ++u)
303 {
304 Ptr<Node> ue = ueNodes.Get (u);
305 // Set the default gateway for the UE
306 Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ue->GetObject<Ipv4> ());
307 ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
308
309 for (uint32_t b = 0; b < numBearersPerUe; ++b)
310 {
311 ApplicationContainer ulClientApps;
312 ApplicationContainer ulServerApps;
313 ApplicationContainer dlClientApps;
314 ApplicationContainer dlServerApps;
315
316 ++dlPort;
317 ++ulPort;
318
319 NS_LOG_LOGIC ("installing UDP DL app for UE " << u + 1);
320 UdpClientHelper dlClientHelper (ueIpIfaces.GetAddress (u), dlPort);
321 dlClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
322 dlClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
323 dlClientApps.Add (dlClientHelper.Install (remoteHost));
324
325 PacketSinkHelper dlPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), dlPort));
326 dlServerApps.Add (dlPacketSinkHelper.Install (ue));
327
328 NS_LOG_LOGIC ("installing UDP UL app for UE " << u + 1);
329 UdpClientHelper ulClientHelper (remoteHostAddr, ulPort);
330 ulClientHelper.SetAttribute ("Interval", TimeValue (udpInterval));
331 ulClientHelper.SetAttribute ("MaxPackets", UintegerValue (1000000));
332 ulClientApps.Add (ulClientHelper.Install (ue));
333
334 PacketSinkHelper ulPacketSinkHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address::GetAny (), ulPort));
335 ulServerApps.Add (ulPacketSinkHelper.Install (remoteHost));
336
337 Ptr<EpcTft> tft = Create<EpcTft> ();
339 dlpf.localPortStart = dlPort;
340 dlpf.localPortEnd = dlPort;
341 tft->Add (dlpf);
343 ulpf.remotePortStart = ulPort;
344 ulpf.remotePortEnd = ulPort;
345 tft->Add (ulpf);
346 EpsBearer bearer (EpsBearer::NGBR_IMS);
347 lteHelper->ActivateDedicatedEpsBearer (ueDevs.Get (u), bearer, tft);
348
349 dlServerApps.Start (Seconds (0.27));
350 dlClientApps.Start (Seconds (0.27));
351 ulServerApps.Start (Seconds (0.27));
352 ulClientApps.Start (Seconds (0.27));
353
354 } // end for b
355 }
356
357 lteHelper->EnableTraces ();
358
359 for (uint32_t u = 0; u < m_numUes; ++u)
360 {
361 Simulator::Schedule (m_checkConnectedList.at (u), &LteRadioLinkFailureTestCase::CheckConnected, this, ueDevs.Get (u), enbDevs);
362 }
363
364 Simulator::Schedule (Seconds (0.4), &LteRadioLinkFailureTestCase::JumpAway, this, m_ueJumpAwayPosition);
365
366 // connect custom trace sinks
367 Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/ConnectionEstablished",
369 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
371 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/StateTransition",
373 Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/NotifyConnectionRelease",
375 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/PhySyncDetection",
377 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/RadioLinkFailure",
379
380 Simulator::Stop (simTime);
381
383 for (uint32_t u = 0; u < m_numUes; ++u)
384 {
386 "Error, UE transitions to idle state for other than radio link failure");
387 CheckIdle (ueDevs.Get (u), enbDevs);
388 }
389 Simulator::Destroy ();
390} // end of void LteRadioLinkFailureTestCase::DoRun ()
391
392void
394{
395 NS_LOG_FUNCTION (this);
396 // move to a far away location so that transmission errors occur
397
398 m_ueMobility->SetPosition (UeJumpAwayPosition);
399}
400
401void
403{
404 NS_LOG_FUNCTION (ueDevice);
405
406 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
407 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc ();
408 NS_TEST_ASSERT_MSG_EQ (ueRrc->GetState (), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!");
409 uint16_t cellId = ueRrc->GetCellId ();
410
411 Ptr<LteEnbNetDevice> enbLteDevice;
412
413 for (std::vector<Ptr<NetDevice> >::const_iterator enbDevIt = enbDevices.Begin ();
414 enbDevIt != enbDevices.End (); ++enbDevIt)
415 {
416 if (((*enbDevIt)->GetObject<LteEnbNetDevice> ())->HasCellId (cellId))
417 {
418 enbLteDevice = (*enbDevIt)->GetObject<LteEnbNetDevice> ();
419 }
420 }
421
422 NS_TEST_ASSERT_MSG_NE (enbLteDevice, nullptr, "LTE eNB device not found");
423 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc ();
424 uint16_t rnti = ueRrc->GetRnti ();
425 Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
426 NS_TEST_ASSERT_MSG_NE (ueManager, nullptr, "RNTI " << rnti << " not found in eNB");
427
428 UeManager::State ueManagerState = ueManager->GetState ();
429 NS_TEST_ASSERT_MSG_EQ (ueManagerState, UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
430 NS_ASSERT_MSG (ueManagerState == UeManager::CONNECTED_NORMALLY, "Wrong UeManager state!");
431
432 uint16_t ueCellId = ueRrc->GetCellId ();
433 uint16_t enbCellId = enbLteDevice->GetCellId ();
434 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
435 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
436 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
437 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
438 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
439 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
440 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
441 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
442 uint64_t ueImsi = ueLteDevice->GetImsi ();
443 uint64_t enbImsi = ueManager->GetImsi ();
444
445 NS_TEST_ASSERT_MSG_EQ (ueImsi, enbImsi, "inconsistent IMSI");
446 NS_TEST_ASSERT_MSG_EQ (ueCellId, enbCellId, "inconsistent CellId");
447 NS_TEST_ASSERT_MSG_EQ (ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth");
448 NS_TEST_ASSERT_MSG_EQ (ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth");
449 NS_TEST_ASSERT_MSG_EQ (ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn");
450 NS_TEST_ASSERT_MSG_EQ (ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn");
451
452 ObjectMapValue enbDataRadioBearerMapValue;
453 ueManager->GetAttribute ("DataRadioBearerMap", enbDataRadioBearerMapValue);
454 NS_TEST_ASSERT_MSG_EQ (enbDataRadioBearerMapValue.GetN (), 1 + 1, "wrong num bearers at eNB");
455
456 ObjectMapValue ueDataRadioBearerMapValue;
457 ueRrc->GetAttribute ("DataRadioBearerMap", ueDataRadioBearerMapValue);
458 NS_TEST_ASSERT_MSG_EQ (ueDataRadioBearerMapValue.GetN (), 1 + 1, "wrong num bearers at UE");
459
460 ObjectMapValue::Iterator enbBearerIt = enbDataRadioBearerMapValue.Begin ();
461 ObjectMapValue::Iterator ueBearerIt = ueDataRadioBearerMapValue.Begin ();
462 while (enbBearerIt != enbDataRadioBearerMapValue.End ()
463 && ueBearerIt != ueDataRadioBearerMapValue.End ())
464 {
465 Ptr<LteDataRadioBearerInfo> enbDrbInfo = enbBearerIt->second->GetObject<LteDataRadioBearerInfo> ();
466 Ptr<LteDataRadioBearerInfo> ueDrbInfo = ueBearerIt->second->GetObject<LteDataRadioBearerInfo> ();
467 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity, "epsBearerIdentity differs");
468 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity, "drbIdentity differs");
469 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity, "logicalChannelIdentity differs");
470
471 ++enbBearerIt;
472 ++ueBearerIt;
473 }
474 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.End (), "too many bearers at eNB");
475 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (), "too many bearers at UE");
476}
477
478void
480{
481 NS_LOG_FUNCTION (ueDevice);
482
483 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
484 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc ();
485 uint16_t rnti = ueRrc->GetRnti ();
486 uint32_t numEnbDevices = enbDevices.GetN ();
487 bool ueManagerFound = false;
488
489 switch (numEnbDevices)
490 {
491 // 1 eNB
492 case 1:
493 NS_TEST_ASSERT_MSG_EQ (ueRrc->GetState (), LteUeRrc::IDLE_CELL_SEARCH, "Wrong LteUeRrc state!");
494 ueManagerFound = CheckUeExistAtEnb (rnti, enbDevices.Get (0));
495 NS_TEST_ASSERT_MSG_EQ (ueManagerFound, false, "Unexpected RNTI with value " << rnti << " found in eNB");
496 break;
497 // 2 eNBs
498 case 2:
499 NS_TEST_ASSERT_MSG_EQ (ueRrc->GetState (), LteUeRrc::CONNECTED_NORMALLY, "Wrong LteUeRrc state!");
500 ueManagerFound = CheckUeExistAtEnb (rnti, enbDevices.Get (1));
501 NS_TEST_ASSERT_MSG_EQ (ueManagerFound, true, "RNTI " << rnti << " is not attached to the eNB");
502 break;
503 default:
504 NS_FATAL_ERROR ("The RRC state of the UE in more then 2 eNB scenario is not defined. Consider creating more cases");
505 break;
506 }
507}
508
509bool
511{
512 NS_LOG_FUNCTION (this << rnti);
513 Ptr<LteEnbNetDevice> enbLteDevice = DynamicCast<LteEnbNetDevice> (enbDevice);
514 NS_ABORT_MSG_IF (!enbLteDevice, "LTE eNB device not found");
515 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc ();
516 bool ueManagerFound = enbRrc->HasUeManager (rnti);
517 return ueManagerFound;
518}
519
520void
522 uint64_t imsi, uint16_t cellId,
523 uint16_t rnti, LteUeRrc::State oldState,
524 LteUeRrc::State newState)
525{
526 NS_LOG_FUNCTION (this << imsi << cellId << rnti << oldState << newState);
527 m_lastState = newState;
528}
529
530void
532 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
533{
534 NS_LOG_FUNCTION (this << imsi << cellId << rnti);
535}
536
537void
539 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
540{
541 NS_LOG_FUNCTION (this << imsi << cellId << rnti);
543 "radio link failure detection should start only in RRC CONNECTED state");
545 "radio link failure detection should start only in RRC CONNECTED state");
546}
547
548void
550 uint16_t cellId, uint16_t rnti)
551{
552 NS_LOG_FUNCTION (this << imsi << cellId << rnti);
553}
554
555void
556LteRadioLinkFailureTestCase::PhySyncDetectionCallback (std::string context, uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint8_t count)
557{
558 NS_LOG_FUNCTION (this << imsi << cellId << rnti);
559 if (type == "Notify out of sync")
560 {
562 }
563 else if (type == "Notify in sync")
564 {
566 }
567}
568
569void
570LteRadioLinkFailureTestCase::RadioLinkFailureCallback (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
571{
572 NS_LOG_FUNCTION (this << imsi << cellId << rnti);
573 NS_LOG_DEBUG ("RLF at " << Simulator::Now ());
575 //The value of N310 is hard coded to the default value 1
577 "wrong number of out-of-sync indications detected, check configured value for N310");
578 //The value of N311 is hard coded to the default value 1
580 "wrong number of out-of-sync indications detected, check configured value for N311");
581 // Reset the counter for the next RRC connection establishment.
583}
void Run(ObjectFactory &factory, uint32_t pop, uint32_t total, uint32_t runs, Ptr< RandomVariableStream > eventStream, bool calRev)
Perform the runs for a single scheduler type.
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
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:41
Hold variables of type enum.
Definition: enum.h:55
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
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:41
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:77
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:256
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:272
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
void SetPathlossModelType(TypeId type)
Set the type of path loss model to be used for both DL and UL channels.
Definition: lte-helper.cc:385
void SetSchedulerType(std::string type)
Set the type of scheduler to be used by eNodeB devices.
Definition: lte-helper.cc:279
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:959
void SetPathlossModelAttribute(std::string n, const AttributeValue &v)
Set an attribute for the path loss models to be created.
Definition: lte-helper.cc:393
void SetEnbDeviceAttribute(std::string n, const AttributeValue &v)
Set an attribute for the eNodeB devices (LteEnbNetDevice) to be created.
Definition: lte-helper.cc:400
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices.
Definition: lte-helper.cc:489
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used.
Definition: lte-helper.cc:1443
void EnableTraces(void)
Enables trace sinks for PHY, MAC, RLC and PDCP.
Definition: lte-helper.cc:1426
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:1068
The LteUeNetDevice class implements the UE net device.
State
The states of the UE RRC entity.
Definition: lte-ue-rrc.h:106
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
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
Iterator Begin(void) const
Get an iterator which refers to the first 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(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
Container for a set of ns3::Object pointers.
std::size_t GetN(void) const
Get the number of Objects.
Iterator Begin(void) const
Get an iterator to the first Object.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
Iterator End(void) const
Get an iterator to the past-the-end 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)
Hold variables of type string.
Definition: string.h:41
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.
Definition: test.cc:430
std::string GetName(void) const
Definition: test.cc:370
A suite of tests to run.
Definition: test.h:1188
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
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:418
AttributeValue implementation for Time.
Definition: nstime.h:1309
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:87
Hold an unsigned integer type.
Definition: uinteger.h:44
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:88
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#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:206
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:274
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:290
#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:329
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:287
#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:675
#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:141
#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:542
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
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:661
mobility
Definition: third.py:98
Implement the data structure representing a TrafficFlowTemplate Packet Filter.
Definition: epc-tft.h:75
uint16_t localPortEnd
end of the port number range of the UE
Definition: epc-tft.h:140
uint16_t remotePortEnd
end of the port number range of the remote host
Definition: epc-tft.h:138
uint16_t remotePortStart
start of the port number range of the remote host
Definition: epc-tft.h:137
uint16_t localPortStart
start of the port number range of the UE
Definition: epc-tft.h:139
static const uint32_t packetSize
Packet size generated at the AP.