A Discrete-Event Network Simulator
API
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 
28 #include <ns3/abort.h>
29 #include <ns3/eps-bearer-tag.h>
30 #include <ns3/fatal-error.h>
31 #include <ns3/log.h>
32 #include <ns3/lte-pdcp.h>
33 #include <ns3/lte-radio-bearer-info.h>
34 #include <ns3/lte-rlc-am.h>
35 #include <ns3/lte-rlc-tm.h>
36 #include <ns3/lte-rlc-um.h>
37 #include <ns3/lte-rlc.h>
38 #include <ns3/object-factory.h>
39 #include <ns3/object-map.h>
40 #include <ns3/packet.h>
41 #include <ns3/pointer.h>
42 #include <ns3/simulator.h>
43 
44 namespace ns3
45 {
46 
47 NS_LOG_COMPONENT_DEFINE("LteEnbRrc");
48 
50 // CMAC SAP forwarder
52 
57 {
58  public:
65  EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc* rrc, uint8_t componentCarrierId);
66 
67  uint16_t AllocateTemporaryCellRnti() override;
68  void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override;
70  bool IsRandomAccessCompleted(uint16_t rnti) override;
71 
72  private:
75 };
76 
78  uint8_t componentCarrierId)
79  : m_rrc(rrc),
80  m_componentCarrierId{componentCarrierId}
81 {
82 }
83 
84 uint16_t
86 {
88 }
89 
90 void
91 EnbRrcMemberLteEnbCmacSapUser::NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
92 {
93  m_rrc->DoNotifyLcConfigResult(rnti, lcid, success);
94 }
95 
96 void
98 {
100 }
101 
102 bool
104 {
105  return m_rrc->IsRandomAccessCompleted(rnti);
106 }
107 
109 // UeManager
111 
113 static const std::string g_ueManagerStateName[UeManager::NUM_STATES] = {
114  "INITIAL_RANDOM_ACCESS",
115  "CONNECTION_SETUP",
116  "CONNECTION_REJECTED",
117  "ATTACH_REQUEST",
118  "CONNECTED_NORMALLY",
119  "CONNECTION_RECONFIGURATION",
120  "CONNECTION_REESTABLISHMENT",
121  "HANDOVER_PREPARATION",
122  "HANDOVER_JOINING",
123  "HANDOVER_PATH_SWITCH",
124  "HANDOVER_LEAVING",
125 };
126 
131 static const std::string&
133 {
134  return g_ueManagerStateName[s];
135 }
136 
137 NS_OBJECT_ENSURE_REGISTERED(UeManager);
138 
140 {
141  NS_FATAL_ERROR("this constructor is not espected to be used");
142 }
143 
144 UeManager::UeManager(Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId)
145  : m_lastAllocatedDrbid(0),
146  m_rnti(rnti),
147  m_imsi(0),
148  m_componentCarrierId(componentCarrierId),
149  m_lastRrcTransactionIdentifier(0),
150  m_rrc(rrc),
151  m_state(s),
152  m_pendingRrcConnectionReconfiguration(false),
153  m_sourceX2apId(0),
154  m_sourceCellId(0),
155  m_needPhyMacConfiguration(false),
156  m_caSupportConfigured(false),
157  m_pendingStartDataRadioBearers(false)
158 {
159  NS_LOG_FUNCTION(this);
160 }
161 
162 void
164 {
165  NS_LOG_FUNCTION(this);
167 
169  m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
172  m_rrc->GetNewSrsConfigurationIndex();
178 
179  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
180  {
181  m_rrc->m_cmacSapProvider.at(i)->AddUe(m_rnti);
182  m_rrc->m_cphySapProvider.at(i)->AddUe(m_rnti);
183  }
184 
185  // setup the eNB side of SRB0
186  {
187  uint8_t lcid = 0;
188 
189  Ptr<LteRlc> rlc = CreateObject<LteRlcTm>()->GetObject<LteRlc>();
190  rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
191  rlc->SetRnti(m_rnti);
192  rlc->SetLcId(lcid);
193 
194  m_srb0 = CreateObject<LteSignalingRadioBearerInfo>();
195  m_srb0->m_rlc = rlc;
196  m_srb0->m_srbIdentity = 0;
197  // no need to store logicalChannelConfig as SRB0 is pre-configured
198 
200  lcinfo.rnti = m_rnti;
201  lcinfo.lcId = lcid;
202  // Initialise the rest of lcinfo structure even if CCCH (LCID 0) is pre-configured, and only
203  // m_rnti and lcid will be used from passed lcinfo structure. See FF LTE MAC Scheduler
204  // Iinterface Specification v1.11, 4.3.4 logicalChannelConfigListElement
205  lcinfo.lcGroup = 0;
206  lcinfo.qci = 0;
207  lcinfo.isGbr = false;
208  lcinfo.mbrUl = 0;
209  lcinfo.mbrDl = 0;
210  lcinfo.gbrUl = 0;
211  lcinfo.gbrDl = 0;
212 
213  // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
214  LteMacSapUser* lteMacSapUser =
215  m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
216  // Signal Channel are only on Primary Carrier
217  m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, lteMacSapUser);
218  m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, lteMacSapUser);
219  }
220 
221  // setup the eNB side of SRB1; the UE side will be set up upon RRC connection establishment
222  {
223  uint8_t lcid = 1;
224 
225  Ptr<LteRlc> rlc = CreateObject<LteRlcAm>()->GetObject<LteRlc>();
226  rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
227  rlc->SetRnti(m_rnti);
228  rlc->SetLcId(lcid);
229 
230  Ptr<LtePdcp> pdcp = CreateObject<LtePdcp>();
231  pdcp->SetRnti(m_rnti);
232  pdcp->SetLcId(lcid);
233  pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
234  pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
235  rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
236 
237  m_srb1 = CreateObject<LteSignalingRadioBearerInfo>();
238  m_srb1->m_rlc = rlc;
239  m_srb1->m_pdcp = pdcp;
240  m_srb1->m_srbIdentity = 1;
241  m_srb1->m_logicalChannelConfig.priority = 1;
242  m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
243  m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
244  m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
245 
247  lcinfo.rnti = m_rnti;
248  lcinfo.lcId = lcid;
249  lcinfo.lcGroup = 0; // all SRBs always mapped to LCG 0
250  lcinfo.qci =
251  EpsBearer::GBR_CONV_VOICE; // not sure why the FF API requires a CQI even for SRBs...
252  lcinfo.isGbr = true;
253  lcinfo.mbrUl = 1e6;
254  lcinfo.mbrDl = 1e6;
255  lcinfo.gbrUl = 1e4;
256  lcinfo.gbrDl = 1e4;
257  // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
258  LteMacSapUser* MacSapUserForRlc =
259  m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
260  // Signal Channel are only on Primary Carrier
261  m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, MacSapUserForRlc);
262  m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, MacSapUserForRlc);
263  }
264 
266  ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider();
267  ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider();
268  m_rrc->m_rrcSapUser->SetupUe(m_rnti, ueParams);
269 
270  // configure MAC (and scheduler)
272  req.m_rnti = m_rnti;
274 
275  // configure PHY
276  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
277  {
278  m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
279  m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(
280  m_rnti,
282  m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
283  m_rnti,
285  }
286  // schedule this UeManager instance to be deleted if the UE does not give any sign of life
287  // within a reasonable time
288  Time maxConnectionDelay;
289  switch (m_state)
290  {
292  m_connectionRequestTimeout = Simulator::Schedule(m_rrc->m_connectionRequestTimeoutDuration,
294  m_rrc,
295  m_rnti);
296  break;
297 
298  case HANDOVER_JOINING:
299  m_handoverJoiningTimeout = Simulator::Schedule(m_rrc->m_handoverJoiningTimeoutDuration,
301  m_rrc,
302  m_rnti);
303  break;
304 
305  default:
306  NS_FATAL_ERROR("unexpected state " << ToString(m_state));
307  break;
308  }
309  m_caSupportConfigured = false;
310 }
311 
313 {
314 }
315 
316 void
318 {
319  delete m_drbPdcpSapUser;
320  // delete eventual X2-U TEIDs
321  for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
322  it != m_drbMap.end();
323  ++it)
324  {
325  m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
326  }
327 }
328 
329 TypeId
331 {
332  static TypeId tid =
333  TypeId("ns3::UeManager")
334  .SetParent<Object>()
335  .AddConstructor<UeManager>()
336  .AddAttribute("DataRadioBearerMap",
337  "List of UE DataRadioBearerInfo by DRBID.",
338  ObjectMapValue(),
340  MakeObjectMapChecker<LteDataRadioBearerInfo>())
341  .AddAttribute("Srb0",
342  "SignalingRadioBearerInfo for SRB0",
343  PointerValue(),
345  MakePointerChecker<LteSignalingRadioBearerInfo>())
346  .AddAttribute("Srb1",
347  "SignalingRadioBearerInfo for SRB1",
348  PointerValue(),
350  MakePointerChecker<LteSignalingRadioBearerInfo>())
351  .AddAttribute("C-RNTI",
352  "Cell Radio Network Temporary Identifier",
353  TypeId::ATTR_GET, // read-only attribute
354  UintegerValue(0), // unused, read-only attribute
356  MakeUintegerChecker<uint16_t>())
357  .AddTraceSource("StateTransition",
358  "fired upon every UE state transition seen by the "
359  "UeManager at the eNB RRC",
361  "ns3::UeManager::StateTracedCallback")
362  .AddTraceSource("DrbCreated",
363  "trace fired after DRB is created",
365  "ns3::UeManager::ImsiCidRntiLcIdTracedCallback");
366  return tid;
367 }
368 
369 void
370 UeManager::SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
371 {
372  m_sourceX2apId = sourceX2apId;
373  m_sourceCellId = sourceCellId;
374 }
375 
376 void
377 UeManager::SetImsi(uint64_t imsi)
378 {
379  m_imsi = imsi;
380 }
381 
382 void
384 {
385  NS_LOG_FUNCTION(this << m_rnti);
386 
387  if (m_state == ATTACH_REQUEST)
388  {
390  }
391  else
392  {
393  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
394  }
395 }
396 
397 void
399  uint8_t bearerId,
400  uint32_t gtpTeid,
401  Ipv4Address transportLayerAddress)
402 {
403  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
404 
405  Ptr<LteDataRadioBearerInfo> drbInfo = CreateObject<LteDataRadioBearerInfo>();
406  uint8_t drbid = AddDataRadioBearerInfo(drbInfo);
407  uint8_t lcid = Drbid2Lcid(drbid);
408  uint8_t bid = Drbid2Bid(drbid);
409  NS_ASSERT_MSG(bearerId == 0 || bid == bearerId,
410  "bearer ID mismatch (" << (uint32_t)bid << " != " << (uint32_t)bearerId
411  << ", the assumption that ID are allocated in the same "
412  "way by MME and RRC is not valid any more");
413  drbInfo->m_epsBearer = bearer;
414  drbInfo->m_epsBearerIdentity = bid;
415  drbInfo->m_drbIdentity = drbid;
416  drbInfo->m_logicalChannelIdentity = lcid;
417  drbInfo->m_gtpTeid = gtpTeid;
418  drbInfo->m_transportLayerAddress = transportLayerAddress;
419 
420  if (m_state == HANDOVER_JOINING)
421  {
422  // setup TEIDs for receiving data eventually forwarded over X2-U
423  LteEnbRrc::X2uTeidInfo x2uTeidInfo;
424  x2uTeidInfo.rnti = m_rnti;
425  x2uTeidInfo.drbid = drbid;
426  std::pair<std::map<uint32_t, LteEnbRrc::X2uTeidInfo>::iterator, bool> ret =
427  m_rrc->m_x2uTeidInfoMap.insert(
428  std::pair<uint32_t, LteEnbRrc::X2uTeidInfo>(gtpTeid, x2uTeidInfo));
429  NS_ASSERT_MSG(ret.second == true, "overwriting a pre-existing entry in m_x2uTeidInfoMap");
430  }
431 
432  TypeId rlcTypeId = m_rrc->GetRlcType(bearer);
433 
434  ObjectFactory rlcObjectFactory;
435  rlcObjectFactory.SetTypeId(rlcTypeId);
436  Ptr<LteRlc> rlc = rlcObjectFactory.Create()->GetObject<LteRlc>();
437  rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
438  rlc->SetRnti(m_rnti);
439 
440  drbInfo->m_rlc = rlc;
441 
442  rlc->SetLcId(lcid);
443 
444  // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
445  // if we are using RLC/SM we don't care of anything above RLC
446  if (rlcTypeId != LteRlcSm::GetTypeId())
447  {
448  Ptr<LtePdcp> pdcp = CreateObject<LtePdcp>();
449  pdcp->SetRnti(m_rnti);
450  pdcp->SetLcId(lcid);
451  pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
452  pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
453  rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
454  drbInfo->m_pdcp = pdcp;
455  }
456 
457  m_drbCreatedTrace(m_imsi, m_rrc->ComponentCarrierToCellId(m_componentCarrierId), m_rnti, lcid);
458 
459  std::vector<LteCcmRrcSapProvider::LcsConfig> lcOnCcMapping =
460  m_rrc->m_ccmRrcSapProvider->SetupDataRadioBearer(bearer,
461  bearerId,
462  m_rnti,
463  lcid,
464  m_rrc->GetLogicalChannelGroup(bearer),
465  rlc->GetLteMacSapUser());
466  // LteEnbCmacSapProvider::LcInfo lcinfo;
467  // lcinfo.rnti = m_rnti;
468  // lcinfo.lcId = lcid;
469  // lcinfo.lcGroup = m_rrc->GetLogicalChannelGroup (bearer);
470  // lcinfo.qci = bearer.qci;
471  // lcinfo.isGbr = bearer.IsGbr ();
472  // lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
473  // lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
474  // lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
475  // lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
476  // use a for cycle to send the AddLc to the appropriate Mac Sap
477  // if the sap is not initialized the appropriated method has to be called
478  std::vector<LteCcmRrcSapProvider::LcsConfig>::iterator itLcOnCcMapping = lcOnCcMapping.begin();
479  NS_ASSERT_MSG(itLcOnCcMapping != lcOnCcMapping.end(), "Problem");
480  for (itLcOnCcMapping = lcOnCcMapping.begin(); itLcOnCcMapping != lcOnCcMapping.end();
481  ++itLcOnCcMapping)
482  {
483  NS_LOG_DEBUG(this << " RNTI " << itLcOnCcMapping->lc.rnti << "Lcid "
484  << (uint16_t)itLcOnCcMapping->lc.lcId << " lcGroup "
485  << (uint16_t)itLcOnCcMapping->lc.lcGroup << " ComponentCarrierId "
486  << itLcOnCcMapping->componentCarrierId);
487  uint8_t index = itLcOnCcMapping->componentCarrierId;
488  LteEnbCmacSapProvider::LcInfo lcinfo = itLcOnCcMapping->lc;
489  LteMacSapUser* msu = itLcOnCcMapping->msu;
490  m_rrc->m_cmacSapProvider.at(index)->AddLc(lcinfo, msu);
491  m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, msu);
492  }
493 
494  if (rlcTypeId == LteRlcAm::GetTypeId())
495  {
496  drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::AM;
497  }
498  else
499  {
500  drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
501  }
502 
503  drbInfo->m_logicalChannelIdentity = lcid;
504  drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority(bearer);
505  drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup(bearer);
506  if (bearer.IsGbr())
507  {
508  drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.gbrQosInfo.gbrUl;
509  }
510  else
511  {
512  drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
513  }
514  drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
515 
517 }
518 
519 void
521 {
522  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
523  for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
524  it != m_drbMap.end();
525  ++it)
526  {
527  m_drbsToBeStarted.push_back(it->first);
528  }
529 }
530 
531 void
533 {
534  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
535  for (std::list<uint8_t>::iterator drbIdIt = m_drbsToBeStarted.begin();
536  drbIdIt != m_drbsToBeStarted.end();
537  ++drbIdIt)
538  {
539  std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator drbIt = m_drbMap.find(*drbIdIt);
540  NS_ASSERT(drbIt != m_drbMap.end());
541  drbIt->second->m_rlc->Initialize();
542  if (drbIt->second->m_pdcp)
543  {
544  drbIt->second->m_pdcp->Initialize();
545  }
546  }
547  m_drbsToBeStarted.clear();
548 }
549 
550 void
552 {
553  NS_LOG_FUNCTION(this << (uint32_t)m_rnti << (uint32_t)drbid);
554  uint8_t lcid = Drbid2Lcid(drbid);
555  std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
556  NS_ASSERT_MSG(it != m_drbMap.end(),
557  "request to remove radio bearer with unknown drbid " << drbid);
558 
559  // first delete eventual X2-U TEIDs
560  m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
561 
562  m_drbMap.erase(it);
563  std::vector<uint8_t> ccToRelease =
564  m_rrc->m_ccmRrcSapProvider->ReleaseDataRadioBearer(m_rnti, lcid);
565  std::vector<uint8_t>::iterator itCcToRelease = ccToRelease.begin();
566  NS_ASSERT_MSG(itCcToRelease != ccToRelease.end(),
567  "request to remove radio bearer with unknown drbid (ComponentCarrierManager)");
568  for (itCcToRelease = ccToRelease.begin(); itCcToRelease != ccToRelease.end(); ++itCcToRelease)
569  {
570  m_rrc->m_cmacSapProvider.at(*itCcToRelease)->ReleaseLc(m_rnti, lcid);
571  }
573  rrcd.havePhysicalConfigDedicated = false;
574  rrcd.drbToReleaseList.push_back(drbid);
575  // populating RadioResourceConfigDedicated information element as per 3GPP TS 36.331
576  // version 9.2.0
577  rrcd.havePhysicalConfigDedicated = true;
579 
580  // populating RRCConnectionReconfiguration message as per 3GPP TS 36.331 version 9.2.0 Release 9
582  msg.haveMeasConfig = false;
583  msg.haveMobilityControlInfo = false;
584  msg.radioResourceConfigDedicated = rrcd;
586  // ToDo: Resend in any case this configuration
587  // needs to be initialized
588  msg.haveNonCriticalExtension = false;
589  // RRC Connection Reconfiguration towards UE
590  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
591 }
592 
593 void
594 LteEnbRrc::DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
595 {
596  NS_LOG_FUNCTION(this << imsi << rnti << (uint16_t)bearerId);
597 
598  // check if the RNTI to be removed is not stale
599  if (HasUeManager(rnti))
600  {
601  Ptr<UeManager> ueManager = GetUeManager(rnti);
602  // Bearer de-activation towards UE
603  ueManager->ReleaseDataRadioBearer(bearerId);
604  // Bearer de-activation indication towards epc-enb application
605  m_s1SapProvider->DoSendReleaseIndication(imsi, rnti, bearerId);
606  }
607 }
608 
609 void
611 {
612  NS_LOG_FUNCTION(this << m_rnti);
613 
614  // release the bearer info for the UE at SGW/PGW
615  if (m_rrc->m_s1SapProvider != nullptr) // if EPC is enabled
616  {
617  for (const auto& it : m_drbMap)
618  {
619  NS_LOG_DEBUG("Sending release of bearer id : "
620  << (uint16_t)(it.first)
621  << "LCID : " << (uint16_t)(it.second->m_logicalChannelIdentity));
622  // Bearer de-activation indication towards epc-enb application
623  m_rrc->m_s1SapProvider->DoSendReleaseIndication(GetImsi(), rnti, it.first);
624  }
625  }
626 }
627 
628 void
630 {
631  NS_LOG_FUNCTION(this);
632  switch (m_state)
633  {
635  case CONNECTION_SETUP:
636  case ATTACH_REQUEST:
640  case HANDOVER_JOINING:
641  case HANDOVER_LEAVING:
642  // a previous reconfiguration still ongoing, we need to wait for it to be finished
644  break;
645 
646  case CONNECTED_NORMALLY: {
649  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
652  }
653  break;
654 
655  default:
656  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
657  break;
658  }
659 }
660 
661 void
663 {
664  NS_LOG_FUNCTION(this << cellId);
665  switch (m_state)
666  {
667  case CONNECTED_NORMALLY: {
668  m_targetCellId = cellId;
669 
670  auto sourceComponentCarrier = DynamicCast<ComponentCarrierEnb>(
671  m_rrc->m_componentCarrierPhyConf.at(m_componentCarrierId));
672  NS_ASSERT(m_targetCellId != sourceComponentCarrier->GetCellId());
673 
674  if (m_rrc->HasCellId(cellId))
675  {
676  // Intra-eNB handover
677  NS_LOG_DEBUG("Intra-eNB handover for cellId " << cellId);
678  uint8_t componentCarrierId = m_rrc->CellToComponentCarrierId(cellId);
679  uint16_t rnti = m_rrc->AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
681  m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
682  if (anrcrv.valid == false)
683  {
684  NS_LOG_INFO(this << " failed to allocate a preamble for non-contention based RA => "
685  "cannot perform HO");
686  NS_FATAL_ERROR("should trigger HO Preparation Failure, but it is not implemented");
687  return;
688  }
689 
690  Ptr<UeManager> ueManager = m_rrc->GetUeManager(rnti);
691  ueManager->SetSource(sourceComponentCarrier->GetCellId(), m_rnti);
692  ueManager->SetImsi(m_imsi);
693 
694  // Setup data radio bearers
695  for (auto& it : m_drbMap)
696  {
697  ueManager->SetupDataRadioBearer(it.second->m_epsBearer,
698  it.second->m_epsBearerIdentity,
699  it.second->m_gtpTeid,
700  it.second->m_transportLayerAddress);
701  }
702 
704  GetRrcConnectionReconfigurationForHandover(componentCarrierId);
705 
706  handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
707  handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
709  anrcrv.raPreambleId;
711  anrcrv.raPrachMaskIndex;
712 
714  m_rrc->m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
716  .preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
718  .raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
720  .raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
721 
722  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
723 
724  // We skip handover preparation
726  m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
728  m_rrc,
729  m_rnti);
730  m_rrc->m_handoverStartTrace(m_imsi,
731  sourceComponentCarrier->GetCellId(),
732  m_rnti,
733  handoverCommand.mobilityControlInfo.targetPhysCellId);
734  }
735  else
736  {
737  // Inter-eNB aka X2 handover
738  NS_LOG_DEBUG("Inter-eNB handover (i.e., X2) for cellId " << cellId);
740  params.oldEnbUeX2apId = m_rnti;
742  params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
743  params.targetCellId = cellId;
744  params.mmeUeS1apId = m_imsi;
745  params.ueAggregateMaxBitRateDownlink = 200 * 1000;
746  params.ueAggregateMaxBitRateUplink = 100 * 1000;
747  params.bearers = GetErabList();
748 
751  hpi.asConfig.sourceDlCarrierFreq = sourceComponentCarrier->GetDlEarfcn();
752  hpi.asConfig.sourceMeasConfig = m_rrc->m_ueMeasConfig;
756  sourceComponentCarrier->GetDlBandwidth();
760  .cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
762  m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
764  m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
766  m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
768  m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->GetRachConfig();
770  .rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
776  .rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
778  sourceComponentCarrier->GetUlEarfcn();
780  sourceComponentCarrier->GetUlBandwidth();
781  params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation(hpi);
782 
783  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
784  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
785  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
786  NS_LOG_LOGIC("mmeUeS1apId = " << params.mmeUeS1apId);
787  NS_LOG_LOGIC("rrcContext = " << params.rrcContext);
788 
789  m_rrc->m_x2SapProvider->SendHandoverRequest(params);
791  }
792  }
793  break;
794 
795  default:
796  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
797  break;
798  }
799 }
800 
801 void
803 {
804  NS_LOG_FUNCTION(this);
805 
806  NS_ASSERT_MSG(params.notAdmittedBearers.empty(),
807  "not admission of some bearers upon handover is not supported");
808  NS_ASSERT_MSG(params.admittedBearers.size() == m_drbMap.size(),
809  "not enough bearers in admittedBearers");
810 
811  // note: the Handover command from the target eNB to the source eNB
812  // is expected to be sent transparently to the UE; however, here we
813  // decode the message and eventually re-encode it. This way we can
814  // support both a real RRC protocol implementation and an ideal one
815  // without actual RRC protocol encoding.
816 
817  Ptr<Packet> encodedHandoverCommand = params.rrcContext;
819  m_rrc->m_rrcSapUser->DecodeHandoverCommand(encodedHandoverCommand);
820  if (handoverCommand.haveNonCriticalExtension)
821  {
822  // Total number of component carriers =
823  // handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 (Primary carrier)
824  if (handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 !=
825  m_rrc->m_numberOfComponentCarriers)
826  {
827  // Currently handover is only possible if source and target eNBs have equal number of
828  // component carriers
829  NS_FATAL_ERROR("The source and target eNBs have unequal number of component carriers. "
830  "Target eNB CCs = "
831  << handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1
832  << " Source eNB CCs = " << m_rrc->m_numberOfComponentCarriers);
833  }
834  }
835  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
837  m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
839  m_rrc,
840  m_rnti);
841  NS_ASSERT(handoverCommand.haveMobilityControlInfo);
842  m_rrc->m_handoverStartTrace(m_imsi,
843  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
844  m_rnti,
845  handoverCommand.mobilityControlInfo.targetPhysCellId);
846 
847  // Set the target cell ID and the RNTI so that handover cancel message can be sent if required
848  m_targetX2apId = params.newEnbUeX2apId;
849  m_targetCellId = params.targetCellId;
850 
852  sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
853  sst.newEnbUeX2apId = params.newEnbUeX2apId;
854  sst.sourceCellId = params.sourceCellId;
855  sst.targetCellId = params.targetCellId;
856  for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator drbIt = m_drbMap.begin();
857  drbIt != m_drbMap.end();
858  ++drbIt)
859  {
860  // SN status transfer is only for AM RLC
861  if (drbIt->second->m_rlc->GetObject<LteRlcAm>())
862  {
863  LtePdcp::Status status = drbIt->second->m_pdcp->GetStatus();
865  i.dlPdcpSn = status.txSn;
866  i.ulPdcpSn = status.rxSn;
867  sst.erabsSubjectToStatusTransferList.push_back(i);
868  }
869  }
870  m_rrc->m_x2SapProvider->SendSnStatusTransfer(sst);
871 }
872 
875 {
876  NS_LOG_FUNCTION(this);
878 }
879 
882 {
883  NS_LOG_FUNCTION(this);
884 
886 
887  auto targetComponentCarrier =
888  DynamicCast<ComponentCarrierEnb>(m_rrc->m_componentCarrierPhyConf.at(componentCarrierId));
889  result.haveMobilityControlInfo = true;
890  result.mobilityControlInfo.targetPhysCellId = targetComponentCarrier->GetCellId();
891  result.mobilityControlInfo.haveCarrierFreq = true;
892  result.mobilityControlInfo.carrierFreq.dlCarrierFreq = targetComponentCarrier->GetDlEarfcn();
893  result.mobilityControlInfo.carrierFreq.ulCarrierFreq = targetComponentCarrier->GetUlEarfcn();
896  targetComponentCarrier->GetDlBandwidth();
898  targetComponentCarrier->GetUlBandwidth();
899 
900  if (m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
901  {
902  // Release sCells
903  result.haveNonCriticalExtension = true;
904 
905  for (auto& it : m_rrc->m_componentCarrierPhyConf)
906  {
907  uint8_t ccId = it.first;
908 
909  if (ccId == m_componentCarrierId)
910  {
911  // Skip primary CC.
912  continue;
913  }
914  else if (ccId < m_componentCarrierId)
915  {
916  // Shift all IDs below PCC forward so PCC can use CC ID 1.
917  result.nonCriticalExtension.sCellToReleaseList.push_back(ccId + 1);
918  }
919  }
920  }
921  else
922  {
923  result.haveNonCriticalExtension = false;
924  }
925 
926  return result;
927 }
928 
929 void
931 {
932  NS_LOG_FUNCTION(this << p << (uint16_t)bid);
934  params.pdcpSdu = p;
935  params.rnti = m_rnti;
936  params.lcid = Bid2Lcid(bid);
937  uint8_t drbid = Bid2Drbid(bid);
938  // Transmit PDCP sdu only if DRB ID found in drbMap
939  std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
940  if (it != m_drbMap.end())
941  {
943  if (bearerInfo)
944  {
945  LtePdcpSapProvider* pdcpSapProvider = bearerInfo->m_pdcp->GetLtePdcpSapProvider();
946  pdcpSapProvider->TransmitPdcpSdu(params);
947  }
948  }
949 }
950 
951 void
953 {
954  NS_LOG_FUNCTION(this << p << (uint16_t)bid);
955  switch (m_state)
956  {
958  case CONNECTION_SETUP:
959  NS_LOG_WARN("not connected, discarding packet");
960  return;
961  break;
962 
963  case CONNECTED_NORMALLY:
967  case HANDOVER_PATH_SWITCH: {
968  NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
969  SendPacket(bid, p);
970  }
971  break;
972 
973  case HANDOVER_JOINING: {
974  // Buffer data until RRC Connection Reconfiguration Complete message is received
975  NS_LOG_LOGIC("buffering data");
976  m_packetBuffer.emplace_back(bid, p);
977  }
978  break;
979 
980  case HANDOVER_LEAVING: {
981  NS_LOG_LOGIC("forwarding data to target eNB over X2-U");
982  uint8_t drbid = Bid2Drbid(bid);
984  params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
985  params.targetCellId = m_targetCellId;
986  params.gtpTeid = GetDataRadioBearerInfo(drbid)->m_gtpTeid;
987  params.ueData = p;
988  m_rrc->m_x2SapProvider->SendUeData(params);
989  }
990  break;
991 
992  default:
993  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
994  break;
995  }
996 }
997 
998 std::vector<EpcX2Sap::ErabToBeSetupItem>
1000 {
1001  NS_LOG_FUNCTION(this);
1002  std::vector<EpcX2Sap::ErabToBeSetupItem> ret;
1003  for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
1004  it != m_drbMap.end();
1005  ++it)
1006  {
1008  etbsi.erabId = it->second->m_epsBearerIdentity;
1009  etbsi.erabLevelQosParameters = it->second->m_epsBearer;
1010  etbsi.dlForwarding = false;
1011  etbsi.transportLayerAddress = it->second->m_transportLayerAddress;
1012  etbsi.gtpTeid = it->second->m_gtpTeid;
1013  ret.push_back(etbsi);
1014  }
1015  return ret;
1016 }
1017 
1018 void
1020 {
1021  NS_LOG_FUNCTION(this);
1022  switch (m_state)
1023  {
1024  case HANDOVER_PATH_SWITCH:
1025  NS_LOG_INFO("Send UE CONTEXT RELEASE from target eNB to source eNB");
1026  EpcX2SapProvider::UeContextReleaseParams ueCtxReleaseParams;
1027  ueCtxReleaseParams.oldEnbUeX2apId = m_sourceX2apId;
1028  ueCtxReleaseParams.newEnbUeX2apId = m_rnti;
1029  ueCtxReleaseParams.sourceCellId = m_sourceCellId;
1030  ueCtxReleaseParams.targetCellId = m_targetCellId;
1031  if (!m_rrc->HasCellId(m_sourceCellId))
1032  {
1033  m_rrc->m_x2SapProvider->SendUeContextRelease(ueCtxReleaseParams);
1034  }
1035  else
1036  {
1037  NS_LOG_INFO("Not sending UE CONTEXT RELEASE because handover is internal");
1038  m_rrc->DoRecvUeContextRelease(ueCtxReleaseParams);
1039  }
1041  m_rrc->m_handoverEndOkTrace(m_imsi,
1042  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1043  m_rnti);
1044  break;
1045 
1046  default:
1047  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1048  break;
1049  }
1050 }
1051 
1052 void
1054 {
1055  NS_LOG_FUNCTION(this << cellId);
1056  switch (m_state)
1057  {
1058  case HANDOVER_PREPARATION:
1059  NS_ASSERT(cellId == m_targetCellId);
1060  NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1062  break;
1063  case HANDOVER_LEAVING: // case added to tackle HO leaving timer expiration
1064  NS_ASSERT(cellId == m_targetCellId);
1065  NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1068  break;
1069 
1070  default:
1071  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1072  break;
1073  }
1074 }
1075 
1076 void
1078 {
1079  NS_LOG_FUNCTION(this);
1080  for (std::vector<EpcX2Sap::ErabsSubjectToStatusTransferItem>::iterator erabIt =
1081  params.erabsSubjectToStatusTransferList.begin();
1082  erabIt != params.erabsSubjectToStatusTransferList.end();
1083  ++erabIt)
1084  {
1085  // LtePdcp::Status status;
1086  // status.txSn = erabIt->dlPdcpSn;
1087  // status.rxSn = erabIt->ulPdcpSn;
1088  // uint8_t drbId = Bid2Drbid (erabIt->erabId);
1089  // std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator drbIt = m_drbMap.find (drbId);
1090  // NS_ASSERT_MSG (drbIt != m_drbMap.end (), "could not find DRBID " << (uint32_t) drbId);
1091  // drbIt->second->m_pdcp->SetStatus (status);
1092  }
1093 }
1094 
1095 void
1097 {
1098  NS_LOG_FUNCTION(this);
1099  NS_ASSERT_MSG(m_state == HANDOVER_LEAVING, "method unexpected in state " << ToString(m_state));
1101 }
1102 
1103 void
1105 {
1106  NS_LOG_FUNCTION(this);
1107  NS_ASSERT_MSG(m_state == HANDOVER_JOINING, "method unexpected in state " << ToString(m_state));
1109 }
1110 
1111 void
1113 {
1114  // TODO implement in the 3gpp way, see Section 5.3.8 of 3GPP TS 36.331.
1115  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
1116  // De-activation towards UE, it will deactivate all bearers
1119  m_rrc->m_rrcSapUser->SendRrcConnectionRelease(m_rnti, msg);
1120 
1126  m_rrc->DoRecvIdealUeContextRemoveRequest(m_rnti);
1127 }
1128 
1129 // methods forwarded from RRC SAP
1130 
1131 void
1133 {
1134  NS_LOG_FUNCTION(this);
1135  m_srb0->m_rlc->SetLteRlcSapUser(params.srb0SapUser);
1136  m_srb1->m_pdcp->SetLtePdcpSapUser(params.srb1SapUser);
1137 }
1138 
1139 void
1141 {
1142  NS_LOG_FUNCTION(this);
1143  switch (m_state)
1144  {
1145  case INITIAL_RANDOM_ACCESS: {
1147 
1148  if (m_rrc->m_admitRrcConnectionRequest == true)
1149  {
1150  m_imsi = msg.ueIdentity;
1151 
1152  // send RRC CONNECTION SETUP to UE
1156  m_rrc->m_rrcSapUser->SendRrcConnectionSetup(m_rnti, msg2);
1157 
1159  m_connectionSetupTimeout = Simulator::Schedule(m_rrc->m_connectionSetupTimeoutDuration,
1161  m_rrc,
1162  m_rnti);
1164  }
1165  else
1166  {
1167  NS_LOG_INFO("rejecting connection request for RNTI " << m_rnti);
1168 
1169  // send RRC CONNECTION REJECT to UE
1171  rejectMsg.waitTime = 3;
1172  m_rrc->m_rrcSapUser->SendRrcConnectionReject(m_rnti, rejectMsg);
1173 
1175  Simulator::Schedule(m_rrc->m_connectionRejectedTimeoutDuration,
1177  m_rrc,
1178  m_rnti);
1180  }
1181  }
1182  break;
1183 
1184  default:
1185  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1186  break;
1187  }
1188 }
1189 
1190 void
1192 {
1193  NS_LOG_FUNCTION(this);
1194  switch (m_state)
1195  {
1196  case CONNECTION_SETUP:
1198  if (m_caSupportConfigured == false && m_rrc->m_numberOfComponentCarriers > 1)
1199  {
1200  m_pendingRrcConnectionReconfiguration = true; // Force Reconfiguration
1202  }
1203 
1204  if (m_rrc->m_s1SapProvider != nullptr)
1205  {
1206  m_rrc->m_s1SapProvider->InitialUeMessage(m_imsi, m_rnti);
1208  }
1209  else
1210  {
1212  }
1213  m_rrc->m_connectionEstablishedTrace(m_imsi,
1214  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1215  m_rnti);
1216  break;
1217 
1218  default:
1219  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1220  break;
1221  }
1222 }
1223 
1224 void
1227 {
1228  NS_LOG_FUNCTION(this);
1229  switch (m_state)
1230  {
1234  {
1235  // configure MAC (and scheduler)
1237  req.m_rnti = m_rnti;
1239  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1240  {
1241  m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
1242 
1243  // configure PHY
1244  m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(req.m_rnti,
1245  req.m_transmissionMode);
1248  m_rrc->m_cphySapProvider.at(i)->SetPa(m_rnti, paDouble);
1249  }
1250 
1251  m_needPhyMacConfiguration = false;
1252  }
1254  m_rrc->m_connectionReconfigurationTrace(
1255  m_imsi,
1256  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1257  m_rnti);
1258  break;
1259 
1260  // This case is added to NS-3 in order to handle bearer de-activation scenario for CONNECTED
1261  // state UE
1262  case CONNECTED_NORMALLY:
1263  NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1264  << ToString(m_state));
1265  break;
1266 
1267  case HANDOVER_LEAVING:
1268  NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1269  << ToString(m_state));
1270  break;
1271 
1272  case HANDOVER_JOINING: {
1274 
1275  while (!m_packetBuffer.empty())
1276  {
1277  NS_LOG_LOGIC("dequeueing data from buffer");
1278  std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1279  uint8_t bid = bidPacket.first;
1280  Ptr<Packet> p = bidPacket.second;
1281 
1282  NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
1283  SendPacket(bid, p);
1284 
1285  m_packetBuffer.pop_front();
1286  }
1287 
1288  NS_LOG_INFO("Send PATH SWITCH REQUEST to the MME");
1290  params.rnti = m_rnti;
1291  params.cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1292  params.mmeUeS1Id = m_imsi;
1294  for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
1295  it != m_drbMap.end();
1296  ++it)
1297  {
1299  b.epsBearerId = it->second->m_epsBearerIdentity;
1300  b.teid = it->second->m_gtpTeid;
1301  params.bearersToBeSwitched.push_back(b);
1302  }
1303  m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1304  }
1305  break;
1306 
1307  default:
1308  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1309  break;
1310  }
1311 }
1312 
1313 void
1316 {
1317  NS_LOG_FUNCTION(this);
1318  switch (m_state)
1319  {
1320  case CONNECTED_NORMALLY:
1321  break;
1322 
1323  case HANDOVER_LEAVING:
1325  break;
1326 
1327  default:
1328  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1329  break;
1330  }
1331 
1335  m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1337 }
1338 
1339 void
1342 {
1343  NS_LOG_FUNCTION(this);
1345 }
1346 
1347 void
1349 {
1350  uint8_t measId = msg.measResults.measId;
1351  NS_LOG_FUNCTION(this << (uint16_t)measId);
1352  NS_LOG_LOGIC(
1353  "measId " << (uint16_t)measId << " haveMeasResultNeighCells "
1354  << msg.measResults.haveMeasResultNeighCells << " measResultListEutra "
1355  << msg.measResults.measResultListEutra.size() << " haveMeasResultServFreqList "
1356  << msg.measResults.haveMeasResultServFreqList << " measResultServFreqList "
1357  << msg.measResults.measResultServFreqList.size());
1358  NS_LOG_LOGIC("serving cellId "
1359  << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) << " RSRP "
1360  << (uint16_t)msg.measResults.measResultPCell.rsrpResult << " RSRQ "
1361  << (uint16_t)msg.measResults.measResultPCell.rsrqResult);
1362 
1363  for (std::list<LteRrcSap::MeasResultEutra>::iterator it =
1364  msg.measResults.measResultListEutra.begin();
1365  it != msg.measResults.measResultListEutra.end();
1366  ++it)
1367  {
1368  NS_LOG_LOGIC("neighbour cellId " << it->physCellId << " RSRP "
1369  << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1370  << " RSRQ "
1371  << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1372  }
1373 
1374  if ((m_rrc->m_handoverManagementSapProvider != nullptr) &&
1375  (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1376  {
1377  // this measurement was requested by the handover algorithm
1378  m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1379  }
1380 
1381  if ((m_rrc->m_ccmRrcSapProvider != nullptr) &&
1382  (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1383  {
1384  // this measurement was requested by the handover algorithm
1385  m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1386  }
1387 
1388  if ((m_rrc->m_anrSapProvider != nullptr) &&
1389  (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1390  {
1391  // this measurement was requested by the ANR function
1392  m_rrc->m_anrSapProvider->ReportUeMeas(msg.measResults);
1393  }
1394 
1395  if ((!m_rrc->m_ffrRrcSapProvider.empty()) &&
1396  (m_rrc->m_ffrMeasIds.find(measId) != m_rrc->m_ffrMeasIds.end()))
1397  {
1398  // this measurement was requested by the FFR function
1399  m_rrc->m_ffrRrcSapProvider.at(0)->ReportUeMeas(m_rnti, msg.measResults);
1400  }
1402  {
1403  for (const auto& it : msg.measResults.measResultServFreqList)
1404  {
1408  m_rrc->m_ffrRrcSapProvider.at(it.servFreqId)->ReportUeMeas(m_rnti, msg.measResults);
1409  }
1410  }
1411 
1414  m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1415  // fire a trace source
1416  m_rrc->m_recvMeasurementReportTrace(m_imsi,
1417  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1418  m_rnti,
1419  msg);
1420 
1421 } // end of UeManager::RecvMeasurementReport
1422 
1423 // methods forwarded from CMAC SAP
1424 
1425 void
1427 {
1428  NS_LOG_FUNCTION(this << m_rnti);
1429  // at this stage used only by the scheduler for updating txMode
1430 
1432 
1434 
1435  // reconfigure the UE RRC
1437 }
1438 
1439 // methods forwarded from PDCP SAP
1440 
1441 void
1443 {
1444  NS_LOG_FUNCTION(this);
1445  if (params.lcid > 2)
1446  {
1447  // data radio bearer
1448  EpsBearerTag tag;
1449  tag.SetRnti(params.rnti);
1450  tag.SetBid(Lcid2Bid(params.lcid));
1451  params.pdcpSdu->AddPacketTag(tag);
1452  m_rrc->m_forwardUpCallback(params.pdcpSdu);
1453  }
1454 }
1455 
1456 uint16_t
1458 {
1459  return m_rnti;
1460 }
1461 
1462 uint64_t
1464 {
1465  return m_imsi;
1466 }
1467 
1468 uint8_t
1470 {
1471  return m_componentCarrierId;
1472 }
1473 
1474 uint16_t
1476 {
1478 }
1479 
1480 void
1482 {
1483  NS_LOG_FUNCTION(this);
1485  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1486  {
1487  m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1488  }
1489  switch (m_state)
1490  {
1491  case INITIAL_RANDOM_ACCESS:
1492  // do nothing, srs conf index will be correctly enforced upon
1493  // RRC connection establishment
1494  break;
1495 
1496  default:
1498  break;
1499  }
1500 }
1501 
1504 {
1505  return m_state;
1506 }
1507 
1508 void
1510 {
1511  NS_LOG_FUNCTION(this);
1512  m_physicalConfigDedicated.pdschConfigDedicated = pdschConfigDedicated;
1513 
1515 
1516  // reconfigure the UE RRC
1518 }
1519 
1520 void
1522 {
1523  NS_LOG_FUNCTION(this);
1529 }
1530 
1533 {
1534  NS_LOG_FUNCTION(this);
1536  res.oldEnbUeX2apId = m_sourceX2apId;
1537  res.sourceCellId = m_sourceCellId;
1538  res.targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1539  res.cause = 0;
1540  res.criticalityDiagnostics = 0;
1541 
1542  return res;
1543 }
1544 
1547 {
1548  NS_LOG_FUNCTION(this);
1550  res.oldEnbUeX2apId = m_rnti; // source cell rnti
1551  res.newEnbUeX2apId = m_targetX2apId;
1552  res.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1553  res.targetCellId = m_targetCellId;
1554  res.cause = 0;
1555 
1556  return res;
1557 }
1558 
1559 uint8_t
1561 {
1562  NS_LOG_FUNCTION(this);
1563  const uint8_t MAX_DRB_ID = 32;
1564  for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1565  drbid = (drbid + 1) % MAX_DRB_ID)
1566  {
1567  if (drbid != 0) // 0 is not allowed
1568  {
1569  if (m_drbMap.find(drbid) == m_drbMap.end())
1570  {
1571  m_drbMap.insert(std::pair<uint8_t, Ptr<LteDataRadioBearerInfo>>(drbid, drbInfo));
1572  drbInfo->m_drbIdentity = drbid;
1573  m_lastAllocatedDrbid = drbid;
1574  return drbid;
1575  }
1576  }
1577  }
1578  NS_FATAL_ERROR("no more data radio bearer ids available");
1579  return 0;
1580 }
1581 
1584 {
1585  NS_LOG_FUNCTION(this << (uint32_t)drbid);
1586  NS_ASSERT(0 != drbid);
1587  std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
1588  NS_ABORT_IF(it == m_drbMap.end());
1589  return it->second;
1590 }
1591 
1592 void
1594 {
1595  NS_LOG_FUNCTION(this << (uint32_t)drbid);
1596  std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.find(drbid);
1597  NS_ASSERT_MSG(it != m_drbMap.end(),
1598  "request to remove radio bearer with unknown drbid " << drbid);
1599  m_drbMap.erase(it);
1600 }
1601 
1604 {
1605  NS_LOG_FUNCTION(this);
1610  msg.haveMobilityControlInfo = false;
1611  msg.haveMeasConfig = true;
1612  msg.measConfig = m_rrc->m_ueMeasConfig;
1613  if (m_caSupportConfigured == false && m_rrc->m_numberOfComponentCarriers > 1)
1614  {
1615  m_caSupportConfigured = true;
1616  NS_LOG_FUNCTION(this << "CA not configured. Configure now!");
1617  msg.haveNonCriticalExtension = true;
1619  NS_LOG_FUNCTION(this << " haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1620  }
1621  else
1622  {
1623  msg.haveNonCriticalExtension = false;
1624  }
1625 
1626  return msg;
1627 }
1628 
1631 {
1632  NS_LOG_FUNCTION(this);
1634 
1635  if (m_srb1)
1636  {
1638  stam.srbIdentity = m_srb1->m_srbIdentity;
1639  stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1640  rrcd.srbToAddModList.push_back(stam);
1641  }
1642 
1643  for (std::map<uint8_t, Ptr<LteDataRadioBearerInfo>>::iterator it = m_drbMap.begin();
1644  it != m_drbMap.end();
1645  ++it)
1646  {
1648  dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1649  dtam.drbIdentity = it->second->m_drbIdentity;
1650  dtam.rlcConfig = it->second->m_rlcConfig;
1651  dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1652  dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1653  rrcd.drbToAddModList.push_back(dtam);
1654  }
1655 
1656  rrcd.havePhysicalConfigDedicated = true;
1658  return rrcd;
1659 }
1660 
1661 uint8_t
1663 {
1664  NS_LOG_FUNCTION(this);
1668 }
1669 
1670 uint8_t
1672 {
1673  NS_ASSERT(lcid > 2);
1674  return lcid - 2;
1675 }
1676 
1677 uint8_t
1679 {
1680  return drbid + 2;
1681 }
1682 
1683 uint8_t
1684 UeManager::Lcid2Bid(uint8_t lcid)
1685 {
1686  NS_ASSERT(lcid > 2);
1687  return lcid - 2;
1688 }
1689 
1690 uint8_t
1692 {
1693  return bid + 2;
1694 }
1695 
1696 uint8_t
1697 UeManager::Drbid2Bid(uint8_t drbid)
1698 {
1699  return drbid;
1700 }
1701 
1702 uint8_t
1704 {
1705  return bid;
1706 }
1707 
1708 void
1710 {
1711  NS_LOG_FUNCTION(this << ToString(newState));
1712  State oldState = m_state;
1713  m_state = newState;
1714  NS_LOG_INFO(this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager "
1715  << ToString(oldState) << " --> " << ToString(newState));
1717  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1718  m_rnti,
1719  oldState,
1720  newState);
1721 
1722  switch (newState)
1723  {
1724  case INITIAL_RANDOM_ACCESS:
1725  case HANDOVER_JOINING:
1726  NS_FATAL_ERROR("cannot switch to an initial state");
1727  break;
1728 
1729  case CONNECTION_SETUP:
1730  break;
1731 
1732  case ATTACH_REQUEST:
1733  break;
1734 
1735  case CONNECTED_NORMALLY: {
1737  {
1739  }
1741  {
1743  }
1744  }
1745  break;
1746 
1748  break;
1749 
1751  break;
1752 
1753  case HANDOVER_LEAVING:
1754  break;
1755 
1756  default:
1757  break;
1758  }
1759 }
1760 
1763 {
1764  NS_LOG_FUNCTION(this);
1766 
1767  for (auto& it : m_rrc->m_componentCarrierPhyConf)
1768  {
1769  uint8_t ccId = it.first;
1770 
1771  if (ccId == m_componentCarrierId)
1772  {
1773  // Skip primary CC.
1774  continue;
1775  }
1776  else if (ccId < m_componentCarrierId)
1777  {
1778  // Shift all IDs below PCC forward so PCC can use CC ID 1.
1779  ccId++;
1780  }
1781 
1782  Ptr<ComponentCarrierBaseStation> eNbCcm = it.second;
1783  LteRrcSap::SCellToAddMod component;
1784  component.sCellIndex = ccId;
1785  component.cellIdentification.physCellId = eNbCcm->GetCellId();
1786  component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1789  eNbCcm->GetDlBandwidth();
1791  .antennaPortsCount = 0;
1793  .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1797  eNbCcm->GetUlEarfcn();
1799  eNbCcm->GetUlBandwidth();
1801  0;
1802  // component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type =
1803  // LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
1805  .srsBandwidthConfig = 0;
1807  .srsSubframeConfig = 0;
1809 
1810  component.haveRadioResourceConfigDedicatedSCell = true;
1812  .haveNonUlConfiguration = true;
1814  .haveAntennaInfoDedicated = true;
1816  .transmissionMode = m_rrc->m_defaultTransmissionMode;
1820  .havePdschConfigDedicated = true;
1824  .haveUlConfiguration = true;
1828  .transmissionMode = m_rrc->m_defaultTransmissionMode;
1841 
1842  ncec.sCellToAddModList.push_back(component);
1843  }
1844 
1845  return ncec;
1846 }
1847 
1849 // eNB RRC methods
1851 
1853 
1855  : m_x2SapProvider(nullptr),
1856  m_cmacSapProvider(0),
1857  m_handoverManagementSapProvider(nullptr),
1858  m_ccmRrcSapProvider(nullptr),
1859  m_anrSapProvider(nullptr),
1860  m_ffrRrcSapProvider(0),
1861  m_rrcSapUser(nullptr),
1862  m_macSapProvider(nullptr),
1863  m_s1SapProvider(nullptr),
1864  m_cphySapProvider(0),
1865  m_configured(false),
1866  m_lastAllocatedRnti(0),
1867  m_srsCurrentPeriodicityId(0),
1868  m_lastAllocatedConfigurationIndex(0),
1869  m_reconfigureUes(false),
1870  m_numberOfComponentCarriers(0),
1871  m_carriersConfigured(false)
1872 {
1873  NS_LOG_FUNCTION(this);
1874  m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, 0));
1883 }
1884 
1885 void
1887 {
1888  NS_ASSERT_MSG(!m_carriersConfigured, "Secondary carriers can be configured only once.");
1889  m_componentCarrierPhyConf = ccPhyConf;
1891  " Number of component carriers "
1892  "are not equal to the number of he component carrier configuration provided");
1893 
1894  for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1895  {
1897  m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, i));
1899  }
1900  m_carriersConfigured = true;
1902 }
1903 
1905 {
1906  NS_LOG_FUNCTION(this);
1907 }
1908 
1909 void
1911 {
1912  NS_LOG_FUNCTION(this);
1913  for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1914  {
1915  delete m_cphySapUser[i];
1916  delete m_cmacSapUser[i];
1917  delete m_ffrRrcSapUser[i];
1918  }
1919  // delete m_cphySapUser;
1920  m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1921  m_cphySapUser.clear();
1922  // delete m_cmacSapUser;
1923  m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1924  m_cmacSapUser.clear();
1925  // delete m_ffrRrcSapUser;
1926  m_ffrRrcSapUser.erase(m_ffrRrcSapUser.begin(), m_ffrRrcSapUser.end());
1927  m_ffrRrcSapUser.clear();
1928  m_ueMap.clear();
1930  delete m_ccmRrcSapUser;
1931  delete m_anrSapUser;
1932  delete m_rrcSapProvider;
1933  delete m_x2SapUser;
1934  delete m_s1SapUser;
1935 }
1936 
1937 TypeId
1939 {
1940  NS_LOG_FUNCTION("LteEnbRrc::GetTypeId");
1941  static TypeId tid =
1942  TypeId("ns3::LteEnbRrc")
1943  .SetParent<Object>()
1944  .SetGroupName("Lte")
1945  .AddConstructor<LteEnbRrc>()
1946  .AddAttribute("UeMap",
1947  "List of UeManager by C-RNTI.",
1948  ObjectMapValue(),
1950  MakeObjectMapChecker<UeManager>())
1951  .AddAttribute("DefaultTransmissionMode",
1952  "The default UEs' transmission mode (0: SISO)",
1953  UintegerValue(0), // default tx-mode
1955  MakeUintegerChecker<uint8_t>())
1956  .AddAttribute("EpsBearerToRlcMapping",
1957  "Specify which type of RLC will be used for each type of EPS bearer.",
1961  "RlcSmAlways",
1962  RLC_UM_ALWAYS,
1963  "RlcUmAlways",
1964  RLC_AM_ALWAYS,
1965  "RlcAmAlways",
1966  PER_BASED,
1967  "PacketErrorRateBased"))
1968  .AddAttribute("SystemInformationPeriodicity",
1969  "The interval for sending system information (Time value)",
1970  TimeValue(MilliSeconds(80)),
1972  MakeTimeChecker())
1973 
1974  // SRS related attributes
1975  .AddAttribute(
1976  "SrsPeriodicity",
1977  "The SRS periodicity in milliseconds",
1978  UintegerValue(40),
1980  MakeUintegerChecker<uint32_t>())
1981 
1982  // Timeout related attributes
1983  .AddAttribute("ConnectionRequestTimeoutDuration",
1984  "After a RA attempt, if no RRC CONNECTION REQUEST is "
1985  "received before this time, the UE context is destroyed. "
1986  "Must account for reception of RAR and transmission of "
1987  "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1988  "timer should not be greater than T300 timer at UE RRC",
1989  TimeValue(MilliSeconds(15)),
1992  .AddAttribute("ConnectionSetupTimeoutDuration",
1993  "After accepting connection request, if no RRC CONNECTION "
1994  "SETUP COMPLETE is received before this time, the UE "
1995  "context is destroyed. Must account for the UE's reception "
1996  "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1997  "SETUP COMPLETE.",
1998  TimeValue(MilliSeconds(150)),
2000  MakeTimeChecker())
2001  .AddAttribute("ConnectionRejectedTimeoutDuration",
2002  "Time to wait between sending a RRC CONNECTION REJECT and "
2003  "destroying the UE context",
2004  TimeValue(MilliSeconds(30)),
2006  MakeTimeChecker())
2007  .AddAttribute("HandoverJoiningTimeoutDuration",
2008  "After accepting a handover request, if no RRC CONNECTION "
2009  "RECONFIGURATION COMPLETE is received before this time, the "
2010  "UE context is destroyed. Must account for reception of "
2011  "X2 HO REQ ACK by source eNB, transmission of the Handover "
2012  "Command, non-contention-based random access and reception "
2013  "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
2014  TimeValue(MilliSeconds(200)),
2016  MakeTimeChecker())
2017  .AddAttribute("HandoverLeavingTimeoutDuration",
2018  "After issuing a Handover Command, if neither RRC "
2019  "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
2020  "been previously received, the UE context is destroyed.",
2021  TimeValue(MilliSeconds(500)),
2023  MakeTimeChecker())
2024 
2025  // Cell selection related attribute
2026  .AddAttribute("QRxLevMin",
2027  "One of information transmitted within the SIB1 message, "
2028  "indicating the required minimum RSRP level that any UE must "
2029  "receive from this cell before it is allowed to camp to this "
2030  "cell. The default value -70 corresponds to -140 dBm and is "
2031  "the lowest possible value as defined by Section 6.3.4 of "
2032  "3GPP TS 36.133. This restriction, however, only applies to "
2033  "initial cell selection and EPC-enabled simulation.",
2035  IntegerValue(-70),
2037  MakeIntegerChecker<int8_t>(-70, -22))
2038  .AddAttribute("NumberOfComponentCarriers",
2039  "Number of Component Carriers",
2040  UintegerValue(1),
2042  MakeIntegerChecker<int16_t>(MIN_NO_CC, MAX_NO_CC))
2043 
2044  // Handover related attributes
2045  .AddAttribute("AdmitHandoverRequest",
2046  "Whether to admit an X2 handover request from another eNB",
2047  BooleanValue(true),
2050  .AddAttribute("AdmitRrcConnectionRequest",
2051  "Whether to admit a connection request from a UE",
2052  BooleanValue(true),
2055 
2056  // UE measurements related attributes
2057  .AddAttribute("RsrpFilterCoefficient",
2058  "Determines the strength of smoothing effect induced by "
2059  "layer 3 filtering of RSRP in all attached UE; "
2060  "if set to 0, no layer 3 filtering is applicable",
2061  // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2062  UintegerValue(4),
2064  MakeUintegerChecker<uint8_t>(0))
2065  .AddAttribute("RsrqFilterCoefficient",
2066  "Determines the strength of smoothing effect induced by "
2067  "layer 3 filtering of RSRQ in all attached UE; "
2068  "if set to 0, no layer 3 filtering is applicable",
2069  // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2070  UintegerValue(4),
2072  MakeUintegerChecker<uint8_t>(0))
2073 
2074  // Trace sources
2075  .AddTraceSource("NewUeContext",
2076  "Fired upon creation of a new UE context.",
2078  "ns3::LteEnbRrc::NewUeContextTracedCallback")
2079  .AddTraceSource("ConnectionEstablished",
2080  "Fired upon successful RRC connection establishment.",
2082  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2083  .AddTraceSource("ConnectionReconfiguration",
2084  "trace fired upon RRC connection reconfiguration",
2086  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2087  .AddTraceSource("HandoverStart",
2088  "trace fired upon start of a handover procedure",
2090  "ns3::LteEnbRrc::HandoverStartTracedCallback")
2091  .AddTraceSource("HandoverEndOk",
2092  "trace fired upon successful termination of a handover procedure",
2094  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2095  .AddTraceSource("RecvMeasurementReport",
2096  "trace fired when measurement report is received",
2098  "ns3::LteEnbRrc::ReceiveReportTracedCallback")
2099  .AddTraceSource("NotifyConnectionRelease",
2100  "trace fired when an UE is released",
2102  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2103  .AddTraceSource("RrcTimeout",
2104  "trace fired when a timer expires",
2106  "ns3::LteEnbRrc::TimerExpiryTracedCallback")
2107  .AddTraceSource(
2108  "HandoverFailureNoPreamble",
2109  "trace fired upon handover failure due to non-allocation of non-contention based "
2110  "preamble at eNB for UE to handover due to max count reached",
2112  "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2113  .AddTraceSource(
2114  "HandoverFailureMaxRach",
2115  "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2117  "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2118  .AddTraceSource(
2119  "HandoverFailureLeaving",
2120  "trace fired upon handover failure due to handover leaving timeout at source eNB",
2122  "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2123  .AddTraceSource(
2124  "HandoverFailureJoining",
2125  "trace fired upon handover failure due to handover joining timeout at target eNB",
2127  "ns3::LteEnbRrc::HandoverFailureTracedCallback");
2128  return tid;
2129 }
2130 
2131 void
2133 {
2134  NS_LOG_FUNCTION(this << s);
2135  m_x2SapProvider = s;
2136 }
2137 
2138 EpcX2SapUser*
2140 {
2141  NS_LOG_FUNCTION(this);
2142  return m_x2SapUser;
2143 }
2144 
2145 void
2147 {
2148  NS_LOG_FUNCTION(this << s);
2149  m_cmacSapProvider.at(0) = s;
2150 }
2151 
2152 void
2154 {
2155  NS_LOG_FUNCTION(this << s);
2156  if (m_cmacSapProvider.size() > pos)
2157  {
2158  m_cmacSapProvider.at(pos) = s;
2159  }
2160  else
2161  {
2162  m_cmacSapProvider.push_back(s);
2163  NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2164  }
2165 }
2166 
2169 {
2170  NS_LOG_FUNCTION(this);
2171  return m_cmacSapUser.at(0);
2172 }
2173 
2176 {
2177  NS_LOG_FUNCTION(this);
2178  return m_cmacSapUser.at(pos);
2179 }
2180 
2181 void
2183 {
2184  NS_LOG_FUNCTION(this << s);
2186 }
2187 
2190 {
2191  NS_LOG_FUNCTION(this);
2193 }
2194 
2195 void
2197 {
2198  NS_LOG_FUNCTION(this << s);
2199  m_ccmRrcSapProvider = s;
2200 }
2201 
2204 {
2205  NS_LOG_FUNCTION(this);
2206  return m_ccmRrcSapUser;
2207 }
2208 
2209 void
2211 {
2212  NS_LOG_FUNCTION(this << s);
2213  m_anrSapProvider = s;
2214 }
2215 
2218 {
2219  NS_LOG_FUNCTION(this);
2220  return m_anrSapUser;
2221 }
2222 
2223 void
2225 {
2226  NS_LOG_FUNCTION(this << s);
2227  if (!m_ffrRrcSapProvider.empty())
2228  {
2229  m_ffrRrcSapProvider.at(0) = s;
2230  }
2231  else
2232  {
2233  m_ffrRrcSapProvider.push_back(s);
2234  }
2235 }
2236 
2237 void
2239 {
2240  NS_LOG_FUNCTION(this << s);
2241  if (m_ffrRrcSapProvider.size() > index)
2242  {
2243  m_ffrRrcSapProvider.at(index) = s;
2244  }
2245  else
2246  {
2247  m_ffrRrcSapProvider.push_back(s);
2248  NS_ABORT_MSG_IF(m_ffrRrcSapProvider.size() - 1 != index,
2249  "You meant to store the pointer at position "
2250  << static_cast<uint32_t>(index) << " but it went to "
2251  << m_ffrRrcSapProvider.size() - 1);
2252  }
2253 }
2254 
2257 {
2258  NS_LOG_FUNCTION(this);
2259  return m_ffrRrcSapUser.at(0);
2260 }
2261 
2264 {
2265  NS_LOG_FUNCTION(this);
2267  "Invalid component carrier index:"
2268  << index << " provided in order to obtain FfrRrcSapUser.");
2269  return m_ffrRrcSapUser.at(index);
2270 }
2271 
2272 void
2274 {
2275  NS_LOG_FUNCTION(this << s);
2276  m_rrcSapUser = s;
2277 }
2278 
2281 {
2282  NS_LOG_FUNCTION(this);
2283  return m_rrcSapProvider;
2284 }
2285 
2286 void
2288 {
2289  NS_LOG_FUNCTION(this);
2290  m_macSapProvider = s;
2291 }
2292 
2293 void
2295 {
2296  m_s1SapProvider = s;
2297 }
2298 
2301 {
2302  return m_s1SapUser;
2303 }
2304 
2305 void
2307 {
2308  NS_LOG_FUNCTION(this << s);
2309  if (!m_cphySapProvider.empty())
2310  {
2311  m_cphySapProvider.at(0) = s;
2312  }
2313  else
2314  {
2315  m_cphySapProvider.push_back(s);
2316  }
2317 }
2318 
2321 {
2322  NS_LOG_FUNCTION(this);
2323  return m_cphySapUser.at(0);
2324 }
2325 
2326 void
2328 {
2329  NS_LOG_FUNCTION(this << s);
2330  if (m_cphySapProvider.size() > pos)
2331  {
2332  m_cphySapProvider.at(pos) = s;
2333  }
2334  else
2335  {
2336  m_cphySapProvider.push_back(s);
2337  NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2338  }
2339 }
2340 
2343 {
2344  NS_LOG_FUNCTION(this);
2345  return m_cphySapUser.at(pos);
2346 }
2347 
2348 bool
2349 LteEnbRrc::HasUeManager(uint16_t rnti) const
2350 {
2351  NS_LOG_FUNCTION(this << (uint32_t)rnti);
2352  std::map<uint16_t, Ptr<UeManager>>::const_iterator it = m_ueMap.find(rnti);
2353  return (it != m_ueMap.end());
2354 }
2355 
2358 {
2359  NS_LOG_FUNCTION(this << (uint32_t)rnti);
2360  NS_ASSERT(0 != rnti);
2361  std::map<uint16_t, Ptr<UeManager>>::iterator it = m_ueMap.find(rnti);
2362  NS_ASSERT_MSG(it != m_ueMap.end(), "UE manager for RNTI " << rnti << " not found");
2363  return it->second;
2364 }
2365 
2366 std::vector<uint8_t>
2368 {
2369  NS_LOG_FUNCTION(this);
2370 
2371  // SANITY CHECK
2372 
2373  NS_ASSERT_MSG(
2376  "Measurement identities and reporting configuration should not have different quantity");
2377 
2378  if (Simulator::Now() != Seconds(0))
2379  {
2380  NS_FATAL_ERROR("AddUeMeasReportConfig may not be called after the simulation has run");
2381  }
2382 
2383  // INPUT VALIDATION
2384 
2385  switch (config.triggerQuantity)
2386  {
2390  {
2392  "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2393  }
2394 
2400  {
2402  "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2403  }
2404  break;
2405 
2409  {
2411  "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2412  }
2413 
2419  {
2421  "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2422  }
2423  break;
2424 
2425  default:
2426  NS_FATAL_ERROR("unsupported triggerQuantity");
2427  break;
2428  }
2429 
2431  {
2432  NS_FATAL_ERROR("Only REPORT_STRONGEST_CELLS purpose is supported");
2433  }
2434 
2436  {
2437  NS_LOG_WARN("reportQuantity = BOTH will be used instead of the given reportQuantity");
2438  }
2439 
2440  uint8_t nextId = m_ueMeasConfig.reportConfigToAddModList.size() + 1;
2441 
2442  // create the reporting configuration
2443  LteRrcSap::ReportConfigToAddMod reportConfig;
2444  reportConfig.reportConfigId = nextId;
2445  reportConfig.reportConfigEutra = config;
2446 
2447  // add reporting configuration to UE measurement configuration
2448  m_ueMeasConfig.reportConfigToAddModList.push_back(reportConfig);
2449 
2450  std::vector<uint8_t> measIds;
2451 
2452  // create measurement identities, linking reporting configuration to all objects
2453  for (uint16_t componentCarrier = 0; componentCarrier < m_numberOfComponentCarriers;
2454  componentCarrier++)
2455  {
2456  LteRrcSap::MeasIdToAddMod measIdToAddMod;
2457 
2458  uint8_t measId = m_ueMeasConfig.measIdToAddModList.size() + 1;
2459 
2460  measIdToAddMod.measId = measId;
2461  measIdToAddMod.measObjectId = componentCarrier + 1;
2462  measIdToAddMod.reportConfigId = nextId;
2463 
2464  m_ueMeasConfig.measIdToAddModList.push_back(measIdToAddMod);
2465  measIds.push_back(measId);
2466  }
2467 
2468  return measIds;
2469 }
2470 
2471 void
2473 {
2474  auto it = ccPhyConf.begin();
2475  NS_ASSERT(it != ccPhyConf.end());
2476  uint16_t ulBandwidth = it->second->GetUlBandwidth();
2477  uint16_t dlBandwidth = it->second->GetDlBandwidth();
2478  uint32_t ulEarfcn = it->second->GetUlEarfcn();
2479  uint32_t dlEarfcn = it->second->GetDlEarfcn();
2480  NS_LOG_FUNCTION(this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2482 
2483  for (const auto& it : ccPhyConf)
2484  {
2485  m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2486  it.second->GetDlBandwidth());
2487  m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2488  it.second->GetDlEarfcn());
2489  m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2490  m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2491  it.second->GetDlBandwidth());
2492  if (m_ffrRrcSapProvider.size() > it.first)
2493  {
2494  m_ffrRrcSapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2495  m_ffrRrcSapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2496  it.second->GetDlBandwidth());
2497  }
2498  }
2499 
2500  m_dlEarfcn = dlEarfcn;
2501  m_ulEarfcn = ulEarfcn;
2502  m_dlBandwidth = dlBandwidth;
2503  m_ulBandwidth = ulBandwidth;
2504 
2505  /*
2506  * Initializing the list of measurement objects.
2507  * Only intra-frequency measurements are supported,
2508  * so one measurement object is created for each carrier frequency.
2509  */
2510  for (const auto& it : ccPhyConf)
2511  {
2512  LteRrcSap::MeasObjectToAddMod measObject;
2513  measObject.measObjectId = it.first + 1;
2514  measObject.measObjectEutra.carrierFreq = it.second->GetDlEarfcn();
2515  measObject.measObjectEutra.allowedMeasBandwidth = it.second->GetDlBandwidth();
2516  measObject.measObjectEutra.presenceAntennaPort1 = false;
2517  measObject.measObjectEutra.neighCellConfig = 0;
2518  measObject.measObjectEutra.offsetFreq = 0;
2519  measObject.measObjectEutra.haveCellForWhichToReportCGI = false;
2520 
2521  m_ueMeasConfig.measObjectToAddModList.push_back(measObject);
2522  }
2523 
2528  m_ueMeasConfig.haveSmeasure = false;
2530 
2531  m_sib1.clear();
2532  m_sib1.reserve(ccPhyConf.size());
2533  for (const auto& it : ccPhyConf)
2534  {
2535  // Enabling MIB transmission
2537  mib.dlBandwidth = it.second->GetDlBandwidth();
2538  mib.systemFrameNumber = 0;
2539  m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2540 
2541  // Enabling SIB1 transmission with default values
2543  sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId();
2544  sib1.cellAccessRelatedInfo.csgIndication = false;
2547  sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
2548  sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
2549  m_sib1.push_back(sib1);
2550  m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2551  }
2552  /*
2553  * Enabling transmission of other SIB. The first time System Information is
2554  * transmitted is arbitrarily assumed to be at +0.016s, and then it will be
2555  * regularly transmitted every 80 ms by default (set the
2556  * SystemInformationPeriodicity attribute to configure this).
2557  */
2559 
2560  m_configured = true;
2561 }
2562 
2563 void
2564 LteEnbRrc::SetCellId(uint16_t cellId)
2565 {
2566  // update SIB1
2567  m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2568  m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2569 }
2570 
2571 void
2572 LteEnbRrc::SetCellId(uint16_t cellId, uint8_t ccIndex)
2573 {
2574  // update SIB1
2575  m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2576  m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2577 }
2578 
2579 uint8_t
2581 {
2582  NS_LOG_FUNCTION(this << cellId);
2583  for (auto& it : m_componentCarrierPhyConf)
2584  {
2585  if (it.second->GetCellId() == cellId)
2586  {
2587  return it.first;
2588  }
2589  }
2590  NS_FATAL_ERROR("Cell " << cellId << " not found in CC map");
2591 }
2592 
2593 uint16_t
2594 LteEnbRrc::ComponentCarrierToCellId(uint8_t componentCarrierId)
2595 {
2596  NS_LOG_FUNCTION(this << +componentCarrierId);
2597  return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2598 }
2599 
2600 bool
2601 LteEnbRrc::HasCellId(uint16_t cellId) const
2602 {
2603  for (auto& it : m_componentCarrierPhyConf)
2604  {
2605  if (it.second->GetCellId() == cellId)
2606  {
2607  return true;
2608  }
2609  }
2610  return false;
2611 }
2612 
2613 bool
2615 {
2616  NS_LOG_FUNCTION(this << packet);
2617 
2618  EpsBearerTag tag;
2619  bool found = packet->RemovePacketTag(tag);
2620  NS_ASSERT_MSG(found, "no EpsBearerTag found in packet to be sent");
2621  Ptr<UeManager> ueManager = GetUeManager(tag.GetRnti());
2622  ueManager->SendData(tag.GetBid(), packet);
2623 
2624  return true;
2625 }
2626 
2627 void
2629 {
2630  m_forwardUpCallback = cb;
2631 }
2632 
2633 void
2635 {
2636  NS_LOG_FUNCTION(this << rnti);
2638  "ConnectionRequestTimeout in unexpected state "
2639  << ToString(GetUeManager(rnti)->GetState()));
2640  m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2641  rnti,
2642  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2643  "ConnectionRequestTimeout");
2644  RemoveUe(rnti);
2645 }
2646 
2647 void
2649 {
2650  NS_LOG_FUNCTION(this << rnti);
2652  "ConnectionSetupTimeout in unexpected state "
2653  << ToString(GetUeManager(rnti)->GetState()));
2654  m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2655  rnti,
2656  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2657  "ConnectionSetupTimeout");
2658  RemoveUe(rnti);
2659 }
2660 
2661 void
2663 {
2664  NS_LOG_FUNCTION(this << rnti);
2666  "ConnectionRejectedTimeout in unexpected state "
2667  << ToString(GetUeManager(rnti)->GetState()));
2668  m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2669  rnti,
2670  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2671  "ConnectionRejectedTimeout");
2672  RemoveUe(rnti);
2673 }
2674 
2675 void
2677 {
2678  NS_LOG_FUNCTION(this << rnti);
2680  "HandoverJoiningTimeout in unexpected state "
2681  << ToString(GetUeManager(rnti)->GetState()));
2683  GetUeManager(rnti)->GetImsi(),
2684  rnti,
2685  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2686  // check if the RNTI to be removed is not stale
2687  if (HasUeManager(rnti))
2688  {
2696  Ptr<UeManager> ueManager = GetUeManager(rnti);
2697  EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2699  RemoveUe(rnti);
2700  }
2701 }
2702 
2703 void
2705 {
2706  NS_LOG_FUNCTION(this << rnti);
2708  "HandoverLeavingTimeout in unexpected state "
2709  << ToString(GetUeManager(rnti)->GetState()));
2711  GetUeManager(rnti)->GetImsi(),
2712  rnti,
2713  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2714  // check if the RNTI to be removed is not stale
2715  if (HasUeManager(rnti))
2716  {
2722  Ptr<UeManager> ueManager = GetUeManager(rnti);
2723  EpcX2Sap::HandoverCancelParams msg = ueManager->BuildHoCancelMsg();
2725  ueManager->SendRrcConnectionRelease();
2726  }
2727 }
2728 
2729 void
2730 LteEnbRrc::SendHandoverRequest(uint16_t rnti, uint16_t cellId)
2731 {
2732  NS_LOG_FUNCTION(this << rnti << cellId);
2733  NS_LOG_LOGIC("Request to send HANDOVER REQUEST");
2735 
2736  Ptr<UeManager> ueManager = GetUeManager(rnti);
2737  ueManager->PrepareHandover(cellId);
2738 }
2739 
2740 void
2742 {
2743  NS_LOG_FUNCTION(this << rnti);
2744  GetUeManager(rnti)->CompleteSetupUe(params);
2745 }
2746 
2747 void
2749 {
2750  NS_LOG_FUNCTION(this << rnti);
2751  GetUeManager(rnti)->RecvRrcConnectionRequest(msg);
2752 }
2753 
2754 void
2757 {
2758  NS_LOG_FUNCTION(this << rnti);
2759  GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2760 }
2761 
2762 void
2764  uint16_t rnti,
2766 {
2767  NS_LOG_FUNCTION(this << rnti);
2768  GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2769 }
2770 
2771 void
2773  uint16_t rnti,
2775 {
2776  NS_LOG_FUNCTION(this << rnti);
2777  GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2778 }
2779 
2780 void
2782  uint16_t rnti,
2784 {
2785  NS_LOG_FUNCTION(this << rnti);
2786  GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2787 }
2788 
2789 void
2791 {
2792  NS_LOG_FUNCTION(this << rnti);
2793  GetUeManager(rnti)->RecvMeasurementReport(msg);
2794 }
2795 
2796 void
2798 {
2799  NS_LOG_FUNCTION(this);
2800  Ptr<UeManager> ueManager = GetUeManager(msg.rnti);
2801  ueManager->InitialContextSetupRequest();
2802 }
2803 
2804 void
2806 {
2807  NS_LOG_FUNCTION(this << rnti);
2808 
2809  // check if the RNTI to be removed is not stale
2810  if (HasUeManager(rnti))
2811  {
2812  Ptr<UeManager> ueManager = GetUeManager(rnti);
2813 
2814  if (ueManager->GetState() == UeManager::HANDOVER_JOINING)
2815  {
2817  GetUeManager(rnti)->GetImsi(),
2818  rnti,
2819  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2826  EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2828  }
2829 
2830  GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2831  // delete the UE context at the eNB
2832  RemoveUe(rnti);
2833  }
2834 }
2835 
2836 void
2839 {
2840  NS_LOG_FUNCTION(this);
2841  Ptr<UeManager> ueManager = GetUeManager(request.rnti);
2842  ueManager->SetupDataRadioBearer(request.bearer,
2843  request.bearerId,
2844  request.gtpTeid,
2845  request.transportLayerAddress);
2846 }
2847 
2848 void
2851 {
2852  NS_LOG_FUNCTION(this);
2853  Ptr<UeManager> ueManager = GetUeManager(params.rnti);
2854  ueManager->SendUeContextRelease();
2855 }
2856 
2857 void
2859 {
2860  NS_LOG_FUNCTION(this);
2861 
2862  NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST");
2863 
2864  NS_LOG_LOGIC("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
2865  NS_LOG_LOGIC("sourceCellId = " << req.sourceCellId);
2866  NS_LOG_LOGIC("targetCellId = " << req.targetCellId);
2867  NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId);
2868 
2869  // if no SRS index is available, then do not accept the handover
2870  if (m_admitHandoverRequest == false || IsMaxSrsReached())
2871  {
2872  NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId);
2874  res.oldEnbUeX2apId = req.oldEnbUeX2apId;
2875  res.sourceCellId = req.sourceCellId;
2876  res.targetCellId = req.targetCellId;
2877  res.cause = 0;
2878  res.criticalityDiagnostics = 0;
2880  return;
2881  }
2882 
2883  uint8_t componentCarrierId = CellToComponentCarrierId(req.targetCellId);
2884  uint16_t rnti = AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
2885  Ptr<UeManager> ueManager = GetUeManager(rnti);
2886  ueManager->SetSource(req.sourceCellId, req.oldEnbUeX2apId);
2887  ueManager->SetImsi(req.mmeUeS1apId);
2889  m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2890  if (anrcrv.valid == false)
2891  {
2892  NS_LOG_INFO(
2893  this
2894  << " failed to allocate a preamble for non-contention based RA => cannot accept HO");
2896  GetUeManager(rnti)->GetImsi(),
2897  rnti,
2898  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2904  Ptr<UeManager> ueManager = GetUeManager(rnti);
2905  EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2907  RemoveUe(rnti); // remove the UE from the target eNB
2908  return;
2909  }
2910 
2912  ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
2913  ackParams.newEnbUeX2apId = rnti;
2914  ackParams.sourceCellId = req.sourceCellId;
2915  ackParams.targetCellId = req.targetCellId;
2916 
2917  for (std::vector<EpcX2Sap::ErabToBeSetupItem>::iterator it = req.bearers.begin();
2918  it != req.bearers.end();
2919  ++it)
2920  {
2921  ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2922  it->erabId,
2923  it->gtpTeid,
2924  it->transportLayerAddress);
2926  i.erabId = it->erabId;
2927  ackParams.admittedBearers.push_back(i);
2928  }
2929 
2930  LteRrcSap::RrcConnectionReconfiguration handoverCommand =
2931  ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2932 
2933  handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2934  handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
2937  anrcrv.raPrachMaskIndex;
2938 
2940  m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2942  .numberOfRaPreambles = rc.numberOfRaPreambles;
2944  .preambleTransMax = rc.preambleTransMax;
2946  .raResponseWindowSize = rc.raResponseWindowSize;
2948  .connEstFailCount = rc.connEstFailCount;
2949 
2950  Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand(handoverCommand);
2951 
2952  ackParams.rrcContext = encodedHandoverCommand;
2953 
2954  NS_LOG_LOGIC("Send X2 message: HANDOVER REQUEST ACK");
2955 
2956  NS_LOG_LOGIC("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
2957  NS_LOG_LOGIC("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
2958  NS_LOG_LOGIC("sourceCellId = " << ackParams.sourceCellId);
2959  NS_LOG_LOGIC("targetCellId = " << ackParams.targetCellId);
2960 
2962 }
2963 
2964 void
2966 {
2967  NS_LOG_FUNCTION(this);
2968 
2969  NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST ACK");
2970 
2971  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2972  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2973  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2974  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2975 
2976  uint16_t rnti = params.oldEnbUeX2apId;
2977  Ptr<UeManager> ueManager = GetUeManager(rnti);
2978  ueManager->RecvHandoverRequestAck(params);
2979 }
2980 
2981 void
2983 {
2984  NS_LOG_FUNCTION(this);
2985 
2986  NS_LOG_LOGIC("Recv X2 message: HANDOVER PREPARATION FAILURE");
2987 
2988  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2989  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2990  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2991  NS_LOG_LOGIC("cause = " << params.cause);
2992  NS_LOG_LOGIC("criticalityDiagnostics = " << params.criticalityDiagnostics);
2993 
2994  uint16_t rnti = params.oldEnbUeX2apId;
2995 
2996  // check if the RNTI is not stale
2997  if (HasUeManager(rnti))
2998  {
2999  Ptr<UeManager> ueManager = GetUeManager(rnti);
3000  ueManager->RecvHandoverPreparationFailure(params.targetCellId);
3001  }
3002 }
3003 
3004 void
3006 {
3007  NS_LOG_FUNCTION(this);
3008 
3009  NS_LOG_LOGIC("Recv X2 message: SN STATUS TRANSFER");
3010 
3011  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3012  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3013  NS_LOG_LOGIC("erabsSubjectToStatusTransferList size = "
3014  << params.erabsSubjectToStatusTransferList.size());
3015 
3016  uint16_t rnti = params.newEnbUeX2apId;
3017 
3018  // check if the RNTI to receive SN transfer for is not stale
3019  if (HasUeManager(rnti))
3020  {
3021  Ptr<UeManager> ueManager = GetUeManager(rnti);
3022  ueManager->RecvSnStatusTransfer(params);
3023  }
3024 }
3025 
3026 void
3028 {
3029  NS_LOG_FUNCTION(this);
3030 
3031  NS_LOG_LOGIC("Recv X2 message: UE CONTEXT RELEASE");
3032 
3033  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3034  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3035 
3036  uint16_t rnti = params.oldEnbUeX2apId;
3037 
3038  // check if the RNTI to be removed is not stale
3039  if (HasUeManager(rnti))
3040  {
3041  GetUeManager(rnti)->RecvUeContextRelease(params);
3042  RemoveUe(rnti);
3043  }
3044 }
3045 
3046 void
3048 {
3049  NS_LOG_FUNCTION(this);
3050 
3051  NS_LOG_LOGIC("Recv X2 message: LOAD INFORMATION");
3052 
3053  NS_LOG_LOGIC("Number of cellInformationItems = " << params.cellInformationList.size());
3054 
3056  m_ffrRrcSapProvider.at(0)->RecvLoadInformation(params);
3057 }
3058 
3059 void
3061 {
3062  NS_LOG_FUNCTION(this);
3063 
3064  NS_LOG_LOGIC("Recv X2 message: RESOURCE STATUS UPDATE");
3065 
3066  NS_LOG_LOGIC(
3067  "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
3068 
3069  NS_ASSERT("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
3070 }
3071 
3072 void
3074 {
3075  NS_LOG_FUNCTION(this);
3076 
3077  NS_LOG_LOGIC("Recv UE DATA FORWARDING through X2 interface");
3078  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3079  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3080  NS_LOG_LOGIC("gtpTeid = " << params.gtpTeid);
3081  NS_LOG_LOGIC("ueData = " << params.ueData);
3082  NS_LOG_LOGIC("ueData size = " << params.ueData->GetSize());
3083 
3084  std::map<uint32_t, X2uTeidInfo>::iterator teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
3085  if (teidInfoIt != m_x2uTeidInfoMap.end())
3086  {
3087  GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
3088  }
3089  else
3090  {
3091  NS_FATAL_ERROR("X2-U data received but no X2uTeidInfo found");
3092  }
3093 }
3094 
3095 void
3097 {
3098  NS_LOG_FUNCTION(this);
3099 
3100  NS_LOG_LOGIC("Recv X2 message: HANDOVER CANCEL");
3101 
3102  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3103  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3104  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3105  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3106  NS_LOG_LOGIC("cause = " << params.cause);
3107 
3108  uint16_t rnti = params.newEnbUeX2apId;
3109  if (HasUeManager(rnti))
3110  {
3111  Ptr<UeManager> ueManager = GetUeManager(rnti);
3112  ueManager->RecvHandoverCancel(params);
3113  GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3114  }
3115 }
3116 
3117 uint16_t
3118 LteEnbRrc::DoAllocateTemporaryCellRnti(uint8_t componentCarrierId)
3119 {
3120  NS_LOG_FUNCTION(this << +componentCarrierId);
3121  // if no SRS index is available, then do not create a new UE context.
3122  if (IsMaxSrsReached())
3123  {
3124  return 0; // return 0 since new RNTI was not assigned for the received preamble
3125  }
3126  return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3127 }
3128 
3129 void
3131 {
3132  Ptr<UeManager> ueManager = GetUeManager(cmacParams.m_rnti);
3133  ueManager->CmacUeConfigUpdateInd(cmacParams);
3134 }
3135 
3136 void
3137 LteEnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
3138 {
3139  NS_LOG_FUNCTION(this << (uint32_t)rnti);
3140  NS_FATAL_ERROR("not implemented");
3141 }
3142 
3143 std::vector<uint8_t>
3145 {
3146  NS_LOG_FUNCTION(this);
3147  std::vector<uint8_t> measIds = AddUeMeasReportConfig(reportConfig);
3148  m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3149  return measIds;
3150 }
3151 
3152 uint8_t
3154 {
3155  NS_LOG_FUNCTION(this);
3156  uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3157  m_componentCarrierMeasIds.insert(measId);
3158  return measId;
3159 }
3160 
3161 void
3162 LteEnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3163 {
3164  m_numberOfComponentCarriers = numberOfComponentCarriers;
3165 }
3166 
3167 void
3168 LteEnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3169 {
3170  NS_LOG_FUNCTION(this << rnti << targetCellId);
3171 
3172  bool isHandoverAllowed = true;
3173 
3174  Ptr<UeManager> ueManager = GetUeManager(rnti);
3175  NS_ASSERT_MSG(ueManager, "Cannot find UE context with RNTI " << rnti);
3176 
3177  if (m_anrSapProvider != nullptr && !HasCellId(targetCellId))
3178  {
3179  // ensure that proper neighbour relationship exists between source and target cells
3180  bool noHo = m_anrSapProvider->GetNoHo(targetCellId);
3181  bool noX2 = m_anrSapProvider->GetNoX2(targetCellId);
3182  NS_LOG_DEBUG(this << " cellId="
3183  << ComponentCarrierToCellId(ueManager->GetComponentCarrierId())
3184  << " targetCellId=" << targetCellId << " NRT.NoHo=" << noHo
3185  << " NRT.NoX2=" << noX2);
3186 
3187  if (noHo || noX2)
3188  {
3189  isHandoverAllowed = false;
3190  NS_LOG_LOGIC(this << " handover to cell " << targetCellId << " is not allowed by ANR");
3191  }
3192  }
3193 
3194  if (ueManager->GetState() != UeManager::CONNECTED_NORMALLY)
3195  {
3196  isHandoverAllowed = false;
3197  NS_LOG_LOGIC(this << " handover is not allowed because the UE"
3198  << " rnti=" << rnti << " is in " << ToString(ueManager->GetState())
3199  << " state");
3200  }
3201 
3202  if (isHandoverAllowed)
3203  {
3204  // initiate handover execution
3205  ueManager->PrepareHandover(targetCellId);
3206  }
3207 }
3208 
3209 uint8_t
3211 {
3212  NS_LOG_FUNCTION(this);
3213  uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3214  m_anrMeasIds.insert(measId);
3215  return measId;
3216 }
3217 
3218 uint8_t
3220 {
3221  NS_LOG_FUNCTION(this);
3222  uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3223  m_ffrMeasIds.insert(measId);
3224  return measId;
3225 }
3226 
3227 void
3229  LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
3230 {
3231  NS_LOG_FUNCTION(this);
3232  Ptr<UeManager> ueManager = GetUeManager(rnti);
3233  ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3234 }
3235 
3236 void
3238 {
3239  NS_LOG_FUNCTION(this);
3240 
3242 }
3243 
3244 uint16_t
3245 LteEnbRrc::AddUe(UeManager::State state, uint8_t componentCarrierId)
3246 {
3247  NS_LOG_FUNCTION(this);
3248  bool found = false;
3249  uint16_t rnti;
3250  for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3251  {
3252  if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3253  {
3254  found = true;
3255  break;
3256  }
3257  }
3258 
3259  NS_ASSERT_MSG(found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3260  m_lastAllocatedRnti = rnti;
3261  Ptr<UeManager> ueManager = CreateObject<UeManager>(this, rnti, state, componentCarrierId);
3262  m_ccmRrcSapProvider->AddUe(rnti, (uint8_t)state);
3263  m_ueMap.insert(std::pair<uint16_t, Ptr<UeManager>>(rnti, ueManager));
3264  ueManager->Initialize();
3265  const uint16_t cellId = ComponentCarrierToCellId(componentCarrierId);
3266  NS_LOG_DEBUG(this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI "
3267  << ueManager->GetSrsConfigurationIndex());
3268  m_newUeContextTrace(cellId, rnti);
3269  return rnti;
3270 }
3271 
3272 void
3273 LteEnbRrc::RemoveUe(uint16_t rnti)
3274 {
3275  NS_LOG_FUNCTION(this << (uint32_t)rnti);
3276  std::map<uint16_t, Ptr<UeManager>>::iterator it = m_ueMap.find(rnti);
3277  NS_ASSERT_MSG(it != m_ueMap.end(), "request to remove UE info with unknown rnti " << rnti);
3278  uint64_t imsi = it->second->GetImsi();
3279  uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3280  // cancel pending events
3281  it->second->CancelPendingEvents();
3282  // fire trace upon connection release
3284  ComponentCarrierToCellId(it->second->GetComponentCarrierId()),
3285  rnti);
3286  m_ueMap.erase(it);
3287  for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3288  {
3289  m_cmacSapProvider.at(i)->RemoveUe(rnti);
3290  m_cphySapProvider.at(i)->RemoveUe(rnti);
3291  }
3292  if (m_s1SapProvider != nullptr)
3293  {
3295  }
3297  // need to do this after UeManager has been deleted
3298  if (srsCi != 0)
3299  {
3301  }
3302 
3303  m_rrcSapUser->RemoveUe(rnti); // Remove UE context at RRC protocol
3304 }
3305 
3306 TypeId
3308 {
3309  switch (m_epsBearerToRlcMapping)
3310  {
3311  case RLC_SM_ALWAYS:
3312  return LteRlcSm::GetTypeId();
3313  break;
3314 
3315  case RLC_UM_ALWAYS:
3316  return LteRlcUm::GetTypeId();
3317  break;
3318 
3319  case RLC_AM_ALWAYS:
3320  return LteRlcAm::GetTypeId();
3321  break;
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  break;
3333 
3334  default:
3335  return LteRlcSm::GetTypeId();
3336  break;
3337  }
3338 }
3339 
3340 void
3342 {
3343  NS_LOG_FUNCTION(this << cellId);
3344 
3345  if (m_anrSapProvider != nullptr)
3346  {
3348  }
3349 }
3350 
3351 void
3352 LteEnbRrc::SetCsgId(uint32_t csgId, bool csgIndication)
3353 {
3354  NS_LOG_FUNCTION(this << csgId << csgIndication);
3355  for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3356  componentCarrierId++)
3357  {
3358  m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3359  m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3360  m_cphySapProvider.at(componentCarrierId)
3361  ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3362  }
3363 }
3364 
3366 static const uint8_t SRS_ENTRIES = 9;
3371 static const uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
3377 static const uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
3383 static const uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
3384 
3385 void
3387 {
3388  NS_LOG_FUNCTION(this << p);
3389  for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3390  {
3391  if (g_srsPeriodicity[id] == p)
3392  {
3394  return;
3395  }
3396  }
3397  // no match found
3398  std::ostringstream allowedValues;
3399  for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3400  {
3401  allowedValues << g_srsPeriodicity[id] << " ";
3402  }
3403  NS_FATAL_ERROR("illecit SRS periodicity value " << p
3404  << ". Allowed values: " << allowedValues.str());
3405 }
3406 
3407 uint32_t
3409 {
3410  NS_LOG_FUNCTION(this);
3414 }
3415 
3416 uint16_t
3418 {
3420  // SRS
3423  NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3424  << m_ueSrsConfigurationIndexSet.size());
3426  {
3427  NS_FATAL_ERROR("too many UEs ("
3428  << m_ueSrsConfigurationIndexSet.size() + 1
3429  << ") for current SRS periodicity "
3431  << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
3432  }
3433 
3434  if (m_ueSrsConfigurationIndexSet.empty())
3435  {
3436  // first entry
3439  }
3440  else
3441  {
3442  // find a CI from the available ones
3443  std::set<uint16_t>::reverse_iterator rit = m_ueSrsConfigurationIndexSet.rbegin();
3444  NS_ASSERT(rit != m_ueSrsConfigurationIndexSet.rend());
3445  NS_LOG_DEBUG(this << " lower bound " << (*rit) << " of "
3447  if ((*rit) < g_srsCiHigh[m_srsCurrentPeriodicityId])
3448  {
3449  // got it from the upper bound
3450  m_lastAllocatedConfigurationIndex = (*rit) + 1;
3452  }
3453  else
3454  {
3455  // look for released ones
3456  for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
3458  srcCi++)
3459  {
3460  std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find(srcCi);
3461  if (it == m_ueSrsConfigurationIndexSet.end())
3462  {
3464  m_ueSrsConfigurationIndexSet.insert(srcCi);
3465  break;
3466  }
3467  }
3468  }
3469  }
3471 }
3472 
3473 void
3475 {
3476  NS_LOG_FUNCTION(this << srcCi);
3477  std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find(srcCi);
3479  "request to remove unknown SRS CI " << srcCi);
3480  m_ueSrsConfigurationIndexSet.erase(it);
3481 }
3482 
3483 bool
3485 {
3488  NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3489  << m_ueSrsConfigurationIndexSet.size());
3491  {
3492  return true;
3493  }
3494  else
3495  {
3496  return false;
3497  }
3498 }
3499 
3500 uint8_t
3502 {
3503  if (bearer.IsGbr())
3504  {
3505  return 1;
3506  }
3507  else
3508  {
3509  return 2;
3510  }
3511 }
3512 
3513 uint8_t
3515 {
3516  return bearer.qci;
3517 }
3518 
3519 void
3521 {
3522  // NS_LOG_FUNCTION (this);
3523 
3524  for (auto& it : m_componentCarrierPhyConf)
3525  {
3526  uint8_t ccId = it.first;
3527 
3529  si.haveSib2 = true;
3530  si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3531  si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3533  m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3535 
3536  LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3537  LteRrcSap::RachConfigCommon rachConfigCommon;
3538  rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3539  rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3540  rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3541  rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3542  si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3543 
3544  m_rrcSapUser->SendSystemInformation(it.second->GetCellId(), si);
3545  }
3546 
3547  /*
3548  * For simplicity, we use the same periodicity for all SIBs. Note that in real
3549  * systems the periodicy of each SIBs could be different.
3550  */
3552 }
3553 
3554 bool
3556 {
3557  NS_LOG_FUNCTION(this << (uint32_t)rnti);
3558  Ptr<UeManager> ueManager = GetUeManager(rnti);
3559  switch (ueManager->GetState())
3560  {
3563  return true;
3564  break;
3565  default:
3566  return false;
3567  break;
3568  }
3569 }
3570 
3571 } // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Callback template class.
Definition: callback.h:443
Class for forwarding CMAC SAP User functions.
Definition: lte-enb-rrc.cc:57
bool IsRandomAccessCompleted(uint16_t rnti) override
Is random access completed function.
Definition: lte-enb-rrc.cc:103
EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc *rrc, uint8_t componentCarrierId)
Constructor.
Definition: lte-enb-rrc.cc:77
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:97
uint16_t AllocateTemporaryCellRnti() override
request the allocation of a Temporary C-RNTI
Definition: lte-enb-rrc.cc:85
uint8_t m_componentCarrierId
Component carrier ID.
Definition: lte-enb-rrc.cc:74
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:91
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:219
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:358
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:426
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
double GetPacketErrorLossRate() const
Definition: eps-bearer.cc:140
Qci qci
Qos class indicator.
Definition: eps-bearer.h:137
bool IsGbr() const
Definition: eps-bearer.cc:122
GbrQosInformation gbrQosInfo
GBR QOS information.
Definition: eps-bearer.h:139
@ 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:43
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:660
~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:1791
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:1659
std::set< uint16_t > m_ueSrsConfigurationIndexSet
UE SRS configuration index set.
Definition: lte-enb-rrc.h:1650
TracedCallback< uint64_t, uint16_t, uint16_t, uint16_t > m_handoverStartTrace
The HandoverStart trace source.
Definition: lte-enb-rrc.h:1736
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:594
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:1617
friend class MemberEpcEnbS1SapUser< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:672
Callback< void, Ptr< Packet > > m_forwardUpCallback
forward up callback function
Definition: lte-enb-rrc.h:1535
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:1615
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:1573
uint32_t GetSrsPeriodicity() const
bool SendData(Ptr< Packet > p)
Enqueue an IP data packet on the proper bearer for downlink transmission.
void ConfigureCell(std::map< uint8_t, Ptr< ComponentCarrierBaseStation >> ccPhyConf)
Configure cell-specific parameters.
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:1553
Time m_connectionRequestTimeoutDuration
The ConnectionRequestTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1688
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 ...
void SetForwardUpCallback(Callback< void, Ptr< Packet >> cb)
set the callback used to forward data packets up the stack
LteHandoverManagementSapUser * m_handoverManagementSapUser
Receive API calls from the handover algorithm instance.
Definition: lte-enb-rrc.h:1548
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:1681
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:1635
Time m_connectionRejectedTimeoutDuration
The ConnectionRejectedTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1700
Time m_connectionSetupTimeoutDuration
The ConnectionSetupTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1695
std::set< uint8_t > m_handoverMeasIds
List of measurement identities which are intended for handover purpose.
Definition: lte-enb-rrc.h:1613
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:1664
uint16_t m_ulBandwidth
Uplink transmission bandwidth configuration in number of Resource Blocks.
Definition: lte-enb-rrc.h:1594
LteAnrSapUser * m_anrSapUser
Receive API calls from the ANR instance.
Definition: lte-enb-rrc.h:1558
LteHandoverManagementSapProvider * m_handoverManagementSapProvider
Interface to the handover algorithm instance.
Definition: lte-enb-rrc.h:1550
friend class EpcX2SpecificEpcX2SapUser< LteEnbRrc >
allow MemberEpcEnbS1SapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:674
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:1565
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:1568
std::map< uint16_t, Ptr< UeManager > > m_ueMap
The UeMap attribute.
Definition: lte-enb-rrc.h:1604
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...
Ptr< UeManager > GetUeManager(uint16_t rnti)
LteCcmRrcSapProvider * m_ccmRrcSapProvider
Interface to the LteEnbComponentCarrierManager instance.
Definition: lte-enb-rrc.h:1555
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:1747
LteAnrSapProvider * m_anrSapProvider
Interface to the ANR instance.
Definition: lte-enb-rrc.h:1560
std::set< uint8_t > m_componentCarrierMeasIds
List of measurement identities which are intended for component carrier management purposes.
Definition: lte-enb-rrc.h:1619
std::vector< LteEnbCphySapProvider * > m_cphySapProvider
Interface to the eNodeB PHY instances.
Definition: lte-enb-rrc.h:1583
void SetLteMacSapProvider(LteMacSapProvider *s)
set the MAC SAP provider.
uint16_t m_lastAllocatedConfigurationIndex
last allocated configuration index
Definition: lte-enb-rrc.h:1651
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureMaxRachTrace
The 'HandoverFailureMaxRach' Trace source.
Definition: lte-enb-rrc.h:1772
friend class MemberLteCcmRrcSapUser< LteEnbRrc >
allow MemberLteCcmRrcSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:678
LteRrcSap::MeasConfig m_ueMeasConfig
List of measurement configuration which are active in every UE attached to this eNodeB instance.
Definition: lte-enb-rrc.h:1610
void ConfigureCarriers(std::map< uint8_t, Ptr< ComponentCarrierBaseStation >> ccPhyConf)
Configure carriers.
friend class MemberLteEnbRrcSapProvider< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:670
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureNoPreambleTrace
The 'HandoverFailureNoPreamble' Trace source.
Definition: lte-enb-rrc.h:1766
TracedCallback< uint16_t, uint16_t > m_newUeContextTrace
The NewUeContext trace source.
Definition: lte-enb-rrc.h:1721
Time m_systemInformationPeriodicity
The SystemInformationPeriodicity attribute.
Definition: lte-enb-rrc.h:1645
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:666
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:1543
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:1588
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:1786
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:1675
EpcEnbS1SapProvider * m_s1SapProvider
Interface to send messages to core network over the S1 protocol.
Definition: lte-enb-rrc.h:1576
uint16_t m_lastAllocatedRnti
Last allocated RNTI.
Definition: lte-enb-rrc.h:1596
uint32_t m_ulEarfcn
Uplink E-UTRA Absolute Radio Frequency Channel Number.
Definition: lte-enb-rrc.h:1590
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:1731
EpcX2SapUser * m_x2SapUser
Interface to receive messages from neighbour eNodeB over the X2 interface.
Definition: lte-enb-rrc.h:1538
bool m_admitRrcConnectionRequest
The AdmitRrcConnectionRequest attribute.
Definition: lte-enb-rrc.h:1669
void DoRecvUeData(EpcX2SapUser::UeDataParams params)
Receive UE data function.
uint16_t m_srsCurrentPeriodicityId
The SrsPeriodicity attribute.
Definition: lte-enb-rrc.h:1649
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:1586
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:662
friend class MemberLteHandoverManagementSapUser< LteEnbRrc >
allow MemberLteHandoverManagementSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:664
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:1753
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:1715
std::map< uint32_t, X2uTeidInfo > m_x2uTeidInfoMap
TEID, RNTI, DRBID.
Definition: lte-enb-rrc.h:1629
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...
enum LteEpsBearerToRlcMapping_t m_epsBearerToRlcMapping
The EpsBearerToRlcMapping attribute.
Definition: lte-enb-rrc.h:1640
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:1581
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureJoiningTrace
The 'HandoverFailureJoining' Trace source.
Definition: lte-enb-rrc.h:1784
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:1563
bool IsMaxSrsReached()
EpcX2SapProvider * m_x2SapProvider
Interface to send messages to neighbour eNodeB over the X2 interface.
Definition: lte-enb-rrc.h:1540
std::vector< LteEnbCmacSapProvider * > m_cmacSapProvider
Interface to the eNodeB MAC instance.
Definition: lte-enb-rrc.h:1545
std::vector< LteRrcSap::SystemInformationBlockType1 > m_sib1
The System Information Block Type 1 that is currently broadcasted over BCH.
Definition: lte-enb-rrc.h:1599
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:1570
bool m_carriersConfigured
are carriers configured
Definition: lte-enb-rrc.h:1788
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionEstablishedTrace
The ConnectionEstablished trace source.
Definition: lte-enb-rrc.h:1726
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureLeavingTrace
The 'HandoverFailureLeaving' Trace source.
Definition: lte-enb-rrc.h:1778
TracedCallback< uint64_t, uint16_t, uint16_t, std::string > m_rrcTimeoutTrace
The 'TimerExpiry' Trace source.
Definition: lte-enb-rrc.h:1759
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:1578
void RemoveSrsConfigurationIndex(uint16_t srcCi)
remove a previously allocated SRS configuration index
Time m_handoverJoiningTimeoutDuration
The HandoverJoiningTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1709
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:1592
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverEndOkTrace
The HandoverEndOk trace source.
Definition: lte-enb-rrc.h:1741
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 Ptr< Packet > EncodeHandoverCommand(RrcConnectionReconfiguration msg)=0
Encode handover command.
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.
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:37
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc-am.cc:86
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE,...
Definition: lte-rlc.h:48
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition: lte-rlc.cc:148
void SetRnti(uint16_t rnti)
Definition: lte-rlc.cc:134
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-rlc.cc:162
LteMacSapUser * GetLteMacSapUser()
Definition: lte-rlc.cc:169
void SetLcId(uint8_t lcId)
Definition: lte-rlc.cc:141
LteRlcSapProvider * GetLteRlcSapProvider()
Definition: lte-rlc.cc:155
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc.cc:190
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc-um.cc:55
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
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:986
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:60
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:65
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:67
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
bool m_pendingStartDataRadioBearers
Pending start data radio bearers.
Definition: lte-enb-rrc.h:639
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:383
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:520
std::map< uint8_t, Ptr< LteDataRadioBearerInfo > > m_drbMap
The DataRadioBearerMap attribute.
Definition: lte-enb-rrc.h:543
Ptr< LteSignalingRadioBearerInfo > m_srb1
The Srb1 attribute.
Definition: lte-enb-rrc.h:552
void PrepareHandover(uint16_t cellId)
Start the handover preparation and send the handover request.
Definition: lte-enb-rrc.cc:662
void SetImsi(uint64_t imsi)
Set the IMSI.
Definition: lte-enb-rrc.cc:377
void SendData(uint8_t bid, Ptr< Packet > p)
Send a data packet over the appropriate Data Radio Bearer.
Definition: lte-enb-rrc.cc:952
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:599
State
The state of the UeManager at the eNB RRC.
Definition: lte-enb-rrc.h:82
@ CONNECTION_REESTABLISHMENT
Definition: lte-enb-rrc.h:89
@ CONNECTION_RECONFIGURATION
Definition: lte-enb-rrc.h:88
LteRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo()
Definition: lte-enb-rrc.cc:874
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:317
LteRrcSap::RrcConnectionReconfiguration BuildRrcConnectionReconfiguration()
EventId m_handoverJoiningTimeout
Time limit before a handover joining timeout occurs.
Definition: lte-enb-rrc.h:626
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:557
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:312
uint8_t Bid2Lcid(uint8_t bid)
LteRrcSap::PhysicalConfigDedicated m_physicalConfigDedicated
physical config dedicated
Definition: lte-enb-rrc.h:570
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:598
uint8_t m_lastAllocatedDrbid
last allocated Data Radio Bearer ID
Definition: lte-enb-rrc.h:537
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:619
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:398
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:592
State GetState() const
uint16_t m_targetX2apId
target X2 ap ID
Definition: lte-enb-rrc.h:595
uint8_t Drbid2Bid(uint8_t drbid)
static TypeId GetTypeId()
Get the type ID.
Definition: lte-enb-rrc.cc:330
Ptr< LteSignalingRadioBearerInfo > m_srb0
The Srb0 attribute.
Definition: lte-enb-rrc.h:548
uint64_t GetImsi() const
EventId m_connectionRequestTimeout
Time limit before a connection request timeout occurs.
Definition: lte-enb-rrc.h:607
uint64_t m_imsi
International Mobile Subscriber Identity assigned to this UE.
Definition: lte-enb-rrc.h:562
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:636
uint16_t m_targetCellId
target cell ID
Definition: lte-enb-rrc.h:597
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:930
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:370
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:650
friend class LtePdcpSpecificLtePdcpSapUser< UeManager >
allow LtePdcpSpecificLtePdcpSapUser<UeManager> class friend access
Definition: lte-enb-rrc.h:74
uint8_t m_lastRrcTransactionIdentifier
last RRC transaction identifier
Definition: lte-enb-rrc.h:568
uint8_t m_componentCarrierId
ID of the primary CC for this UE.
Definition: lte-enb-rrc.h:566
State m_state
The current UeManager state.
Definition: lte-enb-rrc.h:574
void RecvMeasurementReport(LteRrcSap::MeasurementReport msg)
Implement the LteEnbRrcSapProvider::RecvMeasurementReport interface.
void DoInitialize() override
Initialize() implementation.
Definition: lte-enb-rrc.cc:163
Ptr< LteEnbRrc > m_rrc
Pointer to the parent eNodeB RRC.
Definition: lte-enb-rrc.h:572
TracedCallback< uint64_t, uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
Definition: lte-enb-rrc.h:585
bool m_pendingRrcConnectionReconfiguration
pending RRC connection reconfiguration
Definition: lte-enb-rrc.h:578
void ReleaseDataRadioBearer(uint8_t drbid)
Release a given radio bearer.
Definition: lte-enb-rrc.cc:551
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:881
void StartDataRadioBearers()
Start the data radio bearers that have been previously recorded to be started using RecordDataRadioBe...
Definition: lte-enb-rrc.cc:532
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:802
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:629
uint16_t m_sourceCellId
source cell ID
Definition: lte-enb-rrc.h:596
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:633
uint16_t m_sourceX2apId
source X2 ap ID
Definition: lte-enb-rrc.h:594
std::vector< EpcX2Sap::ErabToBeSetupItem > GetErabList()
Definition: lte-enb-rrc.cc:999
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:576
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:613
void RecvIdealUeContextRemoveRequest(uint16_t rnti)
Implement the LteEnbRrcSapProvider::RecvIdealUeContextRemoveRequest interface.
Definition: lte-enb-rrc.cc:610
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)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: enum.h:205
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: integer.h: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)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:231
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1424
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h: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.
#define MIN_NO_CC
Definition: lte-enb-rrc.h:54
#define MAX_NO_CC
Definition: lte-enb-rrc.h:55
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const std::string & ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:48
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
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535
static const std::string g_ueManagerStateName[UeManager::NUM_STATES]
Map each of UE Manager states to its string representation.
Definition: lte-enb-rrc.cc:113
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.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
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:75
uint16_t erabId
E-RAB ID.
Definition: epc-x2-sap.h:76
E-RABs to be setup item as it is used in the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:59
bool dlForwarding
DL forwarding.
Definition: epc-x2-sap.h:62
Ipv4Address transportLayerAddress
transport layer address
Definition: epc-x2-sap.h:63
EpsBearer erabLevelQosParameters
E-RAB level QOS parameters.
Definition: epc-x2-sap.h:61
ErabsSubjectToStatusTransferItem structure.
Definition: epc-x2-sap.h:101
Parameters of the HANDOVER CANCEL message.
Definition: epc-x2-sap.h:344
Parameters of the HANDOVER PREPARATION FAILURE message.
Definition: epc-x2-sap.h:263
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:247
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
Definition: epc-x2-sap.h:252
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:250
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:249
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:251
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:248
Ptr< Packet > rrcContext
RRC context.
Definition: epc-x2-sap.h:254
Parameters of the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:229
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:230
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:232
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:233
uint32_t mmeUeS1apId
MME UE S1 AP ID.
Definition: epc-x2-sap.h:234
std::vector< ErabToBeSetupItem > bearers
bearers
Definition: epc-x2-sap.h:237
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:305
Parameters of the RESOURCE STATUS UPDATE message.
Definition: epc-x2-sap.h:316
Parameters of the SN STATUS TRANSFER message.
Definition: epc-x2-sap.h:277
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:279
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
Definition: epc-x2-sap.h:283
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:278
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:281
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:280
Parameters of the UE CONTEXT RELEASE message.
Definition: epc-x2-sap.h:292
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:294
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:293
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:295
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:296
Parameters of the UE DATA primitive.
Definition: epc-x2-sap.h:331
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
uint64_t gbrDl
guaranteed bitrate in downlink
uint8_t lcId
logical channel identifier
bool isGbr
true if the bearer is GBR, false if the bearer is NON-GBR
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
Parameters for [re]configuring the UE.
uint16_t m_rnti
UE id within this cell.
uint8_t m_transmissionMode
Transmission mode 1..7
X2uTeidInfo structure.
Definition: lte-enb-rrc.h:1623
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:101
uint16_t rxSn
RX sequence number.
Definition: lte-pdcp.h:103
uint16_t txSn
TX sequence number.
Definition: lte-pdcp.h:102
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
uint32_t dlCarrierFreq
ARFCN - valueEUTRA.
Definition: lte-rrc-sap.h:752
uint32_t physCellId
physical cell ID
Definition: lte-rrc-sap.h:751
int8_t qRxLevMin
INTEGER (-70..-22), actual value = IE value * 2 [dBm].
Definition: lte-rrc-sap.h:81
int8_t qQualMin
INTEGER (-34..-3), actual value = IE value [dB].
Definition: lte-rrc-sap.h:82
DrbToAddMod structure.
Definition: lte-rrc-sap.h:245
uint8_t epsBearerIdentity
EPS bearer identity.
Definition: lte-rrc-sap.h:246
RlcConfig rlcConfig
RLC config.
Definition: lte-rrc-sap.h:248
uint8_t logicalChannelIdentity
logical channel identify
Definition: lte-rrc-sap.h:249
uint8_t drbIdentity
DRB identity.
Definition: lte-rrc-sap.h:247
LogicalChannelConfig logicalChannelConfig
logical channel config
Definition: lte-rrc-sap.h:250
uint32_t ulCarrierFreq
UL carrier frequency.
Definition: lte-rrc-sap.h:88
uint16_t ulBandwidth
UL bandwidth.
Definition: lte-rrc-sap.h:89
HandoverPreparationInfo structure.
Definition: lte-rrc-sap.h:942
MasterInformationBlock structure.
Definition: lte-rrc-sap.h:622
uint16_t systemFrameNumber
system frame number
Definition: lte-rrc-sap.h:624
std::list< MeasObjectToAddMod > measObjectToAddModList
measure object to add mod list
Definition: lte-rrc-sap.h:555
bool haveMeasGapConfig
have measure gap config?
Definition: lte-rrc-sap.h:562
QuantityConfig quantityConfig
quantity config
Definition: lte-rrc-sap.h:561
bool haveSmeasure
have S measure?
Definition: lte-rrc-sap.h:564
bool haveSpeedStatePars
have speed state parameters?
Definition: lte-rrc-sap.h:566
std::list< ReportConfigToAddMod > reportConfigToAddModList
report config to add mod list
Definition: lte-rrc-sap.h:557
std::list< MeasIdToAddMod > measIdToAddModList
measure ID to add mod list
Definition: lte-rrc-sap.h:559
bool haveQuantityConfig
have quantity config?
Definition: lte-rrc-sap.h:560
MeasIdToAddMod structure.
Definition: lte-rrc-sap.h:488
uint8_t measObjectId
measure object ID
Definition: lte-rrc-sap.h:490
uint8_t reportConfigId
report config ID
Definition: lte-rrc-sap.h:491
bool haveCellForWhichToReportCGI
have cell for which to report CGI?
Definition: lte-rrc-sap.h:346
uint16_t allowedMeasBandwidth
allowed measure bandwidth
Definition: lte-rrc-sap.h:338
int8_t offsetFreq
offset frequency
Definition: lte-rrc-sap.h:341
uint8_t neighCellConfig
neighbor cell config
Definition: lte-rrc-sap.h:340
bool presenceAntennaPort1
antenna port 1 present?
Definition: lte-rrc-sap.h:339
uint32_t carrierFreq
carrier frequency
Definition: lte-rrc-sap.h:337
MeasObjectToAddMod structure.
Definition: lte-rrc-sap.h:474
uint8_t measObjectId
measure object ID
Definition: lte-rrc-sap.h:475
MeasObjectEutra measObjectEutra
measure object eutra
Definition: lte-rrc-sap.h:476
uint8_t rsrqResult
the RSRQ result
Definition: lte-rrc-sap.h:675
uint8_t rsrpResult
the RSRP result
Definition: lte-rrc-sap.h:674
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:718
bool haveMeasResultNeighCells
have measure result neighbor cells
Definition: lte-rrc-sap.h:720
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
Definition: lte-rrc-sap.h:721
bool haveMeasResultServFreqList
has measResultServFreqList-r10
Definition: lte-rrc-sap.h:722
std::list< MeasResultServFreq > measResultServFreqList
MeasResultServFreqList-r10.
Definition: lte-rrc-sap.h:723
MeasResultPCell measResultPCell
measurement result primary cell
Definition: lte-rrc-sap.h:719
MeasurementReport structure.
Definition: lte-rrc-sap.h:948
MeasResults measResults
measure results
Definition: lte-rrc-sap.h:949
RadioResourceConfigCommon radioResourceConfigCommon
radio resource config common
Definition: lte-rrc-sap.h:600
RachConfigDedicated rachConfigDedicated
RACH config dedicated.
Definition: lte-rrc-sap.h:602
bool haveRachConfigDedicated
Have RACH config dedicated?
Definition: lte-rrc-sap.h:601
uint16_t newUeIdentity
new UE identity
Definition: lte-rrc-sap.h:599
bool haveCarrierBandwidth
have carrier bandwidth?
Definition: lte-rrc-sap.h:597
bool haveCarrierFreq
have carrier frequency?
Definition: lte-rrc-sap.h:595
CarrierBandwidthEutra carrierBandwidth
carrier bandwidth
Definition: lte-rrc-sap.h:598
CarrierFreqEutra carrierFreq
carrier frequency
Definition: lte-rrc-sap.h:596
uint16_t targetPhysCellId
target Phy cell ID
Definition: lte-rrc-sap.h:594
NonCriticalExtensionConfiguration structure.
Definition: lte-rrc-sap.h:874
std::list< uint8_t > sCellToReleaseList
SCell to release list.
Definition: lte-rrc-sap.h:876
std::list< SCellToAddMod > sCellToAddModList
SCell to add mod list.
Definition: lte-rrc-sap.h:875
AntennaInfoCommon antennaInfoCommon
2: Physical configuration, general antennaInfoCommon-r10
Definition: lte-rrc-sap.h:780
PdschConfigCommon pdschConfigCommon
4: Physical configuration, physical channels pdsch-ConfigCommon-r10
Definition: lte-rrc-sap.h:784
uint16_t dlBandwidth
1: Cell characteristics
Definition: lte-rrc-sap.h:778
int8_t referenceSignalPower
INTEGER (-60..50),.
Definition: lte-rrc-sap.h:157
int8_t pb
INTEGER (0..3),.
Definition: lte-rrc-sap.h:158
PdschConfigDedicated structure.
Definition: lte-rrc-sap.h:163
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
Definition: lte-rrc-sap.h:233
bool haveAntennaInfoDedicated
have antenna info dedicated?
Definition: lte-rrc-sap.h:230
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
Definition: lte-rrc-sap.h:229
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
Definition: lte-rrc-sap.h:227
bool havePdschConfigDedicated
have PDSCH config dedicated?
Definition: lte-rrc-sap.h:232
AntennaInfoDedicated antennaInfo
antenna info
Definition: lte-rrc-sap.h:231
PuschConfigDedicatedSCell pushConfigDedicatedSCell
PUSCH config dedicated SCell.
Definition: lte-rrc-sap.h:836
AntennaInfoDedicated antennaInfoUl
antenna info UL
Definition: lte-rrc-sap.h:835
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
Definition: lte-rrc-sap.h:841
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
Definition: lte-rrc-sap.h:830
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
Definition: lte-rrc-sap.h:839
bool haveUlConfiguration
have UL configuration?
Definition: lte-rrc-sap.h:833
bool haveAntennaInfoUlDedicated
have antenna info UL dedicated?
Definition: lte-rrc-sap.h:834
bool havePdschConfigDedicated
have PDSCH config dedicated?
Definition: lte-rrc-sap.h:829
bool crossCarrierSchedulingConfig
currently implemented as boolean variable --> implementing crossCarrierScheduling is out of the scope...
Definition: lte-rrc-sap.h:826
bool haveNonUlConfiguration
have non UL configuration?
Definition: lte-rrc-sap.h:823
AntennaInfoDedicated antennaInfo
antenna info dedicated
Definition: lte-rrc-sap.h:825
bool haveAntennaInfoDedicated
have antenna info dedicated?
Definition: lte-rrc-sap.h:824
UlPowerControlDedicatedSCell ulPowerControlDedicatedSCell
UL power control dedicated SCell.
Definition: lte-rrc-sap.h:838
uint32_t plmnIdentity
PLMN identity.
Definition: lte-rrc-sap.h:66
uint8_t numberOfRaPreambles
number of RA preambles
Definition: lte-rrc-sap.h:256
uint16_t nPuschIdentity
3GPP TS 36.331 v.11.10 R11 page 216
Definition: lte-rrc-sap.h:809
uint8_t filterCoefficientRSRQ
filter coefficient RSRQ
Definition: lte-rrc-sap.h:308
uint8_t filterCoefficientRSRP
filter coefficient RSRP
Definition: lte-rrc-sap.h:307
uint8_t raResponseWindowSize
RA response window size.
Definition: lte-rrc-sap.h:263
uint8_t preambleTransMax
preamble transmit maximum
Definition: lte-rrc-sap.h:262
RachConfigCommon structure.
Definition: lte-rrc-sap.h:275
TxFailParam txFailParam
txFailParams
Definition: lte-rrc-sap.h:278
PreambleInfo preambleInfo
preamble info
Definition: lte-rrc-sap.h:276
RaSupervisionInfo raSupervisionInfo
RA supervision info.
Definition: lte-rrc-sap.h:277
uint8_t raPreambleIndex
RA preamble index.
Definition: lte-rrc-sap.h:587
uint8_t raPrachMaskIndex
RA PRACH mask index.
Definition: lte-rrc-sap.h:588
RachConfigCommon rachConfigCommon
RACH config common.
Definition: lte-rrc-sap.h:284
NonUlConfiguration nonUlConfiguration
non UL configuration
Definition: lte-rrc-sap.h:848
bool haveUlConfiguration
have UL configuration
Definition: lte-rrc-sap.h:849
bool haveNonUlConfiguration
have non UL configuration?
Definition: lte-rrc-sap.h:847
UlConfiguration ulConfiguration
UL configuration.
Definition: lte-rrc-sap.h:850
RachConfigCommon rachConfigCommon
RACH config common.
Definition: lte-rrc-sap.h:290
PdschConfigCommon pdschConfigCommon
PDSCH config common.
Definition: lte-rrc-sap.h:291
RadioResourceConfigDedicated structure.
Definition: lte-rrc-sap.h:296
PhysicalConfigDedicated physicalConfigDedicated
physical config dedicated
Definition: lte-rrc-sap.h:301
std::list< uint8_t > drbToReleaseList
DRB to release list.
Definition: lte-rrc-sap.h:299
bool havePhysicalConfigDedicated
have physical config dedicated?
Definition: lte-rrc-sap.h:300
std::list< DrbToAddMod > drbToAddModList
DRB to add mod list.
Definition: lte-rrc-sap.h:298
std::list< SrbToAddMod > srbToAddModList
SRB to add mod list.
Definition: lte-rrc-sap.h:297
PhysicalConfigDedicatedSCell physicalConfigDedicatedSCell
physical config dedicated SCell
Definition: lte-rrc-sap.h:857
Specifies criteria for triggering of an E-UTRA measurement reporting event.
Definition: lte-rrc-sap.h:373
@ RSRP
Reference Signal Received Power.
Definition: lte-rrc-sap.h:425
@ RSRQ
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:426
@ BOTH
Both the RSRP and RSRQ quantities are to be included in the measurement report.
Definition: lte-rrc-sap.h:434
ThresholdEutra threshold2
Threshold for event A5.
Definition: lte-rrc-sap.h:394
enum ns3::LteRrcSap::ReportConfigEutra::@65 eventId
Event enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@67 reportQuantity
Report type enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@66 triggerQuantity
Trigger type enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Definition: lte-rrc-sap.h:393
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
Definition: lte-rrc-sap.h:385
@ EVENT_A4
Event A4: Neighbour becomes better than absolute threshold.
Definition: lte-rrc-sap.h:387
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:384
@ EVENT_A5
Event A5: PCell becomes worse than absolute threshold1 AND Neighbour becomes better than another abso...
Definition: lte-rrc-sap.h:388
ReportConfigToAddMod structure.
Definition: lte-rrc-sap.h:481
uint8_t reportConfigId
report config ID
Definition: lte-rrc-sap.h:482
ReportConfigEutra reportConfigEutra
report config eutra
Definition: lte-rrc-sap.h:483
RrcConnectionReconfigurationCompleted structure.
Definition: lte-rrc-sap.h:898
RrcConnectionReconfiguration structure.
Definition: lte-rrc-sap.h:881
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:882
bool haveMobilityControlInfo
have mobility control info
Definition: lte-rrc-sap.h:885
NonCriticalExtensionConfiguration nonCriticalExtension
3GPP TS 36.331 v.11.10 R11 Sec.
Definition: lte-rrc-sap.h:893
bool haveRadioResourceConfigDedicated
have radio resource config dedicated
Definition: lte-rrc-sap.h:887
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
Definition: lte-rrc-sap.h:889
bool haveNonCriticalExtension
have critical extension?
Definition: lte-rrc-sap.h:890
MobilityControlInfo mobilityControlInfo
mobility control info
Definition: lte-rrc-sap.h:886
RrcConnectionReestablishmentComplete structure.
Definition: lte-rrc-sap.h:919
RrcConnectionReestablishment structure.
Definition: lte-rrc-sap.h:911
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
Definition: lte-rrc-sap.h:914
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:912
RrcConnectionReestablishmentRequest structure.
Definition: lte-rrc-sap.h:904
RrcConnectionReject structure.
Definition: lte-rrc-sap.h:936
RrcConnectionRelease structure.
Definition: lte-rrc-sap.h:930
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:931
RrcConnectionRequest structure.
Definition: lte-rrc-sap.h:730
RrcConnectionSetupCompleted structure.
Definition: lte-rrc-sap.h:744
RrcConnectionSetup structure.
Definition: lte-rrc-sap.h:736
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:737
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
Definition: lte-rrc-sap.h:739
SCellToAddMod structure.
Definition: lte-rrc-sap.h:862
RadioResourceConfigDedicatedSCell radioResourceConfigDedicatedSCell
radio resource config dedicated SCell
Definition: lte-rrc-sap.h:869
uint32_t sCellIndex
SCell index.
Definition: lte-rrc-sap.h:863
bool haveRadioResourceConfigDedicatedSCell
have radio resource config dedicated SCell?
Definition: lte-rrc-sap.h:867
CellIdentification cellIdentification
cell identification
Definition: lte-rrc-sap.h:864
RadioResourceConfigCommonSCell radioResourceConfigCommonSCell
radio resource config common SCell
Definition: lte-rrc-sap.h:866
uint8_t srsSubframeConfig
SRS subframe config.
Definition: lte-rrc-sap.h:129
uint16_t srsBandwidthConfig
SRS bandwidth config.
Definition: lte-rrc-sap.h:128
uint16_t srsConfigIndex
SRS config index.
Definition: lte-rrc-sap.h:145
SrbToAddMod structure.
Definition: lte-rrc-sap.h:238
LogicalChannelConfig logicalChannelConfig
logical channel config
Definition: lte-rrc-sap.h:240
uint8_t srbIdentity
SB identity.
Definition: lte-rrc-sap.h:239
SystemInformationBlockType1 structure.
Definition: lte-rrc-sap.h:629
CellSelectionInfo cellSelectionInfo
cell selection info
Definition: lte-rrc-sap.h:631
CellAccessRelatedInfo cellAccessRelatedInfo
cell access related info
Definition: lte-rrc-sap.h:630
RadioResourceConfigCommonSib radioResourceConfigCommon
radio resource config common
Definition: lte-rrc-sap.h:637
SystemInformation structure.
Definition: lte-rrc-sap.h:643
SystemInformationBlockType2 sib2
SIB2.
Definition: lte-rrc-sap.h:645
@ THRESHOLD_RSRP
RSRP is used for the threshold.
Definition: lte-rrc-sap.h:364
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:365
enum ns3::LteRrcSap::ThresholdEutra::@63 choice
Threshold enumeration.
uint8_t connEstFailCount
Number of times that the UE detects T300 expiry on the same cell.
Definition: lte-rrc-sap.h:269
UlPowerControlCommonSCell ulPowerControlCommonSCell
3GPP TS 36.331 v.11.10 R11 pag.223
Definition: lte-rrc-sap.h:793
FreqInfo ulFreqInfo
UL frequency info.
Definition: lte-rrc-sap.h:792
SoundingRsUlConfigCommon soundingRsUlConfigCommon
sounding RS UL config common
Definition: lte-rrc-sap.h:794
PrachConfigSCell prachConfigSCell
PRACH config SCell.
Definition: lte-rrc-sap.h:795
uint16_t pSrsOffset
3GPP TS 36.331 v.11.10 R11 page 234
Definition: lte-rrc-sap.h:816