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
91{
92 m_rrc->DoRrcConfigurationUpdateInd(params);
93}
94
95bool
97{
98 return m_rrc->IsRandomAccessCompleted(rnti);
99}
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)
114 m_rnti(rnti),
115 m_imsi(0),
116 m_componentCarrierId(componentCarrierId),
118 m_rrc(rrc),
119 m_state(s),
126{
127 NS_LOG_FUNCTION(this);
128}
129
130void
132{
133 NS_LOG_FUNCTION(this);
135
136 m_physicalConfigDedicated.haveAntennaInfoDedicated = true;
137 m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
138 m_physicalConfigDedicated.haveSoundingRsUlConfigDedicated = true;
139 m_physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex =
140 m_rrc->GetNewSrsConfigurationIndex();
141 m_physicalConfigDedicated.soundingRsUlConfigDedicated.type =
143 m_physicalConfigDedicated.soundingRsUlConfigDedicated.srsBandwidth = 0;
144 m_physicalConfigDedicated.havePdschConfigDedicated = true;
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;
241 req.m_transmissionMode = m_physicalConfigDedicated.antennaInfo.transmissionMode;
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,
249 m_physicalConfigDedicated.antennaInfo.transmissionMode);
250 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
251 m_rnti,
252 m_physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex);
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");
1024 m_handoverLeavingTimeout.Cancel();
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:
1154 m_connectionSetupTimeout.Cancel();
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;
1195 req.m_transmissionMode = m_physicalConfigDedicated.antennaInfo.transmissionMode;
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);
1204 m_physicalConfigDedicated.pdschConfigDedicated);
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 case HANDOVER_LEAVING:
1221 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state " << m_state);
1222 break;
1223
1224 case HANDOVER_JOINING: {
1225 m_handoverJoiningTimeout.Cancel();
1226
1227 while (!m_packetBuffer.empty())
1228 {
1229 NS_LOG_LOGIC("dequeueing data from buffer");
1230 std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1231 uint8_t bid = bidPacket.first;
1232 Ptr<Packet> p = bidPacket.second;
1233
1234 NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
1235 SendPacket(bid, p);
1236
1237 m_packetBuffer.pop_front();
1238 }
1239
1240 NS_LOG_INFO("Send PATH SWITCH REQUEST to the MME");
1242 params.rnti = m_rnti;
1243 params.cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1244 params.mmeUeS1Id = m_imsi;
1246 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1247 {
1249 b.epsBearerId = it->second->m_epsBearerIdentity;
1250 b.teid = it->second->m_gtpTeid;
1251 params.bearersToBeSwitched.push_back(b);
1252 }
1253 m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1254 }
1255 break;
1256
1257 default:
1258 NS_FATAL_ERROR("method unexpected in state " << m_state);
1259 break;
1260 }
1261}
1262
1263void
1266{
1267 NS_LOG_FUNCTION(this);
1268 switch (m_state)
1269 {
1270 case CONNECTED_NORMALLY:
1271 break;
1272
1273 case HANDOVER_LEAVING:
1274 m_handoverLeavingTimeout.Cancel();
1275 break;
1276
1277 default:
1278 NS_FATAL_ERROR("method unexpected in state " << m_state);
1279 break;
1280 }
1281
1285 m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1287}
1288
1289void
1296
1297void
1299{
1300 uint8_t measId = msg.measResults.measId;
1301 NS_LOG_FUNCTION(this << (uint16_t)measId);
1303 "measId " << (uint16_t)measId << " haveMeasResultNeighCells "
1304 << msg.measResults.haveMeasResultNeighCells << " measResultListEutra "
1305 << msg.measResults.measResultListEutra.size() << " haveMeasResultServFreqList "
1306 << msg.measResults.haveMeasResultServFreqList << " measResultServFreqList "
1307 << msg.measResults.measResultServFreqList.size());
1308 NS_LOG_LOGIC("serving cellId "
1309 << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) << " RSRP "
1310 << (uint16_t)msg.measResults.measResultPCell.rsrpResult << " RSRQ "
1311 << (uint16_t)msg.measResults.measResultPCell.rsrqResult);
1312
1313 for (auto it = msg.measResults.measResultListEutra.begin();
1314 it != msg.measResults.measResultListEutra.end();
1315 ++it)
1316 {
1317 NS_LOG_LOGIC("neighbour cellId " << it->physCellId << " RSRP "
1318 << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1319 << " RSRQ "
1320 << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1321 }
1322
1323 if ((m_rrc->m_handoverManagementSapProvider != nullptr) &&
1324 (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1325 {
1326 // this measurement was requested by the handover algorithm
1327 m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1328 }
1329
1330 if ((m_rrc->m_ccmRrcSapProvider != nullptr) &&
1331 (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1332 {
1333 // this measurement was requested by the handover algorithm
1334 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1335 }
1336
1337 if ((m_rrc->m_anrSapProvider != nullptr) &&
1338 (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1339 {
1340 // this measurement was requested by the ANR function
1341 m_rrc->m_anrSapProvider->ReportUeMeas(msg.measResults);
1342 }
1343
1344 if ((!m_rrc->m_ffrRrcSapProvider.empty()) &&
1345 (m_rrc->m_ffrMeasIds.find(measId) != m_rrc->m_ffrMeasIds.end()))
1346 {
1347 // this measurement was requested by the FFR function
1348 m_rrc->m_ffrRrcSapProvider.at(0)->ReportUeMeas(m_rnti, msg.measResults);
1349 }
1351 {
1352 for (const auto& it : msg.measResults.measResultServFreqList)
1353 {
1354 /// ToDo: implement on Ffr algorithm the code to properly parsing the new measResults
1355 /// message format alternatively it is needed to 'repack' properly the measResults
1356 /// message before sending to Ffr
1357 m_rrc->m_ffrRrcSapProvider.at(it.servFreqId)->ReportUeMeas(m_rnti, msg.measResults);
1358 }
1359 }
1360
1361 /// Report any measurements to ComponentCarrierManager, so it can react to any change or
1362 /// activate the SCC
1363 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1364 // fire a trace source
1365 m_rrc->m_recvMeasurementReportTrace(m_imsi,
1366 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1367 m_rnti,
1368 msg);
1369}
1370
1371// methods forwarded from CMAC SAP
1372
1373void
1375{
1376 NS_LOG_FUNCTION(this << m_rnti);
1377 // at this stage used only by the scheduler for updating txMode
1378
1379 m_physicalConfigDedicated.antennaInfo.transmissionMode = cmacParams.m_transmissionMode;
1380
1382
1383 // reconfigure the UE RRC
1385}
1386
1387// methods forwarded from PDCP SAP
1388
1389void
1391{
1392 NS_LOG_FUNCTION(this);
1393 if (params.lcid > 2)
1394 {
1395 // data radio bearer
1396 EpsBearerTag tag;
1397 tag.SetRnti(params.rnti);
1398 tag.SetBid(Lcid2Bid(params.lcid));
1399 params.pdcpSdu->AddPacketTag(tag);
1400 m_rrc->m_forwardUpCallback(params.pdcpSdu);
1401 }
1402}
1403
1404uint16_t
1406{
1407 return m_rnti;
1408}
1409
1410uint64_t
1412{
1413 return m_imsi;
1414}
1415
1416uint8_t
1421
1422uint16_t
1424{
1425 return m_physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex;
1426}
1427
1428void
1430{
1431 NS_LOG_FUNCTION(this);
1432 m_physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex = srsConfIndex;
1433 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1434 {
1435 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1436 }
1437 switch (m_state)
1438 {
1440 // do nothing, srs conf index will be correctly enforced upon
1441 // RRC connection establishment
1442 break;
1443
1444 default:
1446 break;
1447 }
1448}
1449
1452{
1453 return m_state;
1454}
1455
1456void
1458{
1459 NS_LOG_FUNCTION(this);
1460 m_physicalConfigDedicated.pdschConfigDedicated = pdschConfigDedicated;
1461
1463
1464 // reconfigure the UE RRC
1466}
1467
1468void
1478
1481{
1482 NS_LOG_FUNCTION(this);
1484 res.oldEnbUeX2apId = m_sourceX2apId;
1485 res.sourceCellId = m_sourceCellId;
1486 res.targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1487 res.cause = 0;
1488 res.criticalityDiagnostics = 0;
1489
1490 return res;
1491}
1492
1495{
1496 NS_LOG_FUNCTION(this);
1498 res.oldEnbUeX2apId = m_rnti; // source cell rnti
1499 res.newEnbUeX2apId = m_targetX2apId;
1500 res.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1501 res.targetCellId = m_targetCellId;
1502 res.cause = 0;
1503
1504 return res;
1505}
1506
1507uint8_t
1509{
1510 NS_LOG_FUNCTION(this);
1511 const uint8_t MAX_DRB_ID = 32;
1512 for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1513 drbid = (drbid + 1) % MAX_DRB_ID)
1514 {
1515 if (drbid != 0) // 0 is not allowed
1516 {
1517 if (m_drbMap.find(drbid) == m_drbMap.end())
1518 {
1519 m_drbMap.insert(std::pair<uint8_t, Ptr<LteDataRadioBearerInfo>>(drbid, drbInfo));
1520 drbInfo->m_drbIdentity = drbid;
1521 m_lastAllocatedDrbid = drbid;
1522 return drbid;
1523 }
1524 }
1525 }
1526 NS_FATAL_ERROR("no more data radio bearer ids available");
1527 return 0;
1528}
1529
1532{
1533 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1534 NS_ASSERT(0 != drbid);
1535 auto it = m_drbMap.find(drbid);
1536 NS_ABORT_IF(it == m_drbMap.end());
1537 return it->second;
1538}
1539
1540void
1542{
1543 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1544 auto it = m_drbMap.find(drbid);
1545 NS_ASSERT_MSG(it != m_drbMap.end(),
1546 "request to remove radio bearer with unknown drbid " << drbid);
1547 m_drbMap.erase(it);
1548}
1549
1552{
1553 NS_LOG_FUNCTION(this);
1556 msg.haveRadioResourceConfigDedicated = true;
1557 msg.radioResourceConfigDedicated = BuildRadioResourceConfigDedicated();
1558 msg.haveMobilityControlInfo = false;
1559 msg.haveMeasConfig = true;
1560 msg.measConfig = m_rrc->m_ueMeasConfig;
1561 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1562 {
1563 m_caSupportConfigured = true;
1564 NS_LOG_FUNCTION(this << "CA not configured. Configure now!");
1565 msg.haveNonCriticalExtension = true;
1566 msg.nonCriticalExtension = BuildNonCriticalExtensionConfigurationCa();
1567 NS_LOG_FUNCTION(this << " haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1568 }
1569 else
1570 {
1571 msg.haveNonCriticalExtension = false;
1572 }
1573
1574 return msg;
1575}
1576
1579{
1580 NS_LOG_FUNCTION(this);
1582
1583 if (m_srb1)
1584 {
1586 stam.srbIdentity = m_srb1->m_srbIdentity;
1587 stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1588 rrcd.srbToAddModList.push_back(stam);
1589 }
1590
1591 for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1592 {
1594 dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1595 dtam.drbIdentity = it->second->m_drbIdentity;
1596 dtam.rlcConfig = it->second->m_rlcConfig;
1597 dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1598 dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1599 rrcd.drbToAddModList.push_back(dtam);
1600 }
1601
1602 rrcd.havePhysicalConfigDedicated = true;
1604 return rrcd;
1605}
1606
1607uint8_t
1615
1616uint8_t
1618{
1619 NS_ASSERT(lcid > 2);
1620 return lcid - 2;
1621}
1622
1623uint8_t
1625{
1626 return drbid + 2;
1627}
1628
1629uint8_t
1631{
1632 NS_ASSERT(lcid > 2);
1633 return lcid - 2;
1634}
1635
1636uint8_t
1638{
1639 return bid + 2;
1640}
1641
1642uint8_t
1644{
1645 return drbid;
1646}
1647
1648uint8_t
1650{
1651 return bid;
1652}
1653
1654void
1656{
1657 NS_LOG_FUNCTION(this << newState);
1658 State oldState = m_state;
1659 m_state = newState;
1660 NS_LOG_INFO(this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager " << oldState
1661 << " --> " << newState);
1663 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1664 m_rnti,
1665 oldState,
1666 newState);
1667
1668 switch (newState)
1669 {
1671 case HANDOVER_JOINING:
1672 NS_FATAL_ERROR("cannot switch to an initial state");
1673 break;
1674
1675 case CONNECTION_SETUP:
1676 case ATTACH_REQUEST:
1677 break;
1678
1679 case CONNECTED_NORMALLY: {
1681 {
1683 }
1685 {
1687 }
1688 }
1689 break;
1690
1693 case HANDOVER_LEAVING:
1694 default:
1695 break;
1696 }
1697}
1698
1701{
1702 NS_LOG_FUNCTION(this);
1704
1705 for (auto& it : m_rrc->m_componentCarrierPhyConf)
1706 {
1707 uint8_t ccId = it.first;
1708
1709 if (ccId == m_componentCarrierId)
1710 {
1711 // Skip primary CC.
1712 continue;
1713 }
1714 else if (ccId < m_componentCarrierId)
1715 {
1716 // Shift all IDs below PCC forward so PCC can use CC ID 1.
1717 ccId++;
1718 }
1719
1720 Ptr<ComponentCarrierBaseStation> eNbCcm = it.second;
1721 LteRrcSap::SCellToAddMod component;
1722 component.sCellIndex = ccId;
1723 component.cellIdentification.physCellId = eNbCcm->GetCellId();
1724 component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1727 eNbCcm->GetDlBandwidth();
1729 .antennaPortsCount = 0;
1731 .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1735 eNbCcm->GetUlEarfcn();
1737 eNbCcm->GetUlBandwidth();
1739 0;
1740 // component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type =
1741 // LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
1743 .srsBandwidthConfig = 0;
1745 .srsSubframeConfig = 0;
1747
1750 .haveNonUlConfiguration = true;
1754 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1762 .haveUlConfiguration = true;
1766 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1779
1780 ncec.sCellToAddModList.push_back(component);
1781 }
1782
1783 return ncec;
1784}
1785
1786///////////////////////////////////////////
1787// eNB RRC methods
1788///////////////////////////////////////////
1789
1791
1822
1823void
1825{
1826 NS_ASSERT_MSG(!m_carriersConfigured, "Secondary carriers can be configured only once.");
1827 m_componentCarrierPhyConf = ccPhyConf;
1829 " Number of component carriers "
1830 "are not equal to the number of he component carrier configuration provided");
1831
1832 for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1833 {
1835 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, i));
1837 }
1838 m_carriersConfigured = true;
1840}
1841
1843{
1844 NS_LOG_FUNCTION(this);
1845}
1846
1847void
1849{
1850 NS_LOG_FUNCTION(this);
1851 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1852 {
1853 delete m_cphySapUser[i];
1854 delete m_cmacSapUser[i];
1855 delete m_ffrRrcSapUser[i];
1856 }
1857 // delete m_cphySapUser;
1858 m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1859 m_cphySapUser.clear();
1860 // delete m_cmacSapUser;
1861 m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1862 m_cmacSapUser.clear();
1863 // delete m_ffrRrcSapUser;
1864 m_ffrRrcSapUser.erase(m_ffrRrcSapUser.begin(), m_ffrRrcSapUser.end());
1865 m_ffrRrcSapUser.clear();
1866 m_ueMap.clear();
1868 delete m_ccmRrcSapUser;
1869 delete m_anrSapUser;
1870 delete m_rrcSapProvider;
1871 delete m_x2SapUser;
1872 delete m_s1SapUser;
1873}
1874
1875TypeId
1877{
1878 static TypeId tid =
1879 TypeId("ns3::LteEnbRrc")
1880 .SetParent<Object>()
1881 .SetGroupName("Lte")
1882 .AddConstructor<LteEnbRrc>()
1883 .AddAttribute("UeMap",
1884 "List of UeManager by C-RNTI.",
1888 .AddAttribute("DefaultTransmissionMode",
1889 "The default UEs' transmission mode (0: SISO)",
1890 UintegerValue(0), // default tx-mode
1893 .AddAttribute(
1894 "EpsBearerToRlcMapping",
1895 "Specify which type of RLC will be used for each type of EPS bearer.",
1899 "RlcSmAlways",
1901 "RlcUmAlways",
1903 "RlcAmAlways",
1904 PER_BASED,
1905 "PacketErrorRateBased"))
1906 .AddAttribute("SystemInformationPeriodicity",
1907 "The interval for sending system information (Time value)",
1911
1912 // SRS related attributes
1913 .AddAttribute(
1914 "SrsPeriodicity",
1915 "The SRS periodicity in milliseconds",
1916 UintegerValue(40),
1919
1920 // Timeout related attributes
1921 .AddAttribute("ConnectionRequestTimeoutDuration",
1922 "After a RA attempt, if no RRC CONNECTION REQUEST is "
1923 "received before this time, the UE context is destroyed. "
1924 "Must account for reception of RAR and transmission of "
1925 "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1926 "timer should not be greater than T300 timer at UE RRC",
1930 .AddAttribute("ConnectionSetupTimeoutDuration",
1931 "After accepting connection request, if no RRC CONNECTION "
1932 "SETUP COMPLETE is received before this time, the UE "
1933 "context is destroyed. Must account for the UE's reception "
1934 "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1935 "SETUP COMPLETE.",
1936 TimeValue(MilliSeconds(150)),
1939 .AddAttribute("ConnectionRejectedTimeoutDuration",
1940 "Time to wait between sending a RRC CONNECTION REJECT and "
1941 "destroying the UE context",
1945 .AddAttribute("HandoverJoiningTimeoutDuration",
1946 "After accepting a handover request, if no RRC CONNECTION "
1947 "RECONFIGURATION COMPLETE is received before this time, the "
1948 "UE context is destroyed. Must account for reception of "
1949 "X2 HO REQ ACK by source eNB, transmission of the Handover "
1950 "Command, non-contention-based random access and reception "
1951 "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
1952 TimeValue(MilliSeconds(200)),
1955 .AddAttribute("HandoverLeavingTimeoutDuration",
1956 "After issuing a Handover Command, if neither RRC "
1957 "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
1958 "been previously received, the UE context is destroyed.",
1959 TimeValue(MilliSeconds(500)),
1962
1963 // Cell selection related attribute
1964 .AddAttribute("QRxLevMin",
1965 "One of information transmitted within the SIB1 message, "
1966 "indicating the required minimum RSRP level that any UE must "
1967 "receive from this cell before it is allowed to camp to this "
1968 "cell. The default value -70 corresponds to -140 dBm and is "
1969 "the lowest possible value as defined by Section 6.3.4 of "
1970 "3GPP TS 36.133. This restriction, however, only applies to "
1971 "initial cell selection and EPC-enabled simulation.",
1973 IntegerValue(-70),
1976 .AddAttribute("NumberOfComponentCarriers",
1977 "Number of Component Carriers",
1978 UintegerValue(1),
1981
1982 // Handover related attributes
1983 .AddAttribute("AdmitHandoverRequest",
1984 "Whether to admit an X2 handover request from another eNB",
1985 BooleanValue(true),
1988 .AddAttribute("AdmitRrcConnectionRequest",
1989 "Whether to admit a connection request from a UE",
1990 BooleanValue(true),
1993
1994 // UE measurements related attributes
1995 .AddAttribute("RsrpFilterCoefficient",
1996 "Determines the strength of smoothing effect induced by "
1997 "layer 3 filtering of RSRP in all attached UE; "
1998 "if set to 0, no layer 3 filtering is applicable",
1999 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2000 UintegerValue(4),
2003 .AddAttribute("RsrqFilterCoefficient",
2004 "Determines the strength of smoothing effect induced by "
2005 "layer 3 filtering of RSRQ in all attached UE; "
2006 "if set to 0, no layer 3 filtering is applicable",
2007 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2008 UintegerValue(4),
2011
2012 // Trace sources
2013 .AddTraceSource("NewUeContext",
2014 "Fired upon creation of a new UE context.",
2016 "ns3::LteEnbRrc::NewUeContextTracedCallback")
2017 .AddTraceSource("ConnectionEstablished",
2018 "Fired upon successful RRC connection establishment.",
2020 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2021 .AddTraceSource("ConnectionReconfiguration",
2022 "trace fired upon RRC connection reconfiguration",
2024 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2025 .AddTraceSource("HandoverStart",
2026 "trace fired upon start of a handover procedure",
2028 "ns3::LteEnbRrc::HandoverStartTracedCallback")
2029 .AddTraceSource("HandoverEndOk",
2030 "trace fired upon successful termination of a handover procedure",
2032 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2033 .AddTraceSource("RecvMeasurementReport",
2034 "trace fired when measurement report is received",
2036 "ns3::LteEnbRrc::ReceiveReportTracedCallback")
2037 .AddTraceSource("NotifyConnectionRelease",
2038 "trace fired when an UE is released",
2040 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2041 .AddTraceSource("RrcTimeout",
2042 "trace fired when a timer expires",
2044 "ns3::LteEnbRrc::TimerExpiryTracedCallback")
2045 .AddTraceSource(
2046 "HandoverFailureNoPreamble",
2047 "trace fired upon handover failure due to non-allocation of non-contention based "
2048 "preamble at eNB for UE to handover due to max count reached",
2050 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2051 .AddTraceSource(
2052 "HandoverFailureMaxRach",
2053 "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2055 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2056 .AddTraceSource(
2057 "HandoverFailureLeaving",
2058 "trace fired upon handover failure due to handover leaving timeout at source eNB",
2060 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2061 .AddTraceSource(
2062 "HandoverFailureJoining",
2063 "trace fired upon handover failure due to handover joining timeout at target eNB",
2065 "ns3::LteEnbRrc::HandoverFailureTracedCallback");
2066 return tid;
2067}
2068
2069void
2075
2078{
2079 NS_LOG_FUNCTION(this);
2080 return m_x2SapUser;
2081}
2082
2083void
2089
2090void
2092{
2093 NS_LOG_FUNCTION(this << s);
2094 if (m_cmacSapProvider.size() > pos)
2095 {
2096 m_cmacSapProvider.at(pos) = s;
2097 }
2098 else
2099 {
2100 m_cmacSapProvider.push_back(s);
2101 NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2102 }
2103}
2104
2107{
2108 NS_LOG_FUNCTION(this);
2109 return m_cmacSapUser.at(0);
2110}
2111
2114{
2115 NS_LOG_FUNCTION(this);
2116 return m_cmacSapUser.at(pos);
2117}
2118
2119void
2125
2132
2133void
2139
2146
2147void
2153
2156{
2157 NS_LOG_FUNCTION(this);
2158 return m_anrSapUser;
2159}
2160
2161void
2163{
2164 NS_LOG_FUNCTION(this << s);
2165 if (!m_ffrRrcSapProvider.empty())
2166 {
2167 m_ffrRrcSapProvider.at(0) = s;
2168 }
2169 else
2170 {
2171 m_ffrRrcSapProvider.push_back(s);
2172 }
2173}
2174
2175void
2177{
2178 NS_LOG_FUNCTION(this << s);
2179 if (m_ffrRrcSapProvider.size() > index)
2180 {
2181 m_ffrRrcSapProvider.at(index) = s;
2182 }
2183 else
2184 {
2185 m_ffrRrcSapProvider.push_back(s);
2186 NS_ABORT_MSG_IF(m_ffrRrcSapProvider.size() - 1 != index,
2187 "You meant to store the pointer at position "
2188 << static_cast<uint32_t>(index) << " but it went to "
2189 << m_ffrRrcSapProvider.size() - 1);
2190 }
2191}
2192
2195{
2196 NS_LOG_FUNCTION(this);
2197 return m_ffrRrcSapUser.at(0);
2198}
2199
2202{
2203 NS_LOG_FUNCTION(this);
2205 "Invalid component carrier index:"
2206 << index << " provided in order to obtain FfrRrcSapUser.");
2207 return m_ffrRrcSapUser.at(index);
2208}
2209
2210void
2216
2223
2224void
2230
2231void
2236
2239{
2240 return m_s1SapUser;
2241}
2242
2243void
2245{
2246 NS_LOG_FUNCTION(this << s);
2247 if (!m_cphySapProvider.empty())
2248 {
2249 m_cphySapProvider.at(0) = s;
2250 }
2251 else
2252 {
2253 m_cphySapProvider.push_back(s);
2254 }
2255}
2256
2259{
2260 NS_LOG_FUNCTION(this);
2261 return m_cphySapUser.at(0);
2262}
2263
2264void
2266{
2267 NS_LOG_FUNCTION(this << s);
2268 if (m_cphySapProvider.size() > pos)
2269 {
2270 m_cphySapProvider.at(pos) = s;
2271 }
2272 else
2273 {
2274 m_cphySapProvider.push_back(s);
2275 NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2276 }
2277}
2278
2281{
2282 NS_LOG_FUNCTION(this);
2283 return m_cphySapUser.at(pos);
2284}
2285
2286bool
2287LteEnbRrc::HasUeManager(uint16_t rnti) const
2288{
2289 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2290 auto it = m_ueMap.find(rnti);
2291 return (it != m_ueMap.end());
2292}
2293
2296{
2297 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2298 NS_ASSERT(0 != rnti);
2299 auto it = m_ueMap.find(rnti);
2300 NS_ASSERT_MSG(it != m_ueMap.end(), "UE manager for RNTI " << rnti << " not found");
2301 return it->second;
2302}
2303
2304std::vector<uint8_t>
2306{
2307 NS_LOG_FUNCTION(this);
2308
2309 // SANITY CHECK
2310
2312 m_ueMeasConfig.measIdToAddModList.size() ==
2313 m_ueMeasConfig.reportConfigToAddModList.size() * m_numberOfComponentCarriers,
2314 "Measurement identities and reporting configuration should not have different quantity");
2315
2316 if (!Simulator::Now().IsZero())
2317 {
2318 NS_FATAL_ERROR("AddUeMeasReportConfig may not be called after the simulation has run");
2319 }
2320
2321 // INPUT VALIDATION
2322
2323 switch (config.triggerQuantity)
2324 {
2328 {
2330 "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2331 }
2332
2338 {
2340 "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2341 }
2342 break;
2343
2347 {
2349 "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2350 }
2351
2357 {
2359 "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2360 }
2361 break;
2362
2363 default:
2364 NS_FATAL_ERROR("unsupported triggerQuantity");
2365 break;
2366 }
2367
2369 {
2370 NS_FATAL_ERROR("Only REPORT_STRONGEST_CELLS purpose is supported");
2371 }
2372
2374 {
2375 NS_LOG_WARN("reportQuantity = BOTH will be used instead of the given reportQuantity");
2376 }
2377
2378 uint8_t nextId = m_ueMeasConfig.reportConfigToAddModList.size() + 1;
2379
2380 // create the reporting configuration
2382 reportConfig.reportConfigId = nextId;
2383 reportConfig.reportConfigEutra = config;
2384
2385 // add reporting configuration to UE measurement configuration
2386 m_ueMeasConfig.reportConfigToAddModList.push_back(reportConfig);
2387
2388 std::vector<uint8_t> measIds;
2389
2390 // create measurement identities, linking reporting configuration to all objects
2391 for (uint16_t componentCarrier = 0; componentCarrier < m_numberOfComponentCarriers;
2392 componentCarrier++)
2393 {
2394 LteRrcSap::MeasIdToAddMod measIdToAddMod;
2395
2396 uint8_t measId = m_ueMeasConfig.measIdToAddModList.size() + 1;
2397
2398 measIdToAddMod.measId = measId;
2399 measIdToAddMod.measObjectId = componentCarrier + 1;
2400 measIdToAddMod.reportConfigId = nextId;
2401
2402 m_ueMeasConfig.measIdToAddModList.push_back(measIdToAddMod);
2403 measIds.push_back(measId);
2404 }
2405
2406 return measIds;
2407}
2408
2409void
2411{
2412 auto it = ccPhyConf.begin();
2413 NS_ASSERT(it != ccPhyConf.end());
2414 uint16_t ulBandwidth = it->second->GetUlBandwidth();
2415 uint16_t dlBandwidth = it->second->GetDlBandwidth();
2416 uint32_t ulEarfcn = it->second->GetUlEarfcn();
2417 uint32_t dlEarfcn = it->second->GetDlEarfcn();
2418 NS_LOG_FUNCTION(this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2420
2421 for (const auto& it : ccPhyConf)
2422 {
2423 m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2424 it.second->GetDlBandwidth());
2425 m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2426 it.second->GetDlEarfcn());
2427 m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2428 m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2429 it.second->GetDlBandwidth());
2430 if (m_ffrRrcSapProvider.size() > it.first)
2431 {
2432 m_ffrRrcSapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2433 m_ffrRrcSapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2434 it.second->GetDlBandwidth());
2435 }
2436 }
2437
2438 m_dlEarfcn = dlEarfcn;
2439 m_ulEarfcn = ulEarfcn;
2440 m_dlBandwidth = dlBandwidth;
2441 m_ulBandwidth = ulBandwidth;
2442
2443 /*
2444 * Initializing the list of measurement objects.
2445 * Only intra-frequency measurements are supported,
2446 * so one measurement object is created for each carrier frequency.
2447 */
2448 for (const auto& it : ccPhyConf)
2449 {
2451 measObject.measObjectId = it.first + 1;
2452 measObject.measObjectEutra.carrierFreq = it.second->GetDlEarfcn();
2453 measObject.measObjectEutra.allowedMeasBandwidth = it.second->GetDlBandwidth();
2454 measObject.measObjectEutra.presenceAntennaPort1 = false;
2455 measObject.measObjectEutra.neighCellConfig = 0;
2456 measObject.measObjectEutra.offsetFreq = 0;
2458
2459 m_ueMeasConfig.measObjectToAddModList.push_back(measObject);
2460 }
2461
2462 m_ueMeasConfig.haveQuantityConfig = true;
2463 m_ueMeasConfig.quantityConfig.filterCoefficientRSRP = m_rsrpFilterCoefficient;
2464 m_ueMeasConfig.quantityConfig.filterCoefficientRSRQ = m_rsrqFilterCoefficient;
2465 m_ueMeasConfig.haveMeasGapConfig = false;
2466 m_ueMeasConfig.haveSmeasure = false;
2467 m_ueMeasConfig.haveSpeedStatePars = false;
2468
2469 m_sib1.clear();
2470 m_sib1.reserve(ccPhyConf.size());
2471 for (const auto& it : ccPhyConf)
2472 {
2473 // Enabling MIB transmission
2475 mib.dlBandwidth = it.second->GetDlBandwidth();
2476 mib.systemFrameNumber = 0;
2477 m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2478
2479 // Enabling SIB1 transmission with default values
2481 sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId();
2485 sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
2486 sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
2487 m_sib1.push_back(sib1);
2488 m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2489 }
2490 /*
2491 * Enabling transmission of other SIB. The first time System Information is
2492 * transmitted is arbitrarily assumed to be at +0.016s, and then it will be
2493 * regularly transmitted every 80 ms by default (set the
2494 * SystemInformationPeriodicity attribute to configure this).
2495 */
2497
2498 m_configured = true;
2499}
2500
2501void
2502LteEnbRrc::SetCellId(uint16_t cellId)
2503{
2504 // update SIB1
2505 m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2506 m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2507}
2508
2509void
2510LteEnbRrc::SetCellId(uint16_t cellId, uint8_t ccIndex)
2511{
2512 // update SIB1
2513 m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2514 m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2515}
2516
2517uint8_t
2519{
2520 NS_LOG_FUNCTION(this << cellId);
2521 for (auto& it : m_componentCarrierPhyConf)
2522 {
2523 if (it.second->GetCellId() == cellId)
2524 {
2525 return it.first;
2526 }
2527 }
2528 NS_FATAL_ERROR("Cell " << cellId << " not found in CC map");
2529}
2530
2531uint16_t
2532LteEnbRrc::ComponentCarrierToCellId(uint8_t componentCarrierId)
2533{
2534 NS_LOG_FUNCTION(this << +componentCarrierId);
2535 return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2536}
2537
2538bool
2539LteEnbRrc::HasCellId(uint16_t cellId) const
2540{
2541 for (auto& it : m_componentCarrierPhyConf)
2542 {
2543 if (it.second->GetCellId() == cellId)
2544 {
2545 return true;
2546 }
2547 }
2548 return false;
2549}
2550
2551bool
2553{
2554 NS_LOG_FUNCTION(this << packet);
2555 EpsBearerTag tag;
2556 bool found = packet->RemovePacketTag(tag);
2557 NS_ASSERT_MSG(found, "no EpsBearerTag found in packet to be sent");
2558 Ptr<UeManager> ueManager = GetUeManager(tag.GetRnti());
2559
2560 NS_LOG_INFO("Sending a packet of " << packet->GetSize() << " bytes to IMSI "
2561 << ueManager->GetImsi() << ", RNTI " << ueManager->GetRnti()
2562 << ", BID " << (uint16_t)tag.GetBid());
2563 ueManager->SendData(tag.GetBid(), packet);
2564
2565 return true;
2566}
2567
2568void
2573
2574void
2576{
2577 NS_LOG_FUNCTION(this << rnti);
2579 "ConnectionRequestTimeout in unexpected state "
2580 << GetUeManager(rnti)->GetState());
2581 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2582 rnti,
2583 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2584 "ConnectionRequestTimeout");
2585 RemoveUe(rnti);
2586}
2587
2588void
2590{
2591 NS_LOG_FUNCTION(this << rnti);
2593 "ConnectionSetupTimeout in unexpected state " << GetUeManager(rnti)->GetState());
2594 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2595 rnti,
2596 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2597 "ConnectionSetupTimeout");
2598 RemoveUe(rnti);
2599}
2600
2601void
2603{
2604 NS_LOG_FUNCTION(this << rnti);
2606 "ConnectionRejectedTimeout in unexpected state "
2607 << GetUeManager(rnti)->GetState());
2608 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2609 rnti,
2610 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2611 "ConnectionRejectedTimeout");
2612 RemoveUe(rnti);
2613}
2614
2615void
2617{
2618 NS_LOG_FUNCTION(this << rnti);
2620 "HandoverJoiningTimeout in unexpected state " << GetUeManager(rnti)->GetState());
2622 GetUeManager(rnti)->GetImsi(),
2623 rnti,
2624 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2625 // check if the RNTI to be removed is not stale
2626 if (HasUeManager(rnti))
2627 {
2628 /**
2629 * When the handover joining timer expires at the target cell,
2630 * then notify the source cell to release the RRC connection and
2631 * delete the UE context at eNodeB and SGW/PGW. The
2632 * HandoverPreparationFailure message is reused to notify the source cell
2633 * through the X2 interface instead of creating a new message.
2634 */
2635 Ptr<UeManager> ueManager = GetUeManager(rnti);
2636 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2637 m_x2SapProvider->SendHandoverPreparationFailure(msg);
2638 RemoveUe(rnti);
2639 }
2640}
2641
2642void
2644{
2645 NS_LOG_FUNCTION(this << rnti);
2647 "HandoverLeavingTimeout in unexpected state " << GetUeManager(rnti)->GetState());
2649 GetUeManager(rnti)->GetImsi(),
2650 rnti,
2651 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2652 // check if the RNTI to be removed is not stale
2653 if (HasUeManager(rnti))
2654 {
2655 /**
2656 * Send HO cancel msg to the target eNB and release the RRC connection
2657 * with the UE and also delete UE context at the source eNB and bearer
2658 * info at SGW and PGW.
2659 */
2660 Ptr<UeManager> ueManager = GetUeManager(rnti);
2661 EpcX2Sap::HandoverCancelParams msg = ueManager->BuildHoCancelMsg();
2662 m_x2SapProvider->SendHandoverCancel(msg);
2663 ueManager->SendRrcConnectionRelease();
2664 }
2665}
2666
2667void
2668LteEnbRrc::SendHandoverRequest(uint16_t rnti, uint16_t cellId)
2669{
2670 NS_LOG_FUNCTION(this << rnti << cellId);
2671 NS_LOG_LOGIC("Request to send HANDOVER REQUEST");
2673
2674 Ptr<UeManager> ueManager = GetUeManager(rnti);
2675 ueManager->PrepareHandover(cellId);
2676}
2677
2678void
2680{
2681 NS_LOG_FUNCTION(this << rnti);
2682 GetUeManager(rnti)->CompleteSetupUe(params);
2683}
2684
2685void
2687{
2688 NS_LOG_FUNCTION(this << rnti);
2689 GetUeManager(rnti)->RecvRrcConnectionRequest(msg);
2690}
2691
2692void
2695{
2696 NS_LOG_FUNCTION(this << rnti);
2697 GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2698}
2699
2700void
2702 uint16_t rnti,
2704{
2705 NS_LOG_FUNCTION(this << rnti);
2706 GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2707}
2708
2709void
2711 uint16_t rnti,
2713{
2714 NS_LOG_FUNCTION(this << rnti);
2715 GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2716}
2717
2718void
2720 uint16_t rnti,
2722{
2723 NS_LOG_FUNCTION(this << rnti);
2724 GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2725}
2726
2727void
2729{
2730 NS_LOG_FUNCTION(this << rnti);
2731 GetUeManager(rnti)->RecvMeasurementReport(msg);
2732}
2733
2734void
2736{
2737 NS_LOG_FUNCTION(this);
2738 Ptr<UeManager> ueManager = GetUeManager(msg.rnti);
2739 ueManager->InitialContextSetupRequest();
2740}
2741
2742void
2744{
2745 NS_LOG_FUNCTION(this << rnti);
2746
2747 // check if the RNTI to be removed is not stale
2748 if (HasUeManager(rnti))
2749 {
2750 Ptr<UeManager> ueManager = GetUeManager(rnti);
2751
2752 if (ueManager->GetState() == UeManager::HANDOVER_JOINING)
2753 {
2755 GetUeManager(rnti)->GetImsi(),
2756 rnti,
2757 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2758 /**
2759 * During the HO, when the RACH failure due to the maximum number of
2760 * re-attempts is reached the UE request the target eNB to deletes its
2761 * context. Upon which, the target eNB sends handover preparation
2762 * failure to the source eNB.
2763 */
2764 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2765 m_x2SapProvider->SendHandoverPreparationFailure(msg);
2766 }
2767
2768 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2769 // delete the UE context at the eNB
2770 RemoveUe(rnti);
2771 }
2772}
2773
2774void
2777{
2778 NS_LOG_FUNCTION(this);
2779 Ptr<UeManager> ueManager = GetUeManager(request.rnti);
2780 ueManager->SetupDataRadioBearer(request.bearer,
2781 request.bearerId,
2782 request.gtpTeid,
2783 request.transportLayerAddress);
2784}
2785
2786void
2789{
2790 NS_LOG_FUNCTION(this);
2791 Ptr<UeManager> ueManager = GetUeManager(params.rnti);
2792 ueManager->SendUeContextRelease();
2793}
2794
2795void
2797{
2798 NS_LOG_FUNCTION(this);
2799
2800 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST");
2801
2802 NS_LOG_LOGIC("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
2803 NS_LOG_LOGIC("sourceCellId = " << req.sourceCellId);
2804 NS_LOG_LOGIC("targetCellId = " << req.targetCellId);
2805 NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId);
2806
2807 // if no SRS index is available, then do not accept the handover
2809 {
2810 NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId);
2812 res.oldEnbUeX2apId = req.oldEnbUeX2apId;
2813 res.sourceCellId = req.sourceCellId;
2814 res.targetCellId = req.targetCellId;
2815 res.cause = 0;
2816 res.criticalityDiagnostics = 0;
2817 m_x2SapProvider->SendHandoverPreparationFailure(res);
2818 return;
2819 }
2820
2821 uint8_t componentCarrierId = CellToComponentCarrierId(req.targetCellId);
2822 uint16_t rnti = AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
2823 Ptr<UeManager> ueManager = GetUeManager(rnti);
2824 ueManager->SetSource(req.sourceCellId, req.oldEnbUeX2apId);
2825 ueManager->SetImsi(req.mmeUeS1apId);
2827 m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2828 if (!anrcrv.valid)
2829 {
2831 this
2832 << " failed to allocate a preamble for non-contention based RA => cannot accept HO");
2834 GetUeManager(rnti)->GetImsi(),
2835 rnti,
2836 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2837 /**
2838 * When the maximum non-contention based preambles is reached, then it is considered
2839 * handover has failed and source cell is notified to release the RRC connection and delete
2840 * the UE context at eNodeB and SGW/PGW.
2841 */
2842 Ptr<UeManager> ueManager = GetUeManager(rnti);
2843 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2844 m_x2SapProvider->SendHandoverPreparationFailure(msg);
2845 RemoveUe(rnti); // remove the UE from the target eNB
2846 return;
2847 }
2848
2850 ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
2851 ackParams.newEnbUeX2apId = rnti;
2852 ackParams.sourceCellId = req.sourceCellId;
2853 ackParams.targetCellId = req.targetCellId;
2854
2855 for (auto it = req.bearers.begin(); it != req.bearers.end(); ++it)
2856 {
2857 ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2858 it->erabId,
2859 it->gtpTeid,
2860 it->transportLayerAddress);
2862 i.erabId = it->erabId;
2863 ackParams.admittedBearers.push_back(i);
2864 }
2865
2867 ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2868
2869 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2870 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
2873 anrcrv.raPrachMaskIndex;
2874
2876 m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2878 .numberOfRaPreambles = rc.numberOfRaPreambles;
2880 .preambleTransMax = rc.preambleTransMax;
2882 .raResponseWindowSize = rc.raResponseWindowSize;
2884 .connEstFailCount = rc.connEstFailCount;
2885
2886 Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand(handoverCommand);
2887
2888 ackParams.rrcContext = encodedHandoverCommand;
2889
2890 NS_LOG_LOGIC("Send X2 message: HANDOVER REQUEST ACK");
2891
2892 NS_LOG_LOGIC("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
2893 NS_LOG_LOGIC("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
2894 NS_LOG_LOGIC("sourceCellId = " << ackParams.sourceCellId);
2895 NS_LOG_LOGIC("targetCellId = " << ackParams.targetCellId);
2896
2897 m_x2SapProvider->SendHandoverRequestAck(ackParams);
2898}
2899
2900void
2902{
2903 NS_LOG_FUNCTION(this);
2904
2905 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST ACK");
2906
2907 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2908 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2909 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2910 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2911
2912 uint16_t rnti = params.oldEnbUeX2apId;
2913 Ptr<UeManager> ueManager = GetUeManager(rnti);
2914 ueManager->RecvHandoverRequestAck(params);
2915}
2916
2917void
2919{
2920 NS_LOG_FUNCTION(this);
2921
2922 NS_LOG_LOGIC("Recv X2 message: HANDOVER PREPARATION FAILURE");
2923
2924 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2925 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2926 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2927 NS_LOG_LOGIC("cause = " << params.cause);
2928 NS_LOG_LOGIC("criticalityDiagnostics = " << params.criticalityDiagnostics);
2929
2930 uint16_t rnti = params.oldEnbUeX2apId;
2931
2932 // check if the RNTI is not stale
2933 if (HasUeManager(rnti))
2934 {
2935 Ptr<UeManager> ueManager = GetUeManager(rnti);
2936 ueManager->RecvHandoverPreparationFailure(params.targetCellId);
2937 }
2938}
2939
2940void
2942{
2943 NS_LOG_FUNCTION(this);
2944
2945 NS_LOG_LOGIC("Recv X2 message: SN STATUS TRANSFER");
2946
2947 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2948 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2949 NS_LOG_LOGIC("erabsSubjectToStatusTransferList size = "
2950 << params.erabsSubjectToStatusTransferList.size());
2951
2952 uint16_t rnti = params.newEnbUeX2apId;
2953
2954 // check if the RNTI to receive SN transfer for is not stale
2955 if (HasUeManager(rnti))
2956 {
2957 Ptr<UeManager> ueManager = GetUeManager(rnti);
2958 ueManager->RecvSnStatusTransfer(params);
2959 }
2960}
2961
2962void
2964{
2965 NS_LOG_FUNCTION(this);
2966
2967 NS_LOG_LOGIC("Recv X2 message: UE CONTEXT RELEASE");
2968
2969 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2970 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2971
2972 uint16_t rnti = params.oldEnbUeX2apId;
2973
2974 // check if the RNTI to be removed is not stale
2975 if (HasUeManager(rnti))
2976 {
2977 GetUeManager(rnti)->RecvUeContextRelease(params);
2978 RemoveUe(rnti);
2979 }
2980}
2981
2982void
2984{
2985 NS_LOG_FUNCTION(this);
2986
2987 NS_LOG_LOGIC("Recv X2 message: LOAD INFORMATION");
2988
2989 NS_LOG_LOGIC("Number of cellInformationItems = " << params.cellInformationList.size());
2990
2992 m_ffrRrcSapProvider.at(0)->RecvLoadInformation(params);
2993}
2994
2995void
2997{
2998 NS_LOG_FUNCTION(this);
2999
3000 NS_LOG_LOGIC("Recv X2 message: RESOURCE STATUS UPDATE");
3001
3003 "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
3004
3005 NS_ASSERT("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
3006}
3007
3008void
3010{
3011 NS_LOG_FUNCTION(this);
3012
3013 NS_LOG_LOGIC("Recv UE DATA FORWARDING through X2 interface");
3014 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3015 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3016 NS_LOG_LOGIC("gtpTeid = " << params.gtpTeid);
3017 NS_LOG_LOGIC("ueData = " << params.ueData);
3018 NS_LOG_LOGIC("ueData size = " << params.ueData->GetSize());
3019
3020 auto teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
3021 if (teidInfoIt != m_x2uTeidInfoMap.end())
3022 {
3023 GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
3024 }
3025 else
3026 {
3027 NS_FATAL_ERROR("X2-U data received but no X2uTeidInfo found");
3028 }
3029}
3030
3031void
3033{
3034 NS_LOG_FUNCTION(this);
3035
3036 NS_LOG_LOGIC("Recv X2 message: HANDOVER CANCEL");
3037
3038 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3039 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3040 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3041 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3042 NS_LOG_LOGIC("cause = " << params.cause);
3043
3044 uint16_t rnti = params.newEnbUeX2apId;
3045 if (HasUeManager(rnti))
3046 {
3047 Ptr<UeManager> ueManager = GetUeManager(rnti);
3048 ueManager->RecvHandoverCancel(params);
3049 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3050 }
3051}
3052
3053uint16_t
3055{
3056 NS_LOG_FUNCTION(this << +componentCarrierId);
3057 // if no SRS index is available, then do not create a new UE context.
3058 if (IsMaxSrsReached())
3059 {
3060 NS_LOG_WARN("Not enough SRS configuration indices, UE context not created");
3061 return 0; // return 0 since new RNTI was not assigned for the received preamble
3062 }
3063 return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3064}
3065
3066void
3068{
3069 Ptr<UeManager> ueManager = GetUeManager(cmacParams.m_rnti);
3070 ueManager->CmacUeConfigUpdateInd(cmacParams);
3071}
3072
3073void
3074LteEnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
3075{
3076 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3077 NS_FATAL_ERROR("not implemented");
3078}
3079
3080std::vector<uint8_t>
3082{
3083 NS_LOG_FUNCTION(this);
3084 std::vector<uint8_t> measIds = AddUeMeasReportConfig(reportConfig);
3085 m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3086 return measIds;
3087}
3088
3089uint8_t
3091{
3092 NS_LOG_FUNCTION(this);
3093 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3094 m_componentCarrierMeasIds.insert(measId);
3095 return measId;
3096}
3097
3098void
3099LteEnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3100{
3101 m_numberOfComponentCarriers = numberOfComponentCarriers;
3102}
3103
3104void
3105LteEnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3106{
3107 NS_LOG_FUNCTION(this << rnti << targetCellId);
3108
3109 bool isHandoverAllowed = true;
3110
3111 Ptr<UeManager> ueManager = GetUeManager(rnti);
3112 NS_ASSERT_MSG(ueManager, "Cannot find UE context with RNTI " << rnti);
3113
3114 if (m_anrSapProvider != nullptr && !HasCellId(targetCellId))
3115 {
3116 // ensure that proper neighbour relationship exists between source and target cells
3117 bool noHo = m_anrSapProvider->GetNoHo(targetCellId);
3118 bool noX2 = m_anrSapProvider->GetNoX2(targetCellId);
3119 NS_LOG_DEBUG(this << " cellId="
3120 << ComponentCarrierToCellId(ueManager->GetComponentCarrierId())
3121 << " targetCellId=" << targetCellId << " NRT.NoHo=" << noHo
3122 << " NRT.NoX2=" << noX2);
3123
3124 if (noHo || noX2)
3125 {
3126 isHandoverAllowed = false;
3127 NS_LOG_LOGIC(this << " handover to cell " << targetCellId << " is not allowed by ANR");
3128 }
3129 }
3130
3131 if (ueManager->GetState() != UeManager::CONNECTED_NORMALLY)
3132 {
3133 isHandoverAllowed = false;
3134 NS_LOG_LOGIC(this << " handover is not allowed because the UE"
3135 << " rnti=" << rnti << " is in " << ueManager->GetState() << " state");
3136 }
3137
3138 if (isHandoverAllowed)
3139 {
3140 // initiate handover execution
3141 ueManager->PrepareHandover(targetCellId);
3142 }
3143}
3144
3145uint8_t
3147{
3148 NS_LOG_FUNCTION(this);
3149 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3150 m_anrMeasIds.insert(measId);
3151 return measId;
3152}
3153
3154uint8_t
3156{
3157 NS_LOG_FUNCTION(this);
3158 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3159 m_ffrMeasIds.insert(measId);
3160 return measId;
3161}
3162
3163void
3165 LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
3166{
3167 NS_LOG_FUNCTION(this);
3168 Ptr<UeManager> ueManager = GetUeManager(rnti);
3169 ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3170}
3171
3172void
3174{
3175 NS_LOG_FUNCTION(this);
3176
3177 m_x2SapProvider->SendLoadInformation(params);
3178}
3179
3180uint16_t
3181LteEnbRrc::AddUe(UeManager::State state, uint8_t componentCarrierId)
3182{
3183 NS_LOG_FUNCTION(this);
3184 bool found = false;
3185 uint16_t rnti;
3186 for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3187 {
3188 if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3189 {
3190 found = true;
3191 break;
3192 }
3193 }
3194
3195 NS_ASSERT_MSG(found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3196 m_lastAllocatedRnti = rnti;
3197 Ptr<UeManager> ueManager = CreateObject<UeManager>(this, rnti, state, componentCarrierId);
3198 m_ccmRrcSapProvider->AddUe(rnti, (uint8_t)state);
3199 m_ueMap.insert(std::pair<uint16_t, Ptr<UeManager>>(rnti, ueManager));
3200 ueManager->Initialize();
3201 const uint16_t cellId = ComponentCarrierToCellId(componentCarrierId);
3202 NS_LOG_DEBUG(this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI "
3203 << ueManager->GetSrsConfigurationIndex());
3204 m_newUeContextTrace(cellId, rnti);
3205 return rnti;
3206}
3207
3208void
3210{
3211 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3212 auto it = m_ueMap.find(rnti);
3213 NS_ASSERT_MSG(it != m_ueMap.end(), "request to remove UE info with unknown rnti " << rnti);
3214 uint64_t imsi = it->second->GetImsi();
3215 uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3216 // cancel pending events
3217 it->second->CancelPendingEvents();
3218 // fire trace upon connection release
3220 ComponentCarrierToCellId(it->second->GetComponentCarrierId()),
3221 rnti);
3222 m_ueMap.erase(it);
3223 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3224 {
3225 m_cmacSapProvider.at(i)->RemoveUe(rnti);
3226 m_cphySapProvider.at(i)->RemoveUe(rnti);
3227 }
3228 if (m_s1SapProvider != nullptr)
3229 {
3230 m_s1SapProvider->UeContextRelease(rnti);
3231 }
3232 m_ccmRrcSapProvider->RemoveUe(rnti);
3233 // need to do this after UeManager has been deleted
3234 if (srsCi != 0)
3235 {
3237 }
3238
3239 m_rrcSapUser->RemoveUe(rnti); // Remove UE context at RRC protocol
3240}
3241
3242TypeId
3244{
3246 {
3247 case RLC_SM_ALWAYS:
3248 return LteRlcSm::GetTypeId();
3249
3250 case RLC_UM_ALWAYS:
3251 return LteRlcUm::GetTypeId();
3252
3253 case RLC_AM_ALWAYS:
3254 return LteRlcAm::GetTypeId();
3255
3256 case PER_BASED:
3257 if (bearer.GetPacketErrorLossRate() > 1.0e-5)
3258 {
3259 return LteRlcUm::GetTypeId();
3260 }
3261 else
3262 {
3263 return LteRlcAm::GetTypeId();
3264 }
3265
3266 default:
3267 return LteRlcSm::GetTypeId();
3268 }
3269}
3270
3271void
3273{
3274 NS_LOG_FUNCTION(this << cellId);
3275
3276 if (m_anrSapProvider != nullptr)
3277 {
3278 m_anrSapProvider->AddNeighbourRelation(cellId);
3279 }
3280}
3281
3282void
3283LteEnbRrc::SetCsgId(uint32_t csgId, bool csgIndication)
3284{
3285 NS_LOG_FUNCTION(this << csgId << csgIndication);
3286 for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3287 componentCarrierId++)
3288 {
3289 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3290 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3291 m_cphySapProvider.at(componentCarrierId)
3292 ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3293 }
3294}
3295
3296/// Number of distinct SRS periodicity plus one.
3297static const uint8_t SRS_ENTRIES = 9;
3298/**
3299 * Sounding Reference Symbol (SRS) periodicity (TSRS) in milliseconds. Taken
3300 * from 3GPP TS 36.213 Table 8.2-1. Index starts from 1.
3301 */
3302static const uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
3303/**
3304 * The lower bound (inclusive) of the SRS configuration indices (ISRS) which
3305 * use the corresponding SRS periodicity (TSRS). Taken from 3GPP TS 36.213
3306 * Table 8.2-1. Index starts from 1.
3307 */
3308static const uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
3309/**
3310 * The upper bound (inclusive) of the SRS configuration indices (ISRS) which
3311 * use the corresponding SRS periodicity (TSRS). Taken from 3GPP TS 36.213
3312 * Table 8.2-1. Index starts from 1.
3313 */
3314static const uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
3315
3316void
3318{
3319 NS_LOG_FUNCTION(this << p);
3320 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3321 {
3322 if (g_srsPeriodicity[id] == p)
3323 {
3325 return;
3326 }
3327 }
3328 // no match found
3329 std::ostringstream allowedValues;
3330 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3331 {
3332 allowedValues << g_srsPeriodicity[id] << " ";
3333 }
3334 NS_FATAL_ERROR("illecit SRS periodicity value " << p
3335 << ". Allowed values: " << allowedValues.str());
3336}
3337
3346
3347uint16_t
3349{
3351 // SRS
3354 NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3357 {
3358 NS_FATAL_ERROR("too many UEs ("
3359 << m_ueSrsConfigurationIndexSet.size() + 1
3360 << ") for current SRS periodicity "
3362 << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
3363 }
3364
3365 if (m_ueSrsConfigurationIndexSet.empty())
3366 {
3367 // first entry
3370 }
3371 else
3372 {
3373 // find a CI from the available ones
3374 auto rit = m_ueSrsConfigurationIndexSet.rbegin();
3376 NS_LOG_DEBUG(this << " lower bound " << (*rit) << " of "
3379 {
3380 // got it from the upper bound
3383 }
3384 else
3385 {
3386 // look for released ones
3387 for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
3389 srcCi++)
3390 {
3391 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3392 if (it == m_ueSrsConfigurationIndexSet.end())
3393 {
3395 m_ueSrsConfigurationIndexSet.insert(srcCi);
3396 break;
3397 }
3398 }
3399 }
3400 }
3402}
3403
3404void
3406{
3407 NS_LOG_FUNCTION(this << srcCi);
3408 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3410 "request to remove unknown SRS CI " << srcCi);
3412}
3413
3414bool
3423
3424uint8_t
3426{
3427 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
3428 {
3429 return 1;
3430 }
3431 else
3432 {
3433 return 2;
3434 }
3435}
3436
3437uint8_t
3439{
3440 return bearer.qci;
3441}
3442
3443void
3445{
3446 // NS_LOG_FUNCTION (this);
3447
3448 for (auto& it : m_componentCarrierPhyConf)
3449 {
3450 uint8_t ccId = it.first;
3451
3453 si.haveSib2 = true;
3454 si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3455 si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3457 m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3459
3460 LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3461 LteRrcSap::RachConfigCommon rachConfigCommon;
3462 rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3463 rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3464 rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3465 rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3466 si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3467
3468 m_rrcSapUser->SendSystemInformation(it.second->GetCellId(), si);
3469 }
3470
3471 /*
3472 * For simplicity, we use the same periodicity for all SIBs. Note that in real
3473 * systems the periodicy of each SIBs could be different.
3474 */
3476}
3477
3478bool
3480{
3481 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3482 Ptr<UeManager> ueManager = GetUeManager(rnti);
3483 switch (ueManager->GetState())
3484 {
3487 return true;
3488 default:
3489 return false;
3490 }
3491}
3492
3493std::ostream&
3494operator<<(std::ostream& os, UeManager::State state)
3495{
3496 switch (state)
3497 {
3499 return os << "INITIAL_RANDOM_ACCESS";
3501 return os << "CONNECTION_SETUP";
3503 return os << "CONNECTION_REJECTED";
3505 return os << "ATTACH_REQUEST";
3507 return os << "CONNECTED_NORMALLY";
3509 return os << "CONNECTION_RECONFIGURATION";
3511 return os << "CONNECTION_REESTABLISHMENT";
3513 return os << "HANDOVER_PREPARATION";
3515 return os << "HANDOVER_JOINING";
3517 return os << "HANDOVER_PATH_SWITCH";
3519 return os << "HANDOVER_LEAVING";
3521 return os << "NUM_STATES";
3522 };
3523 return os << "UNKNOWN(" << static_cast<uint32_t>(state) << ")";
3524}
3525
3526} // namespace ns3
AttributeValue implementation for Boolean.
Definition boolean.h:26
Callback template class.
Definition callback.h:422
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.
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
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.
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
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 ...
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.
bool m_reconfigureUes
reconfigure UEs?
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.
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...
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.
friend class ObjectFactory
Friends.
Definition object.h:357
virtual void DoInitialize()
Initialize() implementation.
Definition object.cc:440
Object()
Constructor.
Definition object.cc:96
AttributeValue implementation for Pointer.
Definition pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
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:96
AttributeValue implementation for Time.
Definition nstime.h:1456
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:114
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:249
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:270
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:1457
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1477
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:1381
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:585
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
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.
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 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::@174152020357172127004302246116267001242110156064 eventId
Event enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@374136270164373156154156077265266160331034212212 triggerQuantity
Trigger type enumeration.
@ 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.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
@ RSRP
Reference Signal Received Power.
@ RSRQ
Reference Signal Received Quality.
@ BOTH
Both the RSRP and RSRQ quantities are to be included in the measurement report.
enum ns3::LteRrcSap::ReportConfigEutra::@144363074020234244076040076052042351213163213352 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.
enum ns3::LteRrcSap::ThresholdEutra::@200372075340144231162262002242030206054121013015 choice
Threshold enumeration.
@ THRESHOLD_RSRP
RSRP is used for the threshold.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
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