A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-enb-rrc.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 * Copyright (c) 2018 Fraunhofer ESK : RLF extensions
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Authors:
8 * Nicola Baldo <nbaldo@cttc.es>
9 * Marco Miozzo <mmiozzo@cttc.es>
10 * Manuel Requena <manuel.requena@cttc.es>
11 * Modified by:
12 * Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015),
13 * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation)
14 * Vignesh Babu <ns3-dev@esk.fraunhofer.de> (RLF extensions)
15 */
16
17#include "lte-enb-rrc.h"
18
20#include "eps-bearer-tag.h"
21#include "lte-pdcp.h"
23#include "lte-rlc-am.h"
24#include "lte-rlc-tm.h"
25#include "lte-rlc-um.h"
26#include "lte-rlc.h"
27
28#include <ns3/abort.h>
29#include <ns3/fatal-error.h>
30#include <ns3/log.h>
31#include <ns3/object-factory.h>
32#include <ns3/object-map.h>
33#include <ns3/packet.h>
34#include <ns3/pointer.h>
35#include <ns3/simulator.h>
36
37namespace ns3
38{
39
40NS_LOG_COMPONENT_DEFINE("LteEnbRrc");
41
42///////////////////////////////////////////
43// CMAC SAP forwarder
44///////////////////////////////////////////
45
46/**
47 * \brief Class for forwarding CMAC SAP User functions.
48 */
50{
51 public:
52 /**
53 * Constructor
54 *
55 * \param rrc ENB RRC
56 * \param componentCarrierId
57 */
58 EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc* rrc, uint8_t componentCarrierId);
59
60 uint16_t AllocateTemporaryCellRnti() override;
61 void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override;
62 void RrcConfigurationUpdateInd(UeConfig params) override;
63 bool IsRandomAccessCompleted(uint16_t rnti) override;
64
65 private:
66 LteEnbRrc* m_rrc; ///< the RRC
67 uint8_t m_componentCarrierId; ///< Component carrier ID
68};
69
71 uint8_t componentCarrierId)
72 : m_rrc(rrc),
73 m_componentCarrierId{componentCarrierId}
74{
75}
76
77uint16_t
82
83void
84EnbRrcMemberLteEnbCmacSapUser::NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
85{
86 m_rrc->DoNotifyLcConfigResult(rnti, lcid, success);
87}
88
89void
94
95bool
100
101///////////////////////////////////////////
102// UeManager
103///////////////////////////////////////////
104
105/// Map each of UE Manager states to its string representation.
106static const std::string g_ueManagerStateName[UeManager::NUM_STATES] = {
107 "INITIAL_RANDOM_ACCESS",
108 "CONNECTION_SETUP",
109 "CONNECTION_REJECTED",
110 "ATTACH_REQUEST",
111 "CONNECTED_NORMALLY",
112 "CONNECTION_RECONFIGURATION",
113 "CONNECTION_REESTABLISHMENT",
114 "HANDOVER_PREPARATION",
115 "HANDOVER_JOINING",
116 "HANDOVER_PATH_SWITCH",
117 "HANDOVER_LEAVING",
118};
119
120/**
121 * \param s The UE manager state.
122 * \return The string representation of the given state.
123 */
124static const std::string&
129
131
133{
134 NS_FATAL_ERROR("this constructor is not expected to be used");
135}
136
137UeManager::UeManager(Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId)
138 : m_lastAllocatedDrbid(0),
139 m_rnti(rnti),
140 m_imsi(0),
141 m_componentCarrierId(componentCarrierId),
142 m_lastRrcTransactionIdentifier(0),
143 m_rrc(rrc),
144 m_state(s),
145 m_pendingRrcConnectionReconfiguration(false),
146 m_sourceX2apId(0),
147 m_sourceCellId(0),
148 m_needPhyMacConfiguration(false),
149 m_caSupportConfigured(false),
150 m_pendingStartDataRadioBearers(false)
151{
152 NS_LOG_FUNCTION(this);
153}
154
155void
157{
158 NS_LOG_FUNCTION(this);
160
162 m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
165 m_rrc->GetNewSrsConfigurationIndex();
171
172 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
173 {
174 m_rrc->m_cmacSapProvider.at(i)->AddUe(m_rnti);
175 m_rrc->m_cphySapProvider.at(i)->AddUe(m_rnti);
176 }
177
178 // setup the eNB side of SRB0
179 {
180 uint8_t lcid = 0;
181
182 Ptr<LteRlc> rlc = CreateObject<LteRlcTm>()->GetObject<LteRlc>();
183 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
184 rlc->SetRnti(m_rnti);
185 rlc->SetLcId(lcid);
186
188 m_srb0->m_rlc = rlc;
189 m_srb0->m_srbIdentity = 0;
190 // no need to store logicalChannelConfig as SRB0 is pre-configured
191
193 lcinfo.rnti = m_rnti;
194 lcinfo.lcId = lcid;
195 // Initialise the rest of lcinfo structure even if CCCH (LCID 0) is pre-configured, and only
196 // m_rnti and lcid will be used from passed lcinfo structure. See FF LTE MAC Scheduler
197 // Iinterface Specification v1.11, 4.3.4 logicalChannelConfigListElement
198 lcinfo.lcGroup = 0;
199 lcinfo.qci = 0;
200 lcinfo.resourceType = 0;
201 lcinfo.mbrUl = 0;
202 lcinfo.mbrDl = 0;
203 lcinfo.gbrUl = 0;
204 lcinfo.gbrDl = 0;
205
206 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
207 LteMacSapUser* lteMacSapUser =
208 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
209 // Signal Channel are only on Primary Carrier
210 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, lteMacSapUser);
211 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, lteMacSapUser);
212 }
213
214 // setup the eNB side of SRB1; the UE side will be set up upon RRC connection establishment
215 {
216 uint8_t lcid = 1;
217
218 Ptr<LteRlc> rlc = CreateObject<LteRlcAm>()->GetObject<LteRlc>();
219 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
220 rlc->SetRnti(m_rnti);
221 rlc->SetLcId(lcid);
222
224 pdcp->SetRnti(m_rnti);
225 pdcp->SetLcId(lcid);
226 pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
227 pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
228 rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
229
231 m_srb1->m_rlc = rlc;
232 m_srb1->m_pdcp = pdcp;
233 m_srb1->m_srbIdentity = 1;
234 m_srb1->m_logicalChannelConfig.priority = 1;
235 m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
236 m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
237 m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
238
240 lcinfo.rnti = m_rnti;
241 lcinfo.lcId = lcid;
242 lcinfo.lcGroup = 0; // all SRBs always mapped to LCG 0
243 lcinfo.qci =
244 EpsBearer::GBR_CONV_VOICE; // not sure why the FF API requires a CQI even for SRBs...
245 lcinfo.resourceType = 1; // GBR resource type
246 lcinfo.mbrUl = 1e6;
247 lcinfo.mbrDl = 1e6;
248 lcinfo.gbrUl = 1e4;
249 lcinfo.gbrDl = 1e4;
250 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
251 LteMacSapUser* MacSapUserForRlc =
252 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
253 // Signal Channel are only on Primary Carrier
254 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, MacSapUserForRlc);
255 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, MacSapUserForRlc);
256 }
257
259 ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider();
260 ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider();
261 m_rrc->m_rrcSapUser->SetupUe(m_rnti, ueParams);
262
263 // configure MAC (and scheduler)
265 req.m_rnti = m_rnti;
267
268 // configure PHY
269 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
270 {
271 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
272 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(
273 m_rnti,
275 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
276 m_rnti,
278 }
279 // schedule this UeManager instance to be deleted if the UE does not give any sign of life
280 // within a reasonable time
281 Time maxConnectionDelay;
282 switch (m_state)
283 {
285 m_connectionRequestTimeout = Simulator::Schedule(m_rrc->m_connectionRequestTimeoutDuration,
287 m_rrc,
288 m_rnti);
289 break;
290
291 case HANDOVER_JOINING:
292 m_handoverJoiningTimeout = Simulator::Schedule(m_rrc->m_handoverJoiningTimeoutDuration,
294 m_rrc,
295 m_rnti);
296 break;
297
298 default:
299 NS_FATAL_ERROR("unexpected state " << ToString(m_state));
300 break;
301 }
302 m_caSupportConfigured = false;
303}
304
308
309void
311{
312 delete m_drbPdcpSapUser;
313 // delete eventual X2-U TEIDs
314 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
315 {
316 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
317 }
318}
319
320TypeId
322{
323 static TypeId tid =
324 TypeId("ns3::UeManager")
325 .SetParent<Object>()
326 .AddConstructor<UeManager>()
327 .AddAttribute("DataRadioBearerMap",
328 "List of UE DataRadioBearerInfo by DRBID.",
332 .AddAttribute("Srb0",
333 "SignalingRadioBearerInfo for SRB0",
334 PointerValue(),
337 .AddAttribute("Srb1",
338 "SignalingRadioBearerInfo for SRB1",
339 PointerValue(),
342 .AddAttribute("C-RNTI",
343 "Cell Radio Network Temporary Identifier",
344 TypeId::ATTR_GET, // read-only attribute
345 UintegerValue(0), // unused, read-only attribute
348 .AddTraceSource("StateTransition",
349 "fired upon every UE state transition seen by the "
350 "UeManager at the eNB RRC",
352 "ns3::UeManager::StateTracedCallback")
353 .AddTraceSource("DrbCreated",
354 "trace fired after DRB is created",
356 "ns3::UeManager::ImsiCidRntiLcIdTracedCallback");
357 return tid;
358}
359
360void
361UeManager::SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
362{
363 m_sourceX2apId = sourceX2apId;
364 m_sourceCellId = sourceCellId;
365}
366
367void
368UeManager::SetImsi(uint64_t imsi)
369{
370 m_imsi = imsi;
371}
372
373void
375{
376 NS_LOG_FUNCTION(this << m_rnti);
377
378 if (m_state == ATTACH_REQUEST)
379 {
381 }
382 else
383 {
384 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
385 }
386}
387
388void
390 uint8_t bearerId,
391 uint32_t gtpTeid,
392 Ipv4Address transportLayerAddress)
393{
395
397 uint8_t drbid = AddDataRadioBearerInfo(drbInfo);
398 uint8_t lcid = Drbid2Lcid(drbid);
399 uint8_t bid = Drbid2Bid(drbid);
400 NS_ASSERT_MSG(bearerId == 0 || bid == bearerId,
401 "bearer ID mismatch (" << (uint32_t)bid << " != " << (uint32_t)bearerId
402 << ", the assumption that ID are allocated in the same "
403 "way by MME and RRC is not valid any more");
404 drbInfo->m_epsBearer = bearer;
405 drbInfo->m_epsBearerIdentity = bid;
406 drbInfo->m_drbIdentity = drbid;
407 drbInfo->m_logicalChannelIdentity = lcid;
408 drbInfo->m_gtpTeid = gtpTeid;
409 drbInfo->m_transportLayerAddress = transportLayerAddress;
410
412 {
413 // setup TEIDs for receiving data eventually forwarded over X2-U
414 LteEnbRrc::X2uTeidInfo x2uTeidInfo;
415 x2uTeidInfo.rnti = m_rnti;
416 x2uTeidInfo.drbid = drbid;
417 auto ret = m_rrc->m_x2uTeidInfoMap.insert(
418 std::pair<uint32_t, LteEnbRrc::X2uTeidInfo>(gtpTeid, x2uTeidInfo));
419 NS_ASSERT_MSG(ret.second == true, "overwriting a pre-existing entry in m_x2uTeidInfoMap");
420 }
421
422 TypeId rlcTypeId = m_rrc->GetRlcType(bearer);
423
424 ObjectFactory rlcObjectFactory;
425 rlcObjectFactory.SetTypeId(rlcTypeId);
426 Ptr<LteRlc> rlc = rlcObjectFactory.Create()->GetObject<LteRlc>();
427 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
428 rlc->SetRnti(m_rnti);
429 rlc->SetPacketDelayBudgetMs(bearer.GetPacketDelayBudgetMs());
430
431 drbInfo->m_rlc = rlc;
432
433 rlc->SetLcId(lcid);
434
435 // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
436 // if we are using RLC/SM we don't care of anything above RLC
437 if (rlcTypeId != LteRlcSm::GetTypeId())
438 {
440 pdcp->SetRnti(m_rnti);
441 pdcp->SetLcId(lcid);
442 pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
443 pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
444 rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
445 drbInfo->m_pdcp = pdcp;
446 }
447
448 m_drbCreatedTrace(m_imsi, m_rrc->ComponentCarrierToCellId(m_componentCarrierId), m_rnti, lcid);
449
450 std::vector<LteCcmRrcSapProvider::LcsConfig> lcOnCcMapping =
451 m_rrc->m_ccmRrcSapProvider->SetupDataRadioBearer(bearer,
452 bearerId,
453 m_rnti,
454 lcid,
455 m_rrc->GetLogicalChannelGroup(bearer),
456 rlc->GetLteMacSapUser());
457 // LteEnbCmacSapProvider::LcInfo lcinfo;
458 // lcinfo.rnti = m_rnti;
459 // lcinfo.lcId = lcid;
460 // lcinfo.lcGroup = m_rrc->GetLogicalChannelGroup (bearer);
461 // lcinfo.qci = bearer.qci;
462 // lcinfo.resourceType = bearer.GetResourceType();
463 // lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
464 // lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
465 // lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
466 // lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
467 // use a for cycle to send the AddLc to the appropriate Mac Sap
468 // if the sap is not initialized the appropriated method has to be called
469 auto itLcOnCcMapping = lcOnCcMapping.begin();
470 NS_ASSERT_MSG(itLcOnCcMapping != lcOnCcMapping.end(), "Problem");
471 for (itLcOnCcMapping = lcOnCcMapping.begin(); itLcOnCcMapping != lcOnCcMapping.end();
472 ++itLcOnCcMapping)
473 {
474 NS_LOG_DEBUG(this << " RNTI " << itLcOnCcMapping->lc.rnti << "Lcid "
475 << (uint16_t)itLcOnCcMapping->lc.lcId << " lcGroup "
476 << (uint16_t)itLcOnCcMapping->lc.lcGroup << " ComponentCarrierId "
477 << itLcOnCcMapping->componentCarrierId);
478 uint8_t index = itLcOnCcMapping->componentCarrierId;
479 LteEnbCmacSapProvider::LcInfo lcinfo = itLcOnCcMapping->lc;
480 LteMacSapUser* msu = itLcOnCcMapping->msu;
481 m_rrc->m_cmacSapProvider.at(index)->AddLc(lcinfo, msu);
482 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, msu);
483 }
484
485 if (rlcTypeId == LteRlcAm::GetTypeId())
486 {
487 drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::AM;
488 }
489 else
490 {
491 drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
492 }
493
494 drbInfo->m_logicalChannelIdentity = lcid;
495 drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority(bearer);
496 drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup(bearer);
497 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
498 {
499 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.gbrQosInfo.gbrUl;
500 }
501 else
502 {
503 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
504 }
505 drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
506
508}
509
510void
512{
514 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
515 {
516 m_drbsToBeStarted.push_back(it->first);
517 }
518}
519
520void
522{
524 for (auto drbIdIt = m_drbsToBeStarted.begin(); drbIdIt != m_drbsToBeStarted.end(); ++drbIdIt)
525 {
526 auto drbIt = m_drbMap.find(*drbIdIt);
527 NS_ASSERT(drbIt != m_drbMap.end());
528 drbIt->second->m_rlc->Initialize();
529 if (drbIt->second->m_pdcp)
530 {
531 drbIt->second->m_pdcp->Initialize();
532 }
533 }
534 m_drbsToBeStarted.clear();
535}
536
537void
539{
540 NS_LOG_FUNCTION(this << (uint32_t)m_rnti << (uint32_t)drbid);
541 uint8_t lcid = Drbid2Lcid(drbid);
542 auto it = m_drbMap.find(drbid);
543 NS_ASSERT_MSG(it != m_drbMap.end(),
544 "request to remove radio bearer with unknown drbid " << drbid);
545
546 // first delete eventual X2-U TEIDs
547 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
548
549 m_drbMap.erase(it);
550 std::vector<uint8_t> ccToRelease =
551 m_rrc->m_ccmRrcSapProvider->ReleaseDataRadioBearer(m_rnti, lcid);
552 auto itCcToRelease = ccToRelease.begin();
553 NS_ASSERT_MSG(itCcToRelease != ccToRelease.end(),
554 "request to remove radio bearer with unknown drbid (ComponentCarrierManager)");
555 for (itCcToRelease = ccToRelease.begin(); itCcToRelease != ccToRelease.end(); ++itCcToRelease)
556 {
557 m_rrc->m_cmacSapProvider.at(*itCcToRelease)->ReleaseLc(m_rnti, lcid);
558 }
560 rrcd.havePhysicalConfigDedicated = false;
561 rrcd.drbToReleaseList.push_back(drbid);
562 // populating RadioResourceConfigDedicated information element as per 3GPP TS 36.331
563 // version 9.2.0
564 rrcd.havePhysicalConfigDedicated = true;
566
567 // populating RRCConnectionReconfiguration message as per 3GPP TS 36.331 version 9.2.0 Release 9
569 msg.haveMeasConfig = false;
570 msg.haveMobilityControlInfo = false;
571 msg.radioResourceConfigDedicated = rrcd;
572 msg.haveRadioResourceConfigDedicated = true;
573 // ToDo: Resend in any case this configuration
574 // needs to be initialized
575 msg.haveNonCriticalExtension = false;
576 // RRC Connection Reconfiguration towards UE
577 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
578}
579
580void
581LteEnbRrc::DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
582{
583 NS_LOG_FUNCTION(this << imsi << rnti << (uint16_t)bearerId);
584
585 // check if the RNTI to be removed is not stale
586 if (HasUeManager(rnti))
587 {
588 Ptr<UeManager> ueManager = GetUeManager(rnti);
589 // Bearer de-activation towards UE
590 ueManager->ReleaseDataRadioBearer(bearerId);
591 // Bearer de-activation indication towards epc-enb application
592 m_s1SapProvider->DoSendReleaseIndication(imsi, rnti, bearerId);
593 }
594}
595
596void
598{
599 NS_LOG_FUNCTION(this << m_rnti);
600
601 // release the bearer info for the UE at SGW/PGW
602 if (m_rrc->m_s1SapProvider != nullptr) // if EPC is enabled
603 {
604 for (const auto& it : m_drbMap)
605 {
606 NS_LOG_DEBUG("Sending release of bearer id : "
607 << (uint16_t)(it.first)
608 << "LCID : " << (uint16_t)(it.second->m_logicalChannelIdentity));
609 // Bearer de-activation indication towards epc-enb application
610 m_rrc->m_s1SapProvider->DoSendReleaseIndication(GetImsi(), rnti, it.first);
611 }
612 }
613}
614
615void
617{
618 NS_LOG_FUNCTION(this);
619 switch (m_state)
620 {
622 case CONNECTION_SETUP:
623 case ATTACH_REQUEST:
627 case HANDOVER_JOINING:
628 case HANDOVER_LEAVING:
629 // a previous reconfiguration still ongoing, we need to wait for it to be finished
631 break;
632
633 case CONNECTED_NORMALLY: {
636 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
639 }
640 break;
641
642 default:
643 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
644 break;
645 }
646}
647
648void
650{
651 NS_LOG_FUNCTION(this << cellId);
652 switch (m_state)
653 {
654 case CONNECTED_NORMALLY: {
655 m_targetCellId = cellId;
656
657 auto sourceComponentCarrier = DynamicCast<ComponentCarrierEnb>(
658 m_rrc->m_componentCarrierPhyConf.at(m_componentCarrierId));
659 NS_ASSERT(m_targetCellId != sourceComponentCarrier->GetCellId());
660
661 if (m_rrc->HasCellId(cellId))
662 {
663 // Intra-eNB handover
664 NS_LOG_DEBUG("Intra-eNB handover for cellId " << cellId);
665 uint8_t componentCarrierId = m_rrc->CellToComponentCarrierId(cellId);
666 uint16_t rnti = m_rrc->AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
668 m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
669 if (!anrcrv.valid)
670 {
671 NS_LOG_INFO(this << " failed to allocate a preamble for non-contention based RA => "
672 "cannot perform HO");
673 NS_FATAL_ERROR("should trigger HO Preparation Failure, but it is not implemented");
674 return;
675 }
676
677 Ptr<UeManager> ueManager = m_rrc->GetUeManager(rnti);
678 ueManager->SetSource(sourceComponentCarrier->GetCellId(), m_rnti);
679 ueManager->SetImsi(m_imsi);
680
681 // Setup data radio bearers
682 for (auto& it : m_drbMap)
683 {
684 ueManager->SetupDataRadioBearer(it.second->m_epsBearer,
685 it.second->m_epsBearerIdentity,
686 it.second->m_gtpTeid,
687 it.second->m_transportLayerAddress);
688 }
689
692
693 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
694 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
696 anrcrv.raPreambleId;
698 anrcrv.raPrachMaskIndex;
699
701 m_rrc->m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
703 .preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
705 .raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
707 .raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
708
709 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
710
711 // We skip handover preparation
713 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
715 m_rrc,
716 m_rnti);
717 m_rrc->m_handoverStartTrace(m_imsi,
718 sourceComponentCarrier->GetCellId(),
719 m_rnti,
720 handoverCommand.mobilityControlInfo.targetPhysCellId);
721 }
722 else
723 {
724 // Inter-eNB aka X2 handover
725 NS_LOG_DEBUG("Inter-eNB handover (i.e., X2) for cellId " << cellId);
727 params.oldEnbUeX2apId = m_rnti;
729 params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
730 params.targetCellId = cellId;
731 params.mmeUeS1apId = m_imsi;
732 params.ueAggregateMaxBitRateDownlink = 200 * 1000;
733 params.ueAggregateMaxBitRateUplink = 100 * 1000;
734 params.bearers = GetErabList();
735
738 hpi.asConfig.sourceDlCarrierFreq = sourceComponentCarrier->GetDlEarfcn();
739 hpi.asConfig.sourceMeasConfig = m_rrc->m_ueMeasConfig;
743 sourceComponentCarrier->GetDlBandwidth();
747 .cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
749 m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
751 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
753 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
755 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->GetRachConfig();
757 .rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
763 .rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
765 sourceComponentCarrier->GetUlEarfcn();
767 sourceComponentCarrier->GetUlBandwidth();
768 params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation(hpi);
769
770 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
771 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
772 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
773 NS_LOG_LOGIC("mmeUeS1apId = " << params.mmeUeS1apId);
774 NS_LOG_LOGIC("rrcContext = " << params.rrcContext);
775
776 m_rrc->m_x2SapProvider->SendHandoverRequest(params);
778 }
779 }
780 break;
781
782 default:
783 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
784 break;
785 }
786}
787
788void
790{
791 NS_LOG_FUNCTION(this);
792
793 NS_ASSERT_MSG(params.notAdmittedBearers.empty(),
794 "not admission of some bearers upon handover is not supported");
795 NS_ASSERT_MSG(params.admittedBearers.size() == m_drbMap.size(),
796 "not enough bearers in admittedBearers");
797
798 // note: the Handover command from the target eNB to the source eNB
799 // is expected to be sent transparently to the UE; however, here we
800 // decode the message and eventually re-encode it. This way we can
801 // support both a real RRC protocol implementation and an ideal one
802 // without actual RRC protocol encoding.
803
804 Ptr<Packet> encodedHandoverCommand = params.rrcContext;
806 m_rrc->m_rrcSapUser->DecodeHandoverCommand(encodedHandoverCommand);
807 if (handoverCommand.haveNonCriticalExtension)
808 {
809 // Total number of component carriers =
810 // handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 (Primary carrier)
811 if (handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 !=
812 m_rrc->m_numberOfComponentCarriers)
813 {
814 // Currently handover is only possible if source and target eNBs have equal number of
815 // component carriers
816 NS_FATAL_ERROR("The source and target eNBs have unequal number of component carriers. "
817 "Target eNB CCs = "
818 << handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1
819 << " Source eNB CCs = " << m_rrc->m_numberOfComponentCarriers);
820 }
821 }
822 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
824 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
826 m_rrc,
827 m_rnti);
828 NS_ASSERT(handoverCommand.haveMobilityControlInfo);
829 m_rrc->m_handoverStartTrace(m_imsi,
830 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
831 m_rnti,
832 handoverCommand.mobilityControlInfo.targetPhysCellId);
833
834 // Set the target cell ID and the RNTI so that handover cancel message can be sent if required
835 m_targetX2apId = params.newEnbUeX2apId;
836 m_targetCellId = params.targetCellId;
837
839 sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
840 sst.newEnbUeX2apId = params.newEnbUeX2apId;
841 sst.sourceCellId = params.sourceCellId;
842 sst.targetCellId = params.targetCellId;
843 for (auto drbIt = m_drbMap.begin(); drbIt != m_drbMap.end(); ++drbIt)
844 {
845 // SN status transfer is only for AM RLC
846 if (drbIt->second->m_rlc->GetObject<LteRlcAm>())
847 {
848 LtePdcp::Status status = drbIt->second->m_pdcp->GetStatus();
850 i.dlPdcpSn = status.txSn;
851 i.ulPdcpSn = status.rxSn;
852 sst.erabsSubjectToStatusTransferList.push_back(i);
853 }
854 }
855 m_rrc->m_x2SapProvider->SendSnStatusTransfer(sst);
856}
857
864
867{
868 NS_LOG_FUNCTION(this);
869
871
872 auto targetComponentCarrier =
873 DynamicCast<ComponentCarrierEnb>(m_rrc->m_componentCarrierPhyConf.at(componentCarrierId));
874 result.haveMobilityControlInfo = true;
875 result.mobilityControlInfo.targetPhysCellId = targetComponentCarrier->GetCellId();
877 result.mobilityControlInfo.carrierFreq.dlCarrierFreq = targetComponentCarrier->GetDlEarfcn();
878 result.mobilityControlInfo.carrierFreq.ulCarrierFreq = targetComponentCarrier->GetUlEarfcn();
881 targetComponentCarrier->GetDlBandwidth();
883 targetComponentCarrier->GetUlBandwidth();
884
885 if (m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
886 {
887 // Release sCells
888 result.haveNonCriticalExtension = true;
889
890 for (auto& it : m_rrc->m_componentCarrierPhyConf)
891 {
892 uint8_t ccId = it.first;
893
894 if (ccId == m_componentCarrierId)
895 {
896 // Skip primary CC.
897 continue;
898 }
899 else if (ccId < m_componentCarrierId)
900 {
901 // Shift all IDs below PCC forward so PCC can use CC ID 1.
902 result.nonCriticalExtension.sCellToReleaseList.push_back(ccId + 1);
903 }
904 }
905 }
906 else
907 {
908 result.haveNonCriticalExtension = false;
909 }
910
911 return result;
912}
913
914void
916{
917 NS_LOG_FUNCTION(this << p << (uint16_t)bid);
919 params.pdcpSdu = p;
920 params.rnti = m_rnti;
921 params.lcid = Bid2Lcid(bid);
922 uint8_t drbid = Bid2Drbid(bid);
923 // Transmit PDCP sdu only if DRB ID found in drbMap
924 auto it = m_drbMap.find(drbid);
925 if (it != m_drbMap.end())
926 {
928 if (bearerInfo)
929 {
930 NS_LOG_INFO("Send packet to PDCP layer");
931 LtePdcpSapProvider* pdcpSapProvider = bearerInfo->m_pdcp->GetLtePdcpSapProvider();
932 pdcpSapProvider->TransmitPdcpSdu(params);
933 }
934 }
935}
936
937void
939{
940 NS_LOG_FUNCTION(this << p << (uint16_t)bid);
941 switch (m_state)
942 {
944 case CONNECTION_SETUP:
945 NS_LOG_WARN("not connected, discarding packet");
946 return;
947
953 NS_LOG_INFO("queueing data on PDCP for transmission over the air");
954 SendPacket(bid, p);
955 }
956 break;
957
958 case HANDOVER_JOINING: {
959 // Buffer data until RRC Connection Reconfiguration Complete message is received
960 NS_LOG_INFO("buffering data");
961 m_packetBuffer.emplace_back(bid, p);
962 }
963 break;
964
965 case HANDOVER_LEAVING: {
966 NS_LOG_INFO("forwarding data to target eNB over X2-U");
967 uint8_t drbid = Bid2Drbid(bid);
969 params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
970 params.targetCellId = m_targetCellId;
971 params.gtpTeid = GetDataRadioBearerInfo(drbid)->m_gtpTeid;
972 params.ueData = p;
973 m_rrc->m_x2SapProvider->SendUeData(params);
974 }
975 break;
976
977 default:
978 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
979 break;
980 }
981}
982
983std::vector<EpcX2Sap::ErabToBeSetupItem>
985{
986 NS_LOG_FUNCTION(this);
987 std::vector<EpcX2Sap::ErabToBeSetupItem> ret;
988 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
989 {
991 etbsi.erabId = it->second->m_epsBearerIdentity;
992 etbsi.erabLevelQosParameters = it->second->m_epsBearer;
993 etbsi.dlForwarding = false;
994 etbsi.transportLayerAddress = it->second->m_transportLayerAddress;
995 etbsi.gtpTeid = it->second->m_gtpTeid;
996 ret.push_back(etbsi);
997 }
998 return ret;
999}
1000
1001void
1003{
1004 NS_LOG_FUNCTION(this);
1005 switch (m_state)
1006 {
1008 NS_LOG_INFO("Send UE CONTEXT RELEASE from target eNB to source eNB");
1010 ueCtxReleaseParams.oldEnbUeX2apId = m_sourceX2apId;
1011 ueCtxReleaseParams.newEnbUeX2apId = m_rnti;
1012 ueCtxReleaseParams.sourceCellId = m_sourceCellId;
1013 ueCtxReleaseParams.targetCellId = m_targetCellId;
1014 if (!m_rrc->HasCellId(m_sourceCellId))
1015 {
1016 m_rrc->m_x2SapProvider->SendUeContextRelease(ueCtxReleaseParams);
1017 }
1018 else
1019 {
1020 NS_LOG_INFO("Not sending UE CONTEXT RELEASE because handover is internal");
1021 m_rrc->DoRecvUeContextRelease(ueCtxReleaseParams);
1022 }
1024 m_rrc->m_handoverEndOkTrace(m_imsi,
1025 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1026 m_rnti);
1027 break;
1028
1029 default:
1030 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1031 break;
1032 }
1033}
1034
1035void
1037{
1038 NS_LOG_FUNCTION(this << cellId);
1039 switch (m_state)
1040 {
1042 NS_ASSERT(cellId == m_targetCellId);
1043 NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1045 break;
1046 case HANDOVER_LEAVING: // case added to tackle HO leaving timer expiration
1047 NS_ASSERT(cellId == m_targetCellId);
1048 NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1051 break;
1052
1053 default:
1054 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1055 break;
1056 }
1057}
1058
1059void
1061{
1062 NS_LOG_FUNCTION(this);
1063 for (auto erabIt = params.erabsSubjectToStatusTransferList.begin();
1064 erabIt != params.erabsSubjectToStatusTransferList.end();
1065 ++erabIt)
1066 {
1067 // LtePdcp::Status status;
1068 // status.txSn = erabIt->dlPdcpSn;
1069 // status.rxSn = erabIt->ulPdcpSn;
1070 // uint8_t drbId = Bid2Drbid (erabIt->erabId);
1071 // auto drbIt = m_drbMap.find (drbId);
1072 // NS_ASSERT_MSG (drbIt != m_drbMap.end (), "could not find DRBID " << (uint32_t) drbId);
1073 // drbIt->second->m_pdcp->SetStatus (status);
1074 }
1075}
1076
1077void
1084
1085void
1092
1093void
1095{
1096 // TODO implement in the 3gpp way, see Section 5.3.8 of 3GPP TS 36.331.
1098 // De-activation towards UE, it will deactivate all bearers
1101 m_rrc->m_rrcSapUser->SendRrcConnectionRelease(m_rnti, msg);
1102
1103 /**
1104 * Bearer de-activation indication towards epc-enb application
1105 * and removal of UE context at the eNodeB
1106 *
1107 */
1108 m_rrc->DoRecvIdealUeContextRemoveRequest(m_rnti);
1109}
1110
1111// methods forwarded from RRC SAP
1112
1113void
1115{
1116 NS_LOG_FUNCTION(this);
1117 m_srb0->m_rlc->SetLteRlcSapUser(params.srb0SapUser);
1118 m_srb1->m_pdcp->SetLtePdcpSapUser(params.srb1SapUser);
1119}
1120
1121void
1123{
1124 NS_LOG_FUNCTION(this);
1125 switch (m_state)
1126 {
1127 case INITIAL_RANDOM_ACCESS: {
1129
1130 if (m_rrc->m_admitRrcConnectionRequest)
1131 {
1132 m_imsi = msg.ueIdentity;
1133
1134 // send RRC CONNECTION SETUP to UE
1138 m_rrc->m_rrcSapUser->SendRrcConnectionSetup(m_rnti, msg2);
1139
1141 m_connectionSetupTimeout = Simulator::Schedule(m_rrc->m_connectionSetupTimeoutDuration,
1143 m_rrc,
1144 m_rnti);
1146 }
1147 else
1148 {
1149 NS_LOG_INFO("rejecting connection request for RNTI " << m_rnti);
1150
1151 // send RRC CONNECTION REJECT to UE
1153 rejectMsg.waitTime = 3;
1154 m_rrc->m_rrcSapUser->SendRrcConnectionReject(m_rnti, rejectMsg);
1155
1157 Simulator::Schedule(m_rrc->m_connectionRejectedTimeoutDuration,
1159 m_rrc,
1160 m_rnti);
1162 }
1163 }
1164 break;
1165
1166 default:
1167 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1168 break;
1169 }
1170}
1171
1172void
1174{
1175 NS_LOG_FUNCTION(this);
1176 switch (m_state)
1177 {
1178 case CONNECTION_SETUP:
1180 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1181 {
1182 m_pendingRrcConnectionReconfiguration = true; // Force Reconfiguration
1184 }
1185
1186 if (m_rrc->m_s1SapProvider != nullptr)
1187 {
1188 m_rrc->m_s1SapProvider->InitialUeMessage(m_imsi, m_rnti);
1190 }
1191 else
1192 {
1194 }
1195 m_rrc->m_connectionEstablishedTrace(m_imsi,
1196 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1197 m_rnti);
1198 break;
1199
1200 default:
1201 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1202 break;
1203 }
1204}
1205
1206void
1209{
1210 NS_LOG_FUNCTION(this);
1211 switch (m_state)
1212 {
1216 {
1217 // configure MAC (and scheduler)
1219 req.m_rnti = m_rnti;
1221 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1222 {
1223 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
1224
1225 // configure PHY
1226 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(req.m_rnti,
1227 req.m_transmissionMode);
1230 m_rrc->m_cphySapProvider.at(i)->SetPa(m_rnti, paDouble);
1231 }
1232
1234 }
1236 m_rrc->m_connectionReconfigurationTrace(
1237 m_imsi,
1238 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1239 m_rnti);
1240 break;
1241
1242 // This case is added to NS-3 in order to handle bearer de-activation scenario for CONNECTED
1243 // state UE
1244 case CONNECTED_NORMALLY:
1245 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1246 << ToString(m_state));
1247 break;
1248
1249 case HANDOVER_LEAVING:
1250 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1251 << ToString(m_state));
1252 break;
1253
1254 case HANDOVER_JOINING: {
1256
1257 while (!m_packetBuffer.empty())
1258 {
1259 NS_LOG_LOGIC("dequeueing data from buffer");
1260 std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1261 uint8_t bid = bidPacket.first;
1262 Ptr<Packet> p = bidPacket.second;
1263
1264 NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
1265 SendPacket(bid, p);
1266
1267 m_packetBuffer.pop_front();
1268 }
1269
1270 NS_LOG_INFO("Send PATH SWITCH REQUEST to the MME");
1272 params.rnti = m_rnti;
1273 params.cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1274 params.mmeUeS1Id = m_imsi;
1276 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1277 {
1279 b.epsBearerId = it->second->m_epsBearerIdentity;
1280 b.teid = it->second->m_gtpTeid;
1281 params.bearersToBeSwitched.push_back(b);
1282 }
1283 m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1284 }
1285 break;
1286
1287 default:
1288 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1289 break;
1290 }
1291}
1292
1293void
1296{
1297 NS_LOG_FUNCTION(this);
1298 switch (m_state)
1299 {
1300 case CONNECTED_NORMALLY:
1301 break;
1302
1303 case HANDOVER_LEAVING:
1305 break;
1306
1307 default:
1308 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1309 break;
1310 }
1311
1315 m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1317}
1318
1319void
1326
1327void
1329{
1330 uint8_t measId = msg.measResults.measId;
1331 NS_LOG_FUNCTION(this << (uint16_t)measId);
1333 "measId " << (uint16_t)measId << " haveMeasResultNeighCells "
1334 << msg.measResults.haveMeasResultNeighCells << " measResultListEutra "
1335 << msg.measResults.measResultListEutra.size() << " haveMeasResultServFreqList "
1336 << msg.measResults.haveMeasResultServFreqList << " measResultServFreqList "
1337 << msg.measResults.measResultServFreqList.size());
1338 NS_LOG_LOGIC("serving cellId "
1339 << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) << " RSRP "
1340 << (uint16_t)msg.measResults.measResultPCell.rsrpResult << " RSRQ "
1341 << (uint16_t)msg.measResults.measResultPCell.rsrqResult);
1342
1343 for (auto it = msg.measResults.measResultListEutra.begin();
1344 it != msg.measResults.measResultListEutra.end();
1345 ++it)
1346 {
1347 NS_LOG_LOGIC("neighbour cellId " << it->physCellId << " RSRP "
1348 << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1349 << " RSRQ "
1350 << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1351 }
1352
1353 if ((m_rrc->m_handoverManagementSapProvider != nullptr) &&
1354 (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1355 {
1356 // this measurement was requested by the handover algorithm
1357 m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1358 }
1359
1360 if ((m_rrc->m_ccmRrcSapProvider != nullptr) &&
1361 (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1362 {
1363 // this measurement was requested by the handover algorithm
1364 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1365 }
1366
1367 if ((m_rrc->m_anrSapProvider != nullptr) &&
1368 (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1369 {
1370 // this measurement was requested by the ANR function
1371 m_rrc->m_anrSapProvider->ReportUeMeas(msg.measResults);
1372 }
1373
1374 if ((!m_rrc->m_ffrRrcSapProvider.empty()) &&
1375 (m_rrc->m_ffrMeasIds.find(measId) != m_rrc->m_ffrMeasIds.end()))
1376 {
1377 // this measurement was requested by the FFR function
1378 m_rrc->m_ffrRrcSapProvider.at(0)->ReportUeMeas(m_rnti, msg.measResults);
1379 }
1381 {
1382 for (const auto& it : msg.measResults.measResultServFreqList)
1383 {
1384 /// ToDo: implement on Ffr algorithm the code to properly parsing the new measResults
1385 /// message format alternatively it is needed to 'repack' properly the measResults
1386 /// message before sending to Ffr
1387 m_rrc->m_ffrRrcSapProvider.at(it.servFreqId)->ReportUeMeas(m_rnti, msg.measResults);
1388 }
1389 }
1390
1391 /// Report any measurements to ComponentCarrierManager, so it can react to any change or
1392 /// activate the SCC
1393 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1394 // fire a trace source
1395 m_rrc->m_recvMeasurementReportTrace(m_imsi,
1396 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1397 m_rnti,
1398 msg);
1399
1400} // end of UeManager::RecvMeasurementReport
1401
1402// methods forwarded from CMAC SAP
1403
1404void
1406{
1407 NS_LOG_FUNCTION(this << m_rnti);
1408 // at this stage used only by the scheduler for updating txMode
1409
1411
1413
1414 // reconfigure the UE RRC
1416}
1417
1418// methods forwarded from PDCP SAP
1419
1420void
1422{
1423 NS_LOG_FUNCTION(this);
1424 if (params.lcid > 2)
1425 {
1426 // data radio bearer
1427 EpsBearerTag tag;
1428 tag.SetRnti(params.rnti);
1429 tag.SetBid(Lcid2Bid(params.lcid));
1430 params.pdcpSdu->AddPacketTag(tag);
1431 m_rrc->m_forwardUpCallback(params.pdcpSdu);
1432 }
1433}
1434
1435uint16_t
1437{
1438 return m_rnti;
1439}
1440
1441uint64_t
1443{
1444 return m_imsi;
1445}
1446
1447uint8_t
1452
1453uint16_t
1458
1459void
1461{
1462 NS_LOG_FUNCTION(this);
1464 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1465 {
1466 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1467 }
1468 switch (m_state)
1469 {
1471 // do nothing, srs conf index will be correctly enforced upon
1472 // RRC connection establishment
1473 break;
1474
1475 default:
1477 break;
1478 }
1479}
1480
1483{
1484 return m_state;
1485}
1486
1487void
1489{
1490 NS_LOG_FUNCTION(this);
1491 m_physicalConfigDedicated.pdschConfigDedicated = pdschConfigDedicated;
1492
1494
1495 // reconfigure the UE RRC
1497}
1498
1499void
1509
1512{
1513 NS_LOG_FUNCTION(this);
1515 res.oldEnbUeX2apId = m_sourceX2apId;
1516 res.sourceCellId = m_sourceCellId;
1517 res.targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1518 res.cause = 0;
1519 res.criticalityDiagnostics = 0;
1520
1521 return res;
1522}
1523
1526{
1527 NS_LOG_FUNCTION(this);
1529 res.oldEnbUeX2apId = m_rnti; // source cell rnti
1530 res.newEnbUeX2apId = m_targetX2apId;
1531 res.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1532 res.targetCellId = m_targetCellId;
1533 res.cause = 0;
1534
1535 return res;
1536}
1537
1538uint8_t
1540{
1541 NS_LOG_FUNCTION(this);
1542 const uint8_t MAX_DRB_ID = 32;
1543 for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1544 drbid = (drbid + 1) % MAX_DRB_ID)
1545 {
1546 if (drbid != 0) // 0 is not allowed
1547 {
1548 if (m_drbMap.find(drbid) == m_drbMap.end())
1549 {
1550 m_drbMap.insert(std::pair<uint8_t, Ptr<LteDataRadioBearerInfo>>(drbid, drbInfo));
1551 drbInfo->m_drbIdentity = drbid;
1552 m_lastAllocatedDrbid = drbid;
1553 return drbid;
1554 }
1555 }
1556 }
1557 NS_FATAL_ERROR("no more data radio bearer ids available");
1558 return 0;
1559}
1560
1563{
1564 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1565 NS_ASSERT(0 != drbid);
1566 auto it = m_drbMap.find(drbid);
1567 NS_ABORT_IF(it == m_drbMap.end());
1568 return it->second;
1569}
1570
1571void
1573{
1574 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1575 auto it = m_drbMap.find(drbid);
1576 NS_ASSERT_MSG(it != m_drbMap.end(),
1577 "request to remove radio bearer with unknown drbid " << drbid);
1578 m_drbMap.erase(it);
1579}
1580
1583{
1584 NS_LOG_FUNCTION(this);
1587 msg.haveRadioResourceConfigDedicated = true;
1588 msg.radioResourceConfigDedicated = BuildRadioResourceConfigDedicated();
1589 msg.haveMobilityControlInfo = false;
1590 msg.haveMeasConfig = true;
1591 msg.measConfig = m_rrc->m_ueMeasConfig;
1592 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1593 {
1594 m_caSupportConfigured = true;
1595 NS_LOG_FUNCTION(this << "CA not configured. Configure now!");
1596 msg.haveNonCriticalExtension = true;
1597 msg.nonCriticalExtension = BuildNonCriticalExtensionConfigurationCa();
1598 NS_LOG_FUNCTION(this << " haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1599 }
1600 else
1601 {
1602 msg.haveNonCriticalExtension = false;
1603 }
1604
1605 return msg;
1606}
1607
1610{
1611 NS_LOG_FUNCTION(this);
1613
1614 if (m_srb1)
1615 {
1617 stam.srbIdentity = m_srb1->m_srbIdentity;
1618 stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1619 rrcd.srbToAddModList.push_back(stam);
1620 }
1621
1622 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1623 {
1625 dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1626 dtam.drbIdentity = it->second->m_drbIdentity;
1627 dtam.rlcConfig = it->second->m_rlcConfig;
1628 dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1629 dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1630 rrcd.drbToAddModList.push_back(dtam);
1631 }
1632
1633 rrcd.havePhysicalConfigDedicated = true;
1635 return rrcd;
1636}
1637
1638uint8_t
1646
1647uint8_t
1649{
1650 NS_ASSERT(lcid > 2);
1651 return lcid - 2;
1652}
1653
1654uint8_t
1656{
1657 return drbid + 2;
1658}
1659
1660uint8_t
1662{
1663 NS_ASSERT(lcid > 2);
1664 return lcid - 2;
1665}
1666
1667uint8_t
1669{
1670 return bid + 2;
1671}
1672
1673uint8_t
1675{
1676 return drbid;
1677}
1678
1679uint8_t
1681{
1682 return bid;
1683}
1684
1685void
1687{
1688 NS_LOG_FUNCTION(this << ToString(newState));
1689 State oldState = m_state;
1690 m_state = newState;
1691 NS_LOG_INFO(this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager "
1692 << ToString(oldState) << " --> " << ToString(newState));
1694 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1695 m_rnti,
1696 oldState,
1697 newState);
1698
1699 switch (newState)
1700 {
1702 case HANDOVER_JOINING:
1703 NS_FATAL_ERROR("cannot switch to an initial state");
1704 break;
1705
1706 case CONNECTION_SETUP:
1707 case ATTACH_REQUEST:
1708 break;
1709
1710 case CONNECTED_NORMALLY: {
1712 {
1714 }
1716 {
1718 }
1719 }
1720 break;
1721
1724 case HANDOVER_LEAVING:
1725 default:
1726 break;
1727 }
1728}
1729
1732{
1733 NS_LOG_FUNCTION(this);
1735
1736 for (auto& it : m_rrc->m_componentCarrierPhyConf)
1737 {
1738 uint8_t ccId = it.first;
1739
1740 if (ccId == m_componentCarrierId)
1741 {
1742 // Skip primary CC.
1743 continue;
1744 }
1745 else if (ccId < m_componentCarrierId)
1746 {
1747 // Shift all IDs below PCC forward so PCC can use CC ID 1.
1748 ccId++;
1749 }
1750
1751 Ptr<ComponentCarrierBaseStation> eNbCcm = it.second;
1752 LteRrcSap::SCellToAddMod component;
1753 component.sCellIndex = ccId;
1754 component.cellIdentification.physCellId = eNbCcm->GetCellId();
1755 component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1758 eNbCcm->GetDlBandwidth();
1760 .antennaPortsCount = 0;
1762 .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1766 eNbCcm->GetUlEarfcn();
1768 eNbCcm->GetUlBandwidth();
1770 0;
1771 // component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type =
1772 // LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
1774 .srsBandwidthConfig = 0;
1776 .srsSubframeConfig = 0;
1778
1781 .haveNonUlConfiguration = true;
1785 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1793 .haveUlConfiguration = true;
1797 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1810
1811 ncec.sCellToAddModList.push_back(component);
1812 }
1813
1814 return ncec;
1815}
1816
1817///////////////////////////////////////////
1818// eNB RRC methods
1819///////////////////////////////////////////
1820
1822
1824 : m_x2SapProvider(nullptr),
1825 m_cmacSapProvider(0),
1826 m_handoverManagementSapProvider(nullptr),
1827 m_ccmRrcSapProvider(nullptr),
1828 m_anrSapProvider(nullptr),
1829 m_ffrRrcSapProvider(0),
1830 m_rrcSapUser(nullptr),
1831 m_macSapProvider(nullptr),
1832 m_s1SapProvider(nullptr),
1833 m_cphySapProvider(0),
1834 m_configured(false),
1835 m_lastAllocatedRnti(0),
1836 m_srsCurrentPeriodicityId(0),
1837 m_lastAllocatedConfigurationIndex(0),
1838 m_reconfigureUes(false),
1839 m_numberOfComponentCarriers(0),
1840 m_carriersConfigured(false)
1841{
1842 NS_LOG_FUNCTION(this);
1843 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, 0));
1852}
1853
1854void
1856{
1857 NS_ASSERT_MSG(!m_carriersConfigured, "Secondary carriers can be configured only once.");
1858 m_componentCarrierPhyConf = ccPhyConf;
1860 " Number of component carriers "
1861 "are not equal to the number of he component carrier configuration provided");
1862
1863 for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1864 {
1866 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, i));
1868 }
1869 m_carriersConfigured = true;
1871}
1872
1874{
1875 NS_LOG_FUNCTION(this);
1876}
1877
1878void
1880{
1881 NS_LOG_FUNCTION(this);
1882 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1883 {
1884 delete m_cphySapUser[i];
1885 delete m_cmacSapUser[i];
1886 delete m_ffrRrcSapUser[i];
1887 }
1888 // delete m_cphySapUser;
1889 m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1890 m_cphySapUser.clear();
1891 // delete m_cmacSapUser;
1892 m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1893 m_cmacSapUser.clear();
1894 // delete m_ffrRrcSapUser;
1895 m_ffrRrcSapUser.erase(m_ffrRrcSapUser.begin(), m_ffrRrcSapUser.end());
1896 m_ffrRrcSapUser.clear();
1897 m_ueMap.clear();
1899 delete m_ccmRrcSapUser;
1900 delete m_anrSapUser;
1901 delete m_rrcSapProvider;
1902 delete m_x2SapUser;
1903 delete m_s1SapUser;
1904}
1905
1906TypeId
1908{
1909 static TypeId tid =
1910 TypeId("ns3::LteEnbRrc")
1911 .SetParent<Object>()
1912 .SetGroupName("Lte")
1913 .AddConstructor<LteEnbRrc>()
1914 .AddAttribute("UeMap",
1915 "List of UeManager by C-RNTI.",
1919 .AddAttribute("DefaultTransmissionMode",
1920 "The default UEs' transmission mode (0: SISO)",
1921 UintegerValue(0), // default tx-mode
1924 .AddAttribute(
1925 "EpsBearerToRlcMapping",
1926 "Specify which type of RLC will be used for each type of EPS bearer.",
1930 "RlcSmAlways",
1932 "RlcUmAlways",
1934 "RlcAmAlways",
1935 PER_BASED,
1936 "PacketErrorRateBased"))
1937 .AddAttribute("SystemInformationPeriodicity",
1938 "The interval for sending system information (Time value)",
1942
1943 // SRS related attributes
1944 .AddAttribute(
1945 "SrsPeriodicity",
1946 "The SRS periodicity in milliseconds",
1947 UintegerValue(40),
1950
1951 // Timeout related attributes
1952 .AddAttribute("ConnectionRequestTimeoutDuration",
1953 "After a RA attempt, if no RRC CONNECTION REQUEST is "
1954 "received before this time, the UE context is destroyed. "
1955 "Must account for reception of RAR and transmission of "
1956 "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1957 "timer should not be greater than T300 timer at UE RRC",
1961 .AddAttribute("ConnectionSetupTimeoutDuration",
1962 "After accepting connection request, if no RRC CONNECTION "
1963 "SETUP COMPLETE is received before this time, the UE "
1964 "context is destroyed. Must account for the UE's reception "
1965 "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1966 "SETUP COMPLETE.",
1967 TimeValue(MilliSeconds(150)),
1970 .AddAttribute("ConnectionRejectedTimeoutDuration",
1971 "Time to wait between sending a RRC CONNECTION REJECT and "
1972 "destroying the UE context",
1976 .AddAttribute("HandoverJoiningTimeoutDuration",
1977 "After accepting a handover request, if no RRC CONNECTION "
1978 "RECONFIGURATION COMPLETE is received before this time, the "
1979 "UE context is destroyed. Must account for reception of "
1980 "X2 HO REQ ACK by source eNB, transmission of the Handover "
1981 "Command, non-contention-based random access and reception "
1982 "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
1983 TimeValue(MilliSeconds(200)),
1986 .AddAttribute("HandoverLeavingTimeoutDuration",
1987 "After issuing a Handover Command, if neither RRC "
1988 "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
1989 "been previously received, the UE context is destroyed.",
1990 TimeValue(MilliSeconds(500)),
1993
1994 // Cell selection related attribute
1995 .AddAttribute("QRxLevMin",
1996 "One of information transmitted within the SIB1 message, "
1997 "indicating the required minimum RSRP level that any UE must "
1998 "receive from this cell before it is allowed to camp to this "
1999 "cell. The default value -70 corresponds to -140 dBm and is "
2000 "the lowest possible value as defined by Section 6.3.4 of "
2001 "3GPP TS 36.133. This restriction, however, only applies to "
2002 "initial cell selection and EPC-enabled simulation.",
2004 IntegerValue(-70),
2007 .AddAttribute("NumberOfComponentCarriers",
2008 "Number of Component Carriers",
2009 UintegerValue(1),
2012
2013 // Handover related attributes
2014 .AddAttribute("AdmitHandoverRequest",
2015 "Whether to admit an X2 handover request from another eNB",
2016 BooleanValue(true),
2019 .AddAttribute("AdmitRrcConnectionRequest",
2020 "Whether to admit a connection request from a UE",
2021 BooleanValue(true),
2024
2025 // UE measurements related attributes
2026 .AddAttribute("RsrpFilterCoefficient",
2027 "Determines the strength of smoothing effect induced by "
2028 "layer 3 filtering of RSRP in all attached UE; "
2029 "if set to 0, no layer 3 filtering is applicable",
2030 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2031 UintegerValue(4),
2034 .AddAttribute("RsrqFilterCoefficient",
2035 "Determines the strength of smoothing effect induced by "
2036 "layer 3 filtering of RSRQ in all attached UE; "
2037 "if set to 0, no layer 3 filtering is applicable",
2038 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2039 UintegerValue(4),
2042
2043 // Trace sources
2044 .AddTraceSource("NewUeContext",
2045 "Fired upon creation of a new UE context.",
2047 "ns3::LteEnbRrc::NewUeContextTracedCallback")
2048 .AddTraceSource("ConnectionEstablished",
2049 "Fired upon successful RRC connection establishment.",
2051 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2052 .AddTraceSource("ConnectionReconfiguration",
2053 "trace fired upon RRC connection reconfiguration",
2055 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2056 .AddTraceSource("HandoverStart",
2057 "trace fired upon start of a handover procedure",
2059 "ns3::LteEnbRrc::HandoverStartTracedCallback")
2060 .AddTraceSource("HandoverEndOk",
2061 "trace fired upon successful termination of a handover procedure",
2063 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2064 .AddTraceSource("RecvMeasurementReport",
2065 "trace fired when measurement report is received",
2067 "ns3::LteEnbRrc::ReceiveReportTracedCallback")
2068 .AddTraceSource("NotifyConnectionRelease",
2069 "trace fired when an UE is released",
2071 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2072 .AddTraceSource("RrcTimeout",
2073 "trace fired when a timer expires",
2075 "ns3::LteEnbRrc::TimerExpiryTracedCallback")
2076 .AddTraceSource(
2077 "HandoverFailureNoPreamble",
2078 "trace fired upon handover failure due to non-allocation of non-contention based "
2079 "preamble at eNB for UE to handover due to max count reached",
2081 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2082 .AddTraceSource(
2083 "HandoverFailureMaxRach",
2084 "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2086 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2087 .AddTraceSource(
2088 "HandoverFailureLeaving",
2089 "trace fired upon handover failure due to handover leaving timeout at source eNB",
2091 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2092 .AddTraceSource(
2093 "HandoverFailureJoining",
2094 "trace fired upon handover failure due to handover joining timeout at target eNB",
2096 "ns3::LteEnbRrc::HandoverFailureTracedCallback");
2097 return tid;
2098}
2099
2100void
2106
2109{
2110 NS_LOG_FUNCTION(this);
2111 return m_x2SapUser;
2112}
2113
2114void
2120
2121void
2123{
2124 NS_LOG_FUNCTION(this << s);
2125 if (m_cmacSapProvider.size() > pos)
2126 {
2127 m_cmacSapProvider.at(pos) = s;
2128 }
2129 else
2130 {
2131 m_cmacSapProvider.push_back(s);
2132 NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2133 }
2134}
2135
2138{
2139 NS_LOG_FUNCTION(this);
2140 return m_cmacSapUser.at(0);
2141}
2142
2145{
2146 NS_LOG_FUNCTION(this);
2147 return m_cmacSapUser.at(pos);
2148}
2149
2150void
2156
2163
2164void
2170
2177
2178void
2184
2187{
2188 NS_LOG_FUNCTION(this);
2189 return m_anrSapUser;
2190}
2191
2192void
2194{
2195 NS_LOG_FUNCTION(this << s);
2196 if (!m_ffrRrcSapProvider.empty())
2197 {
2198 m_ffrRrcSapProvider.at(0) = s;
2199 }
2200 else
2201 {
2202 m_ffrRrcSapProvider.push_back(s);
2203 }
2204}
2205
2206void
2208{
2209 NS_LOG_FUNCTION(this << s);
2210 if (m_ffrRrcSapProvider.size() > index)
2211 {
2212 m_ffrRrcSapProvider.at(index) = s;
2213 }
2214 else
2215 {
2216 m_ffrRrcSapProvider.push_back(s);
2217 NS_ABORT_MSG_IF(m_ffrRrcSapProvider.size() - 1 != index,
2218 "You meant to store the pointer at position "
2219 << static_cast<uint32_t>(index) << " but it went to "
2220 << m_ffrRrcSapProvider.size() - 1);
2221 }
2222}
2223
2226{
2227 NS_LOG_FUNCTION(this);
2228 return m_ffrRrcSapUser.at(0);
2229}
2230
2233{
2234 NS_LOG_FUNCTION(this);
2236 "Invalid component carrier index:"
2237 << index << " provided in order to obtain FfrRrcSapUser.");
2238 return m_ffrRrcSapUser.at(index);
2239}
2240
2241void
2247
2254
2255void
2261
2262void
2267
2270{
2271 return m_s1SapUser;
2272}
2273
2274void
2276{
2277 NS_LOG_FUNCTION(this << s);
2278 if (!m_cphySapProvider.empty())
2279 {
2280 m_cphySapProvider.at(0) = s;
2281 }
2282 else
2283 {
2284 m_cphySapProvider.push_back(s);
2285 }
2286}
2287
2290{
2291 NS_LOG_FUNCTION(this);
2292 return m_cphySapUser.at(0);
2293}
2294
2295void
2297{
2298 NS_LOG_FUNCTION(this << s);
2299 if (m_cphySapProvider.size() > pos)
2300 {
2301 m_cphySapProvider.at(pos) = s;
2302 }
2303 else
2304 {
2305 m_cphySapProvider.push_back(s);
2306 NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2307 }
2308}
2309
2312{
2313 NS_LOG_FUNCTION(this);
2314 return m_cphySapUser.at(pos);
2315}
2316
2317bool
2318LteEnbRrc::HasUeManager(uint16_t rnti) const
2319{
2320 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2321 auto it = m_ueMap.find(rnti);
2322 return (it != m_ueMap.end());
2323}
2324
2327{
2328 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2329 NS_ASSERT(0 != rnti);
2330 auto it = m_ueMap.find(rnti);
2331 NS_ASSERT_MSG(it != m_ueMap.end(), "UE manager for RNTI " << rnti << " not found");
2332 return it->second;
2333}
2334
2335std::vector<uint8_t>
2337{
2338 NS_LOG_FUNCTION(this);
2339
2340 // SANITY CHECK
2341
2345 "Measurement identities and reporting configuration should not have different quantity");
2346
2347 if (Simulator::Now() != Seconds(0))
2348 {
2349 NS_FATAL_ERROR("AddUeMeasReportConfig may not be called after the simulation has run");
2350 }
2351
2352 // INPUT VALIDATION
2353
2354 switch (config.triggerQuantity)
2355 {
2359 {
2361 "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2362 }
2363
2369 {
2371 "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2372 }
2373 break;
2374
2378 {
2380 "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2381 }
2382
2388 {
2390 "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2391 }
2392 break;
2393
2394 default:
2395 NS_FATAL_ERROR("unsupported triggerQuantity");
2396 break;
2397 }
2398
2400 {
2401 NS_FATAL_ERROR("Only REPORT_STRONGEST_CELLS purpose is supported");
2402 }
2403
2405 {
2406 NS_LOG_WARN("reportQuantity = BOTH will be used instead of the given reportQuantity");
2407 }
2408
2409 uint8_t nextId = m_ueMeasConfig.reportConfigToAddModList.size() + 1;
2410
2411 // create the reporting configuration
2413 reportConfig.reportConfigId = nextId;
2414 reportConfig.reportConfigEutra = config;
2415
2416 // add reporting configuration to UE measurement configuration
2417 m_ueMeasConfig.reportConfigToAddModList.push_back(reportConfig);
2418
2419 std::vector<uint8_t> measIds;
2420
2421 // create measurement identities, linking reporting configuration to all objects
2422 for (uint16_t componentCarrier = 0; componentCarrier < m_numberOfComponentCarriers;
2423 componentCarrier++)
2424 {
2425 LteRrcSap::MeasIdToAddMod measIdToAddMod;
2426
2427 uint8_t measId = m_ueMeasConfig.measIdToAddModList.size() + 1;
2428
2429 measIdToAddMod.measId = measId;
2430 measIdToAddMod.measObjectId = componentCarrier + 1;
2431 measIdToAddMod.reportConfigId = nextId;
2432
2433 m_ueMeasConfig.measIdToAddModList.push_back(measIdToAddMod);
2434 measIds.push_back(measId);
2435 }
2436
2437 return measIds;
2438}
2439
2440void
2442{
2443 auto it = ccPhyConf.begin();
2444 NS_ASSERT(it != ccPhyConf.end());
2445 uint16_t ulBandwidth = it->second->GetUlBandwidth();
2446 uint16_t dlBandwidth = it->second->GetDlBandwidth();
2447 uint32_t ulEarfcn = it->second->GetUlEarfcn();
2448 uint32_t dlEarfcn = it->second->GetDlEarfcn();
2449 NS_LOG_FUNCTION(this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2451
2452 for (const auto& it : ccPhyConf)
2453 {
2454 m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2455 it.second->GetDlBandwidth());
2456 m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2457 it.second->GetDlEarfcn());
2458 m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2459 m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2460 it.second->GetDlBandwidth());
2461 if (m_ffrRrcSapProvider.size() > it.first)
2462 {
2463 m_ffrRrcSapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2464 m_ffrRrcSapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2465 it.second->GetDlBandwidth());
2466 }
2467 }
2468
2469 m_dlEarfcn = dlEarfcn;
2470 m_ulEarfcn = ulEarfcn;
2471 m_dlBandwidth = dlBandwidth;
2472 m_ulBandwidth = ulBandwidth;
2473
2474 /*
2475 * Initializing the list of measurement objects.
2476 * Only intra-frequency measurements are supported,
2477 * so one measurement object is created for each carrier frequency.
2478 */
2479 for (const auto& it : ccPhyConf)
2480 {
2482 measObject.measObjectId = it.first + 1;
2483 measObject.measObjectEutra.carrierFreq = it.second->GetDlEarfcn();
2484 measObject.measObjectEutra.allowedMeasBandwidth = it.second->GetDlBandwidth();
2485 measObject.measObjectEutra.presenceAntennaPort1 = false;
2486 measObject.measObjectEutra.neighCellConfig = 0;
2487 measObject.measObjectEutra.offsetFreq = 0;
2489
2490 m_ueMeasConfig.measObjectToAddModList.push_back(measObject);
2491 }
2492
2499
2500 m_sib1.clear();
2501 m_sib1.reserve(ccPhyConf.size());
2502 for (const auto& it : ccPhyConf)
2503 {
2504 // Enabling MIB transmission
2506 mib.dlBandwidth = it.second->GetDlBandwidth();
2507 mib.systemFrameNumber = 0;
2508 m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2509
2510 // Enabling SIB1 transmission with default values
2512 sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId();
2516 sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
2517 sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
2518 m_sib1.push_back(sib1);
2519 m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2520 }
2521 /*
2522 * Enabling transmission of other SIB. The first time System Information is
2523 * transmitted is arbitrarily assumed to be at +0.016s, and then it will be
2524 * regularly transmitted every 80 ms by default (set the
2525 * SystemInformationPeriodicity attribute to configure this).
2526 */
2528
2529 m_configured = true;
2530}
2531
2532void
2533LteEnbRrc::SetCellId(uint16_t cellId)
2534{
2535 // update SIB1
2536 m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2537 m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2538}
2539
2540void
2541LteEnbRrc::SetCellId(uint16_t cellId, uint8_t ccIndex)
2542{
2543 // update SIB1
2544 m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2545 m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2546}
2547
2548uint8_t
2550{
2551 NS_LOG_FUNCTION(this << cellId);
2552 for (auto& it : m_componentCarrierPhyConf)
2553 {
2554 if (it.second->GetCellId() == cellId)
2555 {
2556 return it.first;
2557 }
2558 }
2559 NS_FATAL_ERROR("Cell " << cellId << " not found in CC map");
2560}
2561
2562uint16_t
2563LteEnbRrc::ComponentCarrierToCellId(uint8_t componentCarrierId)
2564{
2565 NS_LOG_FUNCTION(this << +componentCarrierId);
2566 return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2567}
2568
2569bool
2570LteEnbRrc::HasCellId(uint16_t cellId) const
2571{
2572 for (auto& it : m_componentCarrierPhyConf)
2573 {
2574 if (it.second->GetCellId() == cellId)
2575 {
2576 return true;
2577 }
2578 }
2579 return false;
2580}
2581
2582bool
2584{
2585 NS_LOG_FUNCTION(this << packet);
2586 EpsBearerTag tag;
2587 bool found = packet->RemovePacketTag(tag);
2588 NS_ASSERT_MSG(found, "no EpsBearerTag found in packet to be sent");
2589 Ptr<UeManager> ueManager = GetUeManager(tag.GetRnti());
2590
2591 NS_LOG_INFO("Sending a packet of " << packet->GetSize() << " bytes to IMSI "
2592 << ueManager->GetImsi() << ", RNTI " << ueManager->GetRnti()
2593 << ", BID " << (uint16_t)tag.GetBid());
2594 ueManager->SendData(tag.GetBid(), packet);
2595
2596 return true;
2597}
2598
2599void
2604
2605void
2607{
2608 NS_LOG_FUNCTION(this << rnti);
2610 "ConnectionRequestTimeout in unexpected state "
2611 << ToString(GetUeManager(rnti)->GetState()));
2612 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2613 rnti,
2614 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2615 "ConnectionRequestTimeout");
2616 RemoveUe(rnti);
2617}
2618
2619void
2621{
2622 NS_LOG_FUNCTION(this << rnti);
2624 "ConnectionSetupTimeout in unexpected state "
2625 << ToString(GetUeManager(rnti)->GetState()));
2626 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2627 rnti,
2628 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2629 "ConnectionSetupTimeout");
2630 RemoveUe(rnti);
2631}
2632
2633void
2635{
2636 NS_LOG_FUNCTION(this << rnti);
2638 "ConnectionRejectedTimeout in unexpected state "
2639 << ToString(GetUeManager(rnti)->GetState()));
2640 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2641 rnti,
2642 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2643 "ConnectionRejectedTimeout");
2644 RemoveUe(rnti);
2645}
2646
2647void
2649{
2650 NS_LOG_FUNCTION(this << rnti);
2652 "HandoverJoiningTimeout in unexpected state "
2653 << ToString(GetUeManager(rnti)->GetState()));
2655 GetUeManager(rnti)->GetImsi(),
2656 rnti,
2657 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2658 // check if the RNTI to be removed is not stale
2659 if (HasUeManager(rnti))
2660 {
2661 /**
2662 * When the handover joining timer expires at the target cell,
2663 * then notify the source cell to release the RRC connection and
2664 * delete the UE context at eNodeB and SGW/PGW. The
2665 * HandoverPreparationFailure message is reused to notify the source cell
2666 * through the X2 interface instead of creating a new message.
2667 */
2668 Ptr<UeManager> ueManager = GetUeManager(rnti);
2669 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2671 RemoveUe(rnti);
2672 }
2673}
2674
2675void
2677{
2678 NS_LOG_FUNCTION(this << rnti);
2680 "HandoverLeavingTimeout in unexpected state "
2681 << ToString(GetUeManager(rnti)->GetState()));
2683 GetUeManager(rnti)->GetImsi(),
2684 rnti,
2685 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2686 // check if the RNTI to be removed is not stale
2687 if (HasUeManager(rnti))
2688 {
2689 /**
2690 * Send HO cancel msg to the target eNB and release the RRC connection
2691 * with the UE and also delete UE context at the source eNB and bearer
2692 * info at SGW and PGW.
2693 */
2694 Ptr<UeManager> ueManager = GetUeManager(rnti);
2695 EpcX2Sap::HandoverCancelParams msg = ueManager->BuildHoCancelMsg();
2697 ueManager->SendRrcConnectionRelease();
2698 }
2699}
2700
2701void
2702LteEnbRrc::SendHandoverRequest(uint16_t rnti, uint16_t cellId)
2703{
2704 NS_LOG_FUNCTION(this << rnti << cellId);
2705 NS_LOG_LOGIC("Request to send HANDOVER REQUEST");
2707
2708 Ptr<UeManager> ueManager = GetUeManager(rnti);
2709 ueManager->PrepareHandover(cellId);
2710}
2711
2712void
2714{
2715 NS_LOG_FUNCTION(this << rnti);
2716 GetUeManager(rnti)->CompleteSetupUe(params);
2717}
2718
2719void
2721{
2722 NS_LOG_FUNCTION(this << rnti);
2723 GetUeManager(rnti)->RecvRrcConnectionRequest(msg);
2724}
2725
2726void
2729{
2730 NS_LOG_FUNCTION(this << rnti);
2731 GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2732}
2733
2734void
2736 uint16_t rnti,
2738{
2739 NS_LOG_FUNCTION(this << rnti);
2740 GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2741}
2742
2743void
2745 uint16_t rnti,
2747{
2748 NS_LOG_FUNCTION(this << rnti);
2749 GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2750}
2751
2752void
2754 uint16_t rnti,
2756{
2757 NS_LOG_FUNCTION(this << rnti);
2758 GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2759}
2760
2761void
2763{
2764 NS_LOG_FUNCTION(this << rnti);
2765 GetUeManager(rnti)->RecvMeasurementReport(msg);
2766}
2767
2768void
2770{
2771 NS_LOG_FUNCTION(this);
2772 Ptr<UeManager> ueManager = GetUeManager(msg.rnti);
2773 ueManager->InitialContextSetupRequest();
2774}
2775
2776void
2778{
2779 NS_LOG_FUNCTION(this << rnti);
2780
2781 // check if the RNTI to be removed is not stale
2782 if (HasUeManager(rnti))
2783 {
2784 Ptr<UeManager> ueManager = GetUeManager(rnti);
2785
2786 if (ueManager->GetState() == UeManager::HANDOVER_JOINING)
2787 {
2789 GetUeManager(rnti)->GetImsi(),
2790 rnti,
2791 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2792 /**
2793 * During the HO, when the RACH failure due to the maximum number of
2794 * re-attempts is reached the UE request the target eNB to deletes its
2795 * context. Upon which, the target eNB sends handover preparation
2796 * failure to the source eNB.
2797 */
2798 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2800 }
2801
2802 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2803 // delete the UE context at the eNB
2804 RemoveUe(rnti);
2805 }
2806}
2807
2808void
2811{
2812 NS_LOG_FUNCTION(this);
2813 Ptr<UeManager> ueManager = GetUeManager(request.rnti);
2814 ueManager->SetupDataRadioBearer(request.bearer,
2815 request.bearerId,
2816 request.gtpTeid,
2817 request.transportLayerAddress);
2818}
2819
2820void
2823{
2824 NS_LOG_FUNCTION(this);
2825 Ptr<UeManager> ueManager = GetUeManager(params.rnti);
2826 ueManager->SendUeContextRelease();
2827}
2828
2829void
2831{
2832 NS_LOG_FUNCTION(this);
2833
2834 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST");
2835
2836 NS_LOG_LOGIC("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
2837 NS_LOG_LOGIC("sourceCellId = " << req.sourceCellId);
2838 NS_LOG_LOGIC("targetCellId = " << req.targetCellId);
2839 NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId);
2840
2841 // if no SRS index is available, then do not accept the handover
2843 {
2844 NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId);
2846 res.oldEnbUeX2apId = req.oldEnbUeX2apId;
2847 res.sourceCellId = req.sourceCellId;
2848 res.targetCellId = req.targetCellId;
2849 res.cause = 0;
2850 res.criticalityDiagnostics = 0;
2852 return;
2853 }
2854
2855 uint8_t componentCarrierId = CellToComponentCarrierId(req.targetCellId);
2856 uint16_t rnti = AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
2857 Ptr<UeManager> ueManager = GetUeManager(rnti);
2858 ueManager->SetSource(req.sourceCellId, req.oldEnbUeX2apId);
2859 ueManager->SetImsi(req.mmeUeS1apId);
2861 m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2862 if (!anrcrv.valid)
2863 {
2865 this
2866 << " failed to allocate a preamble for non-contention based RA => cannot accept HO");
2868 GetUeManager(rnti)->GetImsi(),
2869 rnti,
2870 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2871 /**
2872 * When the maximum non-contention based preambles is reached, then it is considered
2873 * handover has failed and source cell is notified to release the RRC connection and delete
2874 * the UE context at eNodeB and SGW/PGW.
2875 */
2876 Ptr<UeManager> ueManager = GetUeManager(rnti);
2877 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2879 RemoveUe(rnti); // remove the UE from the target eNB
2880 return;
2881 }
2882
2884 ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
2885 ackParams.newEnbUeX2apId = rnti;
2886 ackParams.sourceCellId = req.sourceCellId;
2887 ackParams.targetCellId = req.targetCellId;
2888
2889 for (auto it = req.bearers.begin(); it != req.bearers.end(); ++it)
2890 {
2891 ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2892 it->erabId,
2893 it->gtpTeid,
2894 it->transportLayerAddress);
2896 i.erabId = it->erabId;
2897 ackParams.admittedBearers.push_back(i);
2898 }
2899
2901 ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2902
2903 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2904 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
2907 anrcrv.raPrachMaskIndex;
2908
2910 m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2912 .numberOfRaPreambles = rc.numberOfRaPreambles;
2914 .preambleTransMax = rc.preambleTransMax;
2916 .raResponseWindowSize = rc.raResponseWindowSize;
2918 .connEstFailCount = rc.connEstFailCount;
2919
2920 Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand(handoverCommand);
2921
2922 ackParams.rrcContext = encodedHandoverCommand;
2923
2924 NS_LOG_LOGIC("Send X2 message: HANDOVER REQUEST ACK");
2925
2926 NS_LOG_LOGIC("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
2927 NS_LOG_LOGIC("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
2928 NS_LOG_LOGIC("sourceCellId = " << ackParams.sourceCellId);
2929 NS_LOG_LOGIC("targetCellId = " << ackParams.targetCellId);
2930
2932}
2933
2934void
2936{
2937 NS_LOG_FUNCTION(this);
2938
2939 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST ACK");
2940
2941 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2942 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2943 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2944 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2945
2946 uint16_t rnti = params.oldEnbUeX2apId;
2947 Ptr<UeManager> ueManager = GetUeManager(rnti);
2948 ueManager->RecvHandoverRequestAck(params);
2949}
2950
2951void
2953{
2954 NS_LOG_FUNCTION(this);
2955
2956 NS_LOG_LOGIC("Recv X2 message: HANDOVER PREPARATION FAILURE");
2957
2958 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2959 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2960 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2961 NS_LOG_LOGIC("cause = " << params.cause);
2962 NS_LOG_LOGIC("criticalityDiagnostics = " << params.criticalityDiagnostics);
2963
2964 uint16_t rnti = params.oldEnbUeX2apId;
2965
2966 // check if the RNTI is not stale
2967 if (HasUeManager(rnti))
2968 {
2969 Ptr<UeManager> ueManager = GetUeManager(rnti);
2970 ueManager->RecvHandoverPreparationFailure(params.targetCellId);
2971 }
2972}
2973
2974void
2976{
2977 NS_LOG_FUNCTION(this);
2978
2979 NS_LOG_LOGIC("Recv X2 message: SN STATUS TRANSFER");
2980
2981 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2982 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2983 NS_LOG_LOGIC("erabsSubjectToStatusTransferList size = "
2984 << params.erabsSubjectToStatusTransferList.size());
2985
2986 uint16_t rnti = params.newEnbUeX2apId;
2987
2988 // check if the RNTI to receive SN transfer for is not stale
2989 if (HasUeManager(rnti))
2990 {
2991 Ptr<UeManager> ueManager = GetUeManager(rnti);
2992 ueManager->RecvSnStatusTransfer(params);
2993 }
2994}
2995
2996void
2998{
2999 NS_LOG_FUNCTION(this);
3000
3001 NS_LOG_LOGIC("Recv X2 message: UE CONTEXT RELEASE");
3002
3003 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3004 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3005
3006 uint16_t rnti = params.oldEnbUeX2apId;
3007
3008 // check if the RNTI to be removed is not stale
3009 if (HasUeManager(rnti))
3010 {
3011 GetUeManager(rnti)->RecvUeContextRelease(params);
3012 RemoveUe(rnti);
3013 }
3014}
3015
3016void
3018{
3019 NS_LOG_FUNCTION(this);
3020
3021 NS_LOG_LOGIC("Recv X2 message: LOAD INFORMATION");
3022
3023 NS_LOG_LOGIC("Number of cellInformationItems = " << params.cellInformationList.size());
3024
3026 m_ffrRrcSapProvider.at(0)->RecvLoadInformation(params);
3027}
3028
3029void
3031{
3032 NS_LOG_FUNCTION(this);
3033
3034 NS_LOG_LOGIC("Recv X2 message: RESOURCE STATUS UPDATE");
3035
3037 "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
3038
3039 NS_ASSERT("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
3040}
3041
3042void
3044{
3045 NS_LOG_FUNCTION(this);
3046
3047 NS_LOG_LOGIC("Recv UE DATA FORWARDING through X2 interface");
3048 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3049 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3050 NS_LOG_LOGIC("gtpTeid = " << params.gtpTeid);
3051 NS_LOG_LOGIC("ueData = " << params.ueData);
3052 NS_LOG_LOGIC("ueData size = " << params.ueData->GetSize());
3053
3054 auto teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
3055 if (teidInfoIt != m_x2uTeidInfoMap.end())
3056 {
3057 GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
3058 }
3059 else
3060 {
3061 NS_FATAL_ERROR("X2-U data received but no X2uTeidInfo found");
3062 }
3063}
3064
3065void
3067{
3068 NS_LOG_FUNCTION(this);
3069
3070 NS_LOG_LOGIC("Recv X2 message: HANDOVER CANCEL");
3071
3072 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3073 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3074 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3075 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3076 NS_LOG_LOGIC("cause = " << params.cause);
3077
3078 uint16_t rnti = params.newEnbUeX2apId;
3079 if (HasUeManager(rnti))
3080 {
3081 Ptr<UeManager> ueManager = GetUeManager(rnti);
3082 ueManager->RecvHandoverCancel(params);
3083 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3084 }
3085}
3086
3087uint16_t
3089{
3090 NS_LOG_FUNCTION(this << +componentCarrierId);
3091 // if no SRS index is available, then do not create a new UE context.
3092 if (IsMaxSrsReached())
3093 {
3094 NS_LOG_WARN("Not enough SRS configuration indices, UE context not created");
3095 return 0; // return 0 since new RNTI was not assigned for the received preamble
3096 }
3097 return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3098}
3099
3100void
3102{
3103 Ptr<UeManager> ueManager = GetUeManager(cmacParams.m_rnti);
3104 ueManager->CmacUeConfigUpdateInd(cmacParams);
3105}
3106
3107void
3108LteEnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
3109{
3110 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3111 NS_FATAL_ERROR("not implemented");
3112}
3113
3114std::vector<uint8_t>
3116{
3117 NS_LOG_FUNCTION(this);
3118 std::vector<uint8_t> measIds = AddUeMeasReportConfig(reportConfig);
3119 m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3120 return measIds;
3121}
3122
3123uint8_t
3125{
3126 NS_LOG_FUNCTION(this);
3127 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3128 m_componentCarrierMeasIds.insert(measId);
3129 return measId;
3130}
3131
3132void
3133LteEnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3134{
3135 m_numberOfComponentCarriers = numberOfComponentCarriers;
3136}
3137
3138void
3139LteEnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3140{
3141 NS_LOG_FUNCTION(this << rnti << targetCellId);
3142
3143 bool isHandoverAllowed = true;
3144
3145 Ptr<UeManager> ueManager = GetUeManager(rnti);
3146 NS_ASSERT_MSG(ueManager, "Cannot find UE context with RNTI " << rnti);
3147
3148 if (m_anrSapProvider != nullptr && !HasCellId(targetCellId))
3149 {
3150 // ensure that proper neighbour relationship exists between source and target cells
3151 bool noHo = m_anrSapProvider->GetNoHo(targetCellId);
3152 bool noX2 = m_anrSapProvider->GetNoX2(targetCellId);
3153 NS_LOG_DEBUG(this << " cellId="
3154 << ComponentCarrierToCellId(ueManager->GetComponentCarrierId())
3155 << " targetCellId=" << targetCellId << " NRT.NoHo=" << noHo
3156 << " NRT.NoX2=" << noX2);
3157
3158 if (noHo || noX2)
3159 {
3160 isHandoverAllowed = false;
3161 NS_LOG_LOGIC(this << " handover to cell " << targetCellId << " is not allowed by ANR");
3162 }
3163 }
3164
3165 if (ueManager->GetState() != UeManager::CONNECTED_NORMALLY)
3166 {
3167 isHandoverAllowed = false;
3168 NS_LOG_LOGIC(this << " handover is not allowed because the UE"
3169 << " rnti=" << rnti << " is in " << ToString(ueManager->GetState())
3170 << " state");
3171 }
3172
3173 if (isHandoverAllowed)
3174 {
3175 // initiate handover execution
3176 ueManager->PrepareHandover(targetCellId);
3177 }
3178}
3179
3180uint8_t
3182{
3183 NS_LOG_FUNCTION(this);
3184 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3185 m_anrMeasIds.insert(measId);
3186 return measId;
3187}
3188
3189uint8_t
3191{
3192 NS_LOG_FUNCTION(this);
3193 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3194 m_ffrMeasIds.insert(measId);
3195 return measId;
3196}
3197
3198void
3200 LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
3201{
3202 NS_LOG_FUNCTION(this);
3203 Ptr<UeManager> ueManager = GetUeManager(rnti);
3204 ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3205}
3206
3207void
3214
3215uint16_t
3216LteEnbRrc::AddUe(UeManager::State state, uint8_t componentCarrierId)
3217{
3218 NS_LOG_FUNCTION(this);
3219 bool found = false;
3220 uint16_t rnti;
3221 for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3222 {
3223 if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3224 {
3225 found = true;
3226 break;
3227 }
3228 }
3229
3230 NS_ASSERT_MSG(found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3231 m_lastAllocatedRnti = rnti;
3232 Ptr<UeManager> ueManager = CreateObject<UeManager>(this, rnti, state, componentCarrierId);
3233 m_ccmRrcSapProvider->AddUe(rnti, (uint8_t)state);
3234 m_ueMap.insert(std::pair<uint16_t, Ptr<UeManager>>(rnti, ueManager));
3235 ueManager->Initialize();
3236 const uint16_t cellId = ComponentCarrierToCellId(componentCarrierId);
3237 NS_LOG_DEBUG(this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI "
3238 << ueManager->GetSrsConfigurationIndex());
3239 m_newUeContextTrace(cellId, rnti);
3240 return rnti;
3241}
3242
3243void
3245{
3246 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3247 auto it = m_ueMap.find(rnti);
3248 NS_ASSERT_MSG(it != m_ueMap.end(), "request to remove UE info with unknown rnti " << rnti);
3249 uint64_t imsi = it->second->GetImsi();
3250 uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3251 // cancel pending events
3252 it->second->CancelPendingEvents();
3253 // fire trace upon connection release
3255 ComponentCarrierToCellId(it->second->GetComponentCarrierId()),
3256 rnti);
3257 m_ueMap.erase(it);
3258 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3259 {
3260 m_cmacSapProvider.at(i)->RemoveUe(rnti);
3261 m_cphySapProvider.at(i)->RemoveUe(rnti);
3262 }
3263 if (m_s1SapProvider != nullptr)
3264 {
3266 }
3268 // need to do this after UeManager has been deleted
3269 if (srsCi != 0)
3270 {
3272 }
3273
3274 m_rrcSapUser->RemoveUe(rnti); // Remove UE context at RRC protocol
3275}
3276
3277TypeId
3279{
3281 {
3282 case RLC_SM_ALWAYS:
3283 return LteRlcSm::GetTypeId();
3284
3285 case RLC_UM_ALWAYS:
3286 return LteRlcUm::GetTypeId();
3287
3288 case RLC_AM_ALWAYS:
3289 return LteRlcAm::GetTypeId();
3290
3291 case PER_BASED:
3292 if (bearer.GetPacketErrorLossRate() > 1.0e-5)
3293 {
3294 return LteRlcUm::GetTypeId();
3295 }
3296 else
3297 {
3298 return LteRlcAm::GetTypeId();
3299 }
3300
3301 default:
3302 return LteRlcSm::GetTypeId();
3303 }
3304}
3305
3306void
3308{
3309 NS_LOG_FUNCTION(this << cellId);
3310
3311 if (m_anrSapProvider != nullptr)
3312 {
3314 }
3315}
3316
3317void
3318LteEnbRrc::SetCsgId(uint32_t csgId, bool csgIndication)
3319{
3320 NS_LOG_FUNCTION(this << csgId << csgIndication);
3321 for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3322 componentCarrierId++)
3323 {
3324 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3325 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3326 m_cphySapProvider.at(componentCarrierId)
3327 ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3328 }
3329}
3330
3331/// Number of distinct SRS periodicity plus one.
3332static const uint8_t SRS_ENTRIES = 9;
3333/**
3334 * Sounding Reference Symbol (SRS) periodicity (TSRS) in milliseconds. Taken
3335 * from 3GPP TS 36.213 Table 8.2-1. Index starts from 1.
3336 */
3337static const uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
3338/**
3339 * The lower bound (inclusive) of the SRS configuration indices (ISRS) which
3340 * use the corresponding SRS periodicity (TSRS). Taken from 3GPP TS 36.213
3341 * Table 8.2-1. Index starts from 1.
3342 */
3343static const uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
3344/**
3345 * The upper bound (inclusive) of the SRS configuration indices (ISRS) which
3346 * use the corresponding SRS periodicity (TSRS). Taken from 3GPP TS 36.213
3347 * Table 8.2-1. Index starts from 1.
3348 */
3349static const uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
3350
3351void
3353{
3354 NS_LOG_FUNCTION(this << p);
3355 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3356 {
3357 if (g_srsPeriodicity[id] == p)
3358 {
3360 return;
3361 }
3362 }
3363 // no match found
3364 std::ostringstream allowedValues;
3365 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3366 {
3367 allowedValues << g_srsPeriodicity[id] << " ";
3368 }
3369 NS_FATAL_ERROR("illecit SRS periodicity value " << p
3370 << ". Allowed values: " << allowedValues.str());
3371}
3372
3381
3382uint16_t
3384{
3386 // SRS
3389 NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3392 {
3393 NS_FATAL_ERROR("too many UEs ("
3394 << m_ueSrsConfigurationIndexSet.size() + 1
3395 << ") for current SRS periodicity "
3397 << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
3398 }
3399
3400 if (m_ueSrsConfigurationIndexSet.empty())
3401 {
3402 // first entry
3405 }
3406 else
3407 {
3408 // find a CI from the available ones
3409 auto rit = m_ueSrsConfigurationIndexSet.rbegin();
3411 NS_LOG_DEBUG(this << " lower bound " << (*rit) << " of "
3414 {
3415 // got it from the upper bound
3418 }
3419 else
3420 {
3421 // look for released ones
3422 for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
3424 srcCi++)
3425 {
3426 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3427 if (it == m_ueSrsConfigurationIndexSet.end())
3428 {
3430 m_ueSrsConfigurationIndexSet.insert(srcCi);
3431 break;
3432 }
3433 }
3434 }
3435 }
3437}
3438
3439void
3441{
3442 NS_LOG_FUNCTION(this << srcCi);
3443 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3445 "request to remove unknown SRS CI " << srcCi);
3447}
3448
3449bool
3458
3459uint8_t
3461{
3462 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
3463 {
3464 return 1;
3465 }
3466 else
3467 {
3468 return 2;
3469 }
3470}
3471
3472uint8_t
3474{
3475 return bearer.qci;
3476}
3477
3478void
3480{
3481 // NS_LOG_FUNCTION (this);
3482
3483 for (auto& it : m_componentCarrierPhyConf)
3484 {
3485 uint8_t ccId = it.first;
3486
3488 si.haveSib2 = true;
3489 si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3490 si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3492 m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3494
3495 LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3496 LteRrcSap::RachConfigCommon rachConfigCommon;
3497 rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3498 rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3499 rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3500 rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3501 si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3502
3503 m_rrcSapUser->SendSystemInformation(it.second->GetCellId(), si);
3504 }
3505
3506 /*
3507 * For simplicity, we use the same periodicity for all SIBs. Note that in real
3508 * systems the periodicy of each SIBs could be different.
3509 */
3511}
3512
3513bool
3515{
3516 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3517 Ptr<UeManager> ueManager = GetUeManager(rnti);
3518 switch (ueManager->GetState())
3519 {
3522 return true;
3523 default:
3524 return false;
3525 }
3526}
3527
3528} // namespace ns3
Callback template class.
Definition callback.h:422
Class for forwarding CMAC SAP User functions.
bool IsRandomAccessCompleted(uint16_t rnti) override
Is random access completed function.
EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc *rrc, uint8_t componentCarrierId)
Constructor.
void RrcConfigurationUpdateInd(UeConfig params) override
Notify the RRC of a UE config updated requested by the MAC (normally, by the scheduler)
uint16_t AllocateTemporaryCellRnti() override
request the allocation of a Temporary C-RNTI
uint8_t m_componentCarrierId
Component carrier ID.
void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override
notify the result of the last LC config operation
Hold variables of type enum.
Definition enum.h:52
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
virtual void UeContextRelease(uint16_t rnti)=0
Release UE context at the S1 Application of the source eNB after reception of the UE CONTEXT RELEASE ...
virtual void DoSendReleaseIndication(uint64_t imsi, uint16_t rnti, uint8_t bearerId)=0
Triggers epc-enb-application to send ERAB Release Indication message towards MME.
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
@ HandoverDesirableForRadioReason
Definition epc-x2-sap.h:209
These service primitives of this part of the X2 SAP are provided by the X2 entity and issued by RRC e...
Definition epc-x2-sap.h:348
virtual void SendHandoverRequestAck(HandoverRequestAckParams params)=0
Send handover request ack function.
virtual void SendHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
Send handover preparation failure function.
virtual void SendHandoverCancel(HandoverCancelParams params)=0
Send handover Cancel to the target eNB.
virtual void SendLoadInformation(LoadInformationParams params)=0
Send load information function.
These service primitives of this part of the X2 SAP are provided by the RRC entity and issued by the ...
Definition epc-x2-sap.h:416
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
uint8_t GetResourceType() const
uint16_t GetPacketDelayBudgetMs() const
double GetPacketErrorLossRate() const
Qci qci
Qos class indicator.
Definition eps-bearer.h:140
GbrQosInformation gbrQosInfo
GBR QOS information.
Definition eps-bearer.h:142
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition eps-bearer.h:96
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
uint8_t GetBid() const
Get Bearer Id function.
uint16_t GetRnti() const
Get RNTI function.
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
void SetBid(uint8_t bid)
Set the bearer id to the given value.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition event-id.cc:44
Hold a signed integer type.
Definition integer.h:34
Ipv4 addresses are stored in host order in this class.
Service Access Point (SAP) offered by the ANR instance to the eNodeB RRC instance.
Definition lte-anr-sap.h:26
virtual void AddNeighbourRelation(uint16_t cellId)=0
Add a new Neighbour Relation entry.
virtual bool GetNoX2(uint16_t cellId) const =0
Get the value of No X2 field of a neighbouring cell from the Neighbour Relation Table (NRT).
virtual bool GetNoHo(uint16_t cellId) const =0
Get the value of No HO field of a neighbouring cell from the Neighbour Relation Table (NRT).
Service Access Point (SAP) offered by the eNodeB RRC instance to the ANR instance.
Definition lte-anr-sap.h:84
Service Access Point (SAP) offered by the Component Carrier Manager (CCM) instance to the eNodeB RRC ...
virtual void AddUe(uint16_t rnti, uint8_t state)=0
Add a new UE in the LteEnbComponentCarrierManager.
virtual void RemoveUe(uint16_t rnti)=0
Remove an existing UE.
Service Access Point (SAP) offered by the eNodeB RRC instance to the component carrier manager (CCM) ...
Service Access Point (SAP) offered by the eNB MAC to the eNB RRC See Femto Forum MAC Scheduler Interf...
Service Access Point (SAP) offered by the MAC to the RRC See Femto Forum MAC Scheduler Interface Spec...
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
The LTE Radio Resource Control entity at the eNB.
~LteEnbRrc() override
Destructor.
LteEnbRrcSapProvider * GetLteEnbRrcSapProvider()
void SetCsgId(uint32_t csgId, bool csgIndication)
Associate this RRC entity with a particular CSG information.
void RemoveUe(uint16_t rnti)
remove a UE from the cell
void DoSetPdschConfigDedicated(uint16_t rnti, LteRrcSap::PdschConfigDedicated pa)
Set PDSCH config dedicated function.
std::map< uint8_t, Ptr< ComponentCarrierBaseStation > > m_componentCarrierPhyConf
component carrier phy configuration
void SetSrsPeriodicity(uint32_t p)
bool IsRandomAccessCompleted(uint16_t rnti)
Is random access completed function.
uint8_t GetLogicalChannelGroup(EpsBearer bearer)
int8_t m_qRxLevMin
The QRxLevMin attribute.
std::set< uint16_t > m_ueSrsConfigurationIndexSet
UE SRS configuration index set.
TracedCallback< uint64_t, uint16_t, uint16_t, uint16_t > m_handoverStartTrace
The HandoverStart trace source.
void DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
Set number of component carriers.
void DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
This function acts as an interface to trigger Release indication messages towards eNB and EPC.
void SendSystemInformation()
method used to periodically send System Information
void DoRecvRrcConnectionRequest(uint16_t rnti, LteRrcSap::RrcConnectionRequest msg)
Part of the RRC protocol.
std::set< uint8_t > m_ffrMeasIds
List of measurement identities which are intended for FFR purpose.
friend class MemberEpcEnbS1SapUser< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Callback< void, Ptr< Packet > > m_forwardUpCallback
forward up callback function
void DoRecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
Receive SN status transfer function.
void DoRecvHandoverRequest(EpcX2SapUser::HandoverRequestParams params)
Receive handover request function.
LteEnbRrc()
create an RRC instance for use within an eNB
std::set< uint8_t > m_anrMeasIds
List of measurement identities which are intended for ANR purpose.
uint8_t DoAddUeMeasReportConfigForFfr(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for FFR function.
LteMacSapProvider * m_macSapProvider
Interface to the eNodeB MAC instance, to be used by RLC instances.
uint32_t GetSrsPeriodicity() const
bool SendData(Ptr< Packet > p)
Enqueue an IP data packet on the proper bearer for downlink transmission.
EpcEnbS1SapUser * GetS1SapUser()
void AddX2Neighbour(uint16_t cellId)
Add a neighbour with an X2 interface.
LteCcmRrcSapUser * m_ccmRrcSapUser
Receive API calls from the LteEnbComponentCarrierManager instance.
Time m_connectionRequestTimeoutDuration
The ConnectionRequestTimeoutDuration attribute.
void HandoverLeavingTimeout(uint16_t rnti)
Method triggered when a UE is expected to leave a cell for a handover but no feedback is received in ...
LteHandoverManagementSapUser * m_handoverManagementSapUser
Receive API calls from the handover algorithm instance.
static TypeId GetTypeId()
Get the type ID.
void DoRecvMeasurementReport(uint16_t rnti, LteRrcSap::MeasurementReport msg)
Part of the RRC protocol.
void SetLteAnrSapProvider(LteAnrSapProvider *s)
set the ANR SAP this RRC should interact with
void DoRecvHandoverRequestAck(EpcX2SapUser::HandoverRequestAckParams params)
Receive handover request acknowledge function.
LteEnbCphySapUser * GetLteEnbCphySapUser()
bool HasUeManager(uint16_t rnti) const
uint8_t m_rsrqFilterCoefficient
The RsrqFilterCoefficient attribute.
std::vector< uint8_t > DoAddUeMeasReportConfigForHandover(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for handover function.
void DoRecvResourceStatusUpdate(EpcX2SapUser::ResourceStatusUpdateParams params)
Receive resource status update function.
uint16_t AddUe(UeManager::State state, uint8_t componentCarrierId)
Allocate a new RNTI for a new UE.
void DoSendLoadInformation(EpcX2Sap::LoadInformationParams params)
Send load information function.
uint8_t GetLogicalChannelPriority(EpsBearer bearer)
void DoCompleteSetupUe(uint16_t rnti, LteEnbRrcSapProvider::CompleteSetupUeParameters params)
Part of the RRC protocol.
uint16_t GetNewSrsConfigurationIndex()
Allocate a new SRS configuration index for a new UE.
uint8_t m_defaultTransmissionMode
The DefaultTransmissionMode attribute.
Time m_connectionRejectedTimeoutDuration
The ConnectionRejectedTimeoutDuration attribute.
Time m_connectionSetupTimeoutDuration
The ConnectionSetupTimeoutDuration attribute.
std::set< uint8_t > m_handoverMeasIds
List of measurement identities which are intended for handover purpose.
void DoPathSwitchRequestAcknowledge(EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters params)
Path switch request acknowledge function.
std::vector< uint8_t > AddUeMeasReportConfig(LteRrcSap::ReportConfigEutra config)
Add a new UE measurement reporting configuration.
bool m_admitHandoverRequest
The AdmitHandoverRequest attribute.
uint16_t m_ulBandwidth
Uplink transmission bandwidth configuration in number of Resource Blocks.
LteAnrSapUser * m_anrSapUser
Receive API calls from the ANR instance.
LteHandoverManagementSapProvider * m_handoverManagementSapProvider
Interface to the handover algorithm instance.
friend class EpcX2SpecificEpcX2SapUser< LteEnbRrc >
allow MemberEpcEnbS1SapUser<LteEnbRrc> class friend access
uint8_t DoAddUeMeasReportConfigForComponentCarrier(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for component carrier function.
std::vector< LteFfrRrcSapProvider * > m_ffrRrcSapProvider
Interface to the FFR algorithm instance.
uint8_t DoAddUeMeasReportConfigForAnr(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for ANR function.
LteEnbRrcSapUser * m_rrcSapUser
Interface to send messages to UE over the RRC protocol.
std::map< uint16_t, Ptr< UeManager > > m_ueMap
The UeMap attribute.
void HandoverJoiningTimeout(uint16_t rnti)
Method triggered when a UE is expected to join the cell for a handover but does not do so in a reason...
LteEpsBearerToRlcMapping_t m_epsBearerToRlcMapping
The EpsBearerToRlcMapping attribute.
Ptr< UeManager > GetUeManager(uint16_t rnti)
LteCcmRrcSapProvider * m_ccmRrcSapProvider
Interface to the LteEnbComponentCarrierManager instance.
void DoRecvRrcConnectionReestablishmentComplete(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentComplete msg)
Part of the RRC protocol.
void DoRrcConfigurationUpdateInd(LteEnbCmacSapUser::UeConfig params)
RRC configuration update indication function.
TracedCallback< uint64_t, uint16_t, uint16_t, LteRrcSap::MeasurementReport > m_recvMeasurementReportTrace
The RecvMeasurementReport trace source.
LteAnrSapProvider * m_anrSapProvider
Interface to the ANR instance.
std::set< uint8_t > m_componentCarrierMeasIds
List of measurement identities which are intended for component carrier management purposes.
std::vector< LteEnbCphySapProvider * > m_cphySapProvider
Interface to the eNodeB PHY instances.
void SetLteMacSapProvider(LteMacSapProvider *s)
set the MAC SAP provider.
void ConfigureCarriers(std::map< uint8_t, Ptr< ComponentCarrierBaseStation > > ccPhyConf)
Configure carriers.
uint16_t m_lastAllocatedConfigurationIndex
last allocated configuration index
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureMaxRachTrace
The 'HandoverFailureMaxRach' Trace source.
friend class MemberLteCcmRrcSapUser< LteEnbRrc >
allow MemberLteCcmRrcSapUser<LteEnbRrc> class friend access
LteRrcSap::MeasConfig m_ueMeasConfig
List of measurement configuration which are active in every UE attached to this eNodeB instance.
friend class MemberLteEnbRrcSapProvider< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureNoPreambleTrace
The 'HandoverFailureNoPreamble' Trace source.
TracedCallback< uint16_t, uint16_t > m_newUeContextTrace
The NewUeContext trace source.
Time m_systemInformationPeriodicity
The SystemInformationPeriodicity attribute.
void DoRecvRrcConnectionReconfigurationCompleted(uint16_t rnti, LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Part of the RRC protocol.
void SetLteEnbRrcSapUser(LteEnbRrcSapUser *s)
set the RRC SAP this RRC should interact with
friend class MemberLteAnrSapUser< LteEnbRrc >
allow MemberLteAnrSapUser<LteEnbRrc> class friend access
void DoRecvHandoverPreparationFailure(EpcX2SapUser::HandoverPreparationFailureParams params)
Receive handover preparation failure function.
LteHandoverManagementSapUser * GetLteHandoverManagementSapUser()
Get the Handover Management SAP offered by this RRC.
EpcX2SapUser * GetEpcX2SapUser()
Get the X2 SAP offered by this RRC.
std::vector< LteEnbCmacSapUser * > m_cmacSapUser
Receive API calls from the eNodeB MAC instance.
void DoInitialContextSetupRequest(EpcEnbS1SapUser::InitialContextSetupRequestParameters params)
Initial context setup request function.
uint32_t m_dlEarfcn
Downlink E-UTRA Absolute Radio Frequency Channel Number.
void SendHandoverRequest(uint16_t rnti, uint16_t cellId)
Send a HandoverRequest through the X2 SAP interface.
uint16_t m_numberOfComponentCarriers
number of component carriers
void DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
Notify LC config result function.
TypeId GetRlcType(EpsBearer bearer)
uint8_t m_rsrpFilterCoefficient
The RsrpFilterCoefficient attribute.
EpcEnbS1SapProvider * m_s1SapProvider
Interface to send messages to core network over the S1 protocol.
uint16_t m_lastAllocatedRnti
Last allocated RNTI.
uint32_t m_ulEarfcn
Uplink E-UTRA Absolute Radio Frequency Channel Number.
uint16_t ComponentCarrierToCellId(uint8_t componentCarrierId)
convert the component carrier id to cell id
LteFfrRrcSapUser * GetLteFfrRrcSapUser()
Get the FFR SAP offered by this RRC.
void SetS1SapProvider(EpcEnbS1SapProvider *s)
Set the S1 SAP Provider.
bool HasCellId(uint16_t cellId) const
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionReconfigurationTrace
The ConnectionReconfiguration trace source.
EpcX2SapUser * m_x2SapUser
Interface to receive messages from neighbour eNodeB over the X2 interface.
bool m_admitRrcConnectionRequest
The AdmitRrcConnectionRequest attribute.
void DoRecvUeData(EpcX2SapUser::UeDataParams params)
Receive UE data function.
uint16_t m_srsCurrentPeriodicityId
The SrsPeriodicity attribute.
void DoRecvRrcConnectionReestablishmentRequest(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentRequest msg)
Part of the RRC protocol.
bool m_configured
True if ConfigureCell() has been completed.
void ConnectionSetupTimeout(uint16_t rnti)
Method triggered when a UE is expected to complete a connection setup procedure but does not do so in...
friend class EnbRrcMemberLteEnbCmacSapUser
allow EnbRrcMemberLteEnbCmacSapUser class friend access
friend class MemberLteHandoverManagementSapUser< LteEnbRrc >
allow MemberLteHandoverManagementSapUser<LteEnbRrc> class friend access
LteEnbCmacSapUser * GetLteEnbCmacSapUser()
Get the CMAC SAP offered by this RRC.
void DoRecvRrcConnectionSetupCompleted(uint16_t rnti, LteRrcSap::RrcConnectionSetupCompleted msg)
Part of the RRC protocol.
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionReleaseTrace
The NotifyConnectionRelease trace source.
void ConnectionRejectedTimeout(uint16_t rnti)
Method triggered a while after sending RRC Connection Rejected.
void DoRecvUeContextRelease(EpcX2SapUser::UeContextReleaseParams params)
Receive UE context release function.
Time m_handoverLeavingTimeoutDuration
The HandoverLeavingTimeoutDuration attribute.
std::map< uint32_t, X2uTeidInfo > m_x2uTeidInfoMap
TEID, RNTI, DRBID.
void DoRecvLoadInformation(EpcX2SapUser::LoadInformationParams params)
Receive load information function.
void ConnectionRequestTimeout(uint16_t rnti)
Method triggered when a UE is expected to request for connection but does not do so in a reasonable t...
uint16_t DoAllocateTemporaryCellRnti(uint8_t componentCarrierId)
Allocate temporary cell RNTI function.
std::vector< LteEnbCphySapUser * > m_cphySapUser
Receive API calls from the eNodeB PHY instances.
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureJoiningTrace
The 'HandoverFailureJoining' Trace source.
void SetLteHandoverManagementSapProvider(LteHandoverManagementSapProvider *s)
set the Handover Management SAP this RRC should interact with
void SetLteFfrRrcSapProvider(LteFfrRrcSapProvider *s)
set the FFR SAP this RRC should interact with
LteCcmRrcSapUser * GetLteCcmRrcSapUser()
Get the Component Carrier Management SAP offered by this RRC.
void SetLteEnbCphySapProvider(LteEnbCphySapProvider *s)
set the CPHY SAP this RRC should use to interact with the PHY
void DoDispose() override
Destructor implementation.
std::vector< LteFfrRrcSapUser * > m_ffrRrcSapUser
Receive API calls from the FFR algorithm instance.
EpcX2SapProvider * m_x2SapProvider
Interface to send messages to neighbour eNodeB over the X2 interface.
std::vector< LteEnbCmacSapProvider * > m_cmacSapProvider
Interface to the eNodeB MAC instance.
std::vector< LteRrcSap::SystemInformationBlockType1 > m_sib1
The System Information Block Type 1 that is currently broadcasted over BCH.
void DoDataRadioBearerSetupRequest(EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params)
Data radio beaerer setup request function.
LteAnrSapUser * GetLteAnrSapUser()
Get the ANR SAP offered by this RRC.
void SetLteCcmRrcSapProvider(LteCcmRrcSapProvider *s)
set the Component Carrier Management SAP this RRC should interact with
LteEnbRrcSapProvider * m_rrcSapProvider
Interface to receive messages from UE over the RRC protocol.
bool m_carriersConfigured
are carriers configured
void SetForwardUpCallback(Callback< void, Ptr< Packet > > cb)
set the callback used to forward data packets up the stack
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionEstablishedTrace
The ConnectionEstablished trace source.
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureLeavingTrace
The 'HandoverFailureLeaving' Trace source.
TracedCallback< uint64_t, uint16_t, uint16_t, std::string > m_rrcTimeoutTrace
The 'TimerExpiry' Trace source.
void DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
Trigger handover function.
void DoRecvIdealUeContextRemoveRequest(uint16_t rnti)
Part of the RRC protocol.
void SetCellId(uint16_t m_cellId)
set the cell id of this eNB
EpcEnbS1SapUser * m_s1SapUser
Interface to receive messages from core network over the S1 protocol.
void RemoveSrsConfigurationIndex(uint16_t srcCi)
remove a previously allocated SRS configuration index
Time m_handoverJoiningTimeoutDuration
The HandoverJoiningTimeoutDuration attribute.
void ConfigureCell(std::map< uint8_t, Ptr< ComponentCarrierBaseStation > > ccPhyConf)
Configure cell-specific parameters.
void SetLteEnbCmacSapProvider(LteEnbCmacSapProvider *s)
set the CMAC SAP this RRC should interact with
uint16_t m_dlBandwidth
Downlink transmission bandwidth configuration in number of Resource Blocks.
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverEndOkTrace
The HandoverEndOk trace source.
uint8_t CellToComponentCarrierId(uint16_t cellId)
convert the cell id to component carrier id
void SetEpcX2SapProvider(EpcX2SapProvider *s)
Set the X2 SAP this RRC should interact with.
void DoRecvHandoverCancel(EpcX2SapUser::HandoverCancelParams params)
Receive Handover Cancel function.
Part of the RRC protocol.
Part of the RRC protocol.
virtual void SendSystemInformation(uint16_t cellId, SystemInformation msg)=0
Send a SystemInformation message to all attached UEs during a system information acquisition procedur...
virtual void RemoveUe(uint16_t rnti)=0
Remove UE function.
virtual Ptr< Packet > EncodeHandoverCommand(RrcConnectionReconfiguration msg)=0
Encode handover command.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Service Access Point (SAP) offered by the handover algorithm instance to the eNodeB RRC instance.
Service Access Point (SAP) offered by the eNodeB RRC instance to the handover algorithm instance.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition lte-mac-sap.h:25
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition lte-mac-sap.h:85
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
Send RRC PDU parameters to the PDCP for transmission.
LTE RLC Acknowledged Mode (AM), see 3GPP TS 36.322.
Definition lte-rlc-am.h:27
static TypeId GetTypeId()
Get the type ID.
Definition lte-rlc-am.cc:76
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE,...
Definition lte-rlc.h:38
static TypeId GetTypeId()
Get the type ID.
Definition lte-rlc.cc:186
static TypeId GetTypeId()
Get the type ID.
Definition lte-rlc-um.cc:45
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
Convert PDSCH config dedicated function.
Template for the implementation of the LteEnbCphySapUser as a member of an owner class of type C to w...
Template for the implementation of the LteFfrRrcSapUser as a member of an owner class of type C to wh...
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Definition object.h:78
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition object.h:511
virtual void DoInitialize()
Initialize() implementation.
Definition object.cc:440
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
@ ATTR_GET
The attribute can be read.
Definition type-id.h:53
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition type-id.h:55
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
bool m_pendingStartDataRadioBearers
Pending start data radio bearers.
void RecvRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentRequest interface.
void InitialContextSetupRequest()
Process Initial context setup request message from the MME.
void RecvUeContextRelease(EpcX2SapUser::UeContextReleaseParams params)
Take the necessary actions in response to the reception of an X2 UE CONTEXT RELEASE message.
void RecordDataRadioBearersToBeStarted()
Start all configured data radio bearers.
std::map< uint8_t, Ptr< LteDataRadioBearerInfo > > m_drbMap
The DataRadioBearerMap attribute.
Ptr< LteSignalingRadioBearerInfo > m_srb1
The Srb1 attribute.
void PrepareHandover(uint16_t cellId)
Start the handover preparation and send the handover request.
void SetImsi(uint64_t imsi)
Set the IMSI.
void SendData(uint8_t bid, Ptr< Packet > p)
Send a data packet over the appropriate Data Radio Bearer.
void SendRrcConnectionRelease()
This function acts as an interface to trigger the connection release towards eNB, EPC and UE.
EpcX2Sap::HandoverCancelParams BuildHoCancelMsg()
build handover cancel message
void CompleteSetupUe(LteEnbRrcSapProvider::CompleteSetupUeParameters params)
Implement the LteEnbRrcSapProvider::CompleteSetupUe interface.
bool m_needPhyMacConfiguration
need Phy MAC configuration
State
The state of the UeManager at the eNB RRC.
Definition lte-enb-rrc.h:67
@ CONNECTION_REESTABLISHMENT
Definition lte-enb-rrc.h:74
@ CONNECTION_RECONFIGURATION
Definition lte-enb-rrc.h:73
LteRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo()
void CmacUeConfigUpdateInd(LteEnbCmacSapUser::UeConfig cmacParams)
CMAC UE config update indication function.
void RecvHandoverCancel(EpcX2SapUser::HandoverCancelParams params)
Take the necessary actions in response to the reception of an X2 UE CONTEXT RELEASE message.
void DoDispose() override
Destructor implementation.
LteRrcSap::RrcConnectionReconfiguration BuildRrcConnectionReconfiguration()
EventId m_handoverJoiningTimeout
Time limit before a handover joining timeout occurs.
uint8_t AddDataRadioBearerInfo(Ptr< LteDataRadioBearerInfo > radioBearerInfo)
Add a new LteDataRadioBearerInfo structure to the UeManager.
uint16_t GetSrsConfigurationIndex() const
uint8_t Lcid2Bid(uint8_t lcid)
uint16_t m_rnti
The C-RNTI attribute.
void RecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
Take the necessary actions in response to the reception of an X2 SN STATUS TRANSFER message.
~UeManager() override
uint8_t Bid2Lcid(uint8_t bid)
LteRrcSap::PhysicalConfigDedicated m_physicalConfigDedicated
physical config dedicated
void RecvRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionSetupCompleted interface.
std::list< uint8_t > m_drbsToBeStarted
DRBS to be started.
uint8_t m_lastAllocatedDrbid
last allocated Data Radio Bearer ID
uint8_t GetComponentCarrierId() const
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
EventId m_connectionRejectedTimeout
The delay before a connection rejected timeout occurs.
void RemoveDataRadioBearerInfo(uint8_t drbid)
remove the LteDataRadioBearerInfo corresponding to a bearer being released
void SetupDataRadioBearer(EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress)
Setup a new data radio bearer, including both the configuration within the eNB and the necessary RRC ...
void RecvRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReconfigurationCompleted interface.
TracedCallback< uint64_t, uint16_t, uint16_t, uint8_t > m_drbCreatedTrace
The DrbCreated trace source.
State GetState() const
uint16_t m_targetX2apId
target X2 ap ID
uint8_t Drbid2Bid(uint8_t drbid)
static TypeId GetTypeId()
Get the type ID.
Ptr< LteSignalingRadioBearerInfo > m_srb0
The Srb0 attribute.
uint64_t GetImsi() const
EventId m_connectionRequestTimeout
Time limit before a connection request timeout occurs.
uint64_t m_imsi
International Mobile Subscriber Identity assigned to this UE.
uint8_t GetNewRrcTransactionIdentifier()
bool m_caSupportConfigured
Define if the Carrier Aggregation was already configure for the current UE on not.
uint16_t m_targetCellId
target cell ID
void SetSrsConfigurationIndex(uint16_t srsConfIndex)
Set the SRS configuration index and do the necessary reconfiguration.
uint16_t GetRnti() const
Ptr< LteDataRadioBearerInfo > GetDataRadioBearerInfo(uint8_t drbid)
void SendPacket(uint8_t bid, Ptr< Packet > p)
Send a data packet over the appropriate Data Radio Bearer.
void SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
Set the identifiers of the source eNB for the case where a UE joins the current eNB as part of a hand...
LteRrcSap::NonCriticalExtensionConfiguration BuildNonCriticalExtensionConfigurationCa()
std::list< std::pair< uint8_t, Ptr< Packet > > > m_packetBuffer
Packet buffer for when UE is doing the handover.
friend class LtePdcpSpecificLtePdcpSapUser< UeManager >
allow LtePdcpSpecificLtePdcpSapUser<UeManager> class friend access
Definition lte-enb-rrc.h:59
uint8_t m_lastRrcTransactionIdentifier
last RRC transaction identifier
uint8_t m_componentCarrierId
ID of the primary CC for this UE.
State m_state
The current UeManager state.
void RecvMeasurementReport(LteRrcSap::MeasurementReport msg)
Implement the LteEnbRrcSapProvider::RecvMeasurementReport interface.
void DoInitialize() override
Initialize() implementation.
Ptr< LteEnbRrc > m_rrc
Pointer to the parent eNodeB RRC.
TracedCallback< uint64_t, uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
bool m_pendingRrcConnectionReconfiguration
pending RRC connection reconfiguration
void ReleaseDataRadioBearer(uint8_t drbid)
Release a given radio bearer.
void RecvRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentComplete interface.
uint8_t Bid2Drbid(uint8_t bid)
LteRrcSap::RrcConnectionReconfiguration GetRrcConnectionReconfigurationForHandover(uint8_t componentCarrierId)
void StartDataRadioBearers()
Start the data radio bearers that have been previously recorded to be started using RecordDataRadioBe...
void SendUeContextRelease()
send the UE CONTEXT RELEASE X2 message to the source eNB, thus successfully terminating an X2 handove...
void RecvHandoverRequestAck(EpcX2SapUser::HandoverRequestAckParams params)
take the necessary actions in response to the reception of an X2 HANDOVER REQUEST ACK message
LteRrcSap::RadioResourceConfigDedicated BuildRadioResourceConfigDedicated()
void CancelPendingEvents()
Cancel all timers which are running for the UE.
uint8_t Lcid2Drbid(uint8_t lcid)
void ScheduleRrcConnectionReconfiguration()
schedule an RRC Connection Reconfiguration procedure with the UE
uint16_t m_sourceCellId
source cell ID
void RecvHandoverPreparationFailure(uint16_t cellId)
Take the necessary actions in response to the reception of an X2 HO preparation failure message.
EpcX2Sap::HandoverPreparationFailureParams BuildHoPrepFailMsg()
build handover preparation failure message
EventId m_handoverLeavingTimeout
Time limit before a handover leaving timeout occurs.
uint16_t m_sourceX2apId
source X2 ap ID
std::vector< EpcX2Sap::ErabToBeSetupItem > GetErabList()
void RecvRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionRequest interface.
uint8_t Drbid2Lcid(uint8_t drbid)
LtePdcpSapUser * m_drbPdcpSapUser
DRB PDCP SAP user.
void SwitchToState(State s)
Switch the UeManager to the given state.
void SetPdschConfigDedicated(LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
Configure PdschConfigDedicated (i.e.
EventId m_connectionSetupTimeout
Time limit before a connection setup timeout occurs.
void RecvIdealUeContextRemoveRequest(uint16_t rnti)
Implement the LteEnbRrcSapProvider::RecvIdealUeContextRemoveRequest interface.
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#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:75
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition pointer.h:248
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:269
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:97
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition abort.h:65
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#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:250
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1320
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition integer.h:99
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition integer.h:35
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition nstime.h:1396
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Definition object-map.h:29
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition enum.h:179
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
constexpr uint32_t MIN_NO_CC
Minimum number of carrier components allowed by 3GPP up to R13.
Definition lte-common.h:25
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition lte-common.h:28
static const std::string g_ueManagerStateName[UeManager::NUM_STATES]
Map each of UE Manager states to its string representation.
static const uint16_t g_srsCiLow[SRS_ENTRIES]
The lower bound (inclusive) of the SRS configuration indices (ISRS) which use the corresponding SRS p...
static const uint16_t g_srsCiHigh[SRS_ENTRIES]
The upper bound (inclusive) of the SRS configuration indices (ISRS) which use the corresponding SRS p...
static const uint8_t SRS_ENTRIES
Number of distinct SRS periodicity plus one.
static const uint16_t g_srsPeriodicity[SRS_ENTRIES]
Sounding Reference Symbol (SRS) periodicity (TSRS) in milliseconds.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition object-map.h:65
Ptr< const AttributeChecker > MakeObjectMapChecker()
Definition object-map.h:110
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition enum.h:221
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1416
static const std::string & ToString(EpcUeNas::State s)
Definition epc-ue-nas.cc:37
PathSwitchRequestParameters structure.
Parameters passed to DataRadioBearerSetupRequest ()
EpsBearer bearer
the characteristics of the bearer to be setup
uint16_t rnti
the RNTI identifying the UE for which the DataRadioBearer is to be created
uint32_t gtpTeid
S1-bearer GTP tunnel endpoint identifier, see 36.423 9.2.1.
Ipv4Address transportLayerAddress
IP Address of the SGW, see 36.423 9.2.1.
Parameters passed to InitialContextSetupRequest ()
PathSwitchRequestAcknowledgeParameters structure.
E-RABs admitted item as it is used in the HANDOVER REQUEST ACKNOWLEDGE message.
Definition epc-x2-sap.h:65
E-RABs to be setup item as it is used in the HANDOVER REQUEST message.
Definition epc-x2-sap.h:49
bool dlForwarding
DL forwarding.
Definition epc-x2-sap.h:52
Ipv4Address transportLayerAddress
transport layer address
Definition epc-x2-sap.h:53
EpsBearer erabLevelQosParameters
E-RAB level QOS parameters.
Definition epc-x2-sap.h:51
ErabsSubjectToStatusTransferItem structure.
Definition epc-x2-sap.h:91
Parameters of the HANDOVER CANCEL message.
Definition epc-x2-sap.h:334
Parameters of the HANDOVER PREPARATION FAILURE message.
Definition epc-x2-sap.h:253
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
Definition epc-x2-sap.h:237
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
Definition epc-x2-sap.h:242
uint16_t sourceCellId
source cell ID
Definition epc-x2-sap.h:240
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition epc-x2-sap.h:239
uint16_t targetCellId
target cell ID
Definition epc-x2-sap.h:241
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition epc-x2-sap.h:238
Ptr< Packet > rrcContext
RRC context.
Definition epc-x2-sap.h:244
Parameters of the HANDOVER REQUEST message.
Definition epc-x2-sap.h:219
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition epc-x2-sap.h:220
uint16_t sourceCellId
source cell ID
Definition epc-x2-sap.h:222
uint16_t targetCellId
target cell ID
Definition epc-x2-sap.h:223
uint32_t mmeUeS1apId
MME UE S1 AP ID.
Definition epc-x2-sap.h:224
std::vector< ErabToBeSetupItem > bearers
bearers
Definition epc-x2-sap.h:227
Parameters of the LOAD INFORMATION message.
Definition epc-x2-sap.h:295
Parameters of the RESOURCE STATUS UPDATE message.
Definition epc-x2-sap.h:306
Parameters of the SN STATUS TRANSFER message.
Definition epc-x2-sap.h:267
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition epc-x2-sap.h:269
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
Definition epc-x2-sap.h:273
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition epc-x2-sap.h:268
uint16_t targetCellId
target cell ID
Definition epc-x2-sap.h:271
uint16_t sourceCellId
source cell ID
Definition epc-x2-sap.h:270
Parameters of the UE CONTEXT RELEASE message.
Definition epc-x2-sap.h:282
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition epc-x2-sap.h:284
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition epc-x2-sap.h:283
uint16_t sourceCellId
source cell ID
Definition epc-x2-sap.h:285
uint16_t targetCellId
target cell ID
Definition epc-x2-sap.h:286
Parameters of the UE DATA primitive.
Definition epc-x2-sap.h:321
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition eps-bearer.h:32
bool valid
true if a valid RA config was allocated, false otherwise
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
uint64_t gbrUl
guaranteed bitrate in uplink
uint8_t qci
QoS Class Identifier.
uint64_t mbrDl
maximum bitrate in downlink
uint64_t mbrUl
maximum bitrate in uplink
uint8_t lcGroup
logical channel group
uint8_t resourceType
0 if the bearer is NON-GBR, 1 if the bearer is GBR, 2 if the bearer in DC-GBR
uint64_t gbrDl
guaranteed bitrate in downlink
uint8_t lcId
logical channel identifier
uint16_t rnti
C-RNTI identifying the UE.
struct defining the RACH configuration of the MAC
Parameters for [re]configuring the UE.
uint16_t m_rnti
UE id within this cell.
uint8_t m_transmissionMode
Transmission mode [1..7] (i.e., SISO, MIMO, etc.)
Parameters for [re]configuring the UE.
uint16_t m_rnti
UE id within this cell.
uint8_t m_transmissionMode
Transmission mode [1..7] (i.e., SISO, MIMO, etc.)
X2uTeidInfo structure.
CompleteSetupUeParameters structure.
SetupUeParameters structure.
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
Status variables of the PDCP.
Definition lte-pdcp.h:91
uint16_t rxSn
RX sequence number.
Definition lte-pdcp.h:93
uint16_t txSn
TX sequence number.
Definition lte-pdcp.h:92
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
uint16_t antennaPortsCount
antenna ports count
uint8_t transmissionMode
transmission mode
RadioResourceConfigDedicated sourceRadioResourceConfig
source radio resource config
MasterInformationBlock sourceMasterInformationBlock
source master information block
uint16_t sourceUeIdentity
source UE identity
MeasConfig sourceMeasConfig
source measure config
uint32_t sourceDlCarrierFreq
source DL carrier frequency
SystemInformationBlockType1 sourceSystemInformationBlockType1
source system information block type 1
SystemInformationBlockType2 sourceSystemInformationBlockType2
source system information block type 2
uint32_t dlCarrierFreq
DL carrier frequency.
uint32_t ulCarrierFreq
UL carrier frequency.
uint32_t dlCarrierFreq
ARFCN - valueEUTRA.
uint32_t physCellId
physical cell ID
int8_t qRxLevMin
INTEGER (-70..-22), actual value = IE value * 2 [dBm].
Definition lte-rrc-sap.h:70
int8_t qQualMin
INTEGER (-34..-3), actual value = IE value [dB].
Definition lte-rrc-sap.h:71
DrbToAddMod structure.
uint8_t epsBearerIdentity
EPS bearer identity.
RlcConfig rlcConfig
RLC config.
uint8_t logicalChannelIdentity
logical channel identify
uint8_t drbIdentity
DRB identity.
LogicalChannelConfig logicalChannelConfig
logical channel config
uint32_t ulCarrierFreq
UL carrier frequency.
Definition lte-rrc-sap.h:77
uint16_t ulBandwidth
UL bandwidth.
Definition lte-rrc-sap.h:78
HandoverPreparationInfo structure.
MasterInformationBlock structure.
uint16_t systemFrameNumber
system frame number
std::list< MeasObjectToAddMod > measObjectToAddModList
measure object to add mod list
bool haveMeasGapConfig
have measure gap config?
QuantityConfig quantityConfig
quantity config
bool haveSmeasure
have S measure?
bool haveSpeedStatePars
have speed state parameters?
std::list< ReportConfigToAddMod > reportConfigToAddModList
report config to add mod list
std::list< MeasIdToAddMod > measIdToAddModList
measure ID to add mod list
bool haveQuantityConfig
have quantity config?
MeasIdToAddMod structure.
uint8_t measObjectId
measure object ID
uint8_t reportConfigId
report config ID
bool haveCellForWhichToReportCGI
have cell for which to report CGI?
uint16_t allowedMeasBandwidth
allowed measure bandwidth
int8_t offsetFreq
offset frequency
uint8_t neighCellConfig
neighbor cell config
bool presenceAntennaPort1
antenna port 1 present?
uint32_t carrierFreq
carrier frequency
MeasObjectToAddMod structure.
uint8_t measObjectId
measure object ID
MeasObjectEutra measObjectEutra
measure object eutra
uint8_t rsrqResult
the RSRQ result
uint8_t rsrpResult
the RSRP result
uint8_t measId
measure ID
bool haveMeasResultNeighCells
have measure result neighbor cells
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
bool haveMeasResultServFreqList
has measResultServFreqList-r10
std::list< MeasResultServFreq > measResultServFreqList
MeasResultServFreqList-r10.
MeasResultPCell measResultPCell
measurement result primary cell
MeasurementReport structure.
MeasResults measResults
measure results
RadioResourceConfigCommon radioResourceConfigCommon
radio resource config common
RachConfigDedicated rachConfigDedicated
RACH config dedicated.
bool haveRachConfigDedicated
Have RACH config dedicated?
uint16_t newUeIdentity
new UE identity
bool haveCarrierBandwidth
have carrier bandwidth?
bool haveCarrierFreq
have carrier frequency?
CarrierBandwidthEutra carrierBandwidth
carrier bandwidth
CarrierFreqEutra carrierFreq
carrier frequency
uint16_t targetPhysCellId
target Phy cell ID
NonCriticalExtensionConfiguration structure.
std::list< uint8_t > sCellToReleaseList
SCell to release list.
std::list< SCellToAddMod > sCellToAddModList
SCell to add mod list.
AntennaInfoCommon antennaInfoCommon
2: Physical configuration, general antennaInfoCommon-r10
PdschConfigCommon pdschConfigCommon
4: Physical configuration, physical channels pdsch-ConfigCommon-r10
uint16_t dlBandwidth
1: Cell characteristics
int8_t referenceSignalPower
INTEGER (-60..50),.
int8_t pb
INTEGER (0..3),.
PdschConfigDedicated structure.
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
bool haveAntennaInfoDedicated
have antenna info dedicated?
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
bool havePdschConfigDedicated
have PDSCH config dedicated?
AntennaInfoDedicated antennaInfo
antenna info
PuschConfigDedicatedSCell pushConfigDedicatedSCell
PUSCH config dedicated SCell.
AntennaInfoDedicated antennaInfoUl
antenna info UL
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
bool haveUlConfiguration
have UL configuration?
bool haveAntennaInfoUlDedicated
have antenna info UL dedicated?
bool havePdschConfigDedicated
have PDSCH config dedicated?
bool crossCarrierSchedulingConfig
currently implemented as boolean variable --> implementing crossCarrierScheduling is out of the scope...
bool haveNonUlConfiguration
have non UL configuration?
AntennaInfoDedicated antennaInfo
antenna info dedicated
bool haveAntennaInfoDedicated
have antenna info dedicated?
UlPowerControlDedicatedSCell ulPowerControlDedicatedSCell
UL power control dedicated SCell.
uint32_t plmnIdentity
PLMN identity.
Definition lte-rrc-sap.h:55
uint8_t numberOfRaPreambles
number of RA preambles
uint16_t nPuschIdentity
3GPP TS 36.331 v.11.10 R11 page 216
uint8_t filterCoefficientRSRQ
filter coefficient RSRQ
uint8_t filterCoefficientRSRP
filter coefficient RSRP
uint8_t raResponseWindowSize
RA response window size.
uint8_t preambleTransMax
preamble transmit maximum
RachConfigCommon structure.
TxFailParam txFailParam
txFailParams
PreambleInfo preambleInfo
preamble info
RaSupervisionInfo raSupervisionInfo
RA supervision info.
uint8_t raPreambleIndex
RA preamble index.
uint8_t raPrachMaskIndex
RA PRACH mask index.
RachConfigCommon rachConfigCommon
RACH config common.
NonUlConfiguration nonUlConfiguration
non UL configuration
bool haveUlConfiguration
have UL configuration
bool haveNonUlConfiguration
have non UL configuration?
UlConfiguration ulConfiguration
UL configuration.
RachConfigCommon rachConfigCommon
RACH config common.
PdschConfigCommon pdschConfigCommon
PDSCH config common.
RadioResourceConfigDedicated structure.
PhysicalConfigDedicated physicalConfigDedicated
physical config dedicated
std::list< uint8_t > drbToReleaseList
DRB to release list.
bool havePhysicalConfigDedicated
have physical config dedicated?
std::list< DrbToAddMod > drbToAddModList
DRB to add mod list.
std::list< SrbToAddMod > srbToAddModList
SRB to add mod list.
PhysicalConfigDedicatedSCell physicalConfigDedicatedSCell
physical config dedicated SCell
Specifies criteria for triggering of an E-UTRA measurement reporting event.
enum ns3::LteRrcSap::ReportConfigEutra::@62 eventId
Event enumeration.
@ RSRP
Reference Signal Received Power.
@ RSRQ
Reference Signal Received Quality.
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
@ EVENT_A4
Event A4: Neighbour becomes better than absolute threshold.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
@ EVENT_A5
Event A5: PCell becomes worse than absolute threshold1 AND Neighbour becomes better than another abso...
ThresholdEutra threshold2
Threshold for event A5.
enum ns3::LteRrcSap::ReportConfigEutra::@63 triggerQuantity
Trigger type enumeration.
@ BOTH
Both the RSRP and RSRQ quantities are to be included in the measurement report.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
enum ns3::LteRrcSap::ReportConfigEutra::@64 reportQuantity
Report type enumeration.
ReportConfigToAddMod structure.
uint8_t reportConfigId
report config ID
ReportConfigEutra reportConfigEutra
report config eutra
RrcConnectionReconfigurationCompleted structure.
RrcConnectionReconfiguration structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
bool haveMobilityControlInfo
have mobility control info
NonCriticalExtensionConfiguration nonCriticalExtension
3GPP TS 36.331 v.11.10 R11 Sec.
bool haveNonCriticalExtension
have critical extension?
MobilityControlInfo mobilityControlInfo
mobility control info
RrcConnectionReestablishmentComplete structure.
RrcConnectionReestablishment structure.
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionReestablishmentRequest structure.
RrcConnectionReject structure.
RrcConnectionRelease structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionRequest structure.
RrcConnectionSetupCompleted structure.
RrcConnectionSetup structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
SCellToAddMod structure.
RadioResourceConfigDedicatedSCell radioResourceConfigDedicatedSCell
radio resource config dedicated SCell
uint32_t sCellIndex
SCell index.
bool haveRadioResourceConfigDedicatedSCell
have radio resource config dedicated SCell?
CellIdentification cellIdentification
cell identification
RadioResourceConfigCommonSCell radioResourceConfigCommonSCell
radio resource config common SCell
uint8_t srsSubframeConfig
SRS subframe config.
uint16_t srsBandwidthConfig
SRS bandwidth config.
uint16_t srsConfigIndex
SRS config index.
SrbToAddMod structure.
LogicalChannelConfig logicalChannelConfig
logical channel config
uint8_t srbIdentity
SB identity.
SystemInformationBlockType1 structure.
CellSelectionInfo cellSelectionInfo
cell selection info
CellAccessRelatedInfo cellAccessRelatedInfo
cell access related info
RadioResourceConfigCommonSib radioResourceConfigCommon
radio resource config common
SystemInformation structure.
SystemInformationBlockType2 sib2
SIB2.
@ THRESHOLD_RSRP
RSRP is used for the threshold.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
enum ns3::LteRrcSap::ThresholdEutra::@60 choice
Threshold enumeration.
uint8_t connEstFailCount
Number of times that the UE detects T300 expiry on the same cell.
UlPowerControlCommonSCell ulPowerControlCommonSCell
3GPP TS 36.331 v.11.10 R11 pag.223
FreqInfo ulFreqInfo
UL frequency info.
SoundingRsUlConfigCommon soundingRsUlConfigCommon
sounding RS UL config common
PrachConfigSCell prachConfigSCell
PRACH config SCell.
uint16_t pSrsOffset
3GPP TS 36.331 v.11.10 R11 page 234