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 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Nicola Baldo <nbaldo@cttc.es>
19 * Marco Miozzo <mmiozzo@cttc.es>
20 * Manuel Requena <manuel.requena@cttc.es>
21 * Modified by: Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015),
22 * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation)
23 * Vignesh Babu <ns3-dev@esk.fraunhofer.de> (RLF extensions)
24 */
25
26#include "lte-enb-rrc.h"
27
29#include "eps-bearer-tag.h"
30#include "lte-pdcp.h"
32#include "lte-rlc-am.h"
33#include "lte-rlc-tm.h"
34#include "lte-rlc-um.h"
35#include "lte-rlc.h"
36
37#include <ns3/abort.h>
38#include <ns3/fatal-error.h>
39#include <ns3/log.h>
40#include <ns3/object-factory.h>
41#include <ns3/object-map.h>
42#include <ns3/packet.h>
43#include <ns3/pointer.h>
44#include <ns3/simulator.h>
45
46namespace ns3
47{
48
49NS_LOG_COMPONENT_DEFINE("LteEnbRrc");
50
52// CMAC SAP forwarder
54
59{
60 public:
67 EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc* rrc, uint8_t componentCarrierId);
68
69 uint16_t AllocateTemporaryCellRnti() override;
70 void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override;
71 void RrcConfigurationUpdateInd(UeConfig params) override;
72 bool IsRandomAccessCompleted(uint16_t rnti) override;
73
74 private:
77};
78
80 uint8_t componentCarrierId)
81 : m_rrc(rrc),
82 m_componentCarrierId{componentCarrierId}
83{
84}
85
86uint16_t
88{
90}
91
92void
93EnbRrcMemberLteEnbCmacSapUser::NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
94{
95 m_rrc->DoNotifyLcConfigResult(rnti, lcid, success);
96}
97
98void
100{
102}
103
104bool
106{
107 return m_rrc->IsRandomAccessCompleted(rnti);
108}
109
111// UeManager
113
115static const std::string g_ueManagerStateName[UeManager::NUM_STATES] = {
116 "INITIAL_RANDOM_ACCESS",
117 "CONNECTION_SETUP",
118 "CONNECTION_REJECTED",
119 "ATTACH_REQUEST",
120 "CONNECTED_NORMALLY",
121 "CONNECTION_RECONFIGURATION",
122 "CONNECTION_REESTABLISHMENT",
123 "HANDOVER_PREPARATION",
124 "HANDOVER_JOINING",
125 "HANDOVER_PATH_SWITCH",
126 "HANDOVER_LEAVING",
127};
128
133static const std::string&
135{
136 return g_ueManagerStateName[s];
137}
138
140
142{
143 NS_FATAL_ERROR("this constructor is not espected to be used");
144}
145
146UeManager::UeManager(Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId)
147 : m_lastAllocatedDrbid(0),
148 m_rnti(rnti),
149 m_imsi(0),
150 m_componentCarrierId(componentCarrierId),
151 m_lastRrcTransactionIdentifier(0),
152 m_rrc(rrc),
153 m_state(s),
154 m_pendingRrcConnectionReconfiguration(false),
155 m_sourceX2apId(0),
156 m_sourceCellId(0),
157 m_needPhyMacConfiguration(false),
158 m_caSupportConfigured(false),
159 m_pendingStartDataRadioBearers(false)
160{
161 NS_LOG_FUNCTION(this);
162}
163
164void
166{
167 NS_LOG_FUNCTION(this);
169
171 m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
174 m_rrc->GetNewSrsConfigurationIndex();
180
181 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
182 {
183 m_rrc->m_cmacSapProvider.at(i)->AddUe(m_rnti);
184 m_rrc->m_cphySapProvider.at(i)->AddUe(m_rnti);
185 }
186
187 // setup the eNB side of SRB0
188 {
189 uint8_t lcid = 0;
190
191 Ptr<LteRlc> rlc = CreateObject<LteRlcTm>()->GetObject<LteRlc>();
192 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
193 rlc->SetRnti(m_rnti);
194 rlc->SetLcId(lcid);
195
196 m_srb0 = CreateObject<LteSignalingRadioBearerInfo>();
197 m_srb0->m_rlc = rlc;
198 m_srb0->m_srbIdentity = 0;
199 // no need to store logicalChannelConfig as SRB0 is pre-configured
200
202 lcinfo.rnti = m_rnti;
203 lcinfo.lcId = lcid;
204 // Initialise the rest of lcinfo structure even if CCCH (LCID 0) is pre-configured, and only
205 // m_rnti and lcid will be used from passed lcinfo structure. See FF LTE MAC Scheduler
206 // Iinterface Specification v1.11, 4.3.4 logicalChannelConfigListElement
207 lcinfo.lcGroup = 0;
208 lcinfo.qci = 0;
209 lcinfo.resourceType = 0;
210 lcinfo.mbrUl = 0;
211 lcinfo.mbrDl = 0;
212 lcinfo.gbrUl = 0;
213 lcinfo.gbrDl = 0;
214
215 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
216 LteMacSapUser* lteMacSapUser =
217 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
218 // Signal Channel are only on Primary Carrier
219 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, lteMacSapUser);
220 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, lteMacSapUser);
221 }
222
223 // setup the eNB side of SRB1; the UE side will be set up upon RRC connection establishment
224 {
225 uint8_t lcid = 1;
226
227 Ptr<LteRlc> rlc = CreateObject<LteRlcAm>()->GetObject<LteRlc>();
228 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
229 rlc->SetRnti(m_rnti);
230 rlc->SetLcId(lcid);
231
232 Ptr<LtePdcp> pdcp = CreateObject<LtePdcp>();
233 pdcp->SetRnti(m_rnti);
234 pdcp->SetLcId(lcid);
235 pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
236 pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
237 rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
238
239 m_srb1 = CreateObject<LteSignalingRadioBearerInfo>();
240 m_srb1->m_rlc = rlc;
241 m_srb1->m_pdcp = pdcp;
242 m_srb1->m_srbIdentity = 1;
243 m_srb1->m_logicalChannelConfig.priority = 1;
244 m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
245 m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
246 m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
247
249 lcinfo.rnti = m_rnti;
250 lcinfo.lcId = lcid;
251 lcinfo.lcGroup = 0; // all SRBs always mapped to LCG 0
252 lcinfo.qci =
253 EpsBearer::GBR_CONV_VOICE; // not sure why the FF API requires a CQI even for SRBs...
254 lcinfo.resourceType = 1; // GBR resource type
255 lcinfo.mbrUl = 1e6;
256 lcinfo.mbrDl = 1e6;
257 lcinfo.gbrUl = 1e4;
258 lcinfo.gbrDl = 1e4;
259 // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
260 LteMacSapUser* MacSapUserForRlc =
261 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
262 // Signal Channel are only on Primary Carrier
263 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, MacSapUserForRlc);
264 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, MacSapUserForRlc);
265 }
266
268 ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider();
269 ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider();
270 m_rrc->m_rrcSapUser->SetupUe(m_rnti, ueParams);
271
272 // configure MAC (and scheduler)
274 req.m_rnti = m_rnti;
276
277 // configure PHY
278 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
279 {
280 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
281 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(
282 m_rnti,
284 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
285 m_rnti,
287 }
288 // schedule this UeManager instance to be deleted if the UE does not give any sign of life
289 // within a reasonable time
290 Time maxConnectionDelay;
291 switch (m_state)
292 {
294 m_connectionRequestTimeout = Simulator::Schedule(m_rrc->m_connectionRequestTimeoutDuration,
296 m_rrc,
297 m_rnti);
298 break;
299
300 case HANDOVER_JOINING:
301 m_handoverJoiningTimeout = Simulator::Schedule(m_rrc->m_handoverJoiningTimeoutDuration,
303 m_rrc,
304 m_rnti);
305 break;
306
307 default:
308 NS_FATAL_ERROR("unexpected state " << ToString(m_state));
309 break;
310 }
311 m_caSupportConfigured = false;
312}
313
315{
316}
317
318void
320{
321 delete m_drbPdcpSapUser;
322 // delete eventual X2-U TEIDs
323 for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
324 it != m_drbMap.end();
325 ++it)
326 {
327 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
328 }
329}
330
331TypeId
333{
334 static TypeId tid =
335 TypeId("ns3::UeManager")
336 .SetParent<Object>()
337 .AddConstructor<UeManager>()
338 .AddAttribute("DataRadioBearerMap",
339 "List of UE DataRadioBearerInfo by DRBID.",
342 MakeObjectMapChecker<LteDataRadioBearerInfo>())
343 .AddAttribute("Srb0",
344 "SignalingRadioBearerInfo for SRB0",
345 PointerValue(),
347 MakePointerChecker<LteSignalingRadioBearerInfo>())
348 .AddAttribute("Srb1",
349 "SignalingRadioBearerInfo for SRB1",
350 PointerValue(),
352 MakePointerChecker<LteSignalingRadioBearerInfo>())
353 .AddAttribute("C-RNTI",
354 "Cell Radio Network Temporary Identifier",
355 TypeId::ATTR_GET, // read-only attribute
356 UintegerValue(0), // unused, read-only attribute
358 MakeUintegerChecker<uint16_t>())
359 .AddTraceSource("StateTransition",
360 "fired upon every UE state transition seen by the "
361 "UeManager at the eNB RRC",
363 "ns3::UeManager::StateTracedCallback")
364 .AddTraceSource("DrbCreated",
365 "trace fired after DRB is created",
367 "ns3::UeManager::ImsiCidRntiLcIdTracedCallback");
368 return tid;
369}
370
371void
372UeManager::SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
373{
374 m_sourceX2apId = sourceX2apId;
375 m_sourceCellId = sourceCellId;
376}
377
378void
379UeManager::SetImsi(uint64_t imsi)
380{
381 m_imsi = imsi;
382}
383
384void
386{
387 NS_LOG_FUNCTION(this << m_rnti);
388
389 if (m_state == ATTACH_REQUEST)
390 {
392 }
393 else
394 {
395 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
396 }
397}
398
399void
401 uint8_t bearerId,
402 uint32_t gtpTeid,
403 Ipv4Address transportLayerAddress)
404{
406
407 Ptr<LteDataRadioBearerInfo> drbInfo = CreateObject<LteDataRadioBearerInfo>();
408 uint8_t drbid = AddDataRadioBearerInfo(drbInfo);
409 uint8_t lcid = Drbid2Lcid(drbid);
410 uint8_t bid = Drbid2Bid(drbid);
411 NS_ASSERT_MSG(bearerId == 0 || bid == bearerId,
412 "bearer ID mismatch (" << (uint32_t)bid << " != " << (uint32_t)bearerId
413 << ", the assumption that ID are allocated in the same "
414 "way by MME and RRC is not valid any more");
415 drbInfo->m_epsBearer = bearer;
416 drbInfo->m_epsBearerIdentity = bid;
417 drbInfo->m_drbIdentity = drbid;
418 drbInfo->m_logicalChannelIdentity = lcid;
419 drbInfo->m_gtpTeid = gtpTeid;
420 drbInfo->m_transportLayerAddress = transportLayerAddress;
421
423 {
424 // setup TEIDs for receiving data eventually forwarded over X2-U
425 LteEnbRrc::X2uTeidInfo x2uTeidInfo;
426 x2uTeidInfo.rnti = m_rnti;
427 x2uTeidInfo.drbid = drbid;
428 std::pair<std::map<uint32_t, LteEnbRrc::X2uTeidInfo>::iterator, bool> ret =
429 m_rrc->m_x2uTeidInfoMap.insert(
430 std::pair<uint32_t, LteEnbRrc::X2uTeidInfo>(gtpTeid, x2uTeidInfo));
431 NS_ASSERT_MSG(ret.second == true, "overwriting a pre-existing entry in m_x2uTeidInfoMap");
432 }
433
434 TypeId rlcTypeId = m_rrc->GetRlcType(bearer);
435
436 ObjectFactory rlcObjectFactory;
437 rlcObjectFactory.SetTypeId(rlcTypeId);
438 Ptr<LteRlc> rlc = rlcObjectFactory.Create()->GetObject<LteRlc>();
439 rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
440 rlc->SetRnti(m_rnti);
441 rlc->SetPacketDelayBudgetMs(bearer.GetPacketDelayBudgetMs());
442
443 drbInfo->m_rlc = rlc;
444
445 rlc->SetLcId(lcid);
446
447 // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
448 // if we are using RLC/SM we don't care of anything above RLC
449 if (rlcTypeId != LteRlcSm::GetTypeId())
450 {
451 Ptr<LtePdcp> pdcp = CreateObject<LtePdcp>();
452 pdcp->SetRnti(m_rnti);
453 pdcp->SetLcId(lcid);
454 pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
455 pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
456 rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
457 drbInfo->m_pdcp = pdcp;
458 }
459
460 m_drbCreatedTrace(m_imsi, m_rrc->ComponentCarrierToCellId(m_componentCarrierId), m_rnti, lcid);
461
462 std::vector<LteCcmRrcSapProvider::LcsConfig> lcOnCcMapping =
463 m_rrc->m_ccmRrcSapProvider->SetupDataRadioBearer(bearer,
464 bearerId,
465 m_rnti,
466 lcid,
467 m_rrc->GetLogicalChannelGroup(bearer),
468 rlc->GetLteMacSapUser());
469 // LteEnbCmacSapProvider::LcInfo lcinfo;
470 // lcinfo.rnti = m_rnti;
471 // lcinfo.lcId = lcid;
472 // lcinfo.lcGroup = m_rrc->GetLogicalChannelGroup (bearer);
473 // lcinfo.qci = bearer.qci;
474 // lcinfo.resourceType = bearer.GetResourceType();
475 // lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
476 // lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
477 // lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
478 // lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
479 // use a for cycle to send the AddLc to the appropriate Mac Sap
480 // if the sap is not initialized the appropriated method has to be called
481 std::vector<LteCcmRrcSapProvider::LcsConfig>::iterator itLcOnCcMapping = lcOnCcMapping.begin();
482 NS_ASSERT_MSG(itLcOnCcMapping != lcOnCcMapping.end(), "Problem");
483 for (itLcOnCcMapping = lcOnCcMapping.begin(); itLcOnCcMapping != lcOnCcMapping.end();
484 ++itLcOnCcMapping)
485 {
486 NS_LOG_DEBUG(this << " RNTI " << itLcOnCcMapping->lc.rnti << "Lcid "
487 << (uint16_t)itLcOnCcMapping->lc.lcId << " lcGroup "
488 << (uint16_t)itLcOnCcMapping->lc.lcGroup << " ComponentCarrierId "
489 << itLcOnCcMapping->componentCarrierId);
490 uint8_t index = itLcOnCcMapping->componentCarrierId;
491 LteEnbCmacSapProvider::LcInfo lcinfo = itLcOnCcMapping->lc;
492 LteMacSapUser* msu = itLcOnCcMapping->msu;
493 m_rrc->m_cmacSapProvider.at(index)->AddLc(lcinfo, msu);
494 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, msu);
495 }
496
497 if (rlcTypeId == LteRlcAm::GetTypeId())
498 {
499 drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::AM;
500 }
501 else
502 {
503 drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
504 }
505
506 drbInfo->m_logicalChannelIdentity = lcid;
507 drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority(bearer);
508 drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup(bearer);
509 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
510 {
511 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.gbrQosInfo.gbrUl;
512 }
513 else
514 {
515 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
516 }
517 drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
518
520}
521
522void
524{
526 for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
527 it != m_drbMap.end();
528 ++it)
529 {
530 m_drbsToBeStarted.push_back(it->first);
531 }
532}
533
534void
536{
538 for (std::list<uint8_t>::iterator drbIdIt = m_drbsToBeStarted.begin();
539 drbIdIt != m_drbsToBeStarted.end();
540 ++drbIdIt)
541 {
542 std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator drbIt = m_drbMap.find(*drbIdIt);
543 NS_ASSERT(drbIt != m_drbMap.end());
544 drbIt->second->m_rlc->Initialize();
545 if (drbIt->second->m_pdcp)
546 {
547 drbIt->second->m_pdcp->Initialize();
548 }
549 }
550 m_drbsToBeStarted.clear();
551}
552
553void
555{
556 NS_LOG_FUNCTION(this << (uint32_t)m_rnti << (uint32_t)drbid);
557 uint8_t lcid = Drbid2Lcid(drbid);
558 std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
559 NS_ASSERT_MSG(it != m_drbMap.end(),
560 "request to remove radio bearer with unknown drbid " << drbid);
561
562 // first delete eventual X2-U TEIDs
563 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
564
565 m_drbMap.erase(it);
566 std::vector<uint8_t> ccToRelease =
567 m_rrc->m_ccmRrcSapProvider->ReleaseDataRadioBearer(m_rnti, lcid);
568 std::vector<uint8_t>::iterator itCcToRelease = ccToRelease.begin();
569 NS_ASSERT_MSG(itCcToRelease != ccToRelease.end(),
570 "request to remove radio bearer with unknown drbid (ComponentCarrierManager)");
571 for (itCcToRelease = ccToRelease.begin(); itCcToRelease != ccToRelease.end(); ++itCcToRelease)
572 {
573 m_rrc->m_cmacSapProvider.at(*itCcToRelease)->ReleaseLc(m_rnti, lcid);
574 }
576 rrcd.havePhysicalConfigDedicated = false;
577 rrcd.drbToReleaseList.push_back(drbid);
578 // populating RadioResourceConfigDedicated information element as per 3GPP TS 36.331
579 // version 9.2.0
580 rrcd.havePhysicalConfigDedicated = true;
582
583 // populating RRCConnectionReconfiguration message as per 3GPP TS 36.331 version 9.2.0 Release 9
585 msg.haveMeasConfig = false;
586 msg.haveMobilityControlInfo = false;
589 // ToDo: Resend in any case this configuration
590 // needs to be initialized
591 msg.haveNonCriticalExtension = false;
592 // RRC Connection Reconfiguration towards UE
593 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
594}
595
596void
597LteEnbRrc::DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
598{
599 NS_LOG_FUNCTION(this << imsi << rnti << (uint16_t)bearerId);
600
601 // check if the RNTI to be removed is not stale
602 if (HasUeManager(rnti))
603 {
604 Ptr<UeManager> ueManager = GetUeManager(rnti);
605 // Bearer de-activation towards UE
606 ueManager->ReleaseDataRadioBearer(bearerId);
607 // Bearer de-activation indication towards epc-enb application
608 m_s1SapProvider->DoSendReleaseIndication(imsi, rnti, bearerId);
609 }
610}
611
612void
614{
615 NS_LOG_FUNCTION(this << m_rnti);
616
617 // release the bearer info for the UE at SGW/PGW
618 if (m_rrc->m_s1SapProvider != nullptr) // if EPC is enabled
619 {
620 for (const auto& it : m_drbMap)
621 {
622 NS_LOG_DEBUG("Sending release of bearer id : "
623 << (uint16_t)(it.first)
624 << "LCID : " << (uint16_t)(it.second->m_logicalChannelIdentity));
625 // Bearer de-activation indication towards epc-enb application
626 m_rrc->m_s1SapProvider->DoSendReleaseIndication(GetImsi(), rnti, it.first);
627 }
628 }
629}
630
631void
633{
634 NS_LOG_FUNCTION(this);
635 switch (m_state)
636 {
638 case CONNECTION_SETUP:
639 case ATTACH_REQUEST:
643 case HANDOVER_JOINING:
644 case HANDOVER_LEAVING:
645 // a previous reconfiguration still ongoing, we need to wait for it to be finished
647 break;
648
649 case CONNECTED_NORMALLY: {
652 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
655 }
656 break;
657
658 default:
659 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
660 break;
661 }
662}
663
664void
666{
667 NS_LOG_FUNCTION(this << cellId);
668 switch (m_state)
669 {
670 case CONNECTED_NORMALLY: {
671 m_targetCellId = cellId;
672
673 auto sourceComponentCarrier = DynamicCast<ComponentCarrierEnb>(
674 m_rrc->m_componentCarrierPhyConf.at(m_componentCarrierId));
675 NS_ASSERT(m_targetCellId != sourceComponentCarrier->GetCellId());
676
677 if (m_rrc->HasCellId(cellId))
678 {
679 // Intra-eNB handover
680 NS_LOG_DEBUG("Intra-eNB handover for cellId " << cellId);
681 uint8_t componentCarrierId = m_rrc->CellToComponentCarrierId(cellId);
682 uint16_t rnti = m_rrc->AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
684 m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
685 if (!anrcrv.valid)
686 {
687 NS_LOG_INFO(this << " failed to allocate a preamble for non-contention based RA => "
688 "cannot perform HO");
689 NS_FATAL_ERROR("should trigger HO Preparation Failure, but it is not implemented");
690 return;
691 }
692
693 Ptr<UeManager> ueManager = m_rrc->GetUeManager(rnti);
694 ueManager->SetSource(sourceComponentCarrier->GetCellId(), m_rnti);
695 ueManager->SetImsi(m_imsi);
696
697 // Setup data radio bearers
698 for (auto& it : m_drbMap)
699 {
700 ueManager->SetupDataRadioBearer(it.second->m_epsBearer,
701 it.second->m_epsBearerIdentity,
702 it.second->m_gtpTeid,
703 it.second->m_transportLayerAddress);
704 }
705
708
709 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
710 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
712 anrcrv.raPreambleId;
714 anrcrv.raPrachMaskIndex;
715
717 m_rrc->m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
719 .preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
721 .raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
723 .raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
724
725 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
726
727 // We skip handover preparation
729 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
731 m_rrc,
732 m_rnti);
733 m_rrc->m_handoverStartTrace(m_imsi,
734 sourceComponentCarrier->GetCellId(),
735 m_rnti,
736 handoverCommand.mobilityControlInfo.targetPhysCellId);
737 }
738 else
739 {
740 // Inter-eNB aka X2 handover
741 NS_LOG_DEBUG("Inter-eNB handover (i.e., X2) for cellId " << cellId);
743 params.oldEnbUeX2apId = m_rnti;
745 params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
746 params.targetCellId = cellId;
747 params.mmeUeS1apId = m_imsi;
748 params.ueAggregateMaxBitRateDownlink = 200 * 1000;
749 params.ueAggregateMaxBitRateUplink = 100 * 1000;
750 params.bearers = GetErabList();
751
754 hpi.asConfig.sourceDlCarrierFreq = sourceComponentCarrier->GetDlEarfcn();
755 hpi.asConfig.sourceMeasConfig = m_rrc->m_ueMeasConfig;
759 sourceComponentCarrier->GetDlBandwidth();
763 .cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
765 m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
767 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
769 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
771 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->GetRachConfig();
773 .rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
779 .rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
781 sourceComponentCarrier->GetUlEarfcn();
783 sourceComponentCarrier->GetUlBandwidth();
784 params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation(hpi);
785
786 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
787 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
788 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
789 NS_LOG_LOGIC("mmeUeS1apId = " << params.mmeUeS1apId);
790 NS_LOG_LOGIC("rrcContext = " << params.rrcContext);
791
792 m_rrc->m_x2SapProvider->SendHandoverRequest(params);
794 }
795 }
796 break;
797
798 default:
799 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
800 break;
801 }
802}
803
804void
806{
807 NS_LOG_FUNCTION(this);
808
809 NS_ASSERT_MSG(params.notAdmittedBearers.empty(),
810 "not admission of some bearers upon handover is not supported");
811 NS_ASSERT_MSG(params.admittedBearers.size() == m_drbMap.size(),
812 "not enough bearers in admittedBearers");
813
814 // note: the Handover command from the target eNB to the source eNB
815 // is expected to be sent transparently to the UE; however, here we
816 // decode the message and eventually re-encode it. This way we can
817 // support both a real RRC protocol implementation and an ideal one
818 // without actual RRC protocol encoding.
819
820 Ptr<Packet> encodedHandoverCommand = params.rrcContext;
822 m_rrc->m_rrcSapUser->DecodeHandoverCommand(encodedHandoverCommand);
823 if (handoverCommand.haveNonCriticalExtension)
824 {
825 // Total number of component carriers =
826 // handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 (Primary carrier)
827 if (handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 !=
828 m_rrc->m_numberOfComponentCarriers)
829 {
830 // Currently handover is only possible if source and target eNBs have equal number of
831 // component carriers
832 NS_FATAL_ERROR("The source and target eNBs have unequal number of component carriers. "
833 "Target eNB CCs = "
834 << handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1
835 << " Source eNB CCs = " << m_rrc->m_numberOfComponentCarriers);
836 }
837 }
838 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
840 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
842 m_rrc,
843 m_rnti);
844 NS_ASSERT(handoverCommand.haveMobilityControlInfo);
845 m_rrc->m_handoverStartTrace(m_imsi,
846 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
847 m_rnti,
848 handoverCommand.mobilityControlInfo.targetPhysCellId);
849
850 // Set the target cell ID and the RNTI so that handover cancel message can be sent if required
851 m_targetX2apId = params.newEnbUeX2apId;
852 m_targetCellId = params.targetCellId;
853
855 sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
856 sst.newEnbUeX2apId = params.newEnbUeX2apId;
857 sst.sourceCellId = params.sourceCellId;
858 sst.targetCellId = params.targetCellId;
859 for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator drbIt = m_drbMap.begin();
860 drbIt != m_drbMap.end();
861 ++drbIt)
862 {
863 // SN status transfer is only for AM RLC
864 if (drbIt->second->m_rlc->GetObject<LteRlcAm>())
865 {
866 LtePdcp::Status status = drbIt->second->m_pdcp->GetStatus();
868 i.dlPdcpSn = status.txSn;
869 i.ulPdcpSn = status.rxSn;
870 sst.erabsSubjectToStatusTransferList.push_back(i);
871 }
872 }
873 m_rrc->m_x2SapProvider->SendSnStatusTransfer(sst);
874}
875
878{
879 NS_LOG_FUNCTION(this);
881}
882
885{
886 NS_LOG_FUNCTION(this);
887
889
890 auto targetComponentCarrier =
891 DynamicCast<ComponentCarrierEnb>(m_rrc->m_componentCarrierPhyConf.at(componentCarrierId));
892 result.haveMobilityControlInfo = true;
893 result.mobilityControlInfo.targetPhysCellId = targetComponentCarrier->GetCellId();
895 result.mobilityControlInfo.carrierFreq.dlCarrierFreq = targetComponentCarrier->GetDlEarfcn();
896 result.mobilityControlInfo.carrierFreq.ulCarrierFreq = targetComponentCarrier->GetUlEarfcn();
899 targetComponentCarrier->GetDlBandwidth();
901 targetComponentCarrier->GetUlBandwidth();
902
903 if (m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
904 {
905 // Release sCells
906 result.haveNonCriticalExtension = true;
907
908 for (auto& it : m_rrc->m_componentCarrierPhyConf)
909 {
910 uint8_t ccId = it.first;
911
912 if (ccId == m_componentCarrierId)
913 {
914 // Skip primary CC.
915 continue;
916 }
917 else if (ccId < m_componentCarrierId)
918 {
919 // Shift all IDs below PCC forward so PCC can use CC ID 1.
920 result.nonCriticalExtension.sCellToReleaseList.push_back(ccId + 1);
921 }
922 }
923 }
924 else
925 {
926 result.haveNonCriticalExtension = false;
927 }
928
929 return result;
930}
931
932void
934{
935 NS_LOG_FUNCTION(this << p << (uint16_t)bid);
937 params.pdcpSdu = p;
938 params.rnti = m_rnti;
939 params.lcid = Bid2Lcid(bid);
940 uint8_t drbid = Bid2Drbid(bid);
941 // Transmit PDCP sdu only if DRB ID found in drbMap
942 std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
943 if (it != m_drbMap.end())
944 {
946 if (bearerInfo)
947 {
948 LtePdcpSapProvider* pdcpSapProvider = bearerInfo->m_pdcp->GetLtePdcpSapProvider();
949 pdcpSapProvider->TransmitPdcpSdu(params);
950 }
951 }
952}
953
954void
956{
957 NS_LOG_FUNCTION(this << p << (uint16_t)bid);
958 switch (m_state)
959 {
961 case CONNECTION_SETUP:
962 NS_LOG_WARN("not connected, discarding packet");
963 return;
964
970 NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
971 SendPacket(bid, p);
972 }
973 break;
974
975 case HANDOVER_JOINING: {
976 // Buffer data until RRC Connection Reconfiguration Complete message is received
977 NS_LOG_LOGIC("buffering data");
978 m_packetBuffer.emplace_back(bid, p);
979 }
980 break;
981
982 case HANDOVER_LEAVING: {
983 NS_LOG_LOGIC("forwarding data to target eNB over X2-U");
984 uint8_t drbid = Bid2Drbid(bid);
986 params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
987 params.targetCellId = m_targetCellId;
988 params.gtpTeid = GetDataRadioBearerInfo(drbid)->m_gtpTeid;
989 params.ueData = p;
990 m_rrc->m_x2SapProvider->SendUeData(params);
991 }
992 break;
993
994 default:
995 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
996 break;
997 }
998}
999
1000std::vector<EpcX2Sap::ErabToBeSetupItem>
1002{
1003 NS_LOG_FUNCTION(this);
1004 std::vector<EpcX2Sap::ErabToBeSetupItem> ret;
1005 for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
1006 it != m_drbMap.end();
1007 ++it)
1008 {
1010 etbsi.erabId = it->second->m_epsBearerIdentity;
1011 etbsi.erabLevelQosParameters = it->second->m_epsBearer;
1012 etbsi.dlForwarding = false;
1013 etbsi.transportLayerAddress = it->second->m_transportLayerAddress;
1014 etbsi.gtpTeid = it->second->m_gtpTeid;
1015 ret.push_back(etbsi);
1016 }
1017 return ret;
1018}
1019
1020void
1022{
1023 NS_LOG_FUNCTION(this);
1024 switch (m_state)
1025 {
1027 NS_LOG_INFO("Send UE CONTEXT RELEASE from target eNB to source eNB");
1029 ueCtxReleaseParams.oldEnbUeX2apId = m_sourceX2apId;
1030 ueCtxReleaseParams.newEnbUeX2apId = m_rnti;
1031 ueCtxReleaseParams.sourceCellId = m_sourceCellId;
1032 ueCtxReleaseParams.targetCellId = m_targetCellId;
1033 if (!m_rrc->HasCellId(m_sourceCellId))
1034 {
1035 m_rrc->m_x2SapProvider->SendUeContextRelease(ueCtxReleaseParams);
1036 }
1037 else
1038 {
1039 NS_LOG_INFO("Not sending UE CONTEXT RELEASE because handover is internal");
1040 m_rrc->DoRecvUeContextRelease(ueCtxReleaseParams);
1041 }
1043 m_rrc->m_handoverEndOkTrace(m_imsi,
1044 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1045 m_rnti);
1046 break;
1047
1048 default:
1049 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1050 break;
1051 }
1052}
1053
1054void
1056{
1057 NS_LOG_FUNCTION(this << cellId);
1058 switch (m_state)
1059 {
1061 NS_ASSERT(cellId == m_targetCellId);
1062 NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1064 break;
1065 case HANDOVER_LEAVING: // case added to tackle HO leaving timer expiration
1066 NS_ASSERT(cellId == m_targetCellId);
1067 NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1070 break;
1071
1072 default:
1073 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1074 break;
1075 }
1076}
1077
1078void
1080{
1081 NS_LOG_FUNCTION(this);
1082 for (std::vector<EpcX2Sap::ErabsSubjectToStatusTransferItem>::iterator erabIt =
1083 params.erabsSubjectToStatusTransferList.begin();
1084 erabIt != params.erabsSubjectToStatusTransferList.end();
1085 ++erabIt)
1086 {
1087 // LtePdcp::Status status;
1088 // status.txSn = erabIt->dlPdcpSn;
1089 // status.rxSn = erabIt->ulPdcpSn;
1090 // uint8_t drbId = Bid2Drbid (erabIt->erabId);
1091 // std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator drbIt = m_drbMap.find (drbId);
1092 // NS_ASSERT_MSG (drbIt != m_drbMap.end (), "could not find DRBID " << (uint32_t) drbId);
1093 // drbIt->second->m_pdcp->SetStatus (status);
1094 }
1095}
1096
1097void
1099{
1100 NS_LOG_FUNCTION(this);
1101 NS_ASSERT_MSG(m_state == HANDOVER_LEAVING, "method unexpected in state " << ToString(m_state));
1103}
1104
1105void
1107{
1108 NS_LOG_FUNCTION(this);
1109 NS_ASSERT_MSG(m_state == HANDOVER_JOINING, "method unexpected in state " << ToString(m_state));
1111}
1112
1113void
1115{
1116 // TODO implement in the 3gpp way, see Section 5.3.8 of 3GPP TS 36.331.
1118 // De-activation towards UE, it will deactivate all bearers
1121 m_rrc->m_rrcSapUser->SendRrcConnectionRelease(m_rnti, msg);
1122
1128 m_rrc->DoRecvIdealUeContextRemoveRequest(m_rnti);
1129}
1130
1131// methods forwarded from RRC SAP
1132
1133void
1135{
1136 NS_LOG_FUNCTION(this);
1137 m_srb0->m_rlc->SetLteRlcSapUser(params.srb0SapUser);
1138 m_srb1->m_pdcp->SetLtePdcpSapUser(params.srb1SapUser);
1139}
1140
1141void
1143{
1144 NS_LOG_FUNCTION(this);
1145 switch (m_state)
1146 {
1147 case INITIAL_RANDOM_ACCESS: {
1149
1150 if (m_rrc->m_admitRrcConnectionRequest)
1151 {
1152 m_imsi = msg.ueIdentity;
1153
1154 // send RRC CONNECTION SETUP to UE
1158 m_rrc->m_rrcSapUser->SendRrcConnectionSetup(m_rnti, msg2);
1159
1161 m_connectionSetupTimeout = Simulator::Schedule(m_rrc->m_connectionSetupTimeoutDuration,
1163 m_rrc,
1164 m_rnti);
1166 }
1167 else
1168 {
1169 NS_LOG_INFO("rejecting connection request for RNTI " << m_rnti);
1170
1171 // send RRC CONNECTION REJECT to UE
1173 rejectMsg.waitTime = 3;
1174 m_rrc->m_rrcSapUser->SendRrcConnectionReject(m_rnti, rejectMsg);
1175
1177 Simulator::Schedule(m_rrc->m_connectionRejectedTimeoutDuration,
1179 m_rrc,
1180 m_rnti);
1182 }
1183 }
1184 break;
1185
1186 default:
1187 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1188 break;
1189 }
1190}
1191
1192void
1194{
1195 NS_LOG_FUNCTION(this);
1196 switch (m_state)
1197 {
1198 case CONNECTION_SETUP:
1200 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1201 {
1202 m_pendingRrcConnectionReconfiguration = true; // Force Reconfiguration
1204 }
1205
1206 if (m_rrc->m_s1SapProvider != nullptr)
1207 {
1208 m_rrc->m_s1SapProvider->InitialUeMessage(m_imsi, m_rnti);
1210 }
1211 else
1212 {
1214 }
1215 m_rrc->m_connectionEstablishedTrace(m_imsi,
1216 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1217 m_rnti);
1218 break;
1219
1220 default:
1221 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1222 break;
1223 }
1224}
1225
1226void
1229{
1230 NS_LOG_FUNCTION(this);
1231 switch (m_state)
1232 {
1236 {
1237 // configure MAC (and scheduler)
1239 req.m_rnti = m_rnti;
1241 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1242 {
1243 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
1244
1245 // configure PHY
1246 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(req.m_rnti,
1247 req.m_transmissionMode);
1250 m_rrc->m_cphySapProvider.at(i)->SetPa(m_rnti, paDouble);
1251 }
1252
1254 }
1256 m_rrc->m_connectionReconfigurationTrace(
1257 m_imsi,
1258 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1259 m_rnti);
1260 break;
1261
1262 // This case is added to NS-3 in order to handle bearer de-activation scenario for CONNECTED
1263 // state UE
1264 case CONNECTED_NORMALLY:
1265 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1266 << ToString(m_state));
1267 break;
1268
1269 case HANDOVER_LEAVING:
1270 NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1271 << ToString(m_state));
1272 break;
1273
1274 case HANDOVER_JOINING: {
1276
1277 while (!m_packetBuffer.empty())
1278 {
1279 NS_LOG_LOGIC("dequeueing data from buffer");
1280 std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1281 uint8_t bid = bidPacket.first;
1282 Ptr<Packet> p = bidPacket.second;
1283
1284 NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
1285 SendPacket(bid, p);
1286
1287 m_packetBuffer.pop_front();
1288 }
1289
1290 NS_LOG_INFO("Send PATH SWITCH REQUEST to the MME");
1292 params.rnti = m_rnti;
1293 params.cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1294 params.mmeUeS1Id = m_imsi;
1296 for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
1297 it != m_drbMap.end();
1298 ++it)
1299 {
1301 b.epsBearerId = it->second->m_epsBearerIdentity;
1302 b.teid = it->second->m_gtpTeid;
1303 params.bearersToBeSwitched.push_back(b);
1304 }
1305 m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1306 }
1307 break;
1308
1309 default:
1310 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1311 break;
1312 }
1313}
1314
1315void
1318{
1319 NS_LOG_FUNCTION(this);
1320 switch (m_state)
1321 {
1322 case CONNECTED_NORMALLY:
1323 break;
1324
1325 case HANDOVER_LEAVING:
1327 break;
1328
1329 default:
1330 NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1331 break;
1332 }
1333
1337 m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1339}
1340
1341void
1344{
1345 NS_LOG_FUNCTION(this);
1347}
1348
1349void
1351{
1352 uint8_t measId = msg.measResults.measId;
1353 NS_LOG_FUNCTION(this << (uint16_t)measId);
1355 "measId " << (uint16_t)measId << " haveMeasResultNeighCells "
1356 << msg.measResults.haveMeasResultNeighCells << " measResultListEutra "
1357 << msg.measResults.measResultListEutra.size() << " haveMeasResultServFreqList "
1358 << msg.measResults.haveMeasResultServFreqList << " measResultServFreqList "
1359 << msg.measResults.measResultServFreqList.size());
1360 NS_LOG_LOGIC("serving cellId "
1361 << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) << " RSRP "
1362 << (uint16_t)msg.measResults.measResultPCell.rsrpResult << " RSRQ "
1363 << (uint16_t)msg.measResults.measResultPCell.rsrqResult);
1364
1365 for (std::list<LteRrcSap::MeasResultEutra>::iterator it =
1366 msg.measResults.measResultListEutra.begin();
1367 it != msg.measResults.measResultListEutra.end();
1368 ++it)
1369 {
1370 NS_LOG_LOGIC("neighbour cellId " << it->physCellId << " RSRP "
1371 << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1372 << " RSRQ "
1373 << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1374 }
1375
1376 if ((m_rrc->m_handoverManagementSapProvider != nullptr) &&
1377 (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1378 {
1379 // this measurement was requested by the handover algorithm
1380 m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1381 }
1382
1383 if ((m_rrc->m_ccmRrcSapProvider != nullptr) &&
1384 (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1385 {
1386 // this measurement was requested by the handover algorithm
1387 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1388 }
1389
1390 if ((m_rrc->m_anrSapProvider != nullptr) &&
1391 (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1392 {
1393 // this measurement was requested by the ANR function
1394 m_rrc->m_anrSapProvider->ReportUeMeas(msg.measResults);
1395 }
1396
1397 if ((!m_rrc->m_ffrRrcSapProvider.empty()) &&
1398 (m_rrc->m_ffrMeasIds.find(measId) != m_rrc->m_ffrMeasIds.end()))
1399 {
1400 // this measurement was requested by the FFR function
1401 m_rrc->m_ffrRrcSapProvider.at(0)->ReportUeMeas(m_rnti, msg.measResults);
1402 }
1404 {
1405 for (const auto& it : msg.measResults.measResultServFreqList)
1406 {
1410 m_rrc->m_ffrRrcSapProvider.at(it.servFreqId)->ReportUeMeas(m_rnti, msg.measResults);
1411 }
1412 }
1413
1416 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1417 // fire a trace source
1418 m_rrc->m_recvMeasurementReportTrace(m_imsi,
1419 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1420 m_rnti,
1421 msg);
1422
1423} // end of UeManager::RecvMeasurementReport
1424
1425// methods forwarded from CMAC SAP
1426
1427void
1429{
1430 NS_LOG_FUNCTION(this << m_rnti);
1431 // at this stage used only by the scheduler for updating txMode
1432
1434
1436
1437 // reconfigure the UE RRC
1439}
1440
1441// methods forwarded from PDCP SAP
1442
1443void
1445{
1446 NS_LOG_FUNCTION(this);
1447 if (params.lcid > 2)
1448 {
1449 // data radio bearer
1450 EpsBearerTag tag;
1451 tag.SetRnti(params.rnti);
1452 tag.SetBid(Lcid2Bid(params.lcid));
1453 params.pdcpSdu->AddPacketTag(tag);
1454 m_rrc->m_forwardUpCallback(params.pdcpSdu);
1455 }
1456}
1457
1458uint16_t
1460{
1461 return m_rnti;
1462}
1463
1464uint64_t
1466{
1467 return m_imsi;
1468}
1469
1470uint8_t
1472{
1473 return m_componentCarrierId;
1474}
1475
1476uint16_t
1478{
1480}
1481
1482void
1484{
1485 NS_LOG_FUNCTION(this);
1487 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1488 {
1489 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1490 }
1491 switch (m_state)
1492 {
1494 // do nothing, srs conf index will be correctly enforced upon
1495 // RRC connection establishment
1496 break;
1497
1498 default:
1500 break;
1501 }
1502}
1503
1506{
1507 return m_state;
1508}
1509
1510void
1512{
1513 NS_LOG_FUNCTION(this);
1514 m_physicalConfigDedicated.pdschConfigDedicated = pdschConfigDedicated;
1515
1517
1518 // reconfigure the UE RRC
1520}
1521
1522void
1524{
1525 NS_LOG_FUNCTION(this);
1531}
1532
1535{
1536 NS_LOG_FUNCTION(this);
1538 res.oldEnbUeX2apId = m_sourceX2apId;
1539 res.sourceCellId = m_sourceCellId;
1540 res.targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1541 res.cause = 0;
1542 res.criticalityDiagnostics = 0;
1543
1544 return res;
1545}
1546
1549{
1550 NS_LOG_FUNCTION(this);
1552 res.oldEnbUeX2apId = m_rnti; // source cell rnti
1553 res.newEnbUeX2apId = m_targetX2apId;
1554 res.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1555 res.targetCellId = m_targetCellId;
1556 res.cause = 0;
1557
1558 return res;
1559}
1560
1561uint8_t
1563{
1564 NS_LOG_FUNCTION(this);
1565 const uint8_t MAX_DRB_ID = 32;
1566 for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1567 drbid = (drbid + 1) % MAX_DRB_ID)
1568 {
1569 if (drbid != 0) // 0 is not allowed
1570 {
1571 if (m_drbMap.find(drbid) == m_drbMap.end())
1572 {
1573 m_drbMap.insert(std::pair<uint8_t, Ptr<LteDataRadioBearerInfo>>(drbid, drbInfo));
1574 drbInfo->m_drbIdentity = drbid;
1575 m_lastAllocatedDrbid = drbid;
1576 return drbid;
1577 }
1578 }
1579 }
1580 NS_FATAL_ERROR("no more data radio bearer ids available");
1581 return 0;
1582}
1583
1586{
1587 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1588 NS_ASSERT(0 != drbid);
1589 std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
1590 NS_ABORT_IF(it == m_drbMap.end());
1591 return it->second;
1592}
1593
1594void
1596{
1597 NS_LOG_FUNCTION(this << (uint32_t)drbid);
1598 std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
1599 NS_ASSERT_MSG(it != m_drbMap.end(),
1600 "request to remove radio bearer with unknown drbid " << drbid);
1601 m_drbMap.erase(it);
1602}
1603
1606{
1607 NS_LOG_FUNCTION(this);
1612 msg.haveMobilityControlInfo = false;
1613 msg.haveMeasConfig = true;
1614 msg.measConfig = m_rrc->m_ueMeasConfig;
1615 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1616 {
1617 m_caSupportConfigured = true;
1618 NS_LOG_FUNCTION(this << "CA not configured. Configure now!");
1619 msg.haveNonCriticalExtension = true;
1621 NS_LOG_FUNCTION(this << " haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1622 }
1623 else
1624 {
1625 msg.haveNonCriticalExtension = false;
1626 }
1627
1628 return msg;
1629}
1630
1633{
1634 NS_LOG_FUNCTION(this);
1636
1637 if (m_srb1)
1638 {
1640 stam.srbIdentity = m_srb1->m_srbIdentity;
1641 stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1642 rrcd.srbToAddModList.push_back(stam);
1643 }
1644
1645 for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
1646 it != m_drbMap.end();
1647 ++it)
1648 {
1650 dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1651 dtam.drbIdentity = it->second->m_drbIdentity;
1652 dtam.rlcConfig = it->second->m_rlcConfig;
1653 dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1654 dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1655 rrcd.drbToAddModList.push_back(dtam);
1656 }
1657
1658 rrcd.havePhysicalConfigDedicated = true;
1660 return rrcd;
1661}
1662
1663uint8_t
1665{
1666 NS_LOG_FUNCTION(this);
1670}
1671
1672uint8_t
1674{
1675 NS_ASSERT(lcid > 2);
1676 return lcid - 2;
1677}
1678
1679uint8_t
1681{
1682 return drbid + 2;
1683}
1684
1685uint8_t
1687{
1688 NS_ASSERT(lcid > 2);
1689 return lcid - 2;
1690}
1691
1692uint8_t
1694{
1695 return bid + 2;
1696}
1697
1698uint8_t
1700{
1701 return drbid;
1702}
1703
1704uint8_t
1706{
1707 return bid;
1708}
1709
1710void
1712{
1713 NS_LOG_FUNCTION(this << ToString(newState));
1714 State oldState = m_state;
1715 m_state = newState;
1716 NS_LOG_INFO(this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager "
1717 << ToString(oldState) << " --> " << ToString(newState));
1719 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1720 m_rnti,
1721 oldState,
1722 newState);
1723
1724 switch (newState)
1725 {
1727 case HANDOVER_JOINING:
1728 NS_FATAL_ERROR("cannot switch to an initial state");
1729 break;
1730
1731 case CONNECTION_SETUP:
1732 break;
1733
1734 case ATTACH_REQUEST:
1735 break;
1736
1737 case CONNECTED_NORMALLY: {
1739 {
1741 }
1743 {
1745 }
1746 }
1747 break;
1748
1750 break;
1751
1753 break;
1754
1755 case HANDOVER_LEAVING:
1756 break;
1757
1758 default:
1759 break;
1760 }
1761}
1762
1765{
1766 NS_LOG_FUNCTION(this);
1768
1769 for (auto& it : m_rrc->m_componentCarrierPhyConf)
1770 {
1771 uint8_t ccId = it.first;
1772
1773 if (ccId == m_componentCarrierId)
1774 {
1775 // Skip primary CC.
1776 continue;
1777 }
1778 else if (ccId < m_componentCarrierId)
1779 {
1780 // Shift all IDs below PCC forward so PCC can use CC ID 1.
1781 ccId++;
1782 }
1783
1784 Ptr<ComponentCarrierBaseStation> eNbCcm = it.second;
1785 LteRrcSap::SCellToAddMod component;
1786 component.sCellIndex = ccId;
1787 component.cellIdentification.physCellId = eNbCcm->GetCellId();
1788 component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1791 eNbCcm->GetDlBandwidth();
1793 .antennaPortsCount = 0;
1795 .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1799 eNbCcm->GetUlEarfcn();
1801 eNbCcm->GetUlBandwidth();
1803 0;
1804 // component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type =
1805 // LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
1807 .srsBandwidthConfig = 0;
1809 .srsSubframeConfig = 0;
1811
1814 .haveNonUlConfiguration = true;
1818 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1826 .haveUlConfiguration = true;
1830 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1843
1844 ncec.sCellToAddModList.push_back(component);
1845 }
1846
1847 return ncec;
1848}
1849
1851// eNB RRC methods
1853
1855
1857 : m_x2SapProvider(nullptr),
1858 m_cmacSapProvider(0),
1859 m_handoverManagementSapProvider(nullptr),
1860 m_ccmRrcSapProvider(nullptr),
1861 m_anrSapProvider(nullptr),
1862 m_ffrRrcSapProvider(0),
1863 m_rrcSapUser(nullptr),
1864 m_macSapProvider(nullptr),
1865 m_s1SapProvider(nullptr),
1866 m_cphySapProvider(0),
1867 m_configured(false),
1868 m_lastAllocatedRnti(0),
1869 m_srsCurrentPeriodicityId(0),
1870 m_lastAllocatedConfigurationIndex(0),
1871 m_reconfigureUes(false),
1872 m_numberOfComponentCarriers(0),
1873 m_carriersConfigured(false)
1874{
1875 NS_LOG_FUNCTION(this);
1876 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, 0));
1885}
1886
1887void
1889{
1890 NS_ASSERT_MSG(!m_carriersConfigured, "Secondary carriers can be configured only once.");
1891 m_componentCarrierPhyConf = ccPhyConf;
1893 " Number of component carriers "
1894 "are not equal to the number of he component carrier configuration provided");
1895
1896 for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1897 {
1899 m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, i));
1901 }
1902 m_carriersConfigured = true;
1904}
1905
1907{
1908 NS_LOG_FUNCTION(this);
1909}
1910
1911void
1913{
1914 NS_LOG_FUNCTION(this);
1915 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1916 {
1917 delete m_cphySapUser[i];
1918 delete m_cmacSapUser[i];
1919 delete m_ffrRrcSapUser[i];
1920 }
1921 // delete m_cphySapUser;
1922 m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1923 m_cphySapUser.clear();
1924 // delete m_cmacSapUser;
1925 m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1926 m_cmacSapUser.clear();
1927 // delete m_ffrRrcSapUser;
1928 m_ffrRrcSapUser.erase(m_ffrRrcSapUser.begin(), m_ffrRrcSapUser.end());
1929 m_ffrRrcSapUser.clear();
1930 m_ueMap.clear();
1932 delete m_ccmRrcSapUser;
1933 delete m_anrSapUser;
1934 delete m_rrcSapProvider;
1935 delete m_x2SapUser;
1936 delete m_s1SapUser;
1937}
1938
1939TypeId
1941{
1942 NS_LOG_FUNCTION("LteEnbRrc::GetTypeId");
1943 static TypeId tid =
1944 TypeId("ns3::LteEnbRrc")
1945 .SetParent<Object>()
1946 .SetGroupName("Lte")
1947 .AddConstructor<LteEnbRrc>()
1948 .AddAttribute("UeMap",
1949 "List of UeManager by C-RNTI.",
1952 MakeObjectMapChecker<UeManager>())
1953 .AddAttribute("DefaultTransmissionMode",
1954 "The default UEs' transmission mode (0: SISO)",
1955 UintegerValue(0), // default tx-mode
1957 MakeUintegerChecker<uint8_t>())
1958 .AddAttribute("EpsBearerToRlcMapping",
1959 "Specify which type of RLC will be used for each type of EPS bearer.",
1963 "RlcSmAlways",
1965 "RlcUmAlways",
1967 "RlcAmAlways",
1968 PER_BASED,
1969 "PacketErrorRateBased"))
1970 .AddAttribute("SystemInformationPeriodicity",
1971 "The interval for sending system information (Time value)",
1975
1976 // SRS related attributes
1977 .AddAttribute(
1978 "SrsPeriodicity",
1979 "The SRS periodicity in milliseconds",
1980 UintegerValue(40),
1982 MakeUintegerChecker<uint32_t>())
1983
1984 // Timeout related attributes
1985 .AddAttribute("ConnectionRequestTimeoutDuration",
1986 "After a RA attempt, if no RRC CONNECTION REQUEST is "
1987 "received before this time, the UE context is destroyed. "
1988 "Must account for reception of RAR and transmission of "
1989 "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1990 "timer should not be greater than T300 timer at UE RRC",
1994 .AddAttribute("ConnectionSetupTimeoutDuration",
1995 "After accepting connection request, if no RRC CONNECTION "
1996 "SETUP COMPLETE is received before this time, the UE "
1997 "context is destroyed. Must account for the UE's reception "
1998 "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1999 "SETUP COMPLETE.",
2000 TimeValue(MilliSeconds(150)),
2003 .AddAttribute("ConnectionRejectedTimeoutDuration",
2004 "Time to wait between sending a RRC CONNECTION REJECT and "
2005 "destroying the UE context",
2009 .AddAttribute("HandoverJoiningTimeoutDuration",
2010 "After accepting a handover request, if no RRC CONNECTION "
2011 "RECONFIGURATION COMPLETE is received before this time, the "
2012 "UE context is destroyed. Must account for reception of "
2013 "X2 HO REQ ACK by source eNB, transmission of the Handover "
2014 "Command, non-contention-based random access and reception "
2015 "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
2016 TimeValue(MilliSeconds(200)),
2019 .AddAttribute("HandoverLeavingTimeoutDuration",
2020 "After issuing a Handover Command, if neither RRC "
2021 "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
2022 "been previously received, the UE context is destroyed.",
2023 TimeValue(MilliSeconds(500)),
2026
2027 // Cell selection related attribute
2028 .AddAttribute("QRxLevMin",
2029 "One of information transmitted within the SIB1 message, "
2030 "indicating the required minimum RSRP level that any UE must "
2031 "receive from this cell before it is allowed to camp to this "
2032 "cell. The default value -70 corresponds to -140 dBm and is "
2033 "the lowest possible value as defined by Section 6.3.4 of "
2034 "3GPP TS 36.133. This restriction, however, only applies to "
2035 "initial cell selection and EPC-enabled simulation.",
2037 IntegerValue(-70),
2039 MakeIntegerChecker<int8_t>(-70, -22))
2040 .AddAttribute("NumberOfComponentCarriers",
2041 "Number of Component Carriers",
2042 UintegerValue(1),
2044 MakeIntegerChecker<int16_t>(MIN_NO_CC, MAX_NO_CC))
2045
2046 // Handover related attributes
2047 .AddAttribute("AdmitHandoverRequest",
2048 "Whether to admit an X2 handover request from another eNB",
2049 BooleanValue(true),
2052 .AddAttribute("AdmitRrcConnectionRequest",
2053 "Whether to admit a connection request from a UE",
2054 BooleanValue(true),
2057
2058 // UE measurements related attributes
2059 .AddAttribute("RsrpFilterCoefficient",
2060 "Determines the strength of smoothing effect induced by "
2061 "layer 3 filtering of RSRP in all attached UE; "
2062 "if set to 0, no layer 3 filtering is applicable",
2063 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2064 UintegerValue(4),
2066 MakeUintegerChecker<uint8_t>(0))
2067 .AddAttribute("RsrqFilterCoefficient",
2068 "Determines the strength of smoothing effect induced by "
2069 "layer 3 filtering of RSRQ in all attached UE; "
2070 "if set to 0, no layer 3 filtering is applicable",
2071 // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2072 UintegerValue(4),
2074 MakeUintegerChecker<uint8_t>(0))
2075
2076 // Trace sources
2077 .AddTraceSource("NewUeContext",
2078 "Fired upon creation of a new UE context.",
2080 "ns3::LteEnbRrc::NewUeContextTracedCallback")
2081 .AddTraceSource("ConnectionEstablished",
2082 "Fired upon successful RRC connection establishment.",
2084 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2085 .AddTraceSource("ConnectionReconfiguration",
2086 "trace fired upon RRC connection reconfiguration",
2088 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2089 .AddTraceSource("HandoverStart",
2090 "trace fired upon start of a handover procedure",
2092 "ns3::LteEnbRrc::HandoverStartTracedCallback")
2093 .AddTraceSource("HandoverEndOk",
2094 "trace fired upon successful termination of a handover procedure",
2096 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2097 .AddTraceSource("RecvMeasurementReport",
2098 "trace fired when measurement report is received",
2100 "ns3::LteEnbRrc::ReceiveReportTracedCallback")
2101 .AddTraceSource("NotifyConnectionRelease",
2102 "trace fired when an UE is released",
2104 "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2105 .AddTraceSource("RrcTimeout",
2106 "trace fired when a timer expires",
2108 "ns3::LteEnbRrc::TimerExpiryTracedCallback")
2109 .AddTraceSource(
2110 "HandoverFailureNoPreamble",
2111 "trace fired upon handover failure due to non-allocation of non-contention based "
2112 "preamble at eNB for UE to handover due to max count reached",
2114 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2115 .AddTraceSource(
2116 "HandoverFailureMaxRach",
2117 "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2119 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2120 .AddTraceSource(
2121 "HandoverFailureLeaving",
2122 "trace fired upon handover failure due to handover leaving timeout at source eNB",
2124 "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2125 .AddTraceSource(
2126 "HandoverFailureJoining",
2127 "trace fired upon handover failure due to handover joining timeout at target eNB",
2129 "ns3::LteEnbRrc::HandoverFailureTracedCallback");
2130 return tid;
2131}
2132
2133void
2135{
2136 NS_LOG_FUNCTION(this << s);
2137 m_x2SapProvider = s;
2138}
2139
2142{
2143 NS_LOG_FUNCTION(this);
2144 return m_x2SapUser;
2145}
2146
2147void
2149{
2150 NS_LOG_FUNCTION(this << s);
2151 m_cmacSapProvider.at(0) = s;
2152}
2153
2154void
2156{
2157 NS_LOG_FUNCTION(this << s);
2158 if (m_cmacSapProvider.size() > pos)
2159 {
2160 m_cmacSapProvider.at(pos) = s;
2161 }
2162 else
2163 {
2164 m_cmacSapProvider.push_back(s);
2165 NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2166 }
2167}
2168
2171{
2172 NS_LOG_FUNCTION(this);
2173 return m_cmacSapUser.at(0);
2174}
2175
2178{
2179 NS_LOG_FUNCTION(this);
2180 return m_cmacSapUser.at(pos);
2181}
2182
2183void
2185{
2186 NS_LOG_FUNCTION(this << s);
2188}
2189
2192{
2193 NS_LOG_FUNCTION(this);
2195}
2196
2197void
2199{
2200 NS_LOG_FUNCTION(this << s);
2202}
2203
2206{
2207 NS_LOG_FUNCTION(this);
2208 return m_ccmRrcSapUser;
2209}
2210
2211void
2213{
2214 NS_LOG_FUNCTION(this << s);
2215 m_anrSapProvider = s;
2216}
2217
2220{
2221 NS_LOG_FUNCTION(this);
2222 return m_anrSapUser;
2223}
2224
2225void
2227{
2228 NS_LOG_FUNCTION(this << s);
2229 if (!m_ffrRrcSapProvider.empty())
2230 {
2231 m_ffrRrcSapProvider.at(0) = s;
2232 }
2233 else
2234 {
2235 m_ffrRrcSapProvider.push_back(s);
2236 }
2237}
2238
2239void
2241{
2242 NS_LOG_FUNCTION(this << s);
2243 if (m_ffrRrcSapProvider.size() > index)
2244 {
2245 m_ffrRrcSapProvider.at(index) = s;
2246 }
2247 else
2248 {
2249 m_ffrRrcSapProvider.push_back(s);
2250 NS_ABORT_MSG_IF(m_ffrRrcSapProvider.size() - 1 != index,
2251 "You meant to store the pointer at position "
2252 << static_cast<uint32_t>(index) << " but it went to "
2253 << m_ffrRrcSapProvider.size() - 1);
2254 }
2255}
2256
2259{
2260 NS_LOG_FUNCTION(this);
2261 return m_ffrRrcSapUser.at(0);
2262}
2263
2266{
2267 NS_LOG_FUNCTION(this);
2269 "Invalid component carrier index:"
2270 << index << " provided in order to obtain FfrRrcSapUser.");
2271 return m_ffrRrcSapUser.at(index);
2272}
2273
2274void
2276{
2277 NS_LOG_FUNCTION(this << s);
2278 m_rrcSapUser = s;
2279}
2280
2283{
2284 NS_LOG_FUNCTION(this);
2285 return m_rrcSapProvider;
2286}
2287
2288void
2290{
2291 NS_LOG_FUNCTION(this);
2292 m_macSapProvider = s;
2293}
2294
2295void
2297{
2298 m_s1SapProvider = s;
2299}
2300
2303{
2304 return m_s1SapUser;
2305}
2306
2307void
2309{
2310 NS_LOG_FUNCTION(this << s);
2311 if (!m_cphySapProvider.empty())
2312 {
2313 m_cphySapProvider.at(0) = s;
2314 }
2315 else
2316 {
2317 m_cphySapProvider.push_back(s);
2318 }
2319}
2320
2323{
2324 NS_LOG_FUNCTION(this);
2325 return m_cphySapUser.at(0);
2326}
2327
2328void
2330{
2331 NS_LOG_FUNCTION(this << s);
2332 if (m_cphySapProvider.size() > pos)
2333 {
2334 m_cphySapProvider.at(pos) = s;
2335 }
2336 else
2337 {
2338 m_cphySapProvider.push_back(s);
2339 NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2340 }
2341}
2342
2345{
2346 NS_LOG_FUNCTION(this);
2347 return m_cphySapUser.at(pos);
2348}
2349
2350bool
2351LteEnbRrc::HasUeManager(uint16_t rnti) const
2352{
2353 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2354 std::map<uint16_t, Ptr<UeManager>>::const_iterator it = m_ueMap.find(rnti);
2355 return (it != m_ueMap.end());
2356}
2357
2360{
2361 NS_LOG_FUNCTION(this << (uint32_t)rnti);
2362 NS_ASSERT(0 != rnti);
2363 std::map<uint16_t, Ptr<UeManager>>::iterator it = m_ueMap.find(rnti);
2364 NS_ASSERT_MSG(it != m_ueMap.end(), "UE manager for RNTI " << rnti << " not found");
2365 return it->second;
2366}
2367
2368std::vector<uint8_t>
2370{
2371 NS_LOG_FUNCTION(this);
2372
2373 // SANITY CHECK
2374
2378 "Measurement identities and reporting configuration should not have different quantity");
2379
2380 if (Simulator::Now() != Seconds(0))
2381 {
2382 NS_FATAL_ERROR("AddUeMeasReportConfig may not be called after the simulation has run");
2383 }
2384
2385 // INPUT VALIDATION
2386
2387 switch (config.triggerQuantity)
2388 {
2392 {
2394 "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2395 }
2396
2402 {
2404 "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2405 }
2406 break;
2407
2411 {
2413 "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2414 }
2415
2421 {
2423 "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2424 }
2425 break;
2426
2427 default:
2428 NS_FATAL_ERROR("unsupported triggerQuantity");
2429 break;
2430 }
2431
2433 {
2434 NS_FATAL_ERROR("Only REPORT_STRONGEST_CELLS purpose is supported");
2435 }
2436
2438 {
2439 NS_LOG_WARN("reportQuantity = BOTH will be used instead of the given reportQuantity");
2440 }
2441
2442 uint8_t nextId = m_ueMeasConfig.reportConfigToAddModList.size() + 1;
2443
2444 // create the reporting configuration
2446 reportConfig.reportConfigId = nextId;
2447 reportConfig.reportConfigEutra = config;
2448
2449 // add reporting configuration to UE measurement configuration
2450 m_ueMeasConfig.reportConfigToAddModList.push_back(reportConfig);
2451
2452 std::vector<uint8_t> measIds;
2453
2454 // create measurement identities, linking reporting configuration to all objects
2455 for (uint16_t componentCarrier = 0; componentCarrier < m_numberOfComponentCarriers;
2456 componentCarrier++)
2457 {
2458 LteRrcSap::MeasIdToAddMod measIdToAddMod;
2459
2460 uint8_t measId = m_ueMeasConfig.measIdToAddModList.size() + 1;
2461
2462 measIdToAddMod.measId = measId;
2463 measIdToAddMod.measObjectId = componentCarrier + 1;
2464 measIdToAddMod.reportConfigId = nextId;
2465
2466 m_ueMeasConfig.measIdToAddModList.push_back(measIdToAddMod);
2467 measIds.push_back(measId);
2468 }
2469
2470 return measIds;
2471}
2472
2473void
2475{
2476 auto it = ccPhyConf.begin();
2477 NS_ASSERT(it != ccPhyConf.end());
2478 uint16_t ulBandwidth = it->second->GetUlBandwidth();
2479 uint16_t dlBandwidth = it->second->GetDlBandwidth();
2480 uint32_t ulEarfcn = it->second->GetUlEarfcn();
2481 uint32_t dlEarfcn = it->second->GetDlEarfcn();
2482 NS_LOG_FUNCTION(this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2484
2485 for (const auto& it : ccPhyConf)
2486 {
2487 m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2488 it.second->GetDlBandwidth());
2489 m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2490 it.second->GetDlEarfcn());
2491 m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2492 m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2493 it.second->GetDlBandwidth());
2494 if (m_ffrRrcSapProvider.size() > it.first)
2495 {
2496 m_ffrRrcSapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2497 m_ffrRrcSapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2498 it.second->GetDlBandwidth());
2499 }
2500 }
2501
2502 m_dlEarfcn = dlEarfcn;
2503 m_ulEarfcn = ulEarfcn;
2504 m_dlBandwidth = dlBandwidth;
2505 m_ulBandwidth = ulBandwidth;
2506
2507 /*
2508 * Initializing the list of measurement objects.
2509 * Only intra-frequency measurements are supported,
2510 * so one measurement object is created for each carrier frequency.
2511 */
2512 for (const auto& it : ccPhyConf)
2513 {
2515 measObject.measObjectId = it.first + 1;
2516 measObject.measObjectEutra.carrierFreq = it.second->GetDlEarfcn();
2517 measObject.measObjectEutra.allowedMeasBandwidth = it.second->GetDlBandwidth();
2518 measObject.measObjectEutra.presenceAntennaPort1 = false;
2519 measObject.measObjectEutra.neighCellConfig = 0;
2520 measObject.measObjectEutra.offsetFreq = 0;
2522
2523 m_ueMeasConfig.measObjectToAddModList.push_back(measObject);
2524 }
2525
2532
2533 m_sib1.clear();
2534 m_sib1.reserve(ccPhyConf.size());
2535 for (const auto& it : ccPhyConf)
2536 {
2537 // Enabling MIB transmission
2539 mib.dlBandwidth = it.second->GetDlBandwidth();
2540 mib.systemFrameNumber = 0;
2541 m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2542
2543 // Enabling SIB1 transmission with default values
2545 sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId();
2549 sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
2550 sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
2551 m_sib1.push_back(sib1);
2552 m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2553 }
2554 /*
2555 * Enabling transmission of other SIB. The first time System Information is
2556 * transmitted is arbitrarily assumed to be at +0.016s, and then it will be
2557 * regularly transmitted every 80 ms by default (set the
2558 * SystemInformationPeriodicity attribute to configure this).
2559 */
2561
2562 m_configured = true;
2563}
2564
2565void
2566LteEnbRrc::SetCellId(uint16_t cellId)
2567{
2568 // update SIB1
2569 m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2570 m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2571}
2572
2573void
2574LteEnbRrc::SetCellId(uint16_t cellId, uint8_t ccIndex)
2575{
2576 // update SIB1
2577 m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2578 m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2579}
2580
2581uint8_t
2583{
2584 NS_LOG_FUNCTION(this << cellId);
2585 for (auto& it : m_componentCarrierPhyConf)
2586 {
2587 if (it.second->GetCellId() == cellId)
2588 {
2589 return it.first;
2590 }
2591 }
2592 NS_FATAL_ERROR("Cell " << cellId << " not found in CC map");
2593}
2594
2595uint16_t
2596LteEnbRrc::ComponentCarrierToCellId(uint8_t componentCarrierId)
2597{
2598 NS_LOG_FUNCTION(this << +componentCarrierId);
2599 return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2600}
2601
2602bool
2603LteEnbRrc::HasCellId(uint16_t cellId) const
2604{
2605 for (auto& it : m_componentCarrierPhyConf)
2606 {
2607 if (it.second->GetCellId() == cellId)
2608 {
2609 return true;
2610 }
2611 }
2612 return false;
2613}
2614
2615bool
2617{
2618 NS_LOG_FUNCTION(this << packet);
2619
2620 EpsBearerTag tag;
2621 bool found = packet->RemovePacketTag(tag);
2622 NS_ASSERT_MSG(found, "no EpsBearerTag found in packet to be sent");
2623 Ptr<UeManager> ueManager = GetUeManager(tag.GetRnti());
2624 ueManager->SendData(tag.GetBid(), packet);
2625
2626 return true;
2627}
2628
2629void
2631{
2633}
2634
2635void
2637{
2638 NS_LOG_FUNCTION(this << rnti);
2640 "ConnectionRequestTimeout in unexpected state "
2641 << ToString(GetUeManager(rnti)->GetState()));
2642 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2643 rnti,
2644 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2645 "ConnectionRequestTimeout");
2646 RemoveUe(rnti);
2647}
2648
2649void
2651{
2652 NS_LOG_FUNCTION(this << rnti);
2654 "ConnectionSetupTimeout in unexpected state "
2655 << ToString(GetUeManager(rnti)->GetState()));
2656 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2657 rnti,
2658 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2659 "ConnectionSetupTimeout");
2660 RemoveUe(rnti);
2661}
2662
2663void
2665{
2666 NS_LOG_FUNCTION(this << rnti);
2668 "ConnectionRejectedTimeout in unexpected state "
2669 << ToString(GetUeManager(rnti)->GetState()));
2670 m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2671 rnti,
2672 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2673 "ConnectionRejectedTimeout");
2674 RemoveUe(rnti);
2675}
2676
2677void
2679{
2680 NS_LOG_FUNCTION(this << rnti);
2682 "HandoverJoiningTimeout in unexpected state "
2683 << ToString(GetUeManager(rnti)->GetState()));
2685 GetUeManager(rnti)->GetImsi(),
2686 rnti,
2687 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2688 // check if the RNTI to be removed is not stale
2689 if (HasUeManager(rnti))
2690 {
2698 Ptr<UeManager> ueManager = GetUeManager(rnti);
2699 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2701 RemoveUe(rnti);
2702 }
2703}
2704
2705void
2707{
2708 NS_LOG_FUNCTION(this << rnti);
2710 "HandoverLeavingTimeout in unexpected state "
2711 << ToString(GetUeManager(rnti)->GetState()));
2713 GetUeManager(rnti)->GetImsi(),
2714 rnti,
2715 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2716 // check if the RNTI to be removed is not stale
2717 if (HasUeManager(rnti))
2718 {
2724 Ptr<UeManager> ueManager = GetUeManager(rnti);
2725 EpcX2Sap::HandoverCancelParams msg = ueManager->BuildHoCancelMsg();
2727 ueManager->SendRrcConnectionRelease();
2728 }
2729}
2730
2731void
2732LteEnbRrc::SendHandoverRequest(uint16_t rnti, uint16_t cellId)
2733{
2734 NS_LOG_FUNCTION(this << rnti << cellId);
2735 NS_LOG_LOGIC("Request to send HANDOVER REQUEST");
2737
2738 Ptr<UeManager> ueManager = GetUeManager(rnti);
2739 ueManager->PrepareHandover(cellId);
2740}
2741
2742void
2744{
2745 NS_LOG_FUNCTION(this << rnti);
2746 GetUeManager(rnti)->CompleteSetupUe(params);
2747}
2748
2749void
2751{
2752 NS_LOG_FUNCTION(this << rnti);
2753 GetUeManager(rnti)->RecvRrcConnectionRequest(msg);
2754}
2755
2756void
2759{
2760 NS_LOG_FUNCTION(this << rnti);
2761 GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2762}
2763
2764void
2766 uint16_t rnti,
2768{
2769 NS_LOG_FUNCTION(this << rnti);
2770 GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2771}
2772
2773void
2775 uint16_t rnti,
2777{
2778 NS_LOG_FUNCTION(this << rnti);
2779 GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2780}
2781
2782void
2784 uint16_t rnti,
2786{
2787 NS_LOG_FUNCTION(this << rnti);
2788 GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2789}
2790
2791void
2793{
2794 NS_LOG_FUNCTION(this << rnti);
2795 GetUeManager(rnti)->RecvMeasurementReport(msg);
2796}
2797
2798void
2800{
2801 NS_LOG_FUNCTION(this);
2802 Ptr<UeManager> ueManager = GetUeManager(msg.rnti);
2803 ueManager->InitialContextSetupRequest();
2804}
2805
2806void
2808{
2809 NS_LOG_FUNCTION(this << rnti);
2810
2811 // check if the RNTI to be removed is not stale
2812 if (HasUeManager(rnti))
2813 {
2814 Ptr<UeManager> ueManager = GetUeManager(rnti);
2815
2816 if (ueManager->GetState() == UeManager::HANDOVER_JOINING)
2817 {
2819 GetUeManager(rnti)->GetImsi(),
2820 rnti,
2821 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2828 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2830 }
2831
2832 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2833 // delete the UE context at the eNB
2834 RemoveUe(rnti);
2835 }
2836}
2837
2838void
2841{
2842 NS_LOG_FUNCTION(this);
2843 Ptr<UeManager> ueManager = GetUeManager(request.rnti);
2844 ueManager->SetupDataRadioBearer(request.bearer,
2845 request.bearerId,
2846 request.gtpTeid,
2847 request.transportLayerAddress);
2848}
2849
2850void
2853{
2854 NS_LOG_FUNCTION(this);
2855 Ptr<UeManager> ueManager = GetUeManager(params.rnti);
2856 ueManager->SendUeContextRelease();
2857}
2858
2859void
2861{
2862 NS_LOG_FUNCTION(this);
2863
2864 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST");
2865
2866 NS_LOG_LOGIC("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
2867 NS_LOG_LOGIC("sourceCellId = " << req.sourceCellId);
2868 NS_LOG_LOGIC("targetCellId = " << req.targetCellId);
2869 NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId);
2870
2871 // if no SRS index is available, then do not accept the handover
2873 {
2874 NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId);
2876 res.oldEnbUeX2apId = req.oldEnbUeX2apId;
2877 res.sourceCellId = req.sourceCellId;
2878 res.targetCellId = req.targetCellId;
2879 res.cause = 0;
2880 res.criticalityDiagnostics = 0;
2882 return;
2883 }
2884
2885 uint8_t componentCarrierId = CellToComponentCarrierId(req.targetCellId);
2886 uint16_t rnti = AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
2887 Ptr<UeManager> ueManager = GetUeManager(rnti);
2888 ueManager->SetSource(req.sourceCellId, req.oldEnbUeX2apId);
2889 ueManager->SetImsi(req.mmeUeS1apId);
2891 m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2892 if (!anrcrv.valid)
2893 {
2895 this
2896 << " failed to allocate a preamble for non-contention based RA => cannot accept HO");
2898 GetUeManager(rnti)->GetImsi(),
2899 rnti,
2900 ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2906 Ptr<UeManager> ueManager = GetUeManager(rnti);
2907 EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2909 RemoveUe(rnti); // remove the UE from the target eNB
2910 return;
2911 }
2912
2914 ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
2915 ackParams.newEnbUeX2apId = rnti;
2916 ackParams.sourceCellId = req.sourceCellId;
2917 ackParams.targetCellId = req.targetCellId;
2918
2919 for (std::vector<EpcX2Sap::ErabToBeSetupItem>::iterator it = req.bearers.begin();
2920 it != req.bearers.end();
2921 ++it)
2922 {
2923 ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2924 it->erabId,
2925 it->gtpTeid,
2926 it->transportLayerAddress);
2928 i.erabId = it->erabId;
2929 ackParams.admittedBearers.push_back(i);
2930 }
2931
2933 ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2934
2935 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2936 handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
2939 anrcrv.raPrachMaskIndex;
2940
2942 m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2944 .numberOfRaPreambles = rc.numberOfRaPreambles;
2946 .preambleTransMax = rc.preambleTransMax;
2948 .raResponseWindowSize = rc.raResponseWindowSize;
2950 .connEstFailCount = rc.connEstFailCount;
2951
2952 Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand(handoverCommand);
2953
2954 ackParams.rrcContext = encodedHandoverCommand;
2955
2956 NS_LOG_LOGIC("Send X2 message: HANDOVER REQUEST ACK");
2957
2958 NS_LOG_LOGIC("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
2959 NS_LOG_LOGIC("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
2960 NS_LOG_LOGIC("sourceCellId = " << ackParams.sourceCellId);
2961 NS_LOG_LOGIC("targetCellId = " << ackParams.targetCellId);
2962
2964}
2965
2966void
2968{
2969 NS_LOG_FUNCTION(this);
2970
2971 NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST ACK");
2972
2973 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2974 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2975 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2976 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2977
2978 uint16_t rnti = params.oldEnbUeX2apId;
2979 Ptr<UeManager> ueManager = GetUeManager(rnti);
2980 ueManager->RecvHandoverRequestAck(params);
2981}
2982
2983void
2985{
2986 NS_LOG_FUNCTION(this);
2987
2988 NS_LOG_LOGIC("Recv X2 message: HANDOVER PREPARATION FAILURE");
2989
2990 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2991 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2992 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2993 NS_LOG_LOGIC("cause = " << params.cause);
2994 NS_LOG_LOGIC("criticalityDiagnostics = " << params.criticalityDiagnostics);
2995
2996 uint16_t rnti = params.oldEnbUeX2apId;
2997
2998 // check if the RNTI is not stale
2999 if (HasUeManager(rnti))
3000 {
3001 Ptr<UeManager> ueManager = GetUeManager(rnti);
3002 ueManager->RecvHandoverPreparationFailure(params.targetCellId);
3003 }
3004}
3005
3006void
3008{
3009 NS_LOG_FUNCTION(this);
3010
3011 NS_LOG_LOGIC("Recv X2 message: SN STATUS TRANSFER");
3012
3013 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3014 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3015 NS_LOG_LOGIC("erabsSubjectToStatusTransferList size = "
3016 << params.erabsSubjectToStatusTransferList.size());
3017
3018 uint16_t rnti = params.newEnbUeX2apId;
3019
3020 // check if the RNTI to receive SN transfer for is not stale
3021 if (HasUeManager(rnti))
3022 {
3023 Ptr<UeManager> ueManager = GetUeManager(rnti);
3024 ueManager->RecvSnStatusTransfer(params);
3025 }
3026}
3027
3028void
3030{
3031 NS_LOG_FUNCTION(this);
3032
3033 NS_LOG_LOGIC("Recv X2 message: UE CONTEXT RELEASE");
3034
3035 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3036 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3037
3038 uint16_t rnti = params.oldEnbUeX2apId;
3039
3040 // check if the RNTI to be removed is not stale
3041 if (HasUeManager(rnti))
3042 {
3043 GetUeManager(rnti)->RecvUeContextRelease(params);
3044 RemoveUe(rnti);
3045 }
3046}
3047
3048void
3050{
3051 NS_LOG_FUNCTION(this);
3052
3053 NS_LOG_LOGIC("Recv X2 message: LOAD INFORMATION");
3054
3055 NS_LOG_LOGIC("Number of cellInformationItems = " << params.cellInformationList.size());
3056
3058 m_ffrRrcSapProvider.at(0)->RecvLoadInformation(params);
3059}
3060
3061void
3063{
3064 NS_LOG_FUNCTION(this);
3065
3066 NS_LOG_LOGIC("Recv X2 message: RESOURCE STATUS UPDATE");
3067
3069 "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
3070
3071 NS_ASSERT("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
3072}
3073
3074void
3076{
3077 NS_LOG_FUNCTION(this);
3078
3079 NS_LOG_LOGIC("Recv UE DATA FORWARDING through X2 interface");
3080 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3081 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3082 NS_LOG_LOGIC("gtpTeid = " << params.gtpTeid);
3083 NS_LOG_LOGIC("ueData = " << params.ueData);
3084 NS_LOG_LOGIC("ueData size = " << params.ueData->GetSize());
3085
3086 std::map<uint32_t, X2uTeidInfo>::iterator teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
3087 if (teidInfoIt != m_x2uTeidInfoMap.end())
3088 {
3089 GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
3090 }
3091 else
3092 {
3093 NS_FATAL_ERROR("X2-U data received but no X2uTeidInfo found");
3094 }
3095}
3096
3097void
3099{
3100 NS_LOG_FUNCTION(this);
3101
3102 NS_LOG_LOGIC("Recv X2 message: HANDOVER CANCEL");
3103
3104 NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3105 NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3106 NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3107 NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3108 NS_LOG_LOGIC("cause = " << params.cause);
3109
3110 uint16_t rnti = params.newEnbUeX2apId;
3111 if (HasUeManager(rnti))
3112 {
3113 Ptr<UeManager> ueManager = GetUeManager(rnti);
3114 ueManager->RecvHandoverCancel(params);
3115 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3116 }
3117}
3118
3119uint16_t
3121{
3122 NS_LOG_FUNCTION(this << +componentCarrierId);
3123 // if no SRS index is available, then do not create a new UE context.
3124 if (IsMaxSrsReached())
3125 {
3126 NS_LOG_WARN("Not enough SRS configuration indices, UE context not created");
3127 return 0; // return 0 since new RNTI was not assigned for the received preamble
3128 }
3129 return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3130}
3131
3132void
3134{
3135 Ptr<UeManager> ueManager = GetUeManager(cmacParams.m_rnti);
3136 ueManager->CmacUeConfigUpdateInd(cmacParams);
3137}
3138
3139void
3140LteEnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
3141{
3142 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3143 NS_FATAL_ERROR("not implemented");
3144}
3145
3146std::vector<uint8_t>
3148{
3149 NS_LOG_FUNCTION(this);
3150 std::vector<uint8_t> measIds = AddUeMeasReportConfig(reportConfig);
3151 m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3152 return measIds;
3153}
3154
3155uint8_t
3157{
3158 NS_LOG_FUNCTION(this);
3159 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3160 m_componentCarrierMeasIds.insert(measId);
3161 return measId;
3162}
3163
3164void
3165LteEnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3166{
3167 m_numberOfComponentCarriers = numberOfComponentCarriers;
3168}
3169
3170void
3171LteEnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3172{
3173 NS_LOG_FUNCTION(this << rnti << targetCellId);
3174
3175 bool isHandoverAllowed = true;
3176
3177 Ptr<UeManager> ueManager = GetUeManager(rnti);
3178 NS_ASSERT_MSG(ueManager, "Cannot find UE context with RNTI " << rnti);
3179
3180 if (m_anrSapProvider != nullptr && !HasCellId(targetCellId))
3181 {
3182 // ensure that proper neighbour relationship exists between source and target cells
3183 bool noHo = m_anrSapProvider->GetNoHo(targetCellId);
3184 bool noX2 = m_anrSapProvider->GetNoX2(targetCellId);
3185 NS_LOG_DEBUG(this << " cellId="
3186 << ComponentCarrierToCellId(ueManager->GetComponentCarrierId())
3187 << " targetCellId=" << targetCellId << " NRT.NoHo=" << noHo
3188 << " NRT.NoX2=" << noX2);
3189
3190 if (noHo || noX2)
3191 {
3192 isHandoverAllowed = false;
3193 NS_LOG_LOGIC(this << " handover to cell " << targetCellId << " is not allowed by ANR");
3194 }
3195 }
3196
3197 if (ueManager->GetState() != UeManager::CONNECTED_NORMALLY)
3198 {
3199 isHandoverAllowed = false;
3200 NS_LOG_LOGIC(this << " handover is not allowed because the UE"
3201 << " rnti=" << rnti << " is in " << ToString(ueManager->GetState())
3202 << " state");
3203 }
3204
3205 if (isHandoverAllowed)
3206 {
3207 // initiate handover execution
3208 ueManager->PrepareHandover(targetCellId);
3209 }
3210}
3211
3212uint8_t
3214{
3215 NS_LOG_FUNCTION(this);
3216 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3217 m_anrMeasIds.insert(measId);
3218 return measId;
3219}
3220
3221uint8_t
3223{
3224 NS_LOG_FUNCTION(this);
3225 uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3226 m_ffrMeasIds.insert(measId);
3227 return measId;
3228}
3229
3230void
3232 LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
3233{
3234 NS_LOG_FUNCTION(this);
3235 Ptr<UeManager> ueManager = GetUeManager(rnti);
3236 ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3237}
3238
3239void
3241{
3242 NS_LOG_FUNCTION(this);
3243
3245}
3246
3247uint16_t
3248LteEnbRrc::AddUe(UeManager::State state, uint8_t componentCarrierId)
3249{
3250 NS_LOG_FUNCTION(this);
3251 bool found = false;
3252 uint16_t rnti;
3253 for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3254 {
3255 if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3256 {
3257 found = true;
3258 break;
3259 }
3260 }
3261
3262 NS_ASSERT_MSG(found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3263 m_lastAllocatedRnti = rnti;
3264 Ptr<UeManager> ueManager = CreateObject<UeManager>(this, rnti, state, componentCarrierId);
3265 m_ccmRrcSapProvider->AddUe(rnti, (uint8_t)state);
3266 m_ueMap.insert(std::pair<uint16_t, Ptr<UeManager>>(rnti, ueManager));
3267 ueManager->Initialize();
3268 const uint16_t cellId = ComponentCarrierToCellId(componentCarrierId);
3269 NS_LOG_DEBUG(this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI "
3270 << ueManager->GetSrsConfigurationIndex());
3271 m_newUeContextTrace(cellId, rnti);
3272 return rnti;
3273}
3274
3275void
3277{
3278 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3279 std::map<uint16_t, Ptr<UeManager>>::iterator it = m_ueMap.find(rnti);
3280 NS_ASSERT_MSG(it != m_ueMap.end(), "request to remove UE info with unknown rnti " << rnti);
3281 uint64_t imsi = it->second->GetImsi();
3282 uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3283 // cancel pending events
3284 it->second->CancelPendingEvents();
3285 // fire trace upon connection release
3287 ComponentCarrierToCellId(it->second->GetComponentCarrierId()),
3288 rnti);
3289 m_ueMap.erase(it);
3290 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3291 {
3292 m_cmacSapProvider.at(i)->RemoveUe(rnti);
3293 m_cphySapProvider.at(i)->RemoveUe(rnti);
3294 }
3295 if (m_s1SapProvider != nullptr)
3296 {
3298 }
3300 // need to do this after UeManager has been deleted
3301 if (srsCi != 0)
3302 {
3304 }
3305
3306 m_rrcSapUser->RemoveUe(rnti); // Remove UE context at RRC protocol
3307}
3308
3309TypeId
3311{
3313 {
3314 case RLC_SM_ALWAYS:
3315 return LteRlcSm::GetTypeId();
3316
3317 case RLC_UM_ALWAYS:
3318 return LteRlcUm::GetTypeId();
3319
3320 case RLC_AM_ALWAYS:
3321 return LteRlcAm::GetTypeId();
3322
3323 case PER_BASED:
3324 if (bearer.GetPacketErrorLossRate() > 1.0e-5)
3325 {
3326 return LteRlcUm::GetTypeId();
3327 }
3328 else
3329 {
3330 return LteRlcAm::GetTypeId();
3331 }
3332
3333 default:
3334 return LteRlcSm::GetTypeId();
3335 }
3336}
3337
3338void
3340{
3341 NS_LOG_FUNCTION(this << cellId);
3342
3343 if (m_anrSapProvider != nullptr)
3344 {
3346 }
3347}
3348
3349void
3350LteEnbRrc::SetCsgId(uint32_t csgId, bool csgIndication)
3351{
3352 NS_LOG_FUNCTION(this << csgId << csgIndication);
3353 for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3354 componentCarrierId++)
3355 {
3356 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3357 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3358 m_cphySapProvider.at(componentCarrierId)
3359 ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3360 }
3361}
3362
3364static const uint8_t SRS_ENTRIES = 9;
3369static const uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
3375static const uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
3381static const uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
3382
3383void
3385{
3386 NS_LOG_FUNCTION(this << p);
3387 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3388 {
3389 if (g_srsPeriodicity[id] == p)
3390 {
3392 return;
3393 }
3394 }
3395 // no match found
3396 std::ostringstream allowedValues;
3397 for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3398 {
3399 allowedValues << g_srsPeriodicity[id] << " ";
3400 }
3401 NS_FATAL_ERROR("illecit SRS periodicity value " << p
3402 << ". Allowed values: " << allowedValues.str());
3403}
3404
3407{
3408 NS_LOG_FUNCTION(this);
3412}
3413
3414uint16_t
3416{
3418 // SRS
3421 NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3424 {
3425 NS_FATAL_ERROR("too many UEs ("
3426 << m_ueSrsConfigurationIndexSet.size() + 1
3427 << ") for current SRS periodicity "
3429 << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
3430 }
3431
3432 if (m_ueSrsConfigurationIndexSet.empty())
3433 {
3434 // first entry
3437 }
3438 else
3439 {
3440 // find a CI from the available ones
3441 std::set<uint16_t>::reverse_iterator rit = m_ueSrsConfigurationIndexSet.rbegin();
3443 NS_LOG_DEBUG(this << " lower bound " << (*rit) << " of "
3446 {
3447 // got it from the upper bound
3450 }
3451 else
3452 {
3453 // look for released ones
3454 for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
3456 srcCi++)
3457 {
3458 std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find(srcCi);
3459 if (it == m_ueSrsConfigurationIndexSet.end())
3460 {
3462 m_ueSrsConfigurationIndexSet.insert(srcCi);
3463 break;
3464 }
3465 }
3466 }
3467 }
3469}
3470
3471void
3473{
3474 NS_LOG_FUNCTION(this << srcCi);
3475 std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find(srcCi);
3477 "request to remove unknown SRS CI " << srcCi);
3479}
3480
3481bool
3483{
3486 NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3489}
3490
3491uint8_t
3493{
3494 if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
3495 {
3496 return 1;
3497 }
3498 else
3499 {
3500 return 2;
3501 }
3502}
3503
3504uint8_t
3506{
3507 return bearer.qci;
3508}
3509
3510void
3512{
3513 // NS_LOG_FUNCTION (this);
3514
3515 for (auto& it : m_componentCarrierPhyConf)
3516 {
3517 uint8_t ccId = it.first;
3518
3520 si.haveSib2 = true;
3521 si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3522 si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3524 m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3526
3527 LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3528 LteRrcSap::RachConfigCommon rachConfigCommon;
3529 rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3530 rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3531 rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3532 rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3533 si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3534
3535 m_rrcSapUser->SendSystemInformation(it.second->GetCellId(), si);
3536 }
3537
3538 /*
3539 * For simplicity, we use the same periodicity for all SIBs. Note that in real
3540 * systems the periodicy of each SIBs could be different.
3541 */
3543}
3544
3545bool
3547{
3548 NS_LOG_FUNCTION(this << (uint32_t)rnti);
3549 Ptr<UeManager> ueManager = GetUeManager(rnti);
3550 switch (ueManager->GetState())
3551 {
3554 return true;
3555 default:
3556 return false;
3557 }
3558}
3559
3560} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Callback template class.
Definition: callback.h:438
Class for forwarding CMAC SAP User functions.
Definition: lte-enb-rrc.cc:59
bool IsRandomAccessCompleted(uint16_t rnti) override
Is random access completed function.
Definition: lte-enb-rrc.cc:105
EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc *rrc, uint8_t componentCarrierId)
Constructor.
Definition: lte-enb-rrc.cc:79
void RrcConfigurationUpdateInd(UeConfig params) override
Notify the RRC of a UE config updated requested by the MAC (normally, by the scheduler)
Definition: lte-enb-rrc.cc:99
uint16_t AllocateTemporaryCellRnti() override
request the allocation of a Temporary C-RNTI
Definition: lte-enb-rrc.cc:87
uint8_t m_componentCarrierId
Component carrier ID.
Definition: lte-enb-rrc.cc:76
void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override
notify the result of the last LC config operation
Definition: lte-enb-rrc.cc:93
Hold variables of type enum.
Definition: enum.h:56
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
virtual void UeContextRelease(uint16_t rnti)=0
Release UE context at the S1 Application of the source eNB after reception of the UE CONTEXT RELEASE ...
virtual void DoSendReleaseIndication(uint64_t imsi, uint16_t rnti, uint8_t bearerId)=0
Triggers epc-enb-application to send ERAB Release Indication message towards MME.
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
@ HandoverDesirableForRadioReason
Definition: epc-x2-sap.h:220
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:359
virtual void SendHandoverRequestAck(HandoverRequestAckParams params)=0
Send handover request ack function.
virtual void SendHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
Send handover preparation failure function.
virtual void SendHandoverCancel(HandoverCancelParams params)=0
Send handover Cancel to the target eNB.
virtual void SendLoadInformation(LoadInformationParams params)=0
Send load information function.
These service primitives of this part of the X2 SAP are provided by the RRC entity and issued by the ...
Definition: epc-x2-sap.h:427
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
uint8_t GetResourceType() const
Definition: eps-bearer.cc:126
uint16_t GetPacketDelayBudgetMs() const
Definition: eps-bearer.cc:138
double GetPacketErrorLossRate() const
Definition: eps-bearer.cc:144
Qci qci
Qos class indicator.
Definition: eps-bearer.h:151
GbrQosInformation gbrQosInfo
GBR QOS information.
Definition: eps-bearer.h:153
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition: eps-bearer.h:107
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
uint8_t GetBid() const
Get Bearer Id function.
uint16_t GetRnti() const
Get RNTI function.
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
void SetBid(uint8_t bid)
Set the bearer id to the given value.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
Hold a signed integer type.
Definition: integer.h:45
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Service Access Point (SAP) offered by the ANR instance to the eNodeB RRC instance.
Definition: lte-anr-sap.h:37
virtual void AddNeighbourRelation(uint16_t cellId)=0
Add a new Neighbour Relation entry.
virtual bool GetNoX2(uint16_t cellId) const =0
Get the value of No X2 field of a neighbouring cell from the Neighbour Relation Table (NRT).
virtual bool GetNoHo(uint16_t cellId) const =0
Get the value of No HO field of a neighbouring cell from the Neighbour Relation Table (NRT).
Service Access Point (SAP) offered by the eNodeB RRC instance to the ANR instance.
Definition: lte-anr-sap.h:95
Service Access Point (SAP) offered by the Component Carrier Manager (CCM) instance to the eNodeB RRC ...
virtual void AddUe(uint16_t rnti, uint8_t state)=0
Add a new UE in the LteEnbComponentCarrierManager.
virtual void RemoveUe(uint16_t rnti)=0
Remove an existing UE.
Service Access Point (SAP) offered by the eNodeB RRC instance to the component carrier manager (CCM) ...
Service Access Point (SAP) offered by the eNB MAC to the eNB RRC See Femto Forum MAC Scheduler Interf...
Service Access Point (SAP) offered by the MAC to the RRC See Femto Forum MAC Scheduler Interface Spec...
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
The LTE Radio Resource Control entity at the eNB.
Definition: lte-enb-rrc.h:655
~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
Definition: lte-enb-rrc.h:1786
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.
Definition: lte-enb-rrc.h:1654
std::set< uint16_t > m_ueSrsConfigurationIndexSet
UE SRS configuration index set.
Definition: lte-enb-rrc.h:1645
TracedCallback< uint64_t, uint16_t, uint16_t, uint16_t > m_handoverStartTrace
The HandoverStart trace source.
Definition: lte-enb-rrc.h:1731
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.
Definition: lte-enb-rrc.cc:597
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.
Definition: lte-enb-rrc.h:1612
friend class MemberEpcEnbS1SapUser< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:667
Callback< void, Ptr< Packet > > m_forwardUpCallback
forward up callback function
Definition: lte-enb-rrc.h:1530
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.
Definition: lte-enb-rrc.h:1610
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.
Definition: lte-enb-rrc.h:1568
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.
Definition: lte-enb-rrc.h:1548
Time m_connectionRequestTimeoutDuration
The ConnectionRequestTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1683
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.
Definition: lte-enb-rrc.h:1543
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.
Definition: lte-enb-rrc.h:1676
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.
Definition: lte-enb-rrc.h:1630
Time m_connectionRejectedTimeoutDuration
The ConnectionRejectedTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1695
Time m_connectionSetupTimeoutDuration
The ConnectionSetupTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1690
std::set< uint8_t > m_handoverMeasIds
List of measurement identities which are intended for handover purpose.
Definition: lte-enb-rrc.h:1608
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.
Definition: lte-enb-rrc.h:1659
uint16_t m_ulBandwidth
Uplink transmission bandwidth configuration in number of Resource Blocks.
Definition: lte-enb-rrc.h:1589
LteAnrSapUser * m_anrSapUser
Receive API calls from the ANR instance.
Definition: lte-enb-rrc.h:1553
LteHandoverManagementSapProvider * m_handoverManagementSapProvider
Interface to the handover algorithm instance.
Definition: lte-enb-rrc.h:1545
friend class EpcX2SpecificEpcX2SapUser< LteEnbRrc >
allow MemberEpcEnbS1SapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:669
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.
Definition: lte-enb-rrc.h:1560
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.
Definition: lte-enb-rrc.h:1563
std::map< uint16_t, Ptr< UeManager > > m_ueMap
The UeMap attribute.
Definition: lte-enb-rrc.h:1599
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.
Definition: lte-enb-rrc.h:1635
Ptr< UeManager > GetUeManager(uint16_t rnti)
LteCcmRrcSapProvider * m_ccmRrcSapProvider
Interface to the LteEnbComponentCarrierManager instance.
Definition: lte-enb-rrc.h:1550
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.
Definition: lte-enb-rrc.h:1742
LteAnrSapProvider * m_anrSapProvider
Interface to the ANR instance.
Definition: lte-enb-rrc.h:1555
std::set< uint8_t > m_componentCarrierMeasIds
List of measurement identities which are intended for component carrier management purposes.
Definition: lte-enb-rrc.h:1614
std::vector< LteEnbCphySapProvider * > m_cphySapProvider
Interface to the eNodeB PHY instances.
Definition: lte-enb-rrc.h:1578
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
Definition: lte-enb-rrc.h:1646
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureMaxRachTrace
The 'HandoverFailureMaxRach' Trace source.
Definition: lte-enb-rrc.h:1767
friend class MemberLteCcmRrcSapUser< LteEnbRrc >
allow MemberLteCcmRrcSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:673
LteRrcSap::MeasConfig m_ueMeasConfig
List of measurement configuration which are active in every UE attached to this eNodeB instance.
Definition: lte-enb-rrc.h:1605
friend class MemberLteEnbRrcSapProvider< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:665
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureNoPreambleTrace
The 'HandoverFailureNoPreamble' Trace source.
Definition: lte-enb-rrc.h:1761
TracedCallback< uint16_t, uint16_t > m_newUeContextTrace
The NewUeContext trace source.
Definition: lte-enb-rrc.h:1716
Time m_systemInformationPeriodicity
The SystemInformationPeriodicity attribute.
Definition: lte-enb-rrc.h:1640
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
Definition: lte-enb-rrc.h:661
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.
Definition: lte-enb-rrc.h:1538
void DoInitialContextSetupRequest(EpcEnbS1SapUser::InitialContextSetupRequestParameters params)
Initial context setup request function.
uint32_t m_dlEarfcn
Downlink E-UTRA Absolute Radio Frequency Channel Number.
Definition: lte-enb-rrc.h:1583
void SendHandoverRequest(uint16_t rnti, uint16_t cellId)
Send a HandoverRequest through the X2 SAP interface.
uint16_t m_numberOfComponentCarriers
number of component carriers
Definition: lte-enb-rrc.h:1781
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.
Definition: lte-enb-rrc.h:1670
EpcEnbS1SapProvider * m_s1SapProvider
Interface to send messages to core network over the S1 protocol.
Definition: lte-enb-rrc.h:1571
uint16_t m_lastAllocatedRnti
Last allocated RNTI.
Definition: lte-enb-rrc.h:1591
uint32_t m_ulEarfcn
Uplink E-UTRA Absolute Radio Frequency Channel Number.
Definition: lte-enb-rrc.h:1585
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.
Definition: lte-enb-rrc.h:1726
EpcX2SapUser * m_x2SapUser
Interface to receive messages from neighbour eNodeB over the X2 interface.
Definition: lte-enb-rrc.h:1533
bool m_admitRrcConnectionRequest
The AdmitRrcConnectionRequest attribute.
Definition: lte-enb-rrc.h:1664
void DoRecvUeData(EpcX2SapUser::UeDataParams params)
Receive UE data function.
uint16_t m_srsCurrentPeriodicityId
The SrsPeriodicity attribute.
Definition: lte-enb-rrc.h:1644
void DoRecvRrcConnectionReestablishmentRequest(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentRequest msg)
Part of the RRC protocol.
bool m_configured
True if ConfigureCell() has been completed.
Definition: lte-enb-rrc.h:1581
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
Definition: lte-enb-rrc.h:657
friend class MemberLteHandoverManagementSapUser< LteEnbRrc >
allow MemberLteHandoverManagementSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:659
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.
Definition: lte-enb-rrc.h:1748
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.
Definition: lte-enb-rrc.h:1710
std::map< uint32_t, X2uTeidInfo > m_x2uTeidInfoMap
TEID, RNTI, DRBID.
Definition: lte-enb-rrc.h:1624
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.
Definition: lte-enb-rrc.h:1576
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureJoiningTrace
The 'HandoverFailureJoining' Trace source.
Definition: lte-enb-rrc.h:1779
void SetLteHandoverManagementSapProvider(LteHandoverManagementSapProvider *s)
set the Handover Management SAP this RRC should interact with
void SetLteFfrRrcSapProvider(LteFfrRrcSapProvider *s)
set the FFR SAP this RRC should interact with
LteCcmRrcSapUser * GetLteCcmRrcSapUser()
Get the Component Carrier Management SAP offered by this RRC.
void SetLteEnbCphySapProvider(LteEnbCphySapProvider *s)
set the CPHY SAP this RRC should use to interact with the PHY
void DoDispose() override
Destructor implementation.
std::vector< LteFfrRrcSapUser * > m_ffrRrcSapUser
Receive API calls from the FFR algorithm instance.
Definition: lte-enb-rrc.h:1558
bool IsMaxSrsReached()
EpcX2SapProvider * m_x2SapProvider
Interface to send messages to neighbour eNodeB over the X2 interface.
Definition: lte-enb-rrc.h:1535
std::vector< LteEnbCmacSapProvider * > m_cmacSapProvider
Interface to the eNodeB MAC instance.
Definition: lte-enb-rrc.h:1540
std::vector< LteRrcSap::SystemInformationBlockType1 > m_sib1
The System Information Block Type 1 that is currently broadcasted over BCH.
Definition: lte-enb-rrc.h:1594
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.
Definition: lte-enb-rrc.h:1565
bool m_carriersConfigured
are carriers configured
Definition: lte-enb-rrc.h:1783
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.
Definition: lte-enb-rrc.h:1721
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureLeavingTrace
The 'HandoverFailureLeaving' Trace source.
Definition: lte-enb-rrc.h:1773
TracedCallback< uint64_t, uint16_t, uint16_t, std::string > m_rrcTimeoutTrace
The 'TimerExpiry' Trace source.
Definition: lte-enb-rrc.h:1754
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.
Definition: lte-enb-rrc.h:1573
void RemoveSrsConfigurationIndex(uint16_t srcCi)
remove a previously allocated SRS configuration index
Time m_handoverJoiningTimeoutDuration
The HandoverJoiningTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1704
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.
Definition: lte-enb-rrc.h:1587
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverEndOkTrace
The HandoverEndOk trace source.
Definition: lte-enb-rrc.h:1736
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.
Definition: lte-rrc-sap.h:1244
Part of the RRC protocol.
Definition: lte-rrc-sap.h:1124
virtual void SendSystemInformation(uint16_t cellId, SystemInformation msg)=0
Send a SystemInformation message to all attached UEs during a system information acquisition procedur...
virtual void RemoveUe(uint16_t rnti)=0
Remove UE function.
virtual Ptr< Packet > EncodeHandoverCommand(RrcConnectionReconfiguration msg)=0
Encode handover command.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Service Access Point (SAP) offered by the handover algorithm instance to the eNodeB RRC instance.
Service Access Point (SAP) offered by the eNodeB RRC instance to the handover algorithm instance.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:96
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
Definition: lte-pdcp-sap.h: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:38
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc-am.cc:87
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE,...
Definition: lte-rlc.h:49
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc.cc:197
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc-um.cc:56
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
Convert PDSCH config dedicated function.
Definition: lte-rrc-sap.h:189
Template for the implementation of the LteEnbCphySapUser as a member of an owner class of type C to w...
Template for the implementation of the LteFfrRrcSapUser as a member of an owner class of type C to wh...
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
virtual void DoInitialize()
Initialize() implementation.
Definition: object.cc:360
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
AttributeValue implementation for Time.
Definition: nstime.h:1423
a unique identifier for an interface.
Definition: type-id.h:59
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:66
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
bool m_pendingStartDataRadioBearers
Pending start data radio bearers.
Definition: lte-enb-rrc.h:634
void RecvRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentRequest interface.
void InitialContextSetupRequest()
Process Initial context setup request message from the MME.
Definition: lte-enb-rrc.cc:385
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.
Definition: lte-enb-rrc.cc:523
std::map< uint8_t, Ptr< LteDataRadioBearerInfo > > m_drbMap
The DataRadioBearerMap attribute.
Definition: lte-enb-rrc.h:538
Ptr< LteSignalingRadioBearerInfo > m_srb1
The Srb1 attribute.
Definition: lte-enb-rrc.h:547
void PrepareHandover(uint16_t cellId)
Start the handover preparation and send the handover request.
Definition: lte-enb-rrc.cc:665
void SetImsi(uint64_t imsi)
Set the IMSI.
Definition: lte-enb-rrc.cc:379
void SendData(uint8_t bid, Ptr< Packet > p)
Send a data packet over the appropriate Data Radio Bearer.
Definition: lte-enb-rrc.cc:955
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
Definition: lte-enb-rrc.h:594
State
The state of the UeManager at the eNB RRC.
Definition: lte-enb-rrc.h:77
@ CONNECTION_REESTABLISHMENT
Definition: lte-enb-rrc.h:84
@ CONNECTION_RECONFIGURATION
Definition: lte-enb-rrc.h:83
LteRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo()
Definition: lte-enb-rrc.cc:877
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.
Definition: lte-enb-rrc.cc:319
LteRrcSap::RrcConnectionReconfiguration BuildRrcConnectionReconfiguration()
EventId m_handoverJoiningTimeout
Time limit before a handover joining timeout occurs.
Definition: lte-enb-rrc.h:621
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.
Definition: lte-enb-rrc.h:552
void RecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
Take the necessary actions in response to the reception of an X2 SN STATUS TRANSFER message.
~UeManager() override
Definition: lte-enb-rrc.cc:314
uint8_t Bid2Lcid(uint8_t bid)
LteRrcSap::PhysicalConfigDedicated m_physicalConfigDedicated
physical config dedicated
Definition: lte-enb-rrc.h:565
void RecvRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionSetupCompleted interface.
std::list< uint8_t > m_drbsToBeStarted
DRBS to be started.
Definition: lte-enb-rrc.h:593
uint8_t m_lastAllocatedDrbid
last allocated Data Radio Bearer ID
Definition: lte-enb-rrc.h:532
uint8_t GetComponentCarrierId() const
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
EventId m_connectionRejectedTimeout
The delay before a connection rejected timeout occurs.
Definition: lte-enb-rrc.h:614
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 ...
Definition: lte-enb-rrc.cc:400
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.
Definition: lte-enb-rrc.h:587
State GetState() const
uint16_t m_targetX2apId
target X2 ap ID
Definition: lte-enb-rrc.h:590
uint8_t Drbid2Bid(uint8_t drbid)
static TypeId GetTypeId()
Get the type ID.
Definition: lte-enb-rrc.cc:332
Ptr< LteSignalingRadioBearerInfo > m_srb0
The Srb0 attribute.
Definition: lte-enb-rrc.h:543
uint64_t GetImsi() const
EventId m_connectionRequestTimeout
Time limit before a connection request timeout occurs.
Definition: lte-enb-rrc.h:602
uint64_t m_imsi
International Mobile Subscriber Identity assigned to this UE.
Definition: lte-enb-rrc.h:557
uint8_t GetNewRrcTransactionIdentifier()
bool m_caSupportConfigured
Define if the Carrier Aggregation was already configure for the current UE on not.
Definition: lte-enb-rrc.h:631
uint16_t m_targetCellId
target cell ID
Definition: lte-enb-rrc.h:592
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.
Definition: lte-enb-rrc.cc:933
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...
Definition: lte-enb-rrc.cc:372
LteRrcSap::NonCriticalExtensionConfiguration BuildNonCriticalExtensionConfigurationCa()
std::list< std::pair< uint8_t, Ptr< Packet > > > m_packetBuffer
Packet buffer for when UE is doing the handover.
Definition: lte-enb-rrc.h:645
friend class LtePdcpSpecificLtePdcpSapUser< UeManager >
allow LtePdcpSpecificLtePdcpSapUser<UeManager> class friend access
Definition: lte-enb-rrc.h:69
uint8_t m_lastRrcTransactionIdentifier
last RRC transaction identifier
Definition: lte-enb-rrc.h:563
uint8_t m_componentCarrierId
ID of the primary CC for this UE.
Definition: lte-enb-rrc.h:561
State m_state
The current UeManager state.
Definition: lte-enb-rrc.h:569
void RecvMeasurementReport(LteRrcSap::MeasurementReport msg)
Implement the LteEnbRrcSapProvider::RecvMeasurementReport interface.
void DoInitialize() override
Initialize() implementation.
Definition: lte-enb-rrc.cc:165
Ptr< LteEnbRrc > m_rrc
Pointer to the parent eNodeB RRC.
Definition: lte-enb-rrc.h:567
TracedCallback< uint64_t, uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
Definition: lte-enb-rrc.h:580
bool m_pendingRrcConnectionReconfiguration
pending RRC connection reconfiguration
Definition: lte-enb-rrc.h:573
void ReleaseDataRadioBearer(uint8_t drbid)
Release a given radio bearer.
Definition: lte-enb-rrc.cc:554
void RecvRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentComplete interface.
uint8_t Bid2Drbid(uint8_t bid)
LteRrcSap::RrcConnectionReconfiguration GetRrcConnectionReconfigurationForHandover(uint8_t componentCarrierId)
Definition: lte-enb-rrc.cc:884
void StartDataRadioBearers()
Start the data radio bearers that have been previously recorded to be started using RecordDataRadioBe...
Definition: lte-enb-rrc.cc:535
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
Definition: lte-enb-rrc.cc:805
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
Definition: lte-enb-rrc.cc:632
uint16_t m_sourceCellId
source cell ID
Definition: lte-enb-rrc.h:591
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.
Definition: lte-enb-rrc.h:628
uint16_t m_sourceX2apId
source X2 ap ID
Definition: lte-enb-rrc.h:589
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.
Definition: lte-enb-rrc.h:571
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.
Definition: lte-enb-rrc.h:608
void RecvIdealUeContextRemoveRequest(uint16_t rnti)
Implement the LteEnbRrcSapProvider::RecvIdealUeContextRemoveRequest interface.
Definition: lte-enb-rrc.cc:613
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#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:86
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition: enum.h:205
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition: integer.h:46
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Definition: object-map.h:40
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-map.h:76
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:227
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1444
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1424
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#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:261
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
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.
constexpr uint32_t MIN_NO_CC
Minimum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:36
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:39
static const std::string g_ueManagerStateName[UeManager::NUM_STATES]
Map each of UE Manager states to its string representation.
Definition: lte-enb-rrc.cc:115
static const uint16_t g_srsCiLow[SRS_ENTRIES]
The lower bound (inclusive) of the SRS configuration indices (ISRS) which use the corresponding SRS p...
static const uint16_t g_srsCiHigh[SRS_ENTRIES]
The upper bound (inclusive) of the SRS configuration indices (ISRS) which use the corresponding SRS p...
static const uint8_t SRS_ENTRIES
Number of distinct SRS periodicity plus one.
static const uint16_t g_srsPeriodicity[SRS_ENTRIES]
Sounding Reference Symbol (SRS) periodicity (TSRS) in milliseconds.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:163
static const std::string & ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:48
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:76
uint16_t erabId
E-RAB ID.
Definition: epc-x2-sap.h:77
E-RABs to be setup item as it is used in the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:60
bool dlForwarding
DL forwarding.
Definition: epc-x2-sap.h:63
Ipv4Address transportLayerAddress
transport layer address
Definition: epc-x2-sap.h:64
EpsBearer erabLevelQosParameters
E-RAB level QOS parameters.
Definition: epc-x2-sap.h:62
ErabsSubjectToStatusTransferItem structure.
Definition: epc-x2-sap.h:102
Parameters of the HANDOVER CANCEL message.
Definition: epc-x2-sap.h:345
Parameters of the HANDOVER PREPARATION FAILURE message.
Definition: epc-x2-sap.h:264
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:248
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
Definition: epc-x2-sap.h:253
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:251
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:250
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:252
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:249
Ptr< Packet > rrcContext
RRC context.
Definition: epc-x2-sap.h:255
Parameters of the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:230
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:231
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:233
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:234
uint32_t mmeUeS1apId
MME UE S1 AP ID.
Definition: epc-x2-sap.h:235
std::vector< ErabToBeSetupItem > bearers
bearers
Definition: epc-x2-sap.h:238
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:306
Parameters of the RESOURCE STATUS UPDATE message.
Definition: epc-x2-sap.h:317
Parameters of the SN STATUS TRANSFER message.
Definition: epc-x2-sap.h:278
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:280
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
Definition: epc-x2-sap.h:284
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:279
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:282
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:281
Parameters of the UE CONTEXT RELEASE message.
Definition: epc-x2-sap.h:293
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:295
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:294
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:296
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:297
Parameters of the UE DATA primitive.
Definition: epc-x2-sap.h:332
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:43
AllocateNcRaPreambleReturnValue structure.
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.
Definition: lte-enb-rrc.h:1618
CompleteSetupUeParameters structure.
Definition: lte-rrc-sap.h:1248
SetupUeParameters structure.
Definition: lte-rrc-sap.h:1128
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
Definition: lte-rrc-sap.h:1130
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
Definition: lte-rrc-sap.h:1129
Status variables of the PDCP.
Definition: lte-pdcp.h:102
uint16_t rxSn
RX sequence number.
Definition: lte-pdcp.h:104
uint16_t txSn
TX sequence number.
Definition: lte-pdcp.h:103
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
Definition: lte-pdcp-sap.h:44
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
Definition: lte-pdcp-sap.h:77
uint16_t antennaPortsCount
antenna ports count
Definition: lte-rrc-sap.h:758
uint8_t transmissionMode
transmission mode
Definition: lte-rrc-sap.h:151
RadioResourceConfigDedicated sourceRadioResourceConfig
source radio resource config
Definition: lte-rrc-sap.h:652
MasterInformationBlock sourceMasterInformationBlock
source master information block
Definition: lte-rrc-sap.h:654
uint16_t sourceUeIdentity
source UE identity
Definition: lte-rrc-sap.h:653
MeasConfig sourceMeasConfig
source measure config
Definition: lte-rrc-sap.h:651
uint32_t sourceDlCarrierFreq
source DL carrier frequency
Definition: lte-rrc-sap.h:659
SystemInformationBlockType1 sourceSystemInformationBlockType1
source system information block type 1
Definition: lte-rrc-sap.h:656
SystemInformationBlockType2 sourceSystemInformationBlockType2
source system information block type 2
Definition: lte-rrc-sap.h:658
uint16_t dlBandwidth
DL bandwidth.
Definition: lte-rrc-sap.h:580
uint16_t ulBandwidth
UL bandwidth.
Definition: lte-rrc-sap.h:581
uint32_t dlCarrierFreq
DL carrier frequency.
Definition: lte-rrc-sap.h:573
uint32_t ulCarrierFreq
UL carrier frequency.
Definition: lte-rrc-sap.h:574