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
106
108{
109 NS_FATAL_ERROR("this constructor is not expected to be used");
110}
111
112UeManager::UeManager(Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId)
113 : m_lastAllocatedDrbid(0),
114 m_rnti(rnti),
115 m_imsi(0),
116 m_componentCarrierId(componentCarrierId),
117 m_lastRrcTransactionIdentifier(0),
118 m_rrc(rrc),
119 m_state(s),
120 m_pendingRrcConnectionReconfiguration(false),
121 m_sourceX2apId(0),
122 m_sourceCellId(0),
123 m_needPhyMacConfiguration(false),
124 m_caSupportConfigured(false),
125 m_pendingStartDataRadioBearers(false)
126{
127 NS_LOG_FUNCTION(this);
128}
129
130void
132{
133 NS_LOG_FUNCTION(this);
135
137 m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
140 m_rrc->GetNewSrsConfigurationIndex();
146
147 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
148 {
149 m_rrc->m_cmacSapProvider.at(i)->AddUe(m_rnti);
150 m_rrc->m_cphySapProvider.at(i)->AddUe(m_rnti);
151 }
152
153 // setup the eNB side of SRB0
154 {
155 uint8_t lcid = 0;
156
157 Ptr<LteRlc> rlc = CreateObject<LteRlcTm>()->GetObject<LteRlc>();
158 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
159 rlc->SetRnti(m_rnti);
160 rlc->SetLcId(lcid);
161
163 m_srb0->m_rlc = rlc;
164 m_srb0->m_srbIdentity = 0;
165 // no need to store logicalChannelConfig as SRB0 is pre-configured
166
168 lcinfo.rnti = m_rnti;
169 lcinfo.lcId = lcid;
170 // Initialise the rest of lcinfo structure even if CCCH (LCID 0) is pre-configured, and only
171 // m_rnti and lcid will be used from passed lcinfo structure. See FF LTE MAC Scheduler
172 // Iinterface Specification v1.11, 4.3.4 logicalChannelConfigListElement
173 lcinfo.lcGroup = 0;
174 lcinfo.qci = 0;
175 lcinfo.resourceType = 0;
176 lcinfo.mbrUl = 0;
177 lcinfo.mbrDl = 0;
178 lcinfo.gbrUl = 0;
179 lcinfo.gbrDl = 0;
180
181 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
182 LteMacSapUser* lteMacSapUser =
183 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
184 // Signal Channel are only on Primary Carrier
185 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, lteMacSapUser);
186 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, lteMacSapUser);
187 }
188
189 // setup the eNB side of SRB1; the UE side will be set up upon RRC connection establishment
190 {
191 uint8_t lcid = 1;
192
193 Ptr<LteRlc> rlc = CreateObject<LteRlcAm>()->GetObject<LteRlc>();
194 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
195 rlc->SetRnti(m_rnti);
196 rlc->SetLcId(lcid);
197
199 pdcp->SetRnti(m_rnti);
200 pdcp->SetLcId(lcid);
201 pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
202 pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
203 rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
204
206 m_srb1->m_rlc = rlc;
207 m_srb1->m_pdcp = pdcp;
208 m_srb1->m_srbIdentity = 1;
209 m_srb1->m_logicalChannelConfig.priority = 1;
210 m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
211 m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
212 m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
213
215 lcinfo.rnti = m_rnti;
216 lcinfo.lcId = lcid;
217 lcinfo.lcGroup = 0; // all SRBs always mapped to LCG 0
218 lcinfo.qci =
219 EpsBearer::GBR_CONV_VOICE; // not sure why the FF API requires a CQI even for SRBs...
220 lcinfo.resourceType = 1; // GBR resource type
221 lcinfo.mbrUl = 1e6;
222 lcinfo.mbrDl = 1e6;
223 lcinfo.gbrUl = 1e4;
224 lcinfo.gbrDl = 1e4;
225 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
226 LteMacSapUser* MacSapUserForRlc =
227 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
228 // Signal Channel are only on Primary Carrier
229 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, MacSapUserForRlc);
230 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, MacSapUserForRlc);
231 }
232
234 ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider();
235 ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider();
236 m_rrc->m_rrcSapUser->SetupUe(m_rnti, ueParams);
237
238 // configure MAC (and scheduler)
240 req.m_rnti = m_rnti;
242
243 // configure PHY
244 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
245 {
246 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
247 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(
248 m_rnti,
250 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
251 m_rnti,
253 }
254 // schedule this UeManager instance to be deleted if the UE does not give any sign of life
255 // within a reasonable time
256 Time maxConnectionDelay;
257 switch (m_state)
258 {
260 m_connectionRequestTimeout = Simulator::Schedule(m_rrc->m_connectionRequestTimeoutDuration,
262 m_rrc,
263 m_rnti);
264 break;
265
266 case HANDOVER_JOINING:
267 m_handoverJoiningTimeout = Simulator::Schedule(m_rrc->m_handoverJoiningTimeoutDuration,
269 m_rrc,
270 m_rnti);
271 break;
272
273 default:
274 NS_FATAL_ERROR("unexpected state " << m_state);
275 break;
276 }
277 m_caSupportConfigured = false;
278}
279
283
284void
286{
287 delete m_drbPdcpSapUser;
288 // delete eventual X2-U TEIDs
289 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
290 {
291 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
292 }
293}
294
295TypeId
297{
298 static TypeId tid =
299 TypeId("ns3::UeManager")
300 .SetParent<Object>()
301 .AddConstructor<UeManager>()
302 .AddAttribute("DataRadioBearerMap",
303 "List of UE DataRadioBearerInfo by DRBID.",
307 .AddAttribute("Srb0",
308 "SignalingRadioBearerInfo for SRB0",
309 PointerValue(),
312 .AddAttribute("Srb1",
313 "SignalingRadioBearerInfo for SRB1",
314 PointerValue(),
317 .AddAttribute("C-RNTI",
318 "Cell Radio Network Temporary Identifier",
319 TypeId::ATTR_GET, // read-only attribute
320 UintegerValue(0), // unused, read-only attribute
323 .AddTraceSource("StateTransition",
324 "fired upon every UE state transition seen by the "
325 "UeManager at the eNB RRC",
327 "ns3::UeManager::StateTracedCallback")
328 .AddTraceSource("DrbCreated",
329 "trace fired after DRB is created",
331 "ns3::UeManager::ImsiCidRntiLcIdTracedCallback");
332 return tid;
333}
334
335void
336UeManager::SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
337{
338 m_sourceX2apId = sourceX2apId;
339 m_sourceCellId = sourceCellId;
340}
341
342void
343UeManager::SetImsi(uint64_t imsi)
344{
345 m_imsi = imsi;
346}
347
348void
350{
351 NS_LOG_FUNCTION(this << m_rnti);
352
353 if (m_state == ATTACH_REQUEST)
354 {
356 }
357 else
358 {
359 NS_FATAL_ERROR("method unexpected in state " << m_state);
360 }
361}
362
363void
365 uint8_t bearerId,
366 uint32_t gtpTeid,
367 Ipv4Address transportLayerAddress)
368{
370
372 uint8_t drbid = AddDataRadioBearerInfo(drbInfo);
373 uint8_t lcid = Drbid2Lcid(drbid);
374 uint8_t bid = Drbid2Bid(drbid);
375 NS_ASSERT_MSG(bearerId == 0 || bid == bearerId,
376 "bearer ID mismatch (" << (uint32_t)bid << " != " << (uint32_t)bearerId
377 << ", the assumption that ID are allocated in the same "
378 "way by MME and RRC is not valid any more");
379 drbInfo->m_epsBearer = bearer;
380 drbInfo->m_epsBearerIdentity = bid;
381 drbInfo->m_drbIdentity = drbid;
382 drbInfo->m_logicalChannelIdentity = lcid;
383 drbInfo->m_gtpTeid = gtpTeid;
384 drbInfo->m_transportLayerAddress = transportLayerAddress;
385
387 {
388 // setup TEIDs for receiving data eventually forwarded over X2-U
389 LteEnbRrc::X2uTeidInfo x2uTeidInfo;
390 x2uTeidInfo.rnti = m_rnti;
391 x2uTeidInfo.drbid = drbid;
392 auto ret = m_rrc->m_x2uTeidInfoMap.insert(
393 std::pair<uint32_t, LteEnbRrc::X2uTeidInfo>(gtpTeid, x2uTeidInfo));
394 NS_ASSERT_MSG(ret.second == true, "overwriting a pre-existing entry in m_x2uTeidInfoMap");
395 }
396
397 TypeId rlcTypeId = m_rrc->GetRlcType(bearer);
398
399 ObjectFactory rlcObjectFactory;
400 rlcObjectFactory.SetTypeId(rlcTypeId);
401 Ptr<LteRlc> rlc = rlcObjectFactory.Create()->GetObject<LteRlc>();
402 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
403 rlc->SetRnti(m_rnti);
404 rlc->SetPacketDelayBudgetMs(bearer.GetPacketDelayBudgetMs());
405
406 drbInfo->m_rlc = rlc;
407
408 rlc->SetLcId(lcid);
409
410 // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
411 // if we are using RLC/SM we don't care of anything above RLC
412 if (rlcTypeId != LteRlcSm::GetTypeId())
413 {
415 pdcp->SetRnti(m_rnti);
416 pdcp->SetLcId(lcid);
417 pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
418 pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
419 rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
420 drbInfo->m_pdcp = pdcp;
421 }
422
423 m_drbCreatedTrace(m_imsi, m_rrc->ComponentCarrierToCellId(m_componentCarrierId), m_rnti, lcid);
424
425 std::vector<LteCcmRrcSapProvider::LcsConfig> lcOnCcMapping =
426 m_rrc->m_ccmRrcSapProvider->SetupDataRadioBearer(bearer,
427 bearerId,
428 m_rnti,
429 lcid,
430 m_rrc->GetLogicalChannelGroup(bearer),
431 rlc->GetLteMacSapUser());
432 // LteEnbCmacSapProvider::LcInfo lcinfo;
433 // lcinfo.rnti = m_rnti;
434 // lcinfo.lcId = lcid;
435 // lcinfo.lcGroup = m_rrc->GetLogicalChannelGroup (bearer);
436 // lcinfo.qci = bearer.qci;
437 // lcinfo.resourceType = bearer.GetResourceType();
438 // lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
439 // lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
440 // lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
441 // lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
442 // use a for cycle to send the AddLc to the appropriate Mac Sap
443 // if the sap is not initialized the appropriated method has to be called
444 auto itLcOnCcMapping = lcOnCcMapping.begin();
445 NS_ASSERT_MSG(itLcOnCcMapping != lcOnCcMapping.end(), "Problem");
446 for (itLcOnCcMapping = lcOnCcMapping.begin(); itLcOnCcMapping != lcOnCcMapping.end();
447 ++itLcOnCcMapping)
448 {
449 NS_LOG_DEBUG(this << " RNTI " << itLcOnCcMapping->lc.rnti << "Lcid "
450 << (uint16_t)itLcOnCcMapping->lc.lcId << " lcGroup "
451 << (uint16_t)itLcOnCcMapping->lc.lcGroup << " ComponentCarrierId "
452 << itLcOnCcMapping->componentCarrierId);
453 uint8_t index = itLcOnCcMapping->componentCarrierId;
454 LteEnbCmacSapProvider::LcInfo lcinfo = itLcOnCcMapping->lc;
455 LteMacSapUser* msu = itLcOnCcMapping->msu;
456 m_rrc->m_cmacSapProvider.at(index)->AddLc(lcinfo, msu);
457 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, msu);
458 }
459
460 if (rlcTypeId == LteRlcAm::GetTypeId())
461 {
462 drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::AM;
463 }
464 else
465 {
466 drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
467 }
468
469 drbInfo->m_logicalChannelIdentity = lcid;
470 drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority(bearer);
471 drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup(bearer);
472 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
473 {
474 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.gbrQosInfo.gbrUl;
475 }
476 else
477 {
478 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
479 }
480 drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
481
483}
484
485void
487{
489 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
490 {
491 m_drbsToBeStarted.push_back(it->first);
492 }
493}
494
495void
497{
499 for (auto drbIdIt = m_drbsToBeStarted.begin(); drbIdIt != m_drbsToBeStarted.end(); ++drbIdIt)
500 {
501 auto drbIt = m_drbMap.find(*drbIdIt);
502 NS_ASSERT(drbIt != m_drbMap.end());
503 drbIt->second->m_rlc->Initialize();
504 if (drbIt->second->m_pdcp)
505 {
506 drbIt->second->m_pdcp->Initialize();
507 }
508 }
509 m_drbsToBeStarted.clear();
510}
511
512void
514{
515 NS_LOG_FUNCTION(this << (uint32_t)m_rnti << (uint32_t)drbid);
516 uint8_t lcid = Drbid2Lcid(drbid);
517 auto it = m_drbMap.find(drbid);
518 NS_ASSERT_MSG(it != m_drbMap.end(),
519 "request to remove radio bearer with unknown drbid " << drbid);
520
521 // first delete eventual X2-U TEIDs
522 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
523
524 m_drbMap.erase(it);
525 std::vector<uint8_t> ccToRelease =
526 m_rrc->m_ccmRrcSapProvider->ReleaseDataRadioBearer(m_rnti, lcid);
527 auto itCcToRelease = ccToRelease.begin();
528 NS_ASSERT_MSG(itCcToRelease != ccToRelease.end(),
529 "request to remove radio bearer with unknown drbid (ComponentCarrierManager)");
530 for (itCcToRelease = ccToRelease.begin(); itCcToRelease != ccToRelease.end(); ++itCcToRelease)
531 {
532 m_rrc->m_cmacSapProvider.at(*itCcToRelease)->ReleaseLc(m_rnti, lcid);
533 }
535 rrcd.havePhysicalConfigDedicated = false;
536 rrcd.drbToReleaseList.push_back(drbid);
537 // populating RadioResourceConfigDedicated information element as per 3GPP TS 36.331
538 // version 9.2.0
539 rrcd.havePhysicalConfigDedicated = true;
541
542 // populating RRCConnectionReconfiguration message as per 3GPP TS 36.331 version 9.2.0 Release 9
544 msg.haveMeasConfig = false;
545 msg.haveMobilityControlInfo = false;
546 msg.radioResourceConfigDedicated = rrcd;
547 msg.haveRadioResourceConfigDedicated = true;
548 // ToDo: Resend in any case this configuration
549 // needs to be initialized
550 msg.haveNonCriticalExtension = false;
551 // RRC Connection Reconfiguration towards UE
552 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
553}
554
555void
556LteEnbRrc::DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
557{
558 NS_LOG_FUNCTION(this << imsi << rnti << (uint16_t)bearerId);
559
560 // check if the RNTI to be removed is not stale
561 if (HasUeManager(rnti))
562 {
563 Ptr<UeManager> ueManager = GetUeManager(rnti);
564 // Bearer de-activation towards UE
565 ueManager->ReleaseDataRadioBearer(bearerId);
566 // Bearer de-activation indication towards epc-enb application
567 m_s1SapProvider->DoSendReleaseIndication(imsi, rnti, bearerId);
568 }
569}
570
571void
573{
574 NS_LOG_FUNCTION(this << m_rnti);
575
576 // release the bearer info for the UE at SGW/PGW
577 if (m_rrc->m_s1SapProvider != nullptr) // if EPC is enabled
578 {
579 for (const auto& it : m_drbMap)
580 {
581 NS_LOG_DEBUG("Sending release of bearer id : "
582 << (uint16_t)(it.first)
583 << "LCID : " << (uint16_t)(it.second->m_logicalChannelIdentity));
584 // Bearer de-activation indication towards epc-enb application
585 m_rrc->m_s1SapProvider->DoSendReleaseIndication(GetImsi(), rnti, it.first);
586 }
587 }
588}
589
590void
592{
593 NS_LOG_FUNCTION(this);
594 switch (m_state)
595 {
597 case CONNECTION_SETUP:
598 case ATTACH_REQUEST:
602 case HANDOVER_JOINING:
603 case HANDOVER_LEAVING:
604 // a previous reconfiguration still ongoing, we need to wait for it to be finished
606 break;
607
608 case CONNECTED_NORMALLY: {
611 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
614 }
615 break;
616
617 default:
618 NS_FATAL_ERROR("method unexpected in state " << m_state);
619 break;
620 }
621}
622
623void
625{
626 NS_LOG_FUNCTION(this << cellId);
627 switch (m_state)
628 {
629 case CONNECTED_NORMALLY: {
630 m_targetCellId = cellId;
631
632 auto sourceComponentCarrier = DynamicCast<ComponentCarrierEnb>(
633 m_rrc->m_componentCarrierPhyConf.at(m_componentCarrierId));
634 NS_ASSERT(m_targetCellId != sourceComponentCarrier->GetCellId());
635
636 if (m_rrc->HasCellId(cellId))
637 {
638 // Intra-eNB handover
639 NS_LOG_DEBUG("Intra-eNB handover for cellId " << cellId);
640 uint8_t componentCarrierId = m_rrc->CellToComponentCarrierId(cellId);
641 uint16_t rnti = m_rrc->AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
643 m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
644 if (!anrcrv.valid)
645 {
646 NS_LOG_INFO(this << " failed to allocate a preamble for non-contention based RA => "
647 "cannot perform HO");
648 NS_FATAL_ERROR("should trigger HO Preparation Failure, but it is not implemented");
649 return;
650 }
651
652 Ptr<UeManager> ueManager = m_rrc->GetUeManager(rnti);
653 ueManager->SetSource(sourceComponentCarrier->GetCellId(), m_rnti);
654 ueManager->SetImsi(m_imsi);
655
656 // Setup data radio bearers
657 for (auto& it : m_drbMap)
658 {
659 ueManager->SetupDataRadioBearer(it.second->m_epsBearer,
660 it.second->m_epsBearerIdentity,
661 it.second->m_gtpTeid,
662 it.second->m_transportLayerAddress);
663 }
664
667
668 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
669 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
671 anrcrv.raPreambleId;
673 anrcrv.raPrachMaskIndex;
674
676 m_rrc->m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
678 .preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
680 .raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
682 .raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
683
684 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
685
686 // We skip handover preparation
688 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
690 m_rrc,
691 m_rnti);
692 m_rrc->m_handoverStartTrace(m_imsi,
693 sourceComponentCarrier->GetCellId(),
694 m_rnti,
695 handoverCommand.mobilityControlInfo.targetPhysCellId);
696 }
697 else
698 {
699 // Inter-eNB aka X2 handover
700 NS_LOG_DEBUG("Inter-eNB handover (i.e., X2) for cellId " << cellId);
702 params.oldEnbUeX2apId = m_rnti;
704 params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
705 params.targetCellId = cellId;
706 params.mmeUeS1apId = m_imsi;
707 params.ueAggregateMaxBitRateDownlink = 200 * 1000;
708 params.ueAggregateMaxBitRateUplink = 100 * 1000;
709 params.bearers = GetErabList();
710
713 hpi.asConfig.sourceDlCarrierFreq = sourceComponentCarrier->GetDlEarfcn();
714 hpi.asConfig.sourceMeasConfig = m_rrc->m_ueMeasConfig;
718 sourceComponentCarrier->GetDlBandwidth();
722 .cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
724 m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
726 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
728 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
730 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->GetRachConfig();
732 .rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
738 .rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
740 sourceComponentCarrier->GetUlEarfcn();
742 sourceComponentCarrier->GetUlBandwidth();
743 params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation(hpi);
744
745 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
746 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
747 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
748 NS_LOG_LOGIC("mmeUeS1apId = " << params.mmeUeS1apId);
749 NS_LOG_LOGIC("rrcContext = " << params.rrcContext);
750
751 m_rrc->m_x2SapProvider->SendHandoverRequest(params);
753 }
754 }
755 break;
756
757 default:
758 NS_FATAL_ERROR("method unexpected in state " << m_state);
759 break;
760 }
761}
762
763void
765{
766 NS_LOG_FUNCTION(this);
767
768 NS_ASSERT_MSG(params.notAdmittedBearers.empty(),
769 "not admission of some bearers upon handover is not supported");
770 NS_ASSERT_MSG(params.admittedBearers.size() == m_drbMap.size(),
771 "not enough bearers in admittedBearers");
772
773 // note: the Handover command from the target eNB to the source eNB
774 // is expected to be sent transparently to the UE; however, here we
775 // decode the message and eventually re-encode it. This way we can
776 // support both a real RRC protocol implementation and an ideal one
777 // without actual RRC protocol encoding.
778
779 Ptr<Packet> encodedHandoverCommand = params.rrcContext;
781 m_rrc->m_rrcSapUser->DecodeHandoverCommand(encodedHandoverCommand);
782 if (handoverCommand.haveNonCriticalExtension)
783 {
784 // Total number of component carriers =
785 // handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 (Primary carrier)
786 if (handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 !=
787 m_rrc->m_numberOfComponentCarriers)
788 {
789 // Currently handover is only possible if source and target eNBs have equal number of
790 // component carriers
791 NS_FATAL_ERROR("The source and target eNBs have unequal number of component carriers. "
792 "Target eNB CCs = "
793 << handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1
794 << " Source eNB CCs = " << m_rrc->m_numberOfComponentCarriers);
795 }
796 }
797 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
799 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
801 m_rrc,
802 m_rnti);
803 NS_ASSERT(handoverCommand.haveMobilityControlInfo);
804 m_rrc->m_handoverStartTrace(m_imsi,
805 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
806 m_rnti,
807 handoverCommand.mobilityControlInfo.targetPhysCellId);
808
809 // Set the target cell ID and the RNTI so that handover cancel message can be sent if required
810 m_targetX2apId = params.newEnbUeX2apId;
811 m_targetCellId = params.targetCellId;
812
814 sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
815 sst.newEnbUeX2apId = params.newEnbUeX2apId;
816 sst.sourceCellId = params.sourceCellId;
817 sst.targetCellId = params.targetCellId;
818 for (auto drbIt = m_drbMap.begin(); drbIt != m_drbMap.end(); ++drbIt)
819 {
820 // SN status transfer is only for AM RLC
821 if (drbIt->second->m_rlc->GetObject<LteRlcAm>())
822 {
823 LtePdcp::Status status = drbIt->second->m_pdcp->GetStatus();
825 i.dlPdcpSn = status.txSn;
826 i.ulPdcpSn = status.rxSn;
827 sst.erabsSubjectToStatusTransferList.push_back(i);
828 }
829 }
830 m_rrc->m_x2SapProvider->SendSnStatusTransfer(sst);
831}
832
839
842{
843 NS_LOG_FUNCTION(this);
844
846
847 auto targetComponentCarrier =
848 DynamicCast<ComponentCarrierEnb>(m_rrc->m_componentCarrierPhyConf.at(componentCarrierId));
849 result.haveMobilityControlInfo = true;
850 result.mobilityControlInfo.targetPhysCellId = targetComponentCarrier->GetCellId();
852 result.mobilityControlInfo.carrierFreq.dlCarrierFreq = targetComponentCarrier->GetDlEarfcn();
853 result.mobilityControlInfo.carrierFreq.ulCarrierFreq = targetComponentCarrier->GetUlEarfcn();
856 targetComponentCarrier->GetDlBandwidth();
858 targetComponentCarrier->GetUlBandwidth();
859
860 if (m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
861 {
862 // Release sCells
863 result.haveNonCriticalExtension = true;
864
865 for (auto& it : m_rrc->m_componentCarrierPhyConf)
866 {
867 uint8_t ccId = it.first;
868
869 if (ccId == m_componentCarrierId)
870 {
871 // Skip primary CC.
872 continue;
873 }
874 else if (ccId < m_componentCarrierId)
875 {
876 // Shift all IDs below PCC forward so PCC can use CC ID 1.
877 result.nonCriticalExtension.sCellToReleaseList.push_back(ccId + 1);
878 }
879 }
880 }
881 else
882 {
883 result.haveNonCriticalExtension = false;
884 }
885
886 return result;
887}
888
889void
891{
892 NS_LOG_FUNCTION(this << p << (uint16_t)bid);
894 params.pdcpSdu = p;
895 params.rnti = m_rnti;
896 params.lcid = Bid2Lcid(bid);
897 uint8_t drbid = Bid2Drbid(bid);
898 // Transmit PDCP sdu only if DRB ID found in drbMap
899 auto it = m_drbMap.find(drbid);
900 if (it != m_drbMap.end())
901 {
903 if (bearerInfo)
904 {
905 NS_LOG_INFO("Send packet to PDCP layer");
906 LtePdcpSapProvider* pdcpSapProvider = bearerInfo->m_pdcp->GetLtePdcpSapProvider();
907 pdcpSapProvider->TransmitPdcpSdu(params);
908 }
909 }
910}
911
912void
914{
915 NS_LOG_FUNCTION(this << p << (uint16_t)bid);
916 switch (m_state)
917 {
919 case CONNECTION_SETUP:
920 NS_LOG_WARN("not connected, discarding packet");
921 return;
922
928 NS_LOG_INFO("queueing data on PDCP for transmission over the air");
929 SendPacket(bid, p);
930 }
931 break;
932
933 case HANDOVER_JOINING: {
934 // Buffer data until RRC Connection Reconfiguration Complete message is received
935 NS_LOG_INFO("buffering data");
936 m_packetBuffer.emplace_back(bid, p);
937 }
938 break;
939
940 case HANDOVER_LEAVING: {
941 NS_LOG_INFO("forwarding data to target eNB over X2-U");
942 uint8_t drbid = Bid2Drbid(bid);
944 params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
945 params.targetCellId = m_targetCellId;
946 params.gtpTeid = GetDataRadioBearerInfo(drbid)->m_gtpTeid;
947 params.ueData = p;
948 m_rrc->m_x2SapProvider->SendUeData(params);
949 }
950 break;
951
952 default:
953 NS_FATAL_ERROR("method unexpected in state " << m_state);
954 break;
955 }
956}
957
958std::vector<EpcX2Sap::ErabToBeSetupItem>
960{
961 NS_LOG_FUNCTION(this);
962 std::vector<EpcX2Sap::ErabToBeSetupItem> ret;
963 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
964 {
966 etbsi.erabId = it->second->m_epsBearerIdentity;
967 etbsi.erabLevelQosParameters = it->second->m_epsBearer;
968 etbsi.dlForwarding = false;
969 etbsi.transportLayerAddress = it->second->m_transportLayerAddress;
970 etbsi.gtpTeid = it->second->m_gtpTeid;
971 ret.push_back(etbsi);
972 }
973 return ret;
974}
975
976void
978{
979 NS_LOG_FUNCTION(this);
980 switch (m_state)
981 {
983 NS_LOG_INFO("Send UE CONTEXT RELEASE from target eNB to source eNB");
985 ueCtxReleaseParams.oldEnbUeX2apId = m_sourceX2apId;
986 ueCtxReleaseParams.newEnbUeX2apId = m_rnti;
987 ueCtxReleaseParams.sourceCellId = m_sourceCellId;
988 ueCtxReleaseParams.targetCellId = m_targetCellId;
989 if (!m_rrc->HasCellId(m_sourceCellId))
990 {
991 m_rrc->m_x2SapProvider->SendUeContextRelease(ueCtxReleaseParams);
992 }
993 else
994 {
995 NS_LOG_INFO("Not sending UE CONTEXT RELEASE because handover is internal");
996 m_rrc->DoRecvUeContextRelease(ueCtxReleaseParams);
997 }
999 m_rrc->m_handoverEndOkTrace(m_imsi,
1000 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1001 m_rnti);
1002 break;
1003
1004 default:
1005 NS_FATAL_ERROR("method unexpected in state " << m_state);
1006 break;
1007 }
1008}
1009
1010void
1012{
1013 NS_LOG_FUNCTION(this << cellId);
1014 switch (m_state)
1015 {
1017 NS_ASSERT(cellId == m_targetCellId);
1018 NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1020 break;
1021 case HANDOVER_LEAVING: // case added to tackle HO leaving timer expiration
1022 NS_ASSERT(cellId == m_targetCellId);
1023 NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1026 break;
1027
1028 default:
1029 NS_FATAL_ERROR("method unexpected in state " << m_state);
1030 break;
1031 }
1032}
1033
1034void
1036{
1037 NS_LOG_FUNCTION(this);
1038 for (auto erabIt = params.erabsSubjectToStatusTransferList.begin();
1039 erabIt != params.erabsSubjectToStatusTransferList.end();
1040 ++erabIt)
1041 {
1042 // LtePdcp::Status status;
1043 // status.txSn = erabIt->dlPdcpSn;
1044 // status.rxSn = erabIt->ulPdcpSn;
1045 // uint8_t drbId = Bid2Drbid (erabIt->erabId);
1046 // auto drbIt = m_drbMap.find (drbId);
1047 // NS_ASSERT_MSG (drbIt != m_drbMap.end (), "could not find DRBID " << (uint32_t) drbId);
1048 // drbIt->second->m_pdcp->SetStatus (status);
1049 }
1050}
1051
1052void
1059
1060void
1067
1068void
1070{
1071 // TODO implement in the 3gpp way, see Section 5.3.8 of 3GPP TS 36.331.
1073 // De-activation towards UE, it will deactivate all bearers
1076 m_rrc->m_rrcSapUser->SendRrcConnectionRelease(m_rnti, msg);
1077
1078 /**
1079 * Bearer de-activation indication towards epc-enb application
1080 * and removal of UE context at the eNodeB
1081 *
1082 */
1083 m_rrc->DoRecvIdealUeContextRemoveRequest(m_rnti);
1084}
1085
1086// methods forwarded from RRC SAP
1087
1088void
1090{
1091 NS_LOG_FUNCTION(this);
1092 m_srb0->m_rlc->SetLteRlcSapUser(params.srb0SapUser);
1093 m_srb1->m_pdcp->SetLtePdcpSapUser(params.srb1SapUser);
1094}
1095
1096void
1098{
1099 NS_LOG_FUNCTION(this);
1100 switch (m_state)
1101 {
1102 case INITIAL_RANDOM_ACCESS: {
1104
1105 if (m_rrc->m_admitRrcConnectionRequest)
1106 {
1107 m_imsi = msg.ueIdentity;
1108
1109 // send RRC CONNECTION SETUP to UE
1113 m_rrc->m_rrcSapUser->SendRrcConnectionSetup(m_rnti, msg2);
1114
1116 m_connectionSetupTimeout = Simulator::Schedule(m_rrc->m_connectionSetupTimeoutDuration,
1118 m_rrc,
1119 m_rnti);
1121 }
1122 else
1123 {
1124 NS_LOG_INFO("rejecting connection request for RNTI " << m_rnti);
1125
1126 // send RRC CONNECTION REJECT to UE
1128 rejectMsg.waitTime = 3;
1129 m_rrc->m_rrcSapUser->SendRrcConnectionReject(m_rnti, rejectMsg);
1130
1132 Simulator::Schedule(m_rrc->m_connectionRejectedTimeoutDuration,
1134 m_rrc,
1135 m_rnti);
1137 }
1138 }
1139 break;
1140
1141 default:
1142 NS_FATAL_ERROR("method unexpected in state " << m_state);
1143 break;
1144 }
1145}
1146
1147void
1149{
1150 NS_LOG_FUNCTION(this);
1151 switch (m_state)
1152 {
1153 case CONNECTION_SETUP:
1155 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1156 {
1157 m_pendingRrcConnectionReconfiguration = true; // Force Reconfiguration
1159 }
1160
1161 if (m_rrc->m_s1SapProvider != nullptr)
1162 {
1163 m_rrc->m_s1SapProvider->InitialUeMessage(m_imsi, m_rnti);
1165 }
1166 else
1167 {
1169 }
1170 m_rrc->m_connectionEstablishedTrace(m_imsi,
1171 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1172 m_rnti);
1173 break;
1174
1175 default:
1176 NS_FATAL_ERROR("method unexpected in state " << m_state);
1177 break;
1178 }
1179}
1180
1181void
1184{
1185 NS_LOG_FUNCTION(this);
1186 switch (m_state)
1187 {
1191 {
1192 // configure MAC (and scheduler)
1194 req.m_rnti = m_rnti;
1196 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1197 {
1198 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
1199
1200 // configure PHY
1201 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(req.m_rnti,
1202 req.m_transmissionMode);
1205 m_rrc->m_cphySapProvider.at(i)->SetPa(m_rnti, paDouble);
1206 }
1207
1209 }
1211 m_rrc->m_connectionReconfigurationTrace(
1212 m_imsi,
1213 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1214 m_rnti);
1215 break;
1216
1217 // This case is added to NS-3 in order to handle bearer de-activation scenario for CONNECTED
1218 // state UE
1219 case CONNECTED_NORMALLY:
1220 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state " << m_state);
1221 break;
1222
1223 case HANDOVER_LEAVING:
1224 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state " << m_state);
1225 break;
1226
1227 case HANDOVER_JOINING: {
1229
1230 while (!m_packetBuffer.empty())
1231 {
1232 NS_LOG_LOGIC("dequeueing data from buffer");
1233 std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1234 uint8_t bid = bidPacket.first;
1235 Ptr<Packet> p = bidPacket.second;
1236
1237 NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
1238 SendPacket(bid, p);
1239
1240 m_packetBuffer.pop_front();
1241 }
1242
1243 NS_LOG_INFO("Send PATH SWITCH REQUEST to the MME");
1245 params.rnti = m_rnti;
1246 params.cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1247 params.mmeUeS1Id = m_imsi;
1249 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1250 {
1252 b.epsBearerId = it->second->m_epsBearerIdentity;
1253 b.teid = it->second->m_gtpTeid;
1254 params.bearersToBeSwitched.push_back(b);
1255 }
1256 m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1257 }
1258 break;
1259
1260 default:
1261 NS_FATAL_ERROR("method unexpected in state " << m_state);
1262 break;
1263 }
1264}
1265
1266void
1269{
1270 NS_LOG_FUNCTION(this);
1271 switch (m_state)
1272 {
1273 case CONNECTED_NORMALLY:
1274 break;
1275
1276 case HANDOVER_LEAVING:
1278 break;
1279
1280 default:
1281 NS_FATAL_ERROR("method unexpected in state " << m_state);
1282 break;
1283 }
1284
1288 m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1290}
1291
1292void
1299
1300void
1302{
1303 uint8_t measId = msg.measResults.measId;
1304 NS_LOG_FUNCTION(this << (uint16_t)measId);
1306 "measId " << (uint16_t)measId << " haveMeasResultNeighCells "
1307 << msg.measResults.haveMeasResultNeighCells << " measResultListEutra "
1308 << msg.measResults.measResultListEutra.size() << " haveMeasResultServFreqList "
1309 << msg.measResults.haveMeasResultServFreqList << " measResultServFreqList "
1310 << msg.measResults.measResultServFreqList.size());
1311 NS_LOG_LOGIC("serving cellId "
1312 << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) << " RSRP "
1313 << (uint16_t)msg.measResults.measResultPCell.rsrpResult << " RSRQ "
1314 << (uint16_t)msg.measResults.measResultPCell.rsrqResult);
1315
1316 for (auto it = msg.measResults.measResultListEutra.begin();
1317 it != msg.measResults.measResultListEutra.end();
1318 ++it)
1319 {
1320 NS_LOG_LOGIC("neighbour cellId " << it->physCellId << " RSRP "
1321 << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1322 << " RSRQ "
1323 << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1324 }
1325
1326 if ((m_rrc->m_handoverManagementSapProvider != nullptr) &&
1327 (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1328 {
1329 // this measurement was requested by the handover algorithm
1330 m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1331 }
1332
1333 if ((m_rrc->m_ccmRrcSapProvider != nullptr) &&
1334 (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1335 {
1336 // this measurement was requested by the handover algorithm
1337 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1338 }
1339
1340 if ((m_rrc->m_anrSapProvider != nullptr) &&
1341 (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1342 {
1343 // this measurement was requested by the ANR function
1344 m_rrc->m_anrSapProvider->ReportUeMeas(msg.measResults);
1345 }
1346
1347 if ((!m_rrc->m_ffrRrcSapProvider.empty()) &&
1348 (m_rrc->m_ffrMeasIds.find(measId) != m_rrc->m_ffrMeasIds.end()))
1349 {
1350 // this measurement was requested by the FFR function
1351 m_rrc->m_ffrRrcSapProvider.at(0)->ReportUeMeas(m_rnti, msg.measResults);
1352 }
1354 {
1355 for (const auto& it : msg.measResults.measResultServFreqList)
1356 {
1357 /// ToDo: implement on Ffr algorithm the code to properly parsing the new measResults
1358 /// message format alternatively it is needed to 'repack' properly the measResults
1359 /// message before sending to Ffr
1360 m_rrc->m_ffrRrcSapProvider.at(it.servFreqId)->ReportUeMeas(m_rnti, msg.measResults);
1361 }
1362 }
1363
1364 /// Report any measurements to ComponentCarrierManager, so it can react to any change or
1365 /// activate the SCC
1366 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1367 // fire a trace source
1368 m_rrc->m_recvMeasurementReportTrace(m_imsi,
1369 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1370 m_rnti,
1371 msg);
1372}
1373
1374// methods forwarded from CMAC SAP
1375
1376void
1378{
1379 NS_LOG_FUNCTION(this << m_rnti);
1380 // at this stage used only by the scheduler for updating txMode
1381
1383
1385
1386 // reconfigure the UE RRC
1388}
1389
1390// methods forwarded from PDCP SAP
1391
1392void
1394{
1395 NS_LOG_FUNCTION(this);
1396 if (params.lcid > 2)
1397 {
1398 // data radio bearer
1399 EpsBearerTag tag;
1400 tag.SetRnti(params.rnti);
1401 tag.SetBid(Lcid2Bid(params.lcid));
1402 params.pdcpSdu->AddPacketTag(tag);
1403 m_rrc->m_forwardUpCallback(params.pdcpSdu);
1404 }
1405}
1406
1407uint16_t
1409{
1410 return m_rnti;
1411}
1412
1413uint64_t
1415{
1416 return m_imsi;
1417}
1418
1419uint8_t
1424
1425uint16_t
1430
1431void
1433{
1434 NS_LOG_FUNCTION(this);
1436 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1437 {
1438 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1439 }
1440 switch (m_state)
1441 {
1443 // do nothing, srs conf index will be correctly enforced upon
1444 // RRC connection establishment
1445 break;
1446
1447 default:
1449 break;
1450 }
1451}
1452
1455{
1456 return m_state;
1457}
1458
1459void
1461{
1462 NS_LOG_FUNCTION(this);
1463 m_physicalConfigDedicated.pdschConfigDedicated = pdschConfigDedicated;
1464
1466
1467 // reconfigure the UE RRC
1469}
1470
1471void
1481
1484{
1485 NS_LOG_FUNCTION(this);
1487 res.oldEnbUeX2apId = m_sourceX2apId;
1488 res.sourceCellId = m_sourceCellId;
1489 res.targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1490 res.cause = 0;
1491 res.criticalityDiagnostics = 0;
1492
1493 return res;
1494}
1495
1498{
1499 NS_LOG_FUNCTION(this);
1501 res.oldEnbUeX2apId = m_rnti; // source cell rnti
1502 res.newEnbUeX2apId = m_targetX2apId;
1503 res.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1504 res.targetCellId = m_targetCellId;
1505 res.cause = 0;
1506
1507 return res;
1508}
1509
1510uint8_t
1512{
1513 NS_LOG_FUNCTION(this);
1514 const uint8_t MAX_DRB_ID = 32;
1515 for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1516 drbid = (drbid + 1) % MAX_DRB_ID)
1517 {
1518 if (drbid != 0) // 0 is not allowed
1519 {
1520 if (m_drbMap.find(drbid) == m_drbMap.end())
1521 {
1522 m_drbMap.insert(std::pair<uint8_t, Ptr<LteDataRadioBearerInfo>>(drbid, drbInfo));
1523 drbInfo->m_drbIdentity = drbid;
1524 m_lastAllocatedDrbid = drbid;
1525 return drbid;
1526 }
1527 }
1528 }
1529 NS_FATAL_ERROR("no more data radio bearer ids available");
1530 return 0;
1531}
1532
1535{
1536 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1537 NS_ASSERT(0 != drbid);
1538 auto it = m_drbMap.find(drbid);
1539 NS_ABORT_IF(it == m_drbMap.end());
1540 return it->second;
1541}
1542
1543void
1545{
1546 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1547 auto it = m_drbMap.find(drbid);
1548 NS_ASSERT_MSG(it != m_drbMap.end(),
1549 "request to remove radio bearer with unknown drbid " << drbid);
1550 m_drbMap.erase(it);
1551}
1552
1555{
1556 NS_LOG_FUNCTION(this);
1559 msg.haveRadioResourceConfigDedicated = true;
1560 msg.radioResourceConfigDedicated = BuildRadioResourceConfigDedicated();
1561 msg.haveMobilityControlInfo = false;
1562 msg.haveMeasConfig = true;
1563 msg.measConfig = m_rrc->m_ueMeasConfig;
1564 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1565 {
1566 m_caSupportConfigured = true;
1567 NS_LOG_FUNCTION(this << "CA not configured. Configure now!");
1568 msg.haveNonCriticalExtension = true;
1569 msg.nonCriticalExtension = BuildNonCriticalExtensionConfigurationCa();
1570 NS_LOG_FUNCTION(this << " haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1571 }
1572 else
1573 {
1574 msg.haveNonCriticalExtension = false;
1575 }
1576
1577 return msg;
1578}
1579
1582{
1583 NS_LOG_FUNCTION(this);
1585
1586 if (m_srb1)
1587 {
1589 stam.srbIdentity = m_srb1->m_srbIdentity;
1590 stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1591 rrcd.srbToAddModList.push_back(stam);
1592 }
1593
1594 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1595 {
1597 dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1598 dtam.drbIdentity = it->second->m_drbIdentity;
1599 dtam.rlcConfig = it->second->m_rlcConfig;
1600 dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1601 dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1602 rrcd.drbToAddModList.push_back(dtam);
1603 }
1604
1605 rrcd.havePhysicalConfigDedicated = true;
1607 return rrcd;
1608}
1609
1610uint8_t
1618
1619uint8_t
1621{
1622 NS_ASSERT(lcid > 2);
1623 return lcid - 2;
1624}
1625
1626uint8_t
1628{
1629 return drbid + 2;
1630}
1631
1632uint8_t
1634{
1635 NS_ASSERT(lcid > 2);
1636 return lcid - 2;
1637}
1638
1639uint8_t
1641{
1642 return bid + 2;
1643}
1644
1645uint8_t
1647{
1648 return drbid;
1649}
1650
1651uint8_t
1653{
1654 return bid;
1655}
1656
1657void
1659{
1660 NS_LOG_FUNCTION(this << newState);
1661 State oldState = m_state;
1662 m_state = newState;
1663 NS_LOG_INFO(this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager " << oldState
1664 << " --> " << newState);
1666 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1667 m_rnti,
1668 oldState,
1669 newState);
1670
1671 switch (newState)
1672 {
1674 case HANDOVER_JOINING:
1675 NS_FATAL_ERROR("cannot switch to an initial state");
1676 break;
1677
1678 case CONNECTION_SETUP:
1679 case ATTACH_REQUEST:
1680 break;
1681
1682 case CONNECTED_NORMALLY: {
1684 {
1686 }
1688 {
1690 }
1691 }
1692 break;
1693
1696 case HANDOVER_LEAVING:
1697 default:
1698 break;
1699 }
1700}
1701
1704{
1705 NS_LOG_FUNCTION(this);
1707
1708 for (auto& it : m_rrc->m_componentCarrierPhyConf)
1709 {
1710 uint8_t ccId = it.first;
1711
1712 if (ccId == m_componentCarrierId)
1713 {
1714 // Skip primary CC.
1715 continue;
1716 }
1717 else if (ccId < m_componentCarrierId)
1718 {
1719 // Shift all IDs below PCC forward so PCC can use CC ID 1.
1720 ccId++;
1721 }
1722
1723 Ptr<ComponentCarrierBaseStation> eNbCcm = it.second;
1724 LteRrcSap::SCellToAddMod component;
1725 component.sCellIndex = ccId;
1726 component.cellIdentification.physCellId = eNbCcm->GetCellId();
1727 component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1730 eNbCcm->GetDlBandwidth();
1732 .antennaPortsCount = 0;
1734 .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1738 eNbCcm->GetUlEarfcn();
1740 eNbCcm->GetUlBandwidth();
1742 0;
1743 // component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type =
1744 // LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
1746 .srsBandwidthConfig = 0;
1748 .srsSubframeConfig = 0;
1750
1753 .haveNonUlConfiguration = true;
1757 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1765 .haveUlConfiguration = true;
1769 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1782
1783 ncec.sCellToAddModList.push_back(component);
1784 }
1785
1786 return ncec;
1787}
1788
1789///////////////////////////////////////////
1790// eNB RRC methods
1791///////////////////////////////////////////
1792
1794
1796 : m_x2SapProvider(nullptr),
1797 m_cmacSapProvider(0),
1798 m_handoverManagementSapProvider(nullptr),
1799 m_ccmRrcSapProvider(nullptr),
1800 m_anrSapProvider(nullptr),
1801 m_ffrRrcSapProvider(0),
1802 m_rrcSapUser(nullptr),
1803 m_macSapProvider(nullptr),
1804 m_s1SapProvider(nullptr),
1805 m_cphySapProvider(0),
1806 m_configured(false),
1807 m_lastAllocatedRnti(0),
1808 m_srsCurrentPeriodicityId(0),
1809 m_lastAllocatedConfigurationIndex(0),
1810 m_reconfigureUes(false),
1811 m_numberOfComponentCarriers(0),
1812 m_carriersConfigured(false)
1813{
1814 NS_LOG_FUNCTION(this);
1815 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, 0));
1824}
1825
1826void
1828{
1829 NS_ASSERT_MSG(!m_carriersConfigured, "Secondary carriers can be configured only once.");
1830 m_componentCarrierPhyConf = ccPhyConf;
1832 " Number of component carriers "
1833 "are not equal to the number of he component carrier configuration provided");
1834
1835 for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1836 {
1838 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, i));
1840 }
1841 m_carriersConfigured = true;
1843}
1844
1846{
1847 NS_LOG_FUNCTION(this);
1848}
1849
1850void
1852{
1853 NS_LOG_FUNCTION(this);
1854 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1855 {
1856 delete m_cphySapUser[i];
1857 delete m_cmacSapUser[i];
1858 delete m_ffrRrcSapUser[i];
1859 }
1860 // delete m_cphySapUser;
1861 m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1862 m_cphySapUser.clear();
1863 // delete m_cmacSapUser;
1864 m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1865 m_cmacSapUser.clear();
1866 // delete m_ffrRrcSapUser;
1867 m_ffrRrcSapUser.erase(m_ffrRrcSapUser.begin(), m_ffrRrcSapUser.end());
1868 m_ffrRrcSapUser.clear();
1869 m_ueMap.clear();
1871 delete m_ccmRrcSapUser;
1872 delete m_anrSapUser;
1873 delete m_rrcSapProvider;
1874 delete m_x2SapUser;
1875 delete m_s1SapUser;
1876}
1877
1878TypeId
1880{
1881 static TypeId tid =
1882 TypeId("ns3::LteEnbRrc")
1883 .SetParent<Object>()
1884 .SetGroupName("Lte")
1885 .AddConstructor<LteEnbRrc>()
1886 .AddAttribute("UeMap",
1887 "List of UeManager by C-RNTI.",
1891 .AddAttribute("DefaultTransmissionMode",
1892 "The default UEs' transmission mode (0: SISO)",
1893 UintegerValue(0), // default tx-mode
1896 .AddAttribute(
1897 "EpsBearerToRlcMapping",
1898 "Specify which type of RLC will be used for each type of EPS bearer.",
1902 "RlcSmAlways",
1904 "RlcUmAlways",
1906 "RlcAmAlways",
1907 PER_BASED,
1908 "PacketErrorRateBased"))
1909 .AddAttribute("SystemInformationPeriodicity",
1910 "The interval for sending system information (Time value)",
1914
1915 // SRS related attributes
1916 .AddAttribute(
1917 "SrsPeriodicity",
1918 "The SRS periodicity in milliseconds",
1919 UintegerValue(40),
1922
1923 // Timeout related attributes
1924 .AddAttribute("ConnectionRequestTimeoutDuration",
1925 "After a RA attempt, if no RRC CONNECTION REQUEST is "
1926 "received before this time, the UE context is destroyed. "
1927 "Must account for reception of RAR and transmission of "
1928 "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1929 "timer should not be greater than T300 timer at UE RRC",
1933 .AddAttribute("ConnectionSetupTimeoutDuration",
1934 "After accepting connection request, if no RRC CONNECTION "
1935 "SETUP COMPLETE is received before this time, the UE "
1936 "context is destroyed. Must account for the UE's reception "
1937 "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1938 "SETUP COMPLETE.",
1939 TimeValue(MilliSeconds(150)),
1942 .AddAttribute("ConnectionRejectedTimeoutDuration",
1943 "Time to wait between sending a RRC CONNECTION REJECT and "
1944 "destroying the UE context",
1948 .AddAttribute("HandoverJoiningTimeoutDuration",
1949 "After accepting a handover request, if no RRC CONNECTION "
1950 "RECONFIGURATION COMPLETE is received before this time, the "
1951 "UE context is destroyed. Must account for reception of "
1952 "X2 HO REQ ACK by source eNB, transmission of the Handover "
1953 "Command, non-contention-based random access and reception "
1954 "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
1955 TimeValue(MilliSeconds(200)),
1958 .AddAttribute("HandoverLeavingTimeoutDuration",
1959 "After issuing a Handover Command, if neither RRC "
1960 "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
1961 "been previously received, the UE context is destroyed.",
1962 TimeValue(MilliSeconds(500)),
1965
1966 // Cell selection related attribute
1967 .AddAttribute("QRxLevMin",
1968 "One of information transmitted within the SIB1 message, "
1969 "indicating the required minimum RSRP level that any UE must "
1970 "receive from this cell before it is allowed to camp to this "
1971 "cell. The default value -70 corresponds to -140 dBm and is "
1972 "the lowest possible value as defined by Section 6.3.4 of "
1973 "3GPP TS 36.133. This restriction, however, only applies to "
1974 "initial cell selection and EPC-enabled simulation.",
1976 IntegerValue(-70),
1979 .AddAttribute("NumberOfComponentCarriers",
1980 "Number of Component Carriers",
1981 UintegerValue(1),
1984
1985 // Handover related attributes
1986 .AddAttribute("AdmitHandoverRequest",
1987 "Whether to admit an X2 handover request from another eNB",
1988 BooleanValue(true),
1991 .AddAttribute("AdmitRrcConnectionRequest",
1992 "Whether to admit a connection request from a UE",
1993 BooleanValue(true),
1996
1997 // UE measurements related attributes
1998 .AddAttribute("RsrpFilterCoefficient",
1999 "Determines the strength of smoothing effect induced by "
2000 "layer 3 filtering of RSRP in all attached UE; "
2001 "if set to 0, no layer 3 filtering is applicable",
2002 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2003 UintegerValue(4),
2006 .AddAttribute("RsrqFilterCoefficient",
2007 "Determines the strength of smoothing effect induced by "
2008 "layer 3 filtering of RSRQ in all attached UE; "
2009 "if set to 0, no layer 3 filtering is applicable",
2010 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2011 UintegerValue(4),
2014
2015 // Trace sources
2016 .AddTraceSource("NewUeContext",
2017 "Fired upon creation of a new UE context.",
2019 "ns3::LteEnbRrc::NewUeContextTracedCallback")
2020 .AddTraceSource("ConnectionEstablished",
2021 "Fired upon successful RRC connection establishment.",
2023 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2024 .AddTraceSource("ConnectionReconfiguration",
2025 "trace fired upon RRC connection reconfiguration",
2027 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2028 .AddTraceSource("HandoverStart",
2029 "trace fired upon start of a handover procedure",
2031 "ns3::LteEnbRrc::HandoverStartTracedCallback")
2032 .AddTraceSource("HandoverEndOk",
2033 "trace fired upon successful termination of a handover procedure",
2035 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2036 .AddTraceSource("RecvMeasurementReport",
2037 "trace fired when measurement report is received",
2039 "ns3::LteEnbRrc::ReceiveReportTracedCallback")
2040 .AddTraceSource("NotifyConnectionRelease",
2041 "trace fired when an UE is released",
2043 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2044 .AddTraceSource("RrcTimeout",
2045 "trace fired when a timer expires",
2047 "ns3::LteEnbRrc::TimerExpiryTracedCallback")
2048 .AddTraceSource(
2049 "HandoverFailureNoPreamble",
2050 "trace fired upon handover failure due to non-allocation of non-contention based "
2051 "preamble at eNB for UE to handover due to max count reached",
2053 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2054 .AddTraceSource(
2055 "HandoverFailureMaxRach",
2056 "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2058 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2059 .AddTraceSource(
2060 "HandoverFailureLeaving",
2061 "trace fired upon handover failure due to handover leaving timeout at source eNB",
2063 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2064 .AddTraceSource(
2065 "HandoverFailureJoining",
2066 "trace fired upon handover failure due to handover joining timeout at target eNB",
2068 "ns3::LteEnbRrc::HandoverFailureTracedCallback");
2069 return tid;
2070}
2071
2072void
2078
2081{
2082 NS_LOG_FUNCTION(this);
2083 return m_x2SapUser;
2084}
2085
2086void
2092
2093void
2095{
2096 NS_LOG_FUNCTION(this << s);
2097 if (m_cmacSapProvider.size() > pos)
2098 {
2099 m_cmacSapProvider.at(pos) = s;
2100 }
2101 else
2102 {
2103 m_cmacSapProvider.push_back(s);
2104 NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2105 }
2106}
2107
2110{
2111 NS_LOG_FUNCTION(this);
2112 return m_cmacSapUser.at(0);
2113}
2114
2117{
2118 NS_LOG_FUNCTION(this);
2119 return m_cmacSapUser.at(pos);
2120}
2121
2122void
2128
2135
2136void
2142
2149
2150void
2156
2159{
2160 NS_LOG_FUNCTION(this);
2161 return m_anrSapUser;
2162}
2163
2164void
2166{
2167 NS_LOG_FUNCTION(this << s);
2168 if (!m_ffrRrcSapProvider.empty())
2169 {
2170 m_ffrRrcSapProvider.at(0) = s;
2171 }
2172 else
2173 {
2174 m_ffrRrcSapProvider.push_back(s);
2175 }
2176}
2177
2178void
2180{
2181 NS_LOG_FUNCTION(this << s);
2182 if (m_ffrRrcSapProvider.size() > index)
2183 {
2184 m_ffrRrcSapProvider.at(index) = s;
2185 }
2186 else
2187 {
2188 m_ffrRrcSapProvider.push_back(s);
2189 NS_ABORT_MSG_IF(m_ffrRrcSapProvider.size() - 1 != index,
2190 "You meant to store the pointer at position "
2191 << static_cast<uint32_t>(index) << " but it went to "
2192 << m_ffrRrcSapProvider.size() - 1);
2193 }
2194}
2195
2198{
2199 NS_LOG_FUNCTION(this);
2200 return m_ffrRrcSapUser.at(0);
2201}
2202
2205{
2206 NS_LOG_FUNCTION(this);
2208 "Invalid component carrier index:"
2209 << index << " provided in order to obtain FfrRrcSapUser.");
2210 return m_ffrRrcSapUser.at(index);
2211}
2212
2213void
2219
2226
2227void
2233
2234void
2239
2242{
2243 return m_s1SapUser;
2244}
2245
2246void
2248{
2249 NS_LOG_FUNCTION(this << s);
2250 if (!m_cphySapProvider.empty())
2251 {
2252 m_cphySapProvider.at(0) = s;
2253 }
2254 else
2255 {
2256 m_cphySapProvider.push_back(s);
2257 }
2258}
2259
2262{
2263 NS_LOG_FUNCTION(this);
2264 return m_cphySapUser.at(0);
2265}
2266
2267void
2269{
2270 NS_LOG_FUNCTION(this << s);
2271 if (m_cphySapProvider.size() > pos)
2272 {
2273 m_cphySapProvider.at(pos) = s;
2274 }
2275 else
2276 {
2277 m_cphySapProvider.push_back(s);
2278 NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2279 }
2280}
2281
2284{
2285 NS_LOG_FUNCTION(this);
2286 return m_cphySapUser.at(pos);
2287}
2288
2289bool
2290LteEnbRrc::HasUeManager(uint16_t rnti) const
2291{
2292 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2293 auto it = m_ueMap.find(rnti);
2294 return (it != m_ueMap.end());
2295}
2296
2299{
2300 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2301 NS_ASSERT(0 != rnti);
2302 auto it = m_ueMap.find(rnti);
2303 NS_ASSERT_MSG(it != m_ueMap.end(), "UE manager for RNTI " << rnti << " not found");
2304 return it->second;
2305}
2306
2307std::vector<uint8_t>
2309{
2310 NS_LOG_FUNCTION(this);
2311
2312 // SANITY CHECK
2313
2317 "Measurement identities and reporting configuration should not have different quantity");
2318
2319 if (!Simulator::Now().IsZero())
2320 {
2321 NS_FATAL_ERROR("AddUeMeasReportConfig may not be called after the simulation has run");
2322 }
2323
2324 // INPUT VALIDATION
2325
2326 switch (config.triggerQuantity)
2327 {
2331 {
2333 "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2334 }
2335
2341 {
2343 "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2344 }
2345 break;
2346
2350 {
2352 "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2353 }
2354
2360 {
2362 "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2363 }
2364 break;
2365
2366 default:
2367 NS_FATAL_ERROR("unsupported triggerQuantity");
2368 break;
2369 }
2370
2372 {
2373 NS_FATAL_ERROR("Only REPORT_STRONGEST_CELLS purpose is supported");
2374 }
2375
2377 {
2378 NS_LOG_WARN("reportQuantity = BOTH will be used instead of the given reportQuantity");
2379 }
2380
2381 uint8_t nextId = m_ueMeasConfig.reportConfigToAddModList.size() + 1;
2382
2383 // create the reporting configuration
2385 reportConfig.reportConfigId = nextId;
2386 reportConfig.reportConfigEutra = config;
2387
2388 // add reporting configuration to UE measurement configuration
2389 m_ueMeasConfig.reportConfigToAddModList.push_back(reportConfig);
2390
2391 std::vector<uint8_t> measIds;
2392
2393 // create measurement identities, linking reporting configuration to all objects
2394 for (uint16_t componentCarrier = 0; componentCarrier < m_numberOfComponentCarriers;
2395 componentCarrier++)
2396 {
2397 LteRrcSap::MeasIdToAddMod measIdToAddMod;
2398
2399 uint8_t measId = m_ueMeasConfig.measIdToAddModList.size() + 1;
2400
2401 measIdToAddMod.measId = measId;
2402 measIdToAddMod.measObjectId = componentCarrier + 1;
2403 measIdToAddMod.reportConfigId = nextId;
2404
2405 m_ueMeasConfig.measIdToAddModList.push_back(measIdToAddMod);
2406 measIds.push_back(measId);
2407 }
2408
2409 return measIds;
2410}
2411
2412void
2414{
2415 auto it = ccPhyConf.begin();
2416 NS_ASSERT(it != ccPhyConf.end());
2417 uint16_t ulBandwidth = it->second->GetUlBandwidth();
2418 uint16_t dlBandwidth = it->second->GetDlBandwidth();
2419 uint32_t ulEarfcn = it->second->GetUlEarfcn();
2420 uint32_t dlEarfcn = it->second->GetDlEarfcn();
2421 NS_LOG_FUNCTION(this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2423
2424 for (const auto& it : ccPhyConf)
2425 {
2426 m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2427 it.second->GetDlBandwidth());
2428 m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2429 it.second->GetDlEarfcn());
2430 m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2431 m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2432 it.second->GetDlBandwidth());
2433 if (m_ffrRrcSapProvider.size() > it.first)
2434 {
2435 m_ffrRrcSapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2436 m_ffrRrcSapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2437 it.second->GetDlBandwidth());
2438 }
2439 }
2440
2441 m_dlEarfcn = dlEarfcn;
2442 m_ulEarfcn = ulEarfcn;
2443 m_dlBandwidth = dlBandwidth;
2444 m_ulBandwidth = ulBandwidth;
2445
2446 /*
2447 * Initializing the list of measurement objects.
2448 * Only intra-frequency measurements are supported,
2449 * so one measurement object is created for each carrier frequency.
2450 */
2451 for (const auto& it : ccPhyConf)
2452 {
2454 measObject.measObjectId = it.first + 1;
2455 measObject.measObjectEutra.carrierFreq = it.second->GetDlEarfcn();
2456 measObject.measObjectEutra.allowedMeasBandwidth = it.second->GetDlBandwidth();
2457 measObject.measObjectEutra.presenceAntennaPort1 = false;
2458 measObject.measObjectEutra.neighCellConfig = 0;
2459 measObject.measObjectEutra.offsetFreq = 0;
2461
2462 m_ueMeasConfig.measObjectToAddModList.push_back(measObject);
2463 }
2464
2471
2472 m_sib1.clear();
2473 m_sib1.reserve(ccPhyConf.size());
2474 for (const auto& it : ccPhyConf)
2475 {
2476 // Enabling MIB transmission
2478 mib.dlBandwidth = it.second->GetDlBandwidth();
2479 mib.systemFrameNumber = 0;
2480 m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2481
2482 // Enabling SIB1 transmission with default values
2484 sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId();
2488 sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
2489 sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
2490 m_sib1.push_back(sib1);
2491 m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2492 }
2493 /*
2494 * Enabling transmission of other SIB. The first time System Information is
2495 * transmitted is arbitrarily assumed to be at +0.016s, and then it will be
2496 * regularly transmitted every 80 ms by default (set the
2497 * SystemInformationPeriodicity attribute to configure this).
2498 */
2500
2501 m_configured = true;
2502}
2503
2504void
2505LteEnbRrc::SetCellId(uint16_t cellId)
2506{
2507 // update SIB1
2508 m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2509 m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2510}
2511
2512void
2513LteEnbRrc::SetCellId(uint16_t cellId, uint8_t ccIndex)
2514{
2515 // update SIB1
2516 m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2517 m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2518}
2519
2520uint8_t
2522{
2523 NS_LOG_FUNCTION(this << cellId);
2524 for (auto& it : m_componentCarrierPhyConf)
2525 {
2526 if (it.second->GetCellId() == cellId)
2527 {
2528 return it.first;
2529 }
2530 }
2531 NS_FATAL_ERROR("Cell " << cellId << " not found in CC map");
2532}
2533
2534uint16_t
2535LteEnbRrc::ComponentCarrierToCellId(uint8_t componentCarrierId)
2536{
2537 NS_LOG_FUNCTION(this << +componentCarrierId);
2538 return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2539}
2540
2541bool
2542LteEnbRrc::HasCellId(uint16_t cellId) const
2543{
2544 for (auto& it : m_componentCarrierPhyConf)
2545 {
2546 if (it.second->GetCellId() == cellId)
2547 {
2548 return true;
2549 }
2550 }
2551 return false;
2552}
2553
2554bool
2556{
2557 NS_LOG_FUNCTION(this << packet);
2558 EpsBearerTag tag;
2559 bool found = packet->RemovePacketTag(tag);
2560 NS_ASSERT_MSG(found, "no EpsBearerTag found in packet to be sent");
2561 Ptr<UeManager> ueManager = GetUeManager(tag.GetRnti());
2562
2563 NS_LOG_INFO("Sending a packet of " << packet->GetSize() << " bytes to IMSI "
2564 << ueManager->GetImsi() << ", RNTI " << ueManager->GetRnti()
2565 << ", BID " << (uint16_t)tag.GetBid());
2566 ueManager->SendData(tag.GetBid(), packet);
2567
2568 return true;
2569}
2570
2571void
2576
2577void
2579{
2580 NS_LOG_FUNCTION(this << rnti);
2582 "ConnectionRequestTimeout in unexpected state "
2583 << GetUeManager(rnti)->GetState());
2584 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2585 rnti,
2586 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2587 "ConnectionRequestTimeout");
2588 RemoveUe(rnti);
2589}
2590
2591void
2593{
2594 NS_LOG_FUNCTION(this << rnti);
2596 "ConnectionSetupTimeout in unexpected state " << GetUeManager(rnti)->GetState());
2597 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2598 rnti,
2599 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2600 "ConnectionSetupTimeout");
2601 RemoveUe(rnti);
2602}
2603
2604void
2606{
2607 NS_LOG_FUNCTION(this << rnti);
2609 "ConnectionRejectedTimeout in unexpected state "
2610 << GetUeManager(rnti)->GetState());
2611 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2612 rnti,
2613 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2614 "ConnectionRejectedTimeout");
2615 RemoveUe(rnti);
2616}
2617
2618void
2620{
2621 NS_LOG_FUNCTION(this << rnti);
2623 "HandoverJoiningTimeout in unexpected state " << GetUeManager(rnti)->GetState());
2625 GetUeManager(rnti)->GetImsi(),
2626 rnti,
2627 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2628 // check if the RNTI to be removed is not stale
2629 if (HasUeManager(rnti))
2630 {
2631 /**
2632 * When the handover joining timer expires at the target cell,
2633 * then notify the source cell to release the RRC connection and
2634 * delete the UE context at eNodeB and SGW/PGW. The
2635 * HandoverPreparationFailure message is reused to notify the source cell
2636 * through the X2 interface instead of creating a new message.
2637 */
2638 Ptr<UeManager> ueManager = GetUeManager(rnti);
2639 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2641 RemoveUe(rnti);
2642 }
2643}
2644
2645void
2647{
2648 NS_LOG_FUNCTION(this << rnti);
2650 "HandoverLeavingTimeout in unexpected state " << GetUeManager(rnti)->GetState());
2652 GetUeManager(rnti)->GetImsi(),
2653 rnti,
2654 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2655 // check if the RNTI to be removed is not stale
2656 if (HasUeManager(rnti))
2657 {
2658 /**
2659 * Send HO cancel msg to the target eNB and release the RRC connection
2660 * with the UE and also delete UE context at the source eNB and bearer
2661 * info at SGW and PGW.
2662 */
2663 Ptr<UeManager> ueManager = GetUeManager(rnti);
2664 EpcX2Sap::HandoverCancelParams msg = ueManager->BuildHoCancelMsg();
2666 ueManager->SendRrcConnectionRelease();
2667 }
2668}
2669
2670void
2671LteEnbRrc::SendHandoverRequest(uint16_t rnti, uint16_t cellId)
2672{
2673 NS_LOG_FUNCTION(this << rnti << cellId);
2674 NS_LOG_LOGIC("Request to send HANDOVER REQUEST");
2676
2677 Ptr<UeManager> ueManager = GetUeManager(rnti);
2678 ueManager->PrepareHandover(cellId);
2679}
2680
2681void
2683{
2684 NS_LOG_FUNCTION(this << rnti);
2685 GetUeManager(rnti)->CompleteSetupUe(params);
2686}
2687
2688void
2690{
2691 NS_LOG_FUNCTION(this << rnti);
2692 GetUeManager(rnti)->RecvRrcConnectionRequest(msg);
2693}
2694
2695void
2698{
2699 NS_LOG_FUNCTION(this << rnti);
2700 GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2701}
2702
2703void
2705 uint16_t rnti,
2707{
2708 NS_LOG_FUNCTION(this << rnti);
2709 GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2710}
2711
2712void
2714 uint16_t rnti,
2716{
2717 NS_LOG_FUNCTION(this << rnti);
2718 GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2719}
2720
2721void
2723 uint16_t rnti,
2725{
2726 NS_LOG_FUNCTION(this << rnti);
2727 GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2728}
2729
2730void
2732{
2733 NS_LOG_FUNCTION(this << rnti);
2734 GetUeManager(rnti)->RecvMeasurementReport(msg);
2735}
2736
2737void
2739{
2740 NS_LOG_FUNCTION(this);
2741 Ptr<UeManager> ueManager = GetUeManager(msg.rnti);
2742 ueManager->InitialContextSetupRequest();
2743}
2744
2745void
2747{
2748 NS_LOG_FUNCTION(this << rnti);
2749
2750 // check if the RNTI to be removed is not stale
2751 if (HasUeManager(rnti))
2752 {
2753 Ptr<UeManager> ueManager = GetUeManager(rnti);
2754
2755 if (ueManager->GetState() == UeManager::HANDOVER_JOINING)
2756 {
2758 GetUeManager(rnti)->GetImsi(),
2759 rnti,
2760 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2761 /**
2762 * During the HO, when the RACH failure due to the maximum number of
2763 * re-attempts is reached the UE request the target eNB to deletes its
2764 * context. Upon which, the target eNB sends handover preparation
2765 * failure to the source eNB.
2766 */
2767 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2769 }
2770
2771 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2772 // delete the UE context at the eNB
2773 RemoveUe(rnti);
2774 }
2775}
2776
2777void
2780{
2781 NS_LOG_FUNCTION(this);
2782 Ptr<UeManager> ueManager = GetUeManager(request.rnti);
2783 ueManager->SetupDataRadioBearer(request.bearer,
2784 request.bearerId,
2785 request.gtpTeid,
2786 request.transportLayerAddress);
2787}
2788
2789void
2792{
2793 NS_LOG_FUNCTION(this);
2794 Ptr<UeManager> ueManager = GetUeManager(params.rnti);
2795 ueManager->SendUeContextRelease();
2796}
2797
2798void
2800{
2801 NS_LOG_FUNCTION(this);
2802
2803 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST");
2804
2805 NS_LOG_LOGIC("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
2806 NS_LOG_LOGIC("sourceCellId = " << req.sourceCellId);
2807 NS_LOG_LOGIC("targetCellId = " << req.targetCellId);
2808 NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId);
2809
2810 // if no SRS index is available, then do not accept the handover
2812 {
2813 NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId);
2815 res.oldEnbUeX2apId = req.oldEnbUeX2apId;
2816 res.sourceCellId = req.sourceCellId;
2817 res.targetCellId = req.targetCellId;
2818 res.cause = 0;
2819 res.criticalityDiagnostics = 0;
2821 return;
2822 }
2823
2824 uint8_t componentCarrierId = CellToComponentCarrierId(req.targetCellId);
2825 uint16_t rnti = AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
2826 Ptr<UeManager> ueManager = GetUeManager(rnti);
2827 ueManager->SetSource(req.sourceCellId, req.oldEnbUeX2apId);
2828 ueManager->SetImsi(req.mmeUeS1apId);
2830 m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2831 if (!anrcrv.valid)
2832 {
2834 this
2835 << " failed to allocate a preamble for non-contention based RA => cannot accept HO");
2837 GetUeManager(rnti)->GetImsi(),
2838 rnti,
2839 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2840 /**
2841 * When the maximum non-contention based preambles is reached, then it is considered
2842 * handover has failed and source cell is notified to release the RRC connection and delete
2843 * the UE context at eNodeB and SGW/PGW.
2844 */
2845 Ptr<UeManager> ueManager = GetUeManager(rnti);
2846 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2848 RemoveUe(rnti); // remove the UE from the target eNB
2849 return;
2850 }
2851
2853 ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
2854 ackParams.newEnbUeX2apId = rnti;
2855 ackParams.sourceCellId = req.sourceCellId;
2856 ackParams.targetCellId = req.targetCellId;
2857
2858 for (auto it = req.bearers.begin(); it != req.bearers.end(); ++it)
2859 {
2860 ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2861 it->erabId,
2862 it->gtpTeid,
2863 it->transportLayerAddress);
2865 i.erabId = it->erabId;
2866 ackParams.admittedBearers.push_back(i);
2867 }
2868
2870 ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2871
2872 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2873 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
2876 anrcrv.raPrachMaskIndex;
2877
2879 m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2881 .numberOfRaPreambles = rc.numberOfRaPreambles;
2883 .preambleTransMax = rc.preambleTransMax;
2885 .raResponseWindowSize = rc.raResponseWindowSize;
2887 .connEstFailCount = rc.connEstFailCount;
2888
2889 Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand(handoverCommand);
2890
2891 ackParams.rrcContext = encodedHandoverCommand;
2892
2893 NS_LOG_LOGIC("Send X2 message: HANDOVER REQUEST ACK");
2894
2895 NS_LOG_LOGIC("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
2896 NS_LOG_LOGIC("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
2897 NS_LOG_LOGIC("sourceCellId = " << ackParams.sourceCellId);
2898 NS_LOG_LOGIC("targetCellId = " << ackParams.targetCellId);
2899
2901}
2902
2903void
2905{
2906 NS_LOG_FUNCTION(this);
2907
2908 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST ACK");
2909
2910 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2911 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2912 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2913 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2914
2915 uint16_t rnti = params.oldEnbUeX2apId;
2916 Ptr<UeManager> ueManager = GetUeManager(rnti);
2917 ueManager->RecvHandoverRequestAck(params);
2918}
2919
2920void
2922{
2923 NS_LOG_FUNCTION(this);
2924
2925 NS_LOG_LOGIC("Recv X2 message: HANDOVER PREPARATION FAILURE");
2926
2927 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2928 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2929 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2930 NS_LOG_LOGIC("cause = " << params.cause);
2931 NS_LOG_LOGIC("criticalityDiagnostics = " << params.criticalityDiagnostics);
2932
2933 uint16_t rnti = params.oldEnbUeX2apId;
2934
2935 // check if the RNTI is not stale
2936 if (HasUeManager(rnti))
2937 {
2938 Ptr<UeManager> ueManager = GetUeManager(rnti);
2939 ueManager->RecvHandoverPreparationFailure(params.targetCellId);
2940 }
2941}
2942
2943void
2945{
2946 NS_LOG_FUNCTION(this);
2947
2948 NS_LOG_LOGIC("Recv X2 message: SN STATUS TRANSFER");
2949
2950 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2951 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2952 NS_LOG_LOGIC("erabsSubjectToStatusTransferList size = "
2953 << params.erabsSubjectToStatusTransferList.size());
2954
2955 uint16_t rnti = params.newEnbUeX2apId;
2956
2957 // check if the RNTI to receive SN transfer for is not stale
2958 if (HasUeManager(rnti))
2959 {
2960 Ptr<UeManager> ueManager = GetUeManager(rnti);
2961 ueManager->RecvSnStatusTransfer(params);
2962 }
2963}
2964
2965void
2967{
2968 NS_LOG_FUNCTION(this);
2969
2970 NS_LOG_LOGIC("Recv X2 message: UE CONTEXT RELEASE");
2971
2972 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2973 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2974
2975 uint16_t rnti = params.oldEnbUeX2apId;
2976
2977 // check if the RNTI to be removed is not stale
2978 if (HasUeManager(rnti))
2979 {
2980 GetUeManager(rnti)->RecvUeContextRelease(params);
2981 RemoveUe(rnti);
2982 }
2983}
2984
2985void
2987{
2988 NS_LOG_FUNCTION(this);
2989
2990 NS_LOG_LOGIC("Recv X2 message: LOAD INFORMATION");
2991
2992 NS_LOG_LOGIC("Number of cellInformationItems = " << params.cellInformationList.size());
2993
2995 m_ffrRrcSapProvider.at(0)->RecvLoadInformation(params);
2996}
2997
2998void
3000{
3001 NS_LOG_FUNCTION(this);
3002
3003 NS_LOG_LOGIC("Recv X2 message: RESOURCE STATUS UPDATE");
3004
3006 "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
3007
3008 NS_ASSERT("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
3009}
3010
3011void
3013{
3014 NS_LOG_FUNCTION(this);
3015
3016 NS_LOG_LOGIC("Recv UE DATA FORWARDING through X2 interface");
3017 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3018 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3019 NS_LOG_LOGIC("gtpTeid = " << params.gtpTeid);
3020 NS_LOG_LOGIC("ueData = " << params.ueData);
3021 NS_LOG_LOGIC("ueData size = " << params.ueData->GetSize());
3022
3023 auto teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
3024 if (teidInfoIt != m_x2uTeidInfoMap.end())
3025 {
3026 GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
3027 }
3028 else
3029 {
3030 NS_FATAL_ERROR("X2-U data received but no X2uTeidInfo found");
3031 }
3032}
3033
3034void
3036{
3037 NS_LOG_FUNCTION(this);
3038
3039 NS_LOG_LOGIC("Recv X2 message: HANDOVER CANCEL");
3040
3041 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3042 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3043 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3044 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3045 NS_LOG_LOGIC("cause = " << params.cause);
3046
3047 uint16_t rnti = params.newEnbUeX2apId;
3048 if (HasUeManager(rnti))
3049 {
3050 Ptr<UeManager> ueManager = GetUeManager(rnti);
3051 ueManager->RecvHandoverCancel(params);
3052 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3053 }
3054}
3055
3056uint16_t
3058{
3059 NS_LOG_FUNCTION(this << +componentCarrierId);
3060 // if no SRS index is available, then do not create a new UE context.
3061 if (IsMaxSrsReached())
3062 {
3063 NS_LOG_WARN("Not enough SRS configuration indices, UE context not created");
3064 return 0; // return 0 since new RNTI was not assigned for the received preamble
3065 }
3066 return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3067}
3068
3069void
3071{
3072 Ptr<UeManager> ueManager = GetUeManager(cmacParams.m_rnti);
3073 ueManager->CmacUeConfigUpdateInd(cmacParams);
3074}
3075
3076void
3077LteEnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
3078{
3079 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3080 NS_FATAL_ERROR("not implemented");
3081}
3082
3083std::vector<uint8_t>
3085{
3086 NS_LOG_FUNCTION(this);
3087 std::vector<uint8_t> measIds = AddUeMeasReportConfig(reportConfig);
3088 m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3089 return measIds;
3090}
3091
3092uint8_t
3094{
3095 NS_LOG_FUNCTION(this);
3096 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3097 m_componentCarrierMeasIds.insert(measId);
3098 return measId;
3099}
3100
3101void
3102LteEnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3103{
3104 m_numberOfComponentCarriers = numberOfComponentCarriers;
3105}
3106
3107void
3108LteEnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3109{
3110 NS_LOG_FUNCTION(this << rnti << targetCellId);
3111
3112 bool isHandoverAllowed = true;
3113
3114 Ptr<UeManager> ueManager = GetUeManager(rnti);
3115 NS_ASSERT_MSG(ueManager, "Cannot find UE context with RNTI " << rnti);
3116
3117 if (m_anrSapProvider != nullptr && !HasCellId(targetCellId))
3118 {
3119 // ensure that proper neighbour relationship exists between source and target cells
3120 bool noHo = m_anrSapProvider->GetNoHo(targetCellId);
3121 bool noX2 = m_anrSapProvider->GetNoX2(targetCellId);
3122 NS_LOG_DEBUG(this << " cellId="
3123 << ComponentCarrierToCellId(ueManager->GetComponentCarrierId())
3124 << " targetCellId=" << targetCellId << " NRT.NoHo=" << noHo
3125 << " NRT.NoX2=" << noX2);
3126
3127 if (noHo || noX2)
3128 {
3129 isHandoverAllowed = false;
3130 NS_LOG_LOGIC(this << " handover to cell " << targetCellId << " is not allowed by ANR");
3131 }
3132 }
3133
3134 if (ueManager->GetState() != UeManager::CONNECTED_NORMALLY)
3135 {
3136 isHandoverAllowed = false;
3137 NS_LOG_LOGIC(this << " handover is not allowed because the UE"
3138 << " rnti=" << rnti << " is in " << ueManager->GetState() << " state");
3139 }
3140
3141 if (isHandoverAllowed)
3142 {
3143 // initiate handover execution
3144 ueManager->PrepareHandover(targetCellId);
3145 }
3146}
3147
3148uint8_t
3150{
3151 NS_LOG_FUNCTION(this);
3152 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3153 m_anrMeasIds.insert(measId);
3154 return measId;
3155}
3156
3157uint8_t
3159{
3160 NS_LOG_FUNCTION(this);
3161 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3162 m_ffrMeasIds.insert(measId);
3163 return measId;
3164}
3165
3166void
3168 LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
3169{
3170 NS_LOG_FUNCTION(this);
3171 Ptr<UeManager> ueManager = GetUeManager(rnti);
3172 ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3173}
3174
3175void
3182
3183uint16_t
3184LteEnbRrc::AddUe(UeManager::State state, uint8_t componentCarrierId)
3185{
3186 NS_LOG_FUNCTION(this);
3187 bool found = false;
3188 uint16_t rnti;
3189 for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3190 {
3191 if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3192 {
3193 found = true;
3194 break;
3195 }
3196 }
3197
3198 NS_ASSERT_MSG(found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3199 m_lastAllocatedRnti = rnti;
3200 Ptr<UeManager> ueManager = CreateObject<UeManager>(this, rnti, state, componentCarrierId);
3201 m_ccmRrcSapProvider->AddUe(rnti, (uint8_t)state);
3202 m_ueMap.insert(std::pair<uint16_t, Ptr<UeManager>>(rnti, ueManager));
3203 ueManager->Initialize();
3204 const uint16_t cellId = ComponentCarrierToCellId(componentCarrierId);
3205 NS_LOG_DEBUG(this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI "
3206 << ueManager->GetSrsConfigurationIndex());
3207 m_newUeContextTrace(cellId, rnti);
3208 return rnti;
3209}
3210
3211void
3213{
3214 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3215 auto it = m_ueMap.find(rnti);
3216 NS_ASSERT_MSG(it != m_ueMap.end(), "request to remove UE info with unknown rnti " << rnti);
3217 uint64_t imsi = it->second->GetImsi();
3218 uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3219 // cancel pending events
3220 it->second->CancelPendingEvents();
3221 // fire trace upon connection release
3223 ComponentCarrierToCellId(it->second->GetComponentCarrierId()),
3224 rnti);
3225 m_ueMap.erase(it);
3226 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3227 {
3228 m_cmacSapProvider.at(i)->RemoveUe(rnti);
3229 m_cphySapProvider.at(i)->RemoveUe(rnti);
3230 }
3231 if (m_s1SapProvider != nullptr)
3232 {
3234 }
3236 // need to do this after UeManager has been deleted
3237 if (srsCi != 0)
3238 {
3240 }
3241
3242 m_rrcSapUser->RemoveUe(rnti); // Remove UE context at RRC protocol
3243}
3244
3245TypeId
3247{
3249 {
3250 case RLC_SM_ALWAYS:
3251 return LteRlcSm::GetTypeId();
3252
3253 case RLC_UM_ALWAYS:
3254 return LteRlcUm::GetTypeId();
3255
3256 case RLC_AM_ALWAYS:
3257 return LteRlcAm::GetTypeId();
3258
3259 case PER_BASED:
3260 if (bearer.GetPacketErrorLossRate() > 1.0e-5)
3261 {
3262 return LteRlcUm::GetTypeId();
3263 }
3264 else
3265 {
3266 return LteRlcAm::GetTypeId();
3267 }
3268
3269 default:
3270 return LteRlcSm::GetTypeId();
3271 }
3272}
3273
3274void
3276{
3277 NS_LOG_FUNCTION(this << cellId);
3278
3279 if (m_anrSapProvider != nullptr)
3280 {
3282 }
3283}
3284
3285void
3286LteEnbRrc::SetCsgId(uint32_t csgId, bool csgIndication)
3287{
3288 NS_LOG_FUNCTION(this << csgId << csgIndication);
3289 for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3290 componentCarrierId++)
3291 {
3292 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3293 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3294 m_cphySapProvider.at(componentCarrierId)
3295 ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3296 }
3297}
3298
3299/// Number of distinct SRS periodicity plus one.
3300static const uint8_t SRS_ENTRIES = 9;
3301/**
3302 * Sounding Reference Symbol (SRS) periodicity (TSRS) in milliseconds. Taken
3303 * from 3GPP TS 36.213 Table 8.2-1. Index starts from 1.
3304 */
3305static const uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
3306/**
3307 * The lower bound (inclusive) of the SRS configuration indices (ISRS) which
3308 * use the corresponding SRS periodicity (TSRS). Taken from 3GPP TS 36.213
3309 * Table 8.2-1. Index starts from 1.
3310 */
3311static const uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
3312/**
3313 * The upper bound (inclusive) of the SRS configuration indices (ISRS) which
3314 * use the corresponding SRS periodicity (TSRS). Taken from 3GPP TS 36.213
3315 * Table 8.2-1. Index starts from 1.
3316 */
3317static const uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
3318
3319void
3321{
3322 NS_LOG_FUNCTION(this << p);
3323 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3324 {
3325 if (g_srsPeriodicity[id] == p)
3326 {
3328 return;
3329 }
3330 }
3331 // no match found
3332 std::ostringstream allowedValues;
3333 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3334 {
3335 allowedValues << g_srsPeriodicity[id] << " ";
3336 }
3337 NS_FATAL_ERROR("illecit SRS periodicity value " << p
3338 << ". Allowed values: " << allowedValues.str());
3339}
3340
3349
3350uint16_t
3352{
3354 // SRS
3357 NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3360 {
3361 NS_FATAL_ERROR("too many UEs ("
3362 << m_ueSrsConfigurationIndexSet.size() + 1
3363 << ") for current SRS periodicity "
3365 << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
3366 }
3367
3368 if (m_ueSrsConfigurationIndexSet.empty())
3369 {
3370 // first entry
3373 }
3374 else
3375 {
3376 // find a CI from the available ones
3377 auto rit = m_ueSrsConfigurationIndexSet.rbegin();
3379 NS_LOG_DEBUG(this << " lower bound " << (*rit) << " of "
3382 {
3383 // got it from the upper bound
3386 }
3387 else
3388 {
3389 // look for released ones
3390 for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
3392 srcCi++)
3393 {
3394 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3395 if (it == m_ueSrsConfigurationIndexSet.end())
3396 {
3398 m_ueSrsConfigurationIndexSet.insert(srcCi);
3399 break;
3400 }
3401 }
3402 }
3403 }
3405}
3406
3407void
3409{
3410 NS_LOG_FUNCTION(this << srcCi);
3411 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3413 "request to remove unknown SRS CI " << srcCi);
3415}
3416
3417bool
3426
3427uint8_t
3429{
3430 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
3431 {
3432 return 1;
3433 }
3434 else
3435 {
3436 return 2;
3437 }
3438}
3439
3440uint8_t
3442{
3443 return bearer.qci;
3444}
3445
3446void
3448{
3449 // NS_LOG_FUNCTION (this);
3450
3451 for (auto& it : m_componentCarrierPhyConf)
3452 {
3453 uint8_t ccId = it.first;
3454
3456 si.haveSib2 = true;
3457 si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3458 si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3460 m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3462
3463 LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3464 LteRrcSap::RachConfigCommon rachConfigCommon;
3465 rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3466 rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3467 rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3468 rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3469 si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3470
3471 m_rrcSapUser->SendSystemInformation(it.second->GetCellId(), si);
3472 }
3473
3474 /*
3475 * For simplicity, we use the same periodicity for all SIBs. Note that in real
3476 * systems the periodicy of each SIBs could be different.
3477 */
3479}
3480
3481bool
3483{
3484 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3485 Ptr<UeManager> ueManager = GetUeManager(rnti);
3486 switch (ueManager->GetState())
3487 {
3490 return true;
3491 default:
3492 return false;
3493 }
3494}
3495
3496std::ostream&
3497operator<<(std::ostream& os, UeManager::State state)
3498{
3499 switch (state)
3500 {
3502 return os << "INITIAL_RANDOM_ACCESS";
3504 return os << "CONNECTION_SETUP";
3506 return os << "CONNECTION_REJECTED";
3508 return os << "ATTACH_REQUEST";
3510 return os << "CONNECTED_NORMALLY";
3512 return os << "CONNECTION_RECONFIGURATION";
3514 return os << "CONNECTION_REESTABLISHMENT";
3516 return os << "HANDOVER_PREPARATION";
3518 return os << "HANDOVER_JOINING";
3520 return os << "HANDOVER_PATH_SWITCH";
3522 return os << "HANDOVER_LEAVING";
3524 return os << "NUM_STATES";
3525 };
3526 return os << "UNKNOWN(" << static_cast<uint32_t>(state) << ")";
3527}
3528
3529} // namespace ns3
AttributeValue implementation for Boolean.
Definition boolean.h:26
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:561
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
AttributeValue implementation for Time.
Definition nstime.h:1432
a unique identifier for an interface.
Definition type-id.h:49
@ ATTR_GET
The attribute can be read.
Definition type-id.h:54
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition type-id.h:56
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Manages all the radio bearer information possessed by the ENB RRC for a single UE.
Definition lte-enb-rrc.h:57
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 AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition boolean.h:70
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition enum.h:221
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition integer.h:99
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition integer.h:35
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Definition object-map.h:29
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 > 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
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition nstime.h:1433
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1453
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition uinteger.h:35
#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 MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1357
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.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
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 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.
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