A Discrete-Event Network Simulator
API
test-lte-rrc.cc
Go to the documentation of this file.
1/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Nicola Baldo <nbaldo@cttc.es>
19 * Budiarto Herman <budiarto.herman@magister.fi>
20 */
21
22
23#include <ns3/core-module.h>
24#include <ns3/network-module.h>
25#include <ns3/mobility-module.h>
26#include <ns3/lte-module.h>
27#include <cmath>
28
29using namespace ns3;
30
31NS_LOG_COMPONENT_DEFINE ("LteRrcTest");
32
40{
41public:
56 uint32_t nBearers,
57 uint32_t tConnBase,
58 uint32_t tConnIncrPerUe,
59 uint32_t delayDiscStart,
60 bool errorExpected,
61 bool useIdealRrc,
62 bool admitRrcConnectionRequest,
63 std::string description = "");
64
65protected:
66
67 virtual void DoRun (void);
69
83 static std::string BuildNameString (uint32_t nUes,
84 uint32_t nBearers,
85 uint32_t tConnBase,
86 uint32_t tConnIncrPerUe,
87 uint32_t delayDiscStart,
88 bool useIdealRrc,
89 bool admitRrcConnectionRequest,
90 std::string description = "");
96 void Connect (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice);
102 void CheckConnected (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice);
108 void CheckNotConnected (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice);
116 void ConnectionEstablishedCallback (std::string context, uint64_t imsi,
117 uint16_t cellId, uint16_t rnti);
126 void ConnectionTimeoutCallback (std::string context, uint64_t imsi,
127 uint16_t cellId, uint16_t rnti,
128 uint8_t connEstFailCount);
129
139
141 std::map<uint64_t, bool> m_isConnectionEstablished;
142};
143
144
145std::string
147 uint32_t nBearers,
148 uint32_t tConnBase,
149 uint32_t tConnIncrPerUe,
150 uint32_t delayDiscStart,
151 bool useIdealRrc,
152 bool admitRrcConnectionRequest,
153 std::string description)
154{
155 std::ostringstream oss;
156 oss << "nUes=" << nUes
157 << ", nBearers=" << nBearers
158 << ", tConnBase=" << tConnBase
159 << ", tConnIncrPerUe=" << tConnIncrPerUe
160 << ", delayDiscStart=" << delayDiscStart;
161
162 if (useIdealRrc)
163 {
164 oss << ", ideal RRC";
165 }
166 else
167 {
168 oss << ", real RRC";
169 }
170
171 if (admitRrcConnectionRequest)
172 {
173 oss << ", admitRrcConnectionRequest = true";
174 }
175 else
176 {
177 oss << ", admitRrcConnectionRequest = false";
178 }
179
180 if (!description.empty ())
181 {
182 oss << ", " << description;
183 }
184
185 return oss.str ();
186}
187
189 uint32_t nUes, uint32_t nBearers,
190 uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart,
191 bool errorExpected, bool useIdealRrc, bool admitRrcConnectionRequest,
192 std::string description)
193 : TestCase (BuildNameString (nUes, nBearers,
194 tConnBase, tConnIncrPerUe, delayDiscStart,
195 useIdealRrc, admitRrcConnectionRequest,
196 description)),
197 m_nUes (nUes),
198 m_nBearers (nBearers),
199 m_tConnBase (tConnBase),
200 m_tConnIncrPerUe (tConnIncrPerUe),
201
202 m_delayDiscStart (delayDiscStart),
203 m_delayDiscEnd (10),
204 m_useIdealRrc (useIdealRrc),
205 m_admitRrcConnectionRequest (admitRrcConnectionRequest)
206{
207 NS_LOG_FUNCTION (this << GetName ());
208
209 // see the description of d^e in the LTE testing docs
210 double dsi = 90;
211 double nRaAttempts = 0;
212 if (nUes <= 20)
213 {
214 nRaAttempts += 5;
215 }
216 else
217 {
218 NS_ASSERT (nUes <= 50);
219 nRaAttempts += 10;
220 }
221
222 nRaAttempts += std::ceil (nUes / 4.0);
223 double dra = nRaAttempts * 7;
224 double dce = 10.0 + (2.0 * nUes) / 4.0;
225 if (errorExpected)
226 {
227 /*
228 * If transmission error happens, the UE has to repeat again from
229 * acquiring system information.
230 */
231 dce += dsi + dce;
232 }
233 double nCrs;
234 if (nUes <= 2)
235 {
236 nCrs = 0;
237 }
238 else if (nUes <= 5)
239 {
240 nCrs = 1;
241 }
242 else if (nUes <= 10)
243 {
244 nCrs = 2;
245 }
246 else if (nUes <= 20)
247 {
248 nCrs = 3;
249 }
250 else
251 {
252 nCrs = 4;
253 }
254 double dcr = (10.0 + (2.0 * nUes) / 4.0) * (m_nBearers + nCrs);
255
256 m_delayConnEnd = round (dsi + dra + dce + dcr);
257 NS_LOG_LOGIC (this << " " << GetName () << " dsi=" << dsi << " dra=" << dra << " dce=" << dce << " dcr=" << dcr << " m_delayConnEnd=" << m_delayConnEnd);
258}
259
260void
262{
263 NS_LOG_FUNCTION (this << GetName ());
264 Config::Reset ();
265
266 if (m_nUes < 25)
267 {
268 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (40));
269 }
270 else if (m_nUes < 60)
271 {
272 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (80));
273 }
274 else if (m_nUes < 120)
275 {
276 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (160));
277 }
278 else
279 {
280 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (320));
281 }
282
283 // normal code
284 m_lteHelper = CreateObject<LteHelper> ();
286
287 NodeContainer enbNodes;
288 NodeContainer ueNodes;
289
290
291 enbNodes.Create (1);
292 ueNodes.Create (m_nUes);
293
294 // the following positions all nodes at (0, 0, 0)
296 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
297 mobility.Install (enbNodes);
298 mobility.Install (ueNodes);
299
300 int64_t stream = 1;
301 NetDeviceContainer enbDevs;
302 enbDevs = m_lteHelper->InstallEnbDevice (enbNodes);
303 stream += m_lteHelper->AssignStreams (enbDevs, stream);
304
305 NetDeviceContainer ueDevs;
306 ueDevs = m_lteHelper->InstallUeDevice (ueNodes);
307 stream += m_lteHelper->AssignStreams (ueDevs, stream);
308
309 // custom code used for testing purposes
310 // instead of lteHelper->Attach () and lteHelper->ActivateXxx
311
312 // Set AdmitConnectionRequest attribute
313 for (NetDeviceContainer::Iterator it = enbDevs.Begin ();
314 it != enbDevs.End ();
315 ++it)
316 {
317 Ptr<LteEnbRrc> enbRrc = (*it)->GetObject<LteEnbNetDevice> ()->GetRrc ();
318 enbRrc->SetAttribute ("AdmitRrcConnectionRequest",
320 }
321
322
323 uint32_t i = 0;
324 uint32_t tmax = 0;
325 for (NetDeviceContainer::Iterator it = ueDevs.Begin (); it != ueDevs.End (); ++it)
326 {
327 Ptr<NetDevice> ueDevice = *it;
328 Ptr<NetDevice> enbDevice = enbDevs.Get (0);
329 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
330
331 uint32_t tc = m_tConnBase + m_tConnIncrPerUe * i; // time connection start
332 uint32_t tcc = tc + m_delayConnEnd; // time check connection completed;
333 uint32_t td = tcc + m_delayDiscStart; // time disconnect start
334 uint32_t tcd = td + m_delayDiscEnd; // time check disconnection completed
335 tmax = std::max (tmax, tcd);
336
337 // trick to resolve overloading
338 //void (LteHelper::* overloadedAttachFunctionPointer) (Ptr<NetDevice>, Ptr<NetDevice>) = &LteHelper::Attach;
339 //Simulator::Schedule (MilliSeconds (tc), overloadedAttachFunctionPointer, lteHelper, *it, enbDevice);
340 Simulator::Schedule (MilliSeconds (tc), &LteRrcConnectionEstablishmentTestCase::Connect, this, ueDevice, enbDevice);
341
342 Simulator::Schedule (MilliSeconds (tcc), &LteRrcConnectionEstablishmentTestCase::CheckConnected, this, *it, enbDevice);
343
344 // disconnection not supported yet
345
346 uint64_t imsi = ueLteDevice->GetImsi ();
347 m_isConnectionEstablished[imsi] = false;
348
349 ++i;
350 }
351
352 // Connect to trace sources in UEs
353 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
355 this));
356 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
358 this));
359
360 Simulator::Stop (MilliSeconds (tmax + 1));
361
363
364 Simulator::Destroy ();
365
366}
367
368void
370{
371 NS_LOG_FUNCTION (this);
372 m_lteHelper->Attach (ueDevice, enbDevice);
373
374 for (uint32_t b = 0; b < m_nBearers; ++b)
375 {
376 enum EpsBearer::Qci q = EpsBearer::NGBR_VIDEO_TCP_DEFAULT;
377 EpsBearer bearer (q);
378 m_lteHelper->ActivateDataRadioBearer (ueDevice, bearer);
379 }
380}
381
382void
384{
385 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
386 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc ();
387 const uint64_t imsi = ueLteDevice->GetImsi ();
388 const uint16_t rnti = ueRrc->GetRnti ();
389 NS_LOG_FUNCTION (this << imsi << rnti);
391 "Invalid IMSI " << imsi);
392
394 {
396 "Connection with RNTI " << rnti << " should have been rejected");
397 return;
398 }
399
400 /*
401 * Verifying UE state in UE RRC. Try to increase the test case duration if
402 * the following checks.
403 */
405 "RNTI " << rnti << " fails to establish connection");
406 NS_TEST_ASSERT_MSG_EQ (ueRrc->GetState (), LteUeRrc::CONNECTED_NORMALLY,
407 "RNTI " << rnti << " is not at CONNECTED_NORMALLY state");
408
409 // Verifying UE context state in eNodeB RRC.
410
411 Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice> ();
412 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc ();
413 const bool hasContext = enbRrc->HasUeManager (rnti);
414
415 if (hasContext)
416 {
417 Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
418 NS_ASSERT (ueManager);
419 NS_TEST_ASSERT_MSG_EQ (ueManager->GetState (),
420 UeManager::CONNECTED_NORMALLY,
421 "The context of RNTI " << rnti << " is in invalid state");
422 }
423 else
424 {
425 NS_LOG_WARN (this << " RNTI " << rnti << " thinks that it has"
426 << " established connection but the eNodeB thinks"
427 << " that the UE has failed on connection setup.");
428 /*
429 * The standard specifies that this case would exceed the maximum
430 * retransmission limit at UE RLC (SRB1), which will then trigger an RLF.
431 * However, this behaviour is not implemented yet.
432 */
433 }
434
435 // Verifying other attributes on both sides.
436
437 uint16_t ueCellId = ueRrc->GetCellId ();
438 uint16_t enbCellId = enbLteDevice->GetCellId ();
439 uint16_t ueImsi = ueLteDevice->GetImsi ();
440
441 uint8_t ueDlBandwidth = ueRrc->GetDlBandwidth ();
442 uint8_t enbDlBandwidth = enbLteDevice->GetDlBandwidth ();
443 uint8_t ueUlBandwidth = ueRrc->GetUlBandwidth ();
444 uint8_t enbUlBandwidth = enbLteDevice->GetUlBandwidth ();
445 uint8_t ueDlEarfcn = ueRrc->GetDlEarfcn ();
446 uint8_t enbDlEarfcn = enbLteDevice->GetDlEarfcn ();
447 uint8_t ueUlEarfcn = ueRrc->GetUlEarfcn ();
448 uint8_t enbUlEarfcn = enbLteDevice->GetUlEarfcn ();
449
450 NS_TEST_ASSERT_MSG_EQ (ueCellId, enbCellId, "inconsistent CellId");
451 NS_TEST_ASSERT_MSG_EQ (ueDlBandwidth, enbDlBandwidth, "inconsistent DlBandwidth");
452 NS_TEST_ASSERT_MSG_EQ (ueUlBandwidth, enbUlBandwidth, "inconsistent UlBandwidth");
453 NS_TEST_ASSERT_MSG_EQ (ueDlEarfcn, enbDlEarfcn, "inconsistent DlEarfcn");
454 NS_TEST_ASSERT_MSG_EQ (ueUlEarfcn, enbUlEarfcn, "inconsistent UlEarfcn");
455
456 if (hasContext)
457 {
458 Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
459 NS_ASSERT (ueManager);
460 UeManager::State state = ueManager->GetState ();
461 uint16_t enbImsi = ueManager->GetImsi ();
462 NS_TEST_ASSERT_MSG_EQ (ueImsi, enbImsi, "inconsistent Imsi");
463
464 if (state == UeManager::CONNECTED_NORMALLY)
465 {
466 ObjectMapValue enbDataRadioBearerMapValue;
467 ueManager->GetAttribute ("DataRadioBearerMap", enbDataRadioBearerMapValue);
468 NS_TEST_ASSERT_MSG_EQ (enbDataRadioBearerMapValue.GetN (), m_nBearers, "wrong num bearers at eNB");
469 ObjectMapValue ueDataRadioBearerMapValue;
470 ueRrc->GetAttribute ("DataRadioBearerMap", ueDataRadioBearerMapValue);
471 NS_TEST_ASSERT_MSG_EQ (ueDataRadioBearerMapValue.GetN (), m_nBearers, "wrong num bearers at UE");
472
473 ObjectMapValue::Iterator enbBearerIt = enbDataRadioBearerMapValue.Begin ();
474 ObjectMapValue::Iterator ueBearerIt = ueDataRadioBearerMapValue.Begin ();
475 while (enbBearerIt != enbDataRadioBearerMapValue.End ()
476 && ueBearerIt != ueDataRadioBearerMapValue.End ())
477 {
478 Ptr<LteDataRadioBearerInfo> enbDrbInfo = enbBearerIt->second->GetObject<LteDataRadioBearerInfo> ();
479 Ptr<LteDataRadioBearerInfo> ueDrbInfo = ueBearerIt->second->GetObject<LteDataRadioBearerInfo> ();
480 //NS_TEST_ASSERT_MSG_EQ (enbDrbInfo->m_epsBearer, ueDrbInfo->m_epsBearer, "epsBearer differs");
481 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_epsBearerIdentity, (uint32_t) ueDrbInfo->m_epsBearerIdentity, "epsBearerIdentity differs");
482 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_drbIdentity, (uint32_t) ueDrbInfo->m_drbIdentity, "drbIdentity differs");
483 //NS_TEST_ASSERT_MSG_EQ (enbDrbInfo->m_rlcConfig, ueDrbInfo->m_rlcConfig, "rlcConfig differs");
484 NS_TEST_ASSERT_MSG_EQ ((uint32_t) enbDrbInfo->m_logicalChannelIdentity, (uint32_t) ueDrbInfo->m_logicalChannelIdentity, "logicalChannelIdentity differs");
485 //NS_TEST_ASSERT_MSG_EQ (enbDrbInfo->m_logicalChannelConfig, ueDrbInfo->m_logicalChannelConfig, "logicalChannelConfig differs");
486
487 ++enbBearerIt;
488 ++ueBearerIt;
489 }
490
491 NS_ASSERT_MSG (enbBearerIt == enbDataRadioBearerMapValue.End (), "too many bearers at eNB");
492 NS_ASSERT_MSG (ueBearerIt == ueDataRadioBearerMapValue.End (), "too many bearers at UE");
493 }
494 }
495}
496
497void
499{
500 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
501 Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc ();
502 const uint64_t imsi = ueLteDevice->GetImsi ();
503 const uint16_t rnti = ueRrc->GetRnti ();
504 NS_LOG_FUNCTION (this << imsi << rnti);
506 "Invalid IMSI " << imsi);
507
508 bool ueStateIsConnectedNormally = (LteUeRrc::CONNECTED_NORMALLY == ueRrc->GetState ());
509
510 Ptr<LteEnbNetDevice> enbLteDevice = enbDevice->GetObject<LteEnbNetDevice> ();
511 Ptr<LteEnbRrc> enbRrc = enbLteDevice->GetRrc ();
512 const bool hasContext = enbRrc->HasUeManager (rnti);
513 bool contextStateIsConnectedNormally = false;
514 if (hasContext)
515 {
516 Ptr<UeManager> ueManager = enbRrc->GetUeManager (rnti);
517 NS_ASSERT (ueManager);
518 contextStateIsConnectedNormally = (UeManager::CONNECTED_NORMALLY == ueManager->GetState ());
519 }
521 || !ueStateIsConnectedNormally
522 || !hasContext
523 || !contextStateIsConnectedNormally),
524 true,
525 "it should not happen that connection is completed both at the UE and at the eNB side");
526}
527
528void
530 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
531{
532 NS_LOG_FUNCTION (this << imsi << cellId);
533 m_isConnectionEstablished[imsi] = true;
534}
535
536
537void
539 std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti,
540 uint8_t connEstFailCount)
541{
542 NS_LOG_FUNCTION (this << imsi << cellId);
543}
544
545
546
555{
556public:
565 std::string description = "");
566protected:
567 virtual void DoRun (void);
568
569private:
571 void JumpAway ();
573 void JumpBack ();
574
577};
578
579
581 Time jumpAwayTime, std::string description)
582 : LteRrcConnectionEstablishmentTestCase (1, 1, 0, 0, 1, true, false, true,
583 description),
584 m_jumpAwayTime (jumpAwayTime)
585{
586 NS_LOG_FUNCTION (this << GetName ());
587}
588
589
590void
592{
593 NS_LOG_FUNCTION (this << GetName ());
594 Config::Reset ();
595
596 if (m_nUes < 25)
597 {
598 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (40));
599 }
600 else if (m_nUes < 60)
601 {
602 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (80));
603 }
604 else if (m_nUes < 120)
605 {
606 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (160));
607 }
608 else
609 {
610 Config::SetDefault ("ns3::LteEnbRrc::SrsPeriodicity", UintegerValue (320));
611 }
612
613 // normal code
614 m_lteHelper = CreateObject<LteHelper> ();
616
617 NodeContainer enbNodes;
618 NodeContainer ueNodes;
619
620
621 enbNodes.Create (4);
622 ueNodes.Create (1);
623
625 mobility.Install (ueNodes); // UE position at (0, 0, 0)
626 m_ueMobility = ueNodes.Get (0)->GetObject<MobilityModel> ();
627
628 Ptr<ListPositionAllocator> enbPosition = CreateObject<ListPositionAllocator> ();
629 enbPosition->Add (Vector (0, 0, 0));
630 enbPosition->Add (Vector (100.0, 0, 0));
631 enbPosition->Add (Vector (0, 100.0, 0));
632 enbPosition->Add (Vector (100.0, 100.0, 0));
633 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
634 mobility.SetPositionAllocator (enbPosition);
635 mobility.Install (enbNodes);
636
637 int64_t stream = 1;
638 NetDeviceContainer enbDevs;
639 enbDevs = m_lteHelper->InstallEnbDevice (enbNodes);
640 stream += m_lteHelper->AssignStreams (enbDevs, stream);
641
642 NetDeviceContainer ueDevs;
643 ueDevs = m_lteHelper->InstallUeDevice (ueNodes);
644 stream += m_lteHelper->AssignStreams (ueDevs, stream);
645
646 // custom code used for testing purposes
647 // instead of lteHelper->Attach () and lteHelper->ActivateXxx
648
649 // Set AdmitConnectionRequest attribute
650 for (NetDeviceContainer::Iterator it = enbDevs.Begin ();
651 it != enbDevs.End ();
652 ++it)
653 {
654 Ptr<LteEnbRrc> enbRrc = (*it)->GetObject<LteEnbNetDevice> ()->GetRrc ();
655 enbRrc->SetAttribute ("AdmitRrcConnectionRequest",
657 }
658
659
660 uint32_t i = 0;
661 uint32_t tmax = 0;
662 for (NetDeviceContainer::Iterator it = ueDevs.Begin (); it != ueDevs.End (); ++it)
663 {
664 Ptr<NetDevice> ueDevice = *it;
665 Ptr<NetDevice> enbDevice = enbDevs.Get (0);
666 Ptr<LteUeNetDevice> ueLteDevice = ueDevice->GetObject<LteUeNetDevice> ();
667
668 uint32_t tc = m_tConnBase + m_tConnIncrPerUe * i; // time connection start
669 uint32_t tcc = tc + m_delayConnEnd; // time check connection completed;
670 uint32_t td = tcc + m_delayDiscStart; // time disconnect start
671 uint32_t tcd = td + m_delayDiscEnd; // time check disconnection completed
672 tmax = std::max (tmax, tcd);
673
674 // trick to resolve overloading
675 //void (LteHelper::* overloadedAttachFunctionPointer) (Ptr<NetDevice>, Ptr<NetDevice>) = &LteHelper::Attach;
676 //Simulator::Schedule (MilliSeconds (tc), overloadedAttachFunctionPointer, lteHelper, *it, enbDevice);
677 Simulator::Schedule (MilliSeconds (tc), &LteRrcConnectionEstablishmentErrorTestCase::Connect, this, ueDevice, enbDevice);
678
679 // disconnection not supported yet
680
681 uint64_t imsi = ueLteDevice->GetImsi ();
682 m_isConnectionEstablished[imsi] = false;
683
684 ++i;
685 }
686
687 // Connect to trace sources in UEs
688 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionEstablished",
690 this));
691 Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/ConnectionTimeout",
693 this));
694
695
696 Simulator::Schedule (m_jumpAwayTime,
698 this);
699 Simulator::Schedule (m_jumpAwayTime + MilliSeconds (99),
701 this, ueDevs.Get (0), enbDevs.Get (0));
702 Simulator::Schedule (m_jumpAwayTime + MilliSeconds (100),
704 this);
705
706 Simulator::Stop (MilliSeconds (tmax + 1));
707
709
710 Simulator::Destroy ();
711
712}
713
714
715void
717{
718 NS_LOG_FUNCTION (this);
719 // move to a really far away location so that transmission errors occur
720 m_ueMobility->SetPosition (Vector (100000.0, 100000.0, 0.0));
721}
722
723
724void
726{
727 NS_LOG_FUNCTION (this);
728 m_ueMobility->SetPosition (Vector (0.0, 0.0, 0.0));
729}
730
731
739{
740public:
742};
743
744
746 : TestSuite ("lte-rrc", SYSTEM)
747{
748// LogComponentEnableAll (LOG_PREFIX_ALL);
749// LogComponentEnable ("LteRrcTest", LOG_LEVEL_ALL);
750// LogComponentEnable ("LteEnbRrc", LOG_INFO);
751// LogComponentEnable ("LteUeRrc", LOG_INFO);
752
753 NS_LOG_FUNCTION (this);
754
755 for (uint32_t useIdealRrc = 0; useIdealRrc <= 1; ++useIdealRrc)
756 {
757 // <----- all times in ms ----------------->
758
759 // nUes tConnBase delayDiscStart useIdealRrc
760 // nBearers tConnIncrPerUe errorExpected admitRrcConnectionRequest
761 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 0, 0, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
762 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 0, 100, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
763 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 1, 0, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
764 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 1, 100, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
765 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 2, 0, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
766 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 2, 100, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
767 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 0, 20, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
768 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 0, 20, 10, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
769 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 0, 20, 100, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
770 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 1, 20, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
771 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 1, 20, 10, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
772 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 1, 20, 100, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
773 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 2, 20, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
774 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 2, 20, 10, 1, false, useIdealRrc, true), TestCase::QUICK);
775 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 2, 20, 100, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
776 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 3, 0, 20, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
777 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 4, 0, 20, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
778 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 4, 0, 20, 300, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
779 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 20, 0, 10, 1, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
780 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 50, 0, 0, 0, 1, false, useIdealRrc, true), TestCase::EXTENSIVE);
781
782 // Test cases to check admitRrcConnectionRequest=false
783 // nUes tConnBase delayDiscStart useIdealRrc
784 // nBearers tConnIncrPerUe errorExpected admitRrcConnectionRequest
785 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 0, 0, 0, 1, false, useIdealRrc, false), TestCase::EXTENSIVE);
786 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 1, 2, 100, 0, 1, false, useIdealRrc, false), TestCase::EXTENSIVE);
787 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 0, 20, 0, 1, false, useIdealRrc, false), TestCase::EXTENSIVE);
788 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 2, 1, 20, 0, 1, false, useIdealRrc, false), TestCase::QUICK);
789 AddTestCase (new LteRrcConnectionEstablishmentTestCase ( 3, 0, 20, 0, 1, false, useIdealRrc, false), TestCase::EXTENSIVE);
790 }
791
792 // Test cases with transmission error
794 Seconds (0.020214),
795 "failure at RRC Connection Request"),
796 TestCase::QUICK);
798 Seconds (0.025),
799 "failure at RRC Connection Setup"),
800 TestCase::QUICK);
801 /*
802 * With RLF implementation we now do support the Idle mode,
803 * thus it solve Bug 1762 Comment #25.
804 */
806 Seconds (0.030),
807 "failure at RRC Connection Setup Complete"),
808 TestCase::QUICK);
809
810}
811
#define max(a, b)
Definition: 80211b.c:43
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.
Lte Rrc Connection Establishment Error Test Case.
LteRrcConnectionEstablishmentErrorTestCase(Time jumpAwayTime, std::string description="")
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< MobilityModel > m_ueMobility
UE mobility model.
Test rrc connection establishment.
Definition: test-lte-rrc.cc:40
static std::string BuildNameString(uint32_t nUes, uint32_t nBearers, uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart, bool useIdealRrc, bool admitRrcConnectionRequest, std::string description="")
Build name string function.
std::map< uint64_t, bool > m_isConnectionEstablished
key: IMSI
void CheckNotConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check not connected function.
LteRrcConnectionEstablishmentTestCase(uint32_t nUes, uint32_t nBearers, uint32_t tConnBase, uint32_t tConnIncrPerUe, uint32_t delayDiscStart, bool errorExpected, bool useIdealRrc, bool admitRrcConnectionRequest, std::string description="")
virtual void DoRun(void)
Implementation to actually run this TestCase.
bool m_admitRrcConnectionRequest
If set to false, eNb will not allow UE connections.
void ConnectionEstablishedCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
Connection established callback function.
uint32_t m_nUes
number of UEs in the test
Definition: test-lte-rrc.cc:68
void CheckConnected(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Check connected function.
bool m_useIdealRrc
If set to false, real RRC protocol model will be used.
uint32_t m_delayConnEnd
expected duration to perform connection establishment in ms
uint32_t m_tConnBase
connection time base value for all UEs in ms
Ptr< LteHelper > m_lteHelper
LTE helper.
void ConnectionTimeoutCallback(std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t connEstFailCount)
Connection timeout callback function.
uint32_t m_delayDiscStart
delay between connection completed and disconnection request in ms
uint32_t m_tConnIncrPerUe
additional connection time increment for each UE index (0...nUes-1) in ms
void Connect(Ptr< NetDevice > ueDevice, Ptr< NetDevice > enbDevice)
Connect function.
uint32_t m_delayDiscEnd
expected duration to complete disconnection in ms
uint32_t m_nBearers
number of bearers to be setup in each connection
Lte Rrc Test Suite.
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:92
Qci
QoS Class Indicator.
Definition: eps-bearer.h:107
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
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices.
Definition: lte-helper.cc:474
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 ActivateDataRadioBearer(NetDeviceContainer ueDevices, EpsBearer bearer)
Activate a Data Radio Bearer on a given UE devices (for LTE-only simulation).
Definition: lte-helper.cc:1313
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
The LteUeNetDevice class implements the UE net device.
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
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the 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.
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.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
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 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
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
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#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 Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
Definition: config.cc:820
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_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
#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
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1245
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1253
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
static LteRrcTestSuite g_lteRrcTestSuiteInstance