15#include "nr-gnb-rrc.h"
17#include "bandwidth-part-gnb.h"
19#include "nr-eps-bearer-tag.h"
21#include "nr-radio-bearer-info.h"
28#include "ns3/fatal-error.h"
30#include "ns3/object-factory.h"
31#include "ns3/object-map.h"
32#include "ns3/packet.h"
33#include "ns3/pointer.h"
34#include "ns3/simulator.h"
39NS_LOG_COMPONENT_DEFINE(
"NrGnbRrc");
48class GnbRrcMemberNrGnbCmacSapUser :
public NrGnbCmacSapUser
57 GnbRrcMemberNrGnbCmacSapUser(NrGnbRrc* rrc, uint8_t componentCarrierId);
59 uint16_t AllocateTemporaryCellRnti()
override;
60 void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid,
bool success)
override;
61 void RrcConfigurationUpdateInd(UeConfig params)
override;
62 bool IsRandomAccessCompleted(uint16_t rnti)
override;
66 uint8_t m_componentCarrierId;
69GnbRrcMemberNrGnbCmacSapUser::GnbRrcMemberNrGnbCmacSapUser(NrGnbRrc* rrc,
70 uint8_t componentCarrierId)
72 m_componentCarrierId{componentCarrierId}
77GnbRrcMemberNrGnbCmacSapUser::AllocateTemporaryCellRnti()
79 return m_rrc->DoAllocateTemporaryCellRnti(m_componentCarrierId);
83GnbRrcMemberNrGnbCmacSapUser::NotifyLcConfigResult(uint16_t rnti, uint8_t lcid,
bool success)
85 m_rrc->DoNotifyLcConfigResult(rnti, lcid, success);
89GnbRrcMemberNrGnbCmacSapUser::RrcConfigurationUpdateInd(UeConfig params)
91 m_rrc->DoRrcConfigurationUpdateInd(params);
95GnbRrcMemberNrGnbCmacSapUser::IsRandomAccessCompleted(uint16_t rnti)
97 return m_rrc->IsRandomAccessCompleted(rnti);
105static const std::string g_ueManagerStateName[NrUeManager::NUM_STATES] = {
106 "INITIAL_RANDOM_ACCESS",
108 "CONNECTION_REJECTED",
110 "CONNECTED_NORMALLY",
111 "CONNECTION_RECONFIGURATION",
112 "CONNECTION_REESTABLISHMENT",
113 "HANDOVER_PREPARATION",
115 "HANDOVER_PATH_SWITCH",
123static const std::string&
124ToString(NrUeManager::State s)
126 return g_ueManagerStateName[s];
129NS_OBJECT_ENSURE_REGISTERED(NrUeManager);
131NrUeManager::NrUeManager()
133 NS_FATAL_ERROR(
"this constructor is not expected to be used");
136NrUeManager::NrUeManager(Ptr<NrGnbRrc> rrc, uint16_t rnti,
State s, uint8_t componentCarrierId)
137 : m_lastAllocatedDrbid(0),
140 m_componentCarrierId(componentCarrierId),
141 m_lastRrcTransactionIdentifier(0),
144 m_pendingRrcConnectionReconfiguration(false),
147 m_needPhyMacConfiguration(false),
148 m_caSupportConfigured(false),
149 m_pendingStartDataRadioBearers(false)
151 NS_LOG_FUNCTION(
this);
157 NS_LOG_FUNCTION(
this);
167 NS_LOG_FUNCTION(
this);
174 m_rrc->GetNewSrsConfigurationIndex();
176 NrRrcSap::SoundingRsUlConfigDedicated::SETUP;
181 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
183 m_rrc->m_cmacSapProvider.at(i)->AddUe(m_rnti);
184 m_rrc->m_cphySapProvider.at(i)->AddUe(m_rnti);
191 NS_LOG_FUNCTION(
this);
196 Ptr<NrRlc> rlc = CreateObject<NrRlcTm>()->GetObject<
NrRlc>();
198 rlc->SetRnti(m_rnti);
201 m_srb0 = CreateObject<NrSignalingRadioBearerInfo>();
203 m_srb0->m_srbIdentity = 0;
207 lcinfo.
rnti = m_rnti;
222 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetNrMacSapUser());
224 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, nrMacSapUser);
225 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, nrMacSapUser);
232 NS_LOG_FUNCTION(
this);
237 Ptr<NrRlc> rlc = CreateObject<NrRlcAm>()->GetObject<
NrRlc>();
239 rlc->SetRnti(m_rnti);
242 Ptr<NrPdcp> pdcp = CreateObject<NrPdcp>();
243 pdcp->SetRnti(m_rnti);
245 pdcp->SetNrPdcpSapUser(m_drbPdcpSapUser);
246 pdcp->SetNrRlcSapProvider(rlc->GetNrRlcSapProvider());
247 rlc->SetNrRlcSapUser(pdcp->GetNrRlcSapUser());
249 m_srb1 = CreateObject<NrSignalingRadioBearerInfo>();
251 m_srb1->m_pdcp = pdcp;
252 m_srb1->m_srbIdentity = 1;
253 m_srb1->m_logicalChannelConfig.priority = 1;
254 m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
255 m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
256 m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
259 lcinfo.
rnti = m_rnti;
271 m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetNrMacSapUser());
273 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, MacSapUserForRlc);
274 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, MacSapUserForRlc);
280 m_rrc->m_rrcSapUser->SetupUe(m_rnti, ueParams);
286 NS_LOG_FUNCTION(
this);
293 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
295 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
296 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(
299 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
305 Time maxConnectionDelay;
308 case INITIAL_RANDOM_ACCESS:
309 m_connectionRequestTimeout = Simulator::Schedule(m_rrc->m_connectionRequestTimeoutDuration,
315 case HANDOVER_JOINING:
316 m_handoverJoiningTimeout = Simulator::Schedule(m_rrc->m_handoverJoiningTimeoutDuration,
323 NS_FATAL_ERROR(
"unexpected state " << ToString(m_state));
326 m_caSupportConfigured =
false;
329NrUeManager::~NrUeManager()
334NrUeManager::DoDispose()
336 delete m_drbPdcpSapUser;
338 for (
auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
340 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
348 TypeId(
"ns3::NrUeManager")
350 .AddConstructor<NrUeManager>()
351 .AddAttribute(
"DataRadioBearerMap",
352 "List of UE DataRadioBearerInfo by DRBID.",
354 MakeObjectMapAccessor(&NrUeManager::m_drbMap),
355 MakeObjectMapChecker<NrDataRadioBearerInfo>())
356 .AddAttribute(
"Srb0",
357 "SignalingRadioBearerInfo for SRB0",
359 MakePointerAccessor(&NrUeManager::m_srb0),
360 MakePointerChecker<NrSignalingRadioBearerInfo>())
361 .AddAttribute(
"Srb1",
362 "SignalingRadioBearerInfo for SRB1",
364 MakePointerAccessor(&NrUeManager::m_srb1),
365 MakePointerChecker<NrSignalingRadioBearerInfo>())
366 .AddAttribute(
"C-RNTI",
367 "Cell Radio Network Temporary Identifier",
370 MakeUintegerAccessor(&NrUeManager::m_rnti),
371 MakeUintegerChecker<uint16_t>())
372 .AddTraceSource(
"StateTransition",
373 "fired upon every UE state transition seen by the "
374 "NrUeManager at the gNB RRC",
375 MakeTraceSourceAccessor(&NrUeManager::m_stateTransitionTrace),
376 "ns3::NrUeManager::StateTracedCallback")
377 .AddTraceSource(
"DrbCreated",
378 "trace fired after DRB is created",
379 MakeTraceSourceAccessor(&NrUeManager::m_drbCreatedTrace),
380 "ns3::NrUeManager::ImsiCidRntiLcIdTracedCallback");
387 m_sourceX2apId = sourceX2apId;
388 m_sourceCellId = sourceCellId;
400 NS_LOG_FUNCTION(
this << m_rnti);
402 if (m_state == ATTACH_REQUEST)
404 SwitchToState(CONNECTED_NORMALLY);
408 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
416 Ipv4Address transportLayerAddress)
418 NS_LOG_FUNCTION(
this << (uint32_t)m_rnti);
420 Ptr<NrDataRadioBearerInfo> drbInfo = CreateObject<NrDataRadioBearerInfo>();
421 uint8_t drbid = AddDataRadioBearerInfo(drbInfo);
422 uint8_t lcid = Drbid2Lcid(drbid);
423 uint8_t bid = Drbid2Bid(drbid);
424 NS_ASSERT_MSG(bearerId == 0 || bid == bearerId,
425 "bearer ID mismatch (" << (uint32_t)bid <<
" != " << (uint32_t)bearerId
426 <<
", the assumption that ID are allocated in the same "
427 "way by MME and RRC is not valid any more");
428 drbInfo->m_epsBearer = bearer;
429 drbInfo->m_epsBearerIdentity = bid;
430 drbInfo->m_drbIdentity = drbid;
431 drbInfo->m_logicalChannelIdentity = lcid;
432 drbInfo->m_gtpTeid = gtpTeid;
433 drbInfo->m_transportLayerAddress = transportLayerAddress;
435 if (m_state == HANDOVER_JOINING)
438 NrGnbRrc::X2uTeidInfo x2uTeidInfo;
439 x2uTeidInfo.rnti = m_rnti;
440 x2uTeidInfo.drbid = drbid;
441 auto ret = m_rrc->m_x2uTeidInfoMap.insert(
442 std::pair<uint32_t, NrGnbRrc::X2uTeidInfo>(gtpTeid, x2uTeidInfo));
443 NS_ASSERT_MSG(ret.second ==
true,
"overwriting a pre-existing entry in m_x2uTeidInfoMap");
446 TypeId rlcTypeId = m_rrc->GetRlcType(bearer);
448 ObjectFactory rlcObjectFactory;
449 rlcObjectFactory.SetTypeId(rlcTypeId);
450 Ptr<NrRlc> rlc = rlcObjectFactory.Create()->GetObject<
NrRlc>();
452 rlc->SetRnti(m_rnti);
458 Simulator::ScheduleNow(&NrRlcSm::Initialize, rlc);
461 drbInfo->m_rlc = rlc;
469 Ptr<NrPdcp> pdcp = CreateObject<NrPdcp>();
470 pdcp->SetRnti(m_rnti);
472 pdcp->SetNrPdcpSapUser(m_drbPdcpSapUser);
473 pdcp->SetNrRlcSapProvider(rlc->GetNrRlcSapProvider());
474 rlc->SetNrRlcSapUser(pdcp->GetNrRlcSapUser());
475 drbInfo->m_pdcp = pdcp;
478 m_drbCreatedTrace(m_imsi, m_rrc->ComponentCarrierToCellId(m_componentCarrierId), m_rnti, lcid);
480 std::vector<NrCcmRrcSapProvider::LcsConfig> lcOnCcMapping =
481 m_rrc->m_ccmRrcSapProvider->SetupDataRadioBearer(bearer,
485 m_rrc->GetLogicalChannelGroup(bearer),
486 rlc->GetNrMacSapUser());
499 auto itLcOnCcMapping = lcOnCcMapping.begin();
500 NS_ASSERT_MSG(itLcOnCcMapping != lcOnCcMapping.end(),
"Problem");
501 for (itLcOnCcMapping = lcOnCcMapping.begin(); itLcOnCcMapping != lcOnCcMapping.end();
504 NS_LOG_DEBUG(
this <<
" RNTI " << itLcOnCcMapping->lc.rnti <<
"Lcid "
505 << (uint16_t)itLcOnCcMapping->lc.lcId <<
" lcGroup "
506 << (uint16_t)itLcOnCcMapping->lc.lcGroup <<
" ComponentCarrierId "
507 << itLcOnCcMapping->componentCarrierId);
508 uint8_t index = itLcOnCcMapping->componentCarrierId;
511 m_rrc->m_cmacSapProvider.at(index)->AddLc(lcinfo, msu);
512 m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, msu);
517 drbInfo->m_rlcConfig.choice = NrRrcSap::RlcConfig::AM;
521 drbInfo->m_rlcConfig.choice = NrRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
524 drbInfo->m_logicalChannelIdentity = lcid;
525 drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority(bearer);
526 drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup(bearer);
529 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.
gbrQosInfo.
gbrUl;
533 drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
535 drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
543 NS_LOG_FUNCTION(
this << (uint32_t)m_rnti);
544 for (
auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
546 m_drbsToBeStarted.push_back(it->first);
553 NS_LOG_FUNCTION(
this << (uint32_t)m_rnti);
554 for (
auto drbIdIt = m_drbsToBeStarted.begin(); drbIdIt != m_drbsToBeStarted.end(); ++drbIdIt)
556 auto drbIt = m_drbMap.find(*drbIdIt);
557 NS_ASSERT(drbIt != m_drbMap.end());
559 m_drbsToBeStarted.clear();
565 NS_LOG_FUNCTION(
this << (uint32_t)m_rnti << (uint32_t)drbid);
566 uint8_t lcid = Drbid2Lcid(drbid);
567 auto it = m_drbMap.find(drbid);
568 NS_ASSERT_MSG(it != m_drbMap.end(),
569 "request to remove radio bearer with unknown drbid " << drbid);
572 m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
575 std::vector<uint8_t> ccToRelease =
576 m_rrc->m_ccmRrcSapProvider->ReleaseDataRadioBearer(m_rnti, lcid);
577 auto itCcToRelease = ccToRelease.begin();
578 NS_ASSERT_MSG(itCcToRelease != ccToRelease.end(),
579 "request to remove radio bearer with unknown drbid (ComponentCarrierManager)");
580 for (itCcToRelease = ccToRelease.begin(); itCcToRelease != ccToRelease.end(); ++itCcToRelease)
582 m_rrc->m_cmacSapProvider.at(*itCcToRelease)->ReleaseLc(m_rnti, lcid);
595 msg.haveMobilityControlInfo =
false;
596 msg.radioResourceConfigDedicated = rrcd;
597 msg.haveRadioResourceConfigDedicated =
true;
600 msg.haveNonCriticalExtension =
false;
602 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
608 NS_LOG_FUNCTION(
this << imsi << rnti << (uint16_t)bearerId);
615 ueManager->ReleaseDataRadioBearer(bearerId);
624 NS_LOG_FUNCTION(
this << m_rnti);
627 if (m_rrc->m_s1SapProvider !=
nullptr)
629 for (
const auto& it : m_drbMap)
631 NS_LOG_DEBUG(
"Sending release of bearer id : "
632 << (uint16_t)(it.first)
633 <<
"LCID : " << (uint16_t)(it.second->m_logicalChannelIdentity));
635 m_rrc->m_s1SapProvider->DoSendReleaseIndication(
GetImsi(), rnti, it.first);
643 NS_LOG_FUNCTION(
this);
646 case INITIAL_RANDOM_ACCESS:
647 case CONNECTION_SETUP:
649 case CONNECTION_RECONFIGURATION:
650 case CONNECTION_REESTABLISHMENT:
651 case HANDOVER_PREPARATION:
652 case HANDOVER_JOINING:
653 case HANDOVER_LEAVING:
655 m_pendingRrcConnectionReconfiguration =
true;
658 case CONNECTED_NORMALLY: {
659 m_pendingRrcConnectionReconfiguration =
false;
661 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
663 SwitchToState(CONNECTION_RECONFIGURATION);
668 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
676 NS_LOG_FUNCTION(
this << cellId);
679 case CONNECTED_NORMALLY: {
680 m_targetCellId = cellId;
682 auto sourceComponentCarrier = DynamicCast<BandwidthPartGnb>(
683 m_rrc->m_componentCarrierPhyConf.at(m_componentCarrierId));
684 NS_ASSERT(m_targetCellId != sourceComponentCarrier->GetCellId());
686 if (m_rrc->HasCellId(cellId))
689 NS_LOG_DEBUG(
"Intra-gNB handover for cellId " << cellId);
690 uint8_t componentCarrierId = m_rrc->CellToComponentCarrierId(cellId);
691 uint16_t rnti = m_rrc->AddUe(NrUeManager::HANDOVER_JOINING, componentCarrierId);
693 m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
696 NS_LOG_INFO(
this <<
" failed to allocate a preamble for non-contention based RA => "
697 "cannot perform HO");
698 NS_FATAL_ERROR(
"should trigger HO Preparation Failure, but it is not implemented");
702 Ptr<NrUeManager> ueManager = m_rrc->GetUeManager(rnti);
703 ueManager->SetSource(sourceComponentCarrier->GetCellId(), m_rnti);
704 ueManager->SetImsi(m_imsi);
707 for (
auto& it : m_drbMap)
709 ueManager->SetupDataRadioBearer(it.second->m_epsBearer,
710 it.second->m_epsBearerIdentity,
711 it.second->m_gtpTeid,
712 it.second->m_transportLayerAddress);
726 m_rrc->m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
734 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
737 SwitchToState(HANDOVER_LEAVING);
738 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
742 m_rrc->m_handoverStartTrace(m_imsi,
743 sourceComponentCarrier->GetCellId(),
750 NS_LOG_DEBUG(
"Inter-gNB handover (i.e., X2) for cellId " << cellId);
753 params.
cause = NrEpcX2SapProvider::HandoverDesirableForRadioReason;
754 params.
sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
768 sourceComponentCarrier->GetDlBandwidth();
772 .cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
774 m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
776 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
778 m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
780 m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->GetRachConfig();
790 sourceComponentCarrier->GetUlEarfcn();
792 sourceComponentCarrier->GetUlBandwidth();
793 params.
rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation(hpi);
798 NS_LOG_LOGIC(
"mmeUeS1apId = " << params.
mmeUeS1apId);
799 NS_LOG_LOGIC(
"rrcContext = " << params.
rrcContext);
801 m_rrc->m_x2SapProvider->SendHandoverRequest(params);
802 SwitchToState(HANDOVER_PREPARATION);
808 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
816 NS_LOG_FUNCTION(
this);
819 "not admission of some bearers upon handover is not supported");
821 "not enough bearers in admittedBearers");
829 Ptr<Packet> encodedHandoverCommand = params.
rrcContext;
831 m_rrc->m_rrcSapUser->DecodeHandoverCommand(encodedHandoverCommand);
837 m_rrc->m_numberOfComponentCarriers)
841 NS_FATAL_ERROR(
"The source and target eNBs have unequal number of component carriers. "
844 <<
" Source gNB CCs = " << m_rrc->m_numberOfComponentCarriers);
847 m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
848 SwitchToState(HANDOVER_LEAVING);
849 m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
854 m_rrc->m_handoverStartTrace(m_imsi,
855 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
868 for (
auto drbIt = m_drbMap.begin(); drbIt != m_drbMap.end(); ++drbIt)
871 if (drbIt->second->m_rlc->GetObject<
NrRlcAm>())
880 m_rrc->m_x2SapProvider->SendSnStatusTransfer(sst);
886 NS_LOG_FUNCTION(
this);
887 return BuildRadioResourceConfigDedicated();
893 NS_LOG_FUNCTION(
this);
897 auto targetComponentCarrier = m_rrc->m_componentCarrierPhyConf.at(componentCarrierId);
905 targetComponentCarrier->GetDlBandwidth();
907 targetComponentCarrier->GetUlBandwidth();
909 if (m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
914 for (
auto& it : m_rrc->m_componentCarrierPhyConf)
916 uint8_t ccId = it.first;
918 if (ccId == m_componentCarrierId)
923 else if (ccId < m_componentCarrierId)
939NrUeManager::SendPacket(uint8_t bid, Ptr<Packet> p)
941 NS_LOG_FUNCTION(
this << p << (uint16_t)bid);
944 params.
rnti = m_rnti;
945 params.
lcid = Bid2Lcid(bid);
946 uint8_t drbid = Bid2Drbid(bid);
948 auto it = m_drbMap.find(drbid);
949 if (it != m_drbMap.end())
951 Ptr<NrDataRadioBearerInfo> bearerInfo = GetDataRadioBearerInfo(drbid);
954 NS_LOG_INFO(
"Send packet to PDCP layer");
964 NS_LOG_FUNCTION(
this << p << (uint16_t)bid);
967 case INITIAL_RANDOM_ACCESS:
968 case CONNECTION_SETUP:
969 NS_LOG_WARN(
"not connected, discarding packet");
972 case CONNECTED_NORMALLY:
973 case CONNECTION_RECONFIGURATION:
974 case CONNECTION_REESTABLISHMENT:
975 case HANDOVER_PREPARATION:
976 case HANDOVER_PATH_SWITCH: {
977 NS_LOG_INFO(
"queueing data on PDCP for transmission over the air");
982 case HANDOVER_JOINING: {
984 NS_LOG_INFO(
"buffering data");
985 m_packetBuffer.emplace_back(bid, p);
989 case HANDOVER_LEAVING: {
990 NS_LOG_INFO(
"forwarding data to target gNB over X2-U");
991 uint8_t drbid = Bid2Drbid(bid);
993 params.
sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
995 params.
gtpTeid = GetDataRadioBearerInfo(drbid)->m_gtpTeid;
997 m_rrc->m_x2SapProvider->SendUeData(params);
1002 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1007std::vector<NrEpcX2Sap::ErabToBeSetupItem>
1010 NS_LOG_FUNCTION(
this);
1011 std::vector<NrEpcX2Sap::ErabToBeSetupItem> ret;
1012 for (
auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1015 etbsi.
erabId = it->second->m_epsBearerIdentity;
1019 etbsi.
gtpTeid = it->second->m_gtpTeid;
1020 ret.push_back(etbsi);
1028 NS_LOG_FUNCTION(
this);
1031 case HANDOVER_PATH_SWITCH:
1032 NS_LOG_INFO(
"Send UE CONTEXT RELEASE from target gNB to source gNB");
1038 if (!m_rrc->HasCellId(m_sourceCellId))
1040 m_rrc->m_x2SapProvider->SendUeContextRelease(ueCtxReleaseParams);
1044 NS_LOG_INFO(
"Not sending UE CONTEXT RELEASE because handover is internal");
1045 m_rrc->DoRecvUeContextRelease(ueCtxReleaseParams);
1047 SwitchToState(CONNECTED_NORMALLY);
1048 m_rrc->m_handoverEndOkTrace(m_imsi,
1049 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1054 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1062 NS_LOG_FUNCTION(
this << cellId);
1065 case HANDOVER_PREPARATION:
1066 NS_ASSERT(cellId == m_targetCellId);
1067 NS_LOG_INFO(
"target gNB sent HO preparation failure, aborting HO");
1068 SwitchToState(CONNECTED_NORMALLY);
1070 case HANDOVER_LEAVING:
1071 NS_ASSERT(cellId == m_targetCellId);
1072 NS_LOG_INFO(
"target gNB sent HO preparation failure, aborting HO");
1073 m_handoverLeavingTimeout.Cancel();
1078 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1086 NS_LOG_FUNCTION(
this);
1092 status.
txSn = erabIt->dlPdcpSn;
1093 status.
rxSn = erabIt->ulPdcpSn;
1094 uint8_t drbId = Bid2Drbid(erabIt->erabId);
1095 auto drbIt = m_drbMap.find(drbId);
1096 NS_ASSERT_MSG(drbIt != m_drbMap.end(),
"could not find DRBID " << (uint32_t)drbId);
1097 drbIt->second->m_pdcp->SetStatus(status);
1104 NS_LOG_FUNCTION(
this);
1105 NS_ASSERT_MSG(m_state == HANDOVER_LEAVING,
"method unexpected in state " << ToString(m_state));
1106 m_handoverLeavingTimeout.Cancel();
1112 NS_LOG_FUNCTION(
this);
1113 NS_ASSERT_MSG(m_state == HANDOVER_JOINING,
"method unexpected in state " << ToString(m_state));
1114 m_handoverJoiningTimeout.Cancel();
1121 NS_LOG_FUNCTION(
this << (uint32_t)m_rnti);
1125 m_rrc->m_rrcSapUser->SendRrcConnectionRelease(m_rnti, msg);
1132 m_rrc->DoRecvIdealUeContextRemoveRequest(m_rnti);
1140 NS_LOG_FUNCTION(
this);
1141 m_srb0->m_rlc->SetNrRlcSapUser(params.
srb0SapUser);
1142 m_srb1->m_pdcp->SetNrPdcpSapUser(params.
srb1SapUser);
1148 NS_LOG_FUNCTION(
this);
1151 case INITIAL_RANDOM_ACCESS: {
1152 m_connectionRequestTimeout.Cancel();
1154 if (m_rrc->m_admitRrcConnectionRequest)
1162 m_rrc->m_rrcSapUser->SendRrcConnectionSetup(m_rnti, msg2);
1165 m_connectionSetupTimeout = Simulator::Schedule(m_rrc->m_connectionSetupTimeoutDuration,
1169 SwitchToState(CONNECTION_SETUP);
1173 NS_LOG_INFO(
"rejecting connection request for RNTI " << m_rnti);
1178 m_rrc->m_rrcSapUser->SendRrcConnectionReject(m_rnti, rejectMsg);
1180 m_connectionRejectedTimeout =
1181 Simulator::Schedule(m_rrc->m_connectionRejectedTimeoutDuration,
1185 SwitchToState(CONNECTION_REJECTED);
1191 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1199 NS_LOG_FUNCTION(
this);
1202 case CONNECTION_SETUP:
1203 m_connectionSetupTimeout.Cancel();
1204 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1206 m_pendingRrcConnectionReconfiguration =
true;
1207 m_pendingStartDataRadioBearers =
true;
1210 if (m_rrc->m_s1SapProvider !=
nullptr)
1212 m_rrc->m_s1SapProvider->InitialUeMessage(m_imsi, m_rnti);
1213 SwitchToState(ATTACH_REQUEST);
1217 SwitchToState(CONNECTED_NORMALLY);
1219 m_rrc->m_connectionEstablishedTrace(m_imsi,
1220 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1225 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1234 NS_LOG_FUNCTION(
this);
1237 case CONNECTION_RECONFIGURATION:
1239 if (m_needPhyMacConfiguration)
1245 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1247 m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
1250 m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(req.
m_rnti,
1254 m_rrc->m_cphySapProvider.at(i)->SetPa(m_rnti, paDouble);
1257 m_needPhyMacConfiguration =
false;
1259 SwitchToState(CONNECTED_NORMALLY);
1260 m_rrc->m_connectionReconfigurationTrace(
1262 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1268 case CONNECTED_NORMALLY:
1269 case HANDOVER_LEAVING:
1270 NS_LOG_INFO(
"ignoring RecvRrcConnectionReconfigurationCompleted in state "
1271 << ToString(m_state));
1274 case HANDOVER_JOINING: {
1275 m_handoverJoiningTimeout.Cancel();
1277 while (!m_packetBuffer.empty())
1279 NS_LOG_LOGIC(
"dequeueing data from buffer");
1280 std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1281 uint8_t bid = bidPacket.first;
1282 Ptr<Packet> p = bidPacket.second;
1284 NS_LOG_LOGIC(
"queueing data on PDCP for transmission over the air");
1287 m_packetBuffer.pop_front();
1290 NS_LOG_INFO(
"Send PATH SWITCH REQUEST to the MME");
1292 params.
rnti = m_rnti;
1293 params.
cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1295 SwitchToState(HANDOVER_PATH_SWITCH);
1296 for (
auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1300 b.
teid = it->second->m_gtpTeid;
1303 m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1308 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1317 NS_LOG_FUNCTION(
this);
1320 case CONNECTED_NORMALLY:
1323 case HANDOVER_LEAVING:
1324 m_handoverLeavingTimeout.Cancel();
1328 NS_FATAL_ERROR(
"method unexpected in state " << ToString(m_state));
1335 m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1336 SwitchToState(CONNECTION_REESTABLISHMENT);
1343 NS_LOG_FUNCTION(
this);
1344 SwitchToState(CONNECTED_NORMALLY);
1351 NS_LOG_FUNCTION(
this << (uint16_t)measId);
1353 "measId " << (uint16_t)measId <<
" haveMeasResultNeighCells "
1358 NS_LOG_LOGIC(
"serving cellId "
1359 << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) <<
" RSRP "
1367 NS_LOG_LOGIC(
"neighbour cellId " << it->physCellId <<
" RSRP "
1368 << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1370 << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1373 if ((m_rrc->m_handoverManagementSapProvider !=
nullptr) &&
1374 (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1377 m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.
measResults);
1380 if ((m_rrc->m_ccmRrcSapProvider !=
nullptr) &&
1381 (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1384 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.
measResults);
1387 if ((m_rrc->m_anrSapProvider !=
nullptr) &&
1388 (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1391 m_rrc->m_anrSapProvider->ReportUeMeas(msg.
measResults);
1396 m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.
measResults);
1398 m_rrc->m_recvMeasurementReportTrace(m_imsi,
1399 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1410 NS_LOG_FUNCTION(
this << m_rnti);
1415 m_needPhyMacConfiguration =
true;
1426 NS_LOG_FUNCTION(
this);
1427 if (params.
lcid > 2)
1433 params.
pdcpSdu->AddPacketTag(tag);
1434 m_rrc->m_forwardUpCallback(params.
pdcpSdu);
1453 return m_componentCarrierId;
1465 NS_LOG_FUNCTION(
this);
1467 for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1469 m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1473 case INITIAL_RANDOM_ACCESS:
1493 NS_LOG_FUNCTION(
this);
1496 m_needPhyMacConfiguration =
true;
1505 NS_LOG_FUNCTION(
this);
1506 m_connectionRequestTimeout.Cancel();
1507 m_connectionRejectedTimeout.Cancel();
1508 m_connectionSetupTimeout.Cancel();
1509 m_handoverJoiningTimeout.Cancel();
1510 m_handoverLeavingTimeout.Cancel();
1516 NS_LOG_FUNCTION(
this);
1520 res.
targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1530 NS_LOG_FUNCTION(
this);
1534 res.
sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1542NrUeManager::AddDataRadioBearerInfo(Ptr<NrDataRadioBearerInfo> drbInfo)
1544 NS_LOG_FUNCTION(
this);
1545 const uint8_t MAX_DRB_ID = 32;
1546 for (
int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1547 drbid = (drbid + 1) % MAX_DRB_ID)
1551 if (m_drbMap.find(drbid) == m_drbMap.end())
1553 m_drbMap.insert(std::pair<uint8_t, Ptr<NrDataRadioBearerInfo>>(drbid, drbInfo));
1554 drbInfo->m_drbIdentity = drbid;
1555 m_lastAllocatedDrbid = drbid;
1560 NS_FATAL_ERROR(
"no more data radio bearer ids available");
1564Ptr<NrDataRadioBearerInfo>
1565NrUeManager::GetDataRadioBearerInfo(uint8_t drbid)
1567 NS_LOG_FUNCTION(
this << (uint32_t)drbid);
1568 NS_ASSERT(0 != drbid);
1569 auto it = m_drbMap.find(drbid);
1570 NS_ABORT_IF(it == m_drbMap.end());
1575NrUeManager::RemoveDataRadioBearerInfo(uint8_t drbid)
1577 NS_LOG_FUNCTION(
this << (uint32_t)drbid);
1578 auto it = m_drbMap.find(drbid);
1579 NS_ASSERT_MSG(it != m_drbMap.end(),
1580 "request to remove radio bearer with unknown drbid " << drbid);
1584NrRrcSap::RrcConnectionReconfiguration
1585NrUeManager::BuildRrcConnectionReconfiguration()
1587 NS_LOG_FUNCTION(
this);
1588 NrRrcSap::RrcConnectionReconfiguration msg{};
1589 msg.rrcTransactionIdentifier = GetNewRrcTransactionIdentifier();
1590 msg.haveRadioResourceConfigDedicated =
true;
1591 msg.radioResourceConfigDedicated = BuildRadioResourceConfigDedicated();
1592 msg.haveMobilityControlInfo =
false;
1593 msg.haveMeasConfig =
true;
1594 msg.measConfig = m_rrc->m_ueMeasConfig;
1595 if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1597 m_caSupportConfigured =
true;
1598 NS_LOG_FUNCTION(
this <<
"CA not configured. Configure now!");
1599 msg.haveNonCriticalExtension =
true;
1600 msg.nonCriticalExtension = BuildNonCriticalExtensionConfigurationCa();
1601 NS_LOG_FUNCTION(
this <<
" haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1605 msg.haveNonCriticalExtension =
false;
1611NrRrcSap::RadioResourceConfigDedicated
1612NrUeManager::BuildRadioResourceConfigDedicated()
1614 NS_LOG_FUNCTION(
this);
1615 NrRrcSap::RadioResourceConfigDedicated rrcd;
1619 NrRrcSap::SrbToAddMod stam;
1620 stam.srbIdentity = m_srb1->m_srbIdentity;
1621 stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1622 rrcd.srbToAddModList.push_back(stam);
1625 for (
auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1627 NrRrcSap::DrbToAddMod dtam;
1628 dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1629 dtam.drbIdentity = it->second->m_drbIdentity;
1630 dtam.rlcConfig = it->second->m_rlcConfig;
1631 dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1632 dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1633 rrcd.drbToAddModList.push_back(dtam);
1636 rrcd.havePhysicalConfigDedicated =
true;
1637 rrcd.physicalConfigDedicated = m_physicalConfigDedicated;
1642NrUeManager::GetNewRrcTransactionIdentifier()
1644 NS_LOG_FUNCTION(
this);
1645 ++m_lastRrcTransactionIdentifier;
1646 m_lastRrcTransactionIdentifier %= 4;
1647 return m_lastRrcTransactionIdentifier;
1651NrUeManager::Lcid2Drbid(uint8_t lcid)
1653 NS_ASSERT(lcid > 2);
1658NrUeManager::Drbid2Lcid(uint8_t drbid)
1664NrUeManager::Lcid2Bid(uint8_t lcid)
1666 NS_ASSERT(lcid > 2);
1671NrUeManager::Bid2Lcid(uint8_t bid)
1677NrUeManager::Drbid2Bid(uint8_t drbid)
1683NrUeManager::Bid2Drbid(uint8_t bid)
1689NrUeManager::SwitchToState(State newState)
1691 NS_LOG_FUNCTION(
this << ToString(newState));
1692 State oldState = m_state;
1694 NS_LOG_INFO(
this <<
" IMSI " << m_imsi <<
" RNTI " << m_rnti <<
" NrUeManager "
1695 << ToString(oldState) <<
" --> " << ToString(newState));
1696 m_stateTransitionTrace(m_imsi,
1697 m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1704 case INITIAL_RANDOM_ACCESS:
1705 case HANDOVER_JOINING:
1706 NS_FATAL_ERROR(
"cannot switch to an initial state");
1709 case CONNECTION_SETUP:
1710 case ATTACH_REQUEST:
1713 case CONNECTED_NORMALLY: {
1714 if (m_pendingRrcConnectionReconfiguration)
1718 if (m_pendingStartDataRadioBearers && m_caSupportConfigured)
1725 case CONNECTION_RECONFIGURATION:
1726 case CONNECTION_REESTABLISHMENT:
1727 case HANDOVER_LEAVING:
1733NrRrcSap::NonCriticalExtensionConfiguration
1734NrUeManager::BuildNonCriticalExtensionConfigurationCa()
1736 NS_LOG_FUNCTION(
this);
1737 NrRrcSap::NonCriticalExtensionConfiguration ncec;
1739 for (
auto& it : m_rrc->m_componentCarrierPhyConf)
1741 uint8_t ccId = it.first;
1743 if (ccId == m_componentCarrierId)
1748 else if (ccId < m_componentCarrierId)
1754 Ptr<BandwidthPartGnb> eNbCcm = it.second;
1755 NrRrcSap::SCellToAddMod component;
1756 component.sCellIndex = ccId;
1757 component.cellIdentification.physCellId = eNbCcm->GetCellId();
1758 component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1759 component.radioResourceConfigCommonSCell.haveNonUlConfiguration =
true;
1760 component.radioResourceConfigCommonSCell.nonUlConfiguration.dlBandwidth =
1761 eNbCcm->GetDlBandwidth();
1762 component.radioResourceConfigCommonSCell.nonUlConfiguration.antennaInfoCommon
1763 .antennaPortsCount = 0;
1764 component.radioResourceConfigCommonSCell.nonUlConfiguration.pdschConfigCommon
1765 .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1766 component.radioResourceConfigCommonSCell.nonUlConfiguration.pdschConfigCommon.pb = 0;
1767 component.radioResourceConfigCommonSCell.haveUlConfiguration =
true;
1768 component.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulCarrierFreq =
1769 eNbCcm->GetUlEarfcn();
1770 component.radioResourceConfigCommonSCell.ulConfiguration.ulFreqInfo.ulBandwidth =
1771 eNbCcm->GetUlBandwidth();
1772 component.radioResourceConfigCommonSCell.ulConfiguration.ulPowerControlCommonSCell.alpha =
1776 component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon
1777 .srsBandwidthConfig = 0;
1778 component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon
1779 .srsSubframeConfig = 0;
1780 component.radioResourceConfigCommonSCell.ulConfiguration.prachConfigSCell.index = 0;
1782 component.haveRadioResourceConfigDedicatedSCell =
true;
1783 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1784 .haveNonUlConfiguration =
true;
1785 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1786 .haveAntennaInfoDedicated =
true;
1787 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell.antennaInfo
1788 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1789 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1790 .crossCarrierSchedulingConfig =
false;
1791 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1792 .havePdschConfigDedicated =
true;
1793 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1794 .pdschConfigDedicated.pa = NrRrcSap::PdschConfigDedicated::dB0;
1795 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1796 .haveUlConfiguration =
true;
1797 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1798 .haveAntennaInfoUlDedicated =
true;
1799 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell.antennaInfoUl
1800 .transmissionMode = m_rrc->m_defaultTransmissionMode;
1801 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1802 .pushConfigDedicatedSCell.nPuschIdentity = 0;
1803 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1804 .ulPowerControlDedicatedSCell.pSrsOffset = 0;
1805 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1806 .haveSoundingRsUlConfigDedicated =
true;
1807 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1809 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1810 .soundingRsUlConfigDedicated.type = NrRrcSap::SoundingRsUlConfigDedicated::SETUP;
1811 component.radioResourceConfigDedicatedSCell.physicalConfigDedicatedSCell
1812 .soundingRsUlConfigDedicated.srsBandwidth = 0;
1814 ncec.sCellToAddModList.push_back(component);
1824NS_OBJECT_ENSURE_REGISTERED(NrGnbRrc);
1827 : m_x2SapProvider(nullptr),
1828 m_cmacSapProvider(0),
1829 m_handoverManagementSapProvider(nullptr),
1830 m_ccmRrcSapProvider(nullptr),
1831 m_anrSapProvider(nullptr),
1832 m_rrcSapUser(nullptr),
1833 m_macSapProvider(nullptr),
1834 m_s1SapProvider(nullptr),
1835 m_cphySapProvider(0),
1836 m_configured(false),
1837 m_lastAllocatedRnti(0),
1838 m_lastAllocatedConfigurationIndex(0),
1839 m_reconfigureUes(false),
1840 m_numberOfComponentCarriers(0),
1841 m_carriersConfigured(false)
1843 NS_LOG_FUNCTION(
this);
1857 NS_ASSERT_MSG(!m_carriersConfigured,
"Secondary carriers can be configured only once.");
1858 m_componentCarrierPhyConf = ccPhyConf;
1859 NS_ABORT_MSG_IF(m_numberOfComponentCarriers != m_componentCarrierPhyConf.size(),
1860 " Number of component carriers "
1861 "are not equal to the number of he component carrier configuration provided");
1863 for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1868 m_carriersConfigured =
true;
1869 Object::DoInitialize();
1874 NS_LOG_FUNCTION(
this);
1878NrGnbRrc::DoDispose()
1880 NS_LOG_FUNCTION(
this);
1881 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1883 delete m_cphySapUser[i];
1884 delete m_cmacSapUser[i];
1887 m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1888 m_cphySapUser.clear();
1890 m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1891 m_cmacSapUser.clear();
1893 delete m_handoverManagementSapUser;
1894 delete m_ccmRrcSapUser;
1895 delete m_anrSapUser;
1896 delete m_rrcSapProvider;
1905 TypeId(
"ns3::NrGnbRrc")
1906 .SetParent<Object>()
1909 .AddAttribute(
"UeMap",
1910 "List of NrUeManager by C-RNTI.",
1912 MakeObjectMapAccessor(&NrGnbRrc::m_ueMap),
1913 MakeObjectMapChecker<NrUeManager>())
1914 .AddAttribute(
"DefaultTransmissionMode",
1915 "The default UEs' transmission mode (0: SISO)",
1917 MakeUintegerAccessor(&NrGnbRrc::m_defaultTransmissionMode),
1918 MakeUintegerChecker<uint8_t>())
1920 "EpsBearerToRlcMapping",
1921 "Specify which type of RLC will be used for each type of EPS bearer.",
1922 EnumValue(RLC_SM_ALWAYS),
1923 MakeEnumAccessor<NrEpsBearerToRlcMapping_t>(&NrGnbRrc::m_epsBearerToRlcMapping),
1924 MakeEnumChecker(RLC_SM_ALWAYS,
1931 "PacketErrorRateBased"))
1932 .AddAttribute(
"SystemInformationPeriodicity",
1933 "The interval for sending system information (Time value)",
1934 TimeValue(MilliSeconds(80)),
1935 MakeTimeAccessor(&NrGnbRrc::m_systemInformationPeriodicity),
1939 .AddAttribute(
"ConnectionRequestTimeoutDuration",
1940 "After a RA attempt, if no RRC CONNECTION REQUEST is "
1941 "received before this time, the UE context is destroyed. "
1942 "Must account for reception of RAR and transmission of "
1943 "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1944 "timer should not be greater than T300 timer at UE RRC",
1945 TimeValue(MilliSeconds(15)),
1946 MakeTimeAccessor(&NrGnbRrc::m_connectionRequestTimeoutDuration),
1947 MakeTimeChecker(MilliSeconds(1), MilliSeconds(15)))
1948 .AddAttribute(
"ConnectionSetupTimeoutDuration",
1949 "After accepting connection request, if no RRC CONNECTION "
1950 "SETUP COMPLETE is received before this time, the UE "
1951 "context is destroyed. Must account for the UE's reception "
1952 "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1954 TimeValue(MilliSeconds(150)),
1955 MakeTimeAccessor(&NrGnbRrc::m_connectionSetupTimeoutDuration),
1957 .AddAttribute(
"ConnectionRejectedTimeoutDuration",
1958 "Time to wait between sending a RRC CONNECTION REJECT and "
1959 "destroying the UE context",
1960 TimeValue(MilliSeconds(30)),
1961 MakeTimeAccessor(&NrGnbRrc::m_connectionRejectedTimeoutDuration),
1963 .AddAttribute(
"HandoverJoiningTimeoutDuration",
1964 "After accepting a handover request, if no RRC CONNECTION "
1965 "RECONFIGURATION COMPLETE is received before this time, the "
1966 "UE context is destroyed. Must account for reception of "
1967 "X2 HO REQ ACK by source eNB, transmission of the Handover "
1968 "Command, non-contention-based random access and reception "
1969 "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
1970 TimeValue(MilliSeconds(200)),
1971 MakeTimeAccessor(&NrGnbRrc::m_handoverJoiningTimeoutDuration),
1973 .AddAttribute(
"HandoverLeavingTimeoutDuration",
1974 "After issuing a Handover Command, if neither RRC "
1975 "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
1976 "been previously received, the UE context is destroyed.",
1977 TimeValue(MilliSeconds(500)),
1978 MakeTimeAccessor(&NrGnbRrc::m_handoverLeavingTimeoutDuration),
1982 .AddAttribute(
"QRxLevMin",
1983 "One of information transmitted within the SIB1 message, "
1984 "indicating the required minimum RSRP level that any UE must "
1985 "receive from this cell before it is allowed to camp to this "
1986 "cell. The default value -70 corresponds to -140 dBm and is "
1987 "the lowest possible value as defined by Section 6.3.4 of "
1988 "3GPP TS 36.133. This restriction, however, only applies to "
1989 "initial cell selection and EPC-enabled simulation.",
1990 TypeId::ATTR_GET | TypeId::ATTR_CONSTRUCT,
1992 MakeIntegerAccessor(&NrGnbRrc::m_qRxLevMin),
1993 MakeIntegerChecker<int8_t>(-70, -22))
1994 .AddAttribute(
"NumberOfComponentCarriers",
1995 "Number of Component Carriers",
1997 MakeIntegerAccessor(&NrGnbRrc::m_numberOfComponentCarriers),
1998 MakeIntegerChecker<int16_t>(nr::MIN_NO_CC, nr::MAX_NO_CC))
2001 .AddAttribute(
"AdmitHandoverRequest",
2002 "Whether to admit an X2 handover request from another eNB",
2004 MakeBooleanAccessor(&NrGnbRrc::m_admitHandoverRequest),
2005 MakeBooleanChecker())
2006 .AddAttribute(
"AdmitRrcConnectionRequest",
2007 "Whether to admit a connection request from a UE",
2009 MakeBooleanAccessor(&NrGnbRrc::m_admitRrcConnectionRequest),
2010 MakeBooleanChecker())
2013 .AddAttribute(
"RsrpFilterCoefficient",
2014 "Determines the strength of smoothing effect induced by "
2015 "layer 3 filtering of RSRP in all attached UE; "
2016 "if set to 0, no layer 3 filtering is applicable",
2019 MakeUintegerAccessor(&NrGnbRrc::m_rsrpFilterCoefficient),
2020 MakeUintegerChecker<uint8_t>(0))
2021 .AddAttribute(
"RsrqFilterCoefficient",
2022 "Determines the strength of smoothing effect induced by "
2023 "layer 3 filtering of RSRQ in all attached UE; "
2024 "if set to 0, no layer 3 filtering is applicable",
2027 MakeUintegerAccessor(&NrGnbRrc::m_rsrqFilterCoefficient),
2028 MakeUintegerChecker<uint8_t>(0))
2031 .AddTraceSource(
"NewUeContext",
2032 "Fired upon creation of a new UE context.",
2033 MakeTraceSourceAccessor(&NrGnbRrc::m_newUeContextTrace),
2034 "ns3::NrGnbRrc::NewUeContextTracedCallback")
2035 .AddTraceSource(
"ConnectionEstablished",
2036 "Fired upon successful RRC connection establishment.",
2037 MakeTraceSourceAccessor(&NrGnbRrc::m_connectionEstablishedTrace),
2038 "ns3::NrGnbRrc::ConnectionHandoverTracedCallback")
2039 .AddTraceSource(
"ConnectionReconfiguration",
2040 "trace fired upon RRC connection reconfiguration",
2041 MakeTraceSourceAccessor(&NrGnbRrc::m_connectionReconfigurationTrace),
2042 "ns3::NrGnbRrc::ConnectionHandoverTracedCallback")
2043 .AddTraceSource(
"HandoverStart",
2044 "trace fired upon start of a handover procedure",
2045 MakeTraceSourceAccessor(&NrGnbRrc::m_handoverStartTrace),
2046 "ns3::NrGnbRrc::HandoverStartTracedCallback")
2047 .AddTraceSource(
"HandoverEndOk",
2048 "trace fired upon successful termination of a handover procedure",
2049 MakeTraceSourceAccessor(&NrGnbRrc::m_handoverEndOkTrace),
2050 "ns3::NrGnbRrc::ConnectionHandoverTracedCallback")
2051 .AddTraceSource(
"RecvMeasurementReport",
2052 "trace fired when measurement report is received",
2053 MakeTraceSourceAccessor(&NrGnbRrc::m_recvMeasurementReportTrace),
2054 "ns3::NrGnbRrc::ReceiveReportTracedCallback")
2055 .AddTraceSource(
"NotifyConnectionRelease",
2056 "trace fired when an UE is released",
2057 MakeTraceSourceAccessor(&NrGnbRrc::m_connectionReleaseTrace),
2058 "ns3::NrGnbRrc::ConnectionHandoverTracedCallback")
2059 .AddTraceSource(
"RrcTimeout",
2060 "trace fired when a timer expires",
2061 MakeTraceSourceAccessor(&NrGnbRrc::m_rrcTimeoutTrace),
2062 "ns3::NrGnbRrc::TimerExpiryTracedCallback")
2064 "HandoverFailureNoPreamble",
2065 "trace fired upon handover failure due to non-allocation of non-contention based "
2066 "preamble at gNB for UE to handover due to max count reached",
2067 MakeTraceSourceAccessor(&NrGnbRrc::m_handoverFailureNoPreambleTrace),
2068 "ns3::NrGnbRrc::HandoverFailureTracedCallback")
2070 "HandoverFailureMaxRach",
2071 "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2072 MakeTraceSourceAccessor(&NrGnbRrc::m_handoverFailureMaxRachTrace),
2073 "ns3::NrGnbRrc::HandoverFailureTracedCallback")
2075 "HandoverFailureLeaving",
2076 "trace fired upon handover failure due to handover leaving timeout at source eNB",
2077 MakeTraceSourceAccessor(&NrGnbRrc::m_handoverFailureLeavingTrace),
2078 "ns3::NrGnbRrc::HandoverFailureTracedCallback")
2080 "HandoverFailureJoining",
2081 "trace fired upon handover failure due to handover joining timeout at target eNB",
2082 MakeTraceSourceAccessor(&NrGnbRrc::m_handoverFailureJoiningTrace),
2083 "ns3::NrGnbRrc::HandoverFailureTracedCallback");
2090 NS_LOG_FUNCTION(
this << s);
2091 m_x2SapProvider = s;
2097 NS_LOG_FUNCTION(
this);
2104 NS_LOG_FUNCTION(
this << s);
2105 m_cmacSapProvider.at(0) = s;
2111 NS_LOG_FUNCTION(
this << s);
2112 if (m_cmacSapProvider.size() > pos)
2114 m_cmacSapProvider.at(pos) = s;
2118 m_cmacSapProvider.push_back(s);
2119 NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2126 NS_LOG_FUNCTION(
this);
2127 return m_cmacSapUser.at(0);
2133 NS_LOG_FUNCTION(
this);
2134 return m_cmacSapUser.at(pos);
2140 NS_LOG_FUNCTION(
this << s);
2141 m_handoverManagementSapProvider = s;
2147 NS_LOG_FUNCTION(
this);
2148 return m_handoverManagementSapUser;
2154 NS_LOG_FUNCTION(
this << s);
2155 m_ccmRrcSapProvider = s;
2161 NS_LOG_FUNCTION(
this);
2162 return m_ccmRrcSapUser;
2168 NS_LOG_FUNCTION(
this << s);
2169 m_anrSapProvider = s;
2175 NS_LOG_FUNCTION(
this);
2176 return m_anrSapUser;
2182 NS_LOG_FUNCTION(
this << s);
2189 NS_LOG_FUNCTION(
this);
2190 return m_rrcSapProvider;
2196 NS_LOG_FUNCTION(
this);
2197 m_macSapProvider = s;
2203 m_s1SapProvider = s;
2215 NS_LOG_FUNCTION(
this << s);
2216 if (!m_cphySapProvider.empty())
2218 m_cphySapProvider.at(0) = s;
2222 m_cphySapProvider.push_back(s);
2229 NS_LOG_FUNCTION(
this);
2230 return m_cphySapUser.at(0);
2236 NS_LOG_FUNCTION(
this << s);
2237 if (m_cphySapProvider.size() > pos)
2239 m_cphySapProvider.at(pos) = s;
2243 m_cphySapProvider.push_back(s);
2244 NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2251 NS_LOG_FUNCTION(
this);
2252 return m_cphySapUser.at(pos);
2258 NS_LOG_FUNCTION(
this << (uint32_t)rnti);
2259 auto it = m_ueMap.find(rnti);
2260 return (it != m_ueMap.end());
2266 NS_LOG_FUNCTION(
this << (uint32_t)rnti);
2267 NS_ASSERT(0 != rnti);
2268 auto it = m_ueMap.find(rnti);
2269 NS_ASSERT_MSG(it != m_ueMap.end(),
"UE manager for RNTI " << rnti <<
" not found");
2276 NS_LOG_FUNCTION(
this);
2283 "Measurement identities and reporting configuration should not have different quantity");
2285 if (Simulator::Now() != Seconds(0))
2287 NS_FATAL_ERROR(
"AddUeMeasReportConfig may not be called after the simulation has run");
2299 "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2309 "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2318 "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2328 "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2333 NS_FATAL_ERROR(
"unsupported triggerQuantity");
2337 if (config.
purpose != NrRrcSap::ReportConfigEutra::REPORT_STRONGEST_CELLS)
2339 NS_FATAL_ERROR(
"Only REPORT_STRONGEST_CELLS purpose is supported");
2344 NS_LOG_WARN(
"reportQuantity = BOTH will be used instead of the given reportQuantity");
2357 std::vector<uint8_t> measIds;
2367 measIdToAddMod.
measId = measId;
2372 measIds.push_back(measId);
2381 auto it = ccPhyConf.begin();
2382 NS_ASSERT(it != ccPhyConf.end());
2383 uint16_t ulBandwidth = it->second->GetUlBandwidth();
2384 uint16_t dlBandwidth = it->second->GetDlBandwidth();
2385 uint32_t ulEarfcn = it->second->GetUlEarfcn();
2386 uint32_t dlEarfcn = it->second->GetDlEarfcn();
2387 NS_LOG_FUNCTION(
this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2388 NS_ASSERT_MSG(!m_configured,
"NrGnbRrc::ConfigureCell called more than once");
2390 for (
const auto& it : ccPhyConf)
2392 m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2393 it.second->GetDlBandwidth());
2394 m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2395 it.second->GetDlEarfcn());
2396 m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2397 m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2398 it.second->GetDlBandwidth());
2401 m_dlEarfcn = dlEarfcn;
2402 m_ulEarfcn = ulEarfcn;
2403 m_dlBandwidth = dlBandwidth;
2404 m_ulBandwidth = ulBandwidth;
2411 for (
const auto& it : ccPhyConf)
2433 m_sib1.reserve(ccPhyConf.size());
2434 for (
const auto& it : ccPhyConf)
2438 mib.
numerology = it.second->GetPhy()->GetNumerology();
2441 m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2451 m_sib1.push_back(sib1);
2452 m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2460 Simulator::Schedule(MilliSeconds(16), &NrGnbRrc::SendSystemInformation,
this);
2462 m_configured =
true;
2469 m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2470 m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2477 m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2478 m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2484 NS_LOG_FUNCTION(
this << cellId);
2485 for (
auto& it : m_componentCarrierPhyConf)
2487 if (it.second->GetCellId() == cellId)
2492 NS_FATAL_ERROR(
"Cell " << cellId <<
" not found in CC map");
2498 NS_LOG_FUNCTION(
this << +componentCarrierId);
2499 return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2505 for (
auto& it : m_componentCarrierPhyConf)
2507 if (it.second->GetCellId() == cellId)
2518 NS_LOG_FUNCTION(
this << packet);
2520 bool found = packet->RemovePacketTag(tag);
2521 NS_ASSERT_MSG(found,
"no NrEpsBearerTag found in packet to be sent");
2524 NS_LOG_INFO(
"Sending a packet of " << packet->GetSize() <<
" bytes to IMSI "
2525 << ueManager->GetImsi() <<
", RNTI " << ueManager->GetRnti()
2526 <<
", BID " << (uint16_t)tag.
GetBid());
2527 ueManager->SendData(tag.
GetBid(), packet);
2535 m_forwardUpCallback = cb;
2541 NS_LOG_FUNCTION(
this << rnti);
2542 NS_ASSERT_MSG(
GetUeManager(rnti)->GetState() == NrUeManager::INITIAL_RANDOM_ACCESS,
2543 "ConnectionRequestTimeout in unexpected state "
2548 "ConnectionRequestTimeout");
2555 NS_LOG_FUNCTION(
this << rnti);
2556 NS_ASSERT_MSG(
GetUeManager(rnti)->GetState() == NrUeManager::CONNECTION_SETUP,
2557 "ConnectionSetupTimeout in unexpected state "
2562 "ConnectionSetupTimeout");
2569 NS_LOG_FUNCTION(
this << rnti);
2570 NS_ASSERT_MSG(
GetUeManager(rnti)->GetState() == NrUeManager::CONNECTION_REJECTED,
2571 "ConnectionRejectedTimeout in unexpected state "
2576 "ConnectionRejectedTimeout");
2583 NS_LOG_FUNCTION(
this << rnti);
2584 NS_ASSERT_MSG(
GetUeManager(rnti)->GetState() == NrUeManager::HANDOVER_JOINING,
2585 "HandoverJoiningTimeout in unexpected state "
2587 m_handoverFailureJoiningTrace(
2611 NS_LOG_FUNCTION(
this << rnti);
2612 NS_ASSERT_MSG(
GetUeManager(rnti)->GetState() == NrUeManager::HANDOVER_LEAVING,
2613 "HandoverLeavingTimeout in unexpected state "
2615 m_handoverFailureLeavingTrace(
2630 ueManager->SendRrcConnectionRelease();
2637 NS_LOG_FUNCTION(
this << rnti << cellId);
2638 NS_LOG_LOGIC(
"Request to send HANDOVER REQUEST");
2639 NS_ASSERT(m_configured);
2642 ueManager->PrepareHandover(cellId);
2648 NS_LOG_FUNCTION(
this << rnti);
2653NrGnbRrc::DoRecvRrcConnectionRequest(uint16_t rnti, NrRrcSap::RrcConnectionRequest msg)
2655 NS_LOG_FUNCTION(
this << rnti);
2660NrGnbRrc::DoRecvRrcConnectionSetupCompleted(uint16_t rnti,
2661 NrRrcSap::RrcConnectionSetupCompleted msg)
2663 NS_LOG_FUNCTION(
this << rnti);
2664 GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2668NrGnbRrc::DoRecvRrcConnectionReconfigurationCompleted(
2670 NrRrcSap::RrcConnectionReconfigurationCompleted msg)
2672 NS_LOG_FUNCTION(
this << rnti);
2673 GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2677NrGnbRrc::DoRecvRrcConnectionReestablishmentRequest(
2679 NrRrcSap::RrcConnectionReestablishmentRequest msg)
2681 NS_LOG_FUNCTION(
this << rnti);
2682 GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2686NrGnbRrc::DoRecvRrcConnectionReestablishmentComplete(
2688 NrRrcSap::RrcConnectionReestablishmentComplete msg)
2690 NS_LOG_FUNCTION(
this << rnti);
2691 GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2695NrGnbRrc::DoRecvMeasurementReport(uint16_t rnti, NrRrcSap::MeasurementReport msg)
2697 NS_LOG_FUNCTION(
this << rnti);
2702NrGnbRrc::DoInitialContextSetupRequest(NrEpcGnbS1SapUser::InitialContextSetupRequestParameters msg)
2704 NS_LOG_FUNCTION(
this);
2706 ueManager->InitialContextSetupRequest();
2710NrGnbRrc::DoRecvIdealUeContextRemoveRequest(uint16_t rnti)
2712 NS_LOG_FUNCTION(
this << rnti);
2719 if (ueManager->GetState() == NrUeManager::HANDOVER_JOINING)
2721 m_handoverFailureMaxRachTrace(
2731 NrEpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2735 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2742NrGnbRrc::DoDataRadioBearerSetupRequest(
2743 NrEpcGnbS1SapUser::DataRadioBearerSetupRequestParameters request)
2745 NS_LOG_FUNCTION(
this);
2746 Ptr<NrUeManager> ueManager =
GetUeManager(request.rnti);
2747 ueManager->SetupDataRadioBearer(request.bearer,
2750 request.transportLayerAddress);
2754NrGnbRrc::DoPathSwitchRequestAcknowledge(
2755 NrEpcGnbS1SapUser::PathSwitchRequestAcknowledgeParameters params)
2757 NS_LOG_FUNCTION(
this);
2758 Ptr<NrUeManager> ueManager =
GetUeManager(params.rnti);
2759 ueManager->SendUeContextRelease();
2763NrGnbRrc::DoRecvHandoverRequest(NrEpcX2SapUser::HandoverRequestParams req)
2765 NS_LOG_FUNCTION(
this);
2767 NS_LOG_LOGIC(
"Recv X2 message: HANDOVER REQUEST");
2769 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << req.oldGnbUeX2apId);
2770 NS_LOG_LOGIC(
"sourceCellId = " << req.sourceCellId);
2771 NS_LOG_LOGIC(
"targetCellId = " << req.targetCellId);
2772 NS_LOG_LOGIC(
"mmeUeS1apId = " << req.mmeUeS1apId);
2775 if (!m_admitHandoverRequest || IsMaxSrsReached())
2777 NS_LOG_INFO(
"rejecting handover request from cellId " << req.sourceCellId);
2778 NrEpcX2Sap::HandoverPreparationFailureParams res;
2779 res.oldGnbUeX2apId = req.oldGnbUeX2apId;
2780 res.sourceCellId = req.sourceCellId;
2781 res.targetCellId = req.targetCellId;
2783 res.criticalityDiagnostics = 0;
2789 uint16_t rnti = AddUe(NrUeManager::HANDOVER_JOINING, componentCarrierId);
2791 ueManager->SetSource(req.sourceCellId, req.oldGnbUeX2apId);
2792 ueManager->SetImsi(req.mmeUeS1apId);
2793 NrGnbCmacSapProvider::AllocateNcRaPreambleReturnValue anrcrv =
2794 m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2799 <<
" failed to allocate a preamble for non-contention based RA => cannot accept HO");
2800 m_handoverFailureNoPreambleTrace(
2810 NrEpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2816 NrEpcX2SapProvider::HandoverRequestAckParams ackParams;
2817 ackParams.oldGnbUeX2apId = req.oldGnbUeX2apId;
2818 ackParams.newGnbUeX2apId = rnti;
2819 ackParams.sourceCellId = req.sourceCellId;
2820 ackParams.targetCellId = req.targetCellId;
2822 for (
auto it = req.bearers.begin(); it != req.bearers.end(); ++it)
2824 ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2827 it->transportLayerAddress);
2828 NrEpcX2Sap::ErabAdmittedItem i;
2829 i.erabId = it->erabId;
2830 ackParams.admittedBearers.push_back(i);
2833 NrRrcSap::RrcConnectionReconfiguration handoverCommand =
2834 ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2836 handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2837 handoverCommand.mobilityControlInfo.haveRachConfigDedicated =
true;
2838 handoverCommand.mobilityControlInfo.rachConfigDedicated.raPreambleIndex = anrcrv.raPreambleId;
2839 handoverCommand.mobilityControlInfo.rachConfigDedicated.raPrachMaskIndex =
2840 anrcrv.raPrachMaskIndex;
2842 NrGnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2843 handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.preambleInfo
2844 .numberOfRaPreambles = rc.numberOfRaPreambles;
2845 handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo
2846 .preambleTransMax = rc.preambleTransMax;
2847 handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.raSupervisionInfo
2848 .raResponseWindowSize = rc.raResponseWindowSize;
2849 handoverCommand.mobilityControlInfo.radioResourceConfigCommon.rachConfigCommon.txFailParam
2850 .connEstFailCount = rc.connEstFailCount;
2854 ackParams.rrcContext = encodedHandoverCommand;
2856 NS_LOG_LOGIC(
"Send X2 message: HANDOVER REQUEST ACK");
2858 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << ackParams.oldGnbUeX2apId);
2859 NS_LOG_LOGIC(
"newGnbUeX2apId = " << ackParams.newGnbUeX2apId);
2860 NS_LOG_LOGIC(
"sourceCellId = " << ackParams.sourceCellId);
2861 NS_LOG_LOGIC(
"targetCellId = " << ackParams.targetCellId);
2867NrGnbRrc::DoRecvHandoverRequestAck(NrEpcX2SapUser::HandoverRequestAckParams params)
2869 NS_LOG_FUNCTION(
this);
2871 NS_LOG_LOGIC(
"Recv X2 message: HANDOVER REQUEST ACK");
2873 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << params.oldGnbUeX2apId);
2874 NS_LOG_LOGIC(
"newGnbUeX2apId = " << params.newGnbUeX2apId);
2875 NS_LOG_LOGIC(
"sourceCellId = " << params.sourceCellId);
2876 NS_LOG_LOGIC(
"targetCellId = " << params.targetCellId);
2878 uint16_t rnti = params.oldGnbUeX2apId;
2880 ueManager->RecvHandoverRequestAck(params);
2884NrGnbRrc::DoRecvHandoverPreparationFailure(NrEpcX2SapUser::HandoverPreparationFailureParams params)
2886 NS_LOG_FUNCTION(
this);
2888 NS_LOG_LOGIC(
"Recv X2 message: HANDOVER PREPARATION FAILURE");
2890 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << params.oldGnbUeX2apId);
2891 NS_LOG_LOGIC(
"sourceCellId = " << params.sourceCellId);
2892 NS_LOG_LOGIC(
"targetCellId = " << params.targetCellId);
2893 NS_LOG_LOGIC(
"cause = " << params.cause);
2894 NS_LOG_LOGIC(
"criticalityDiagnostics = " << params.criticalityDiagnostics);
2896 uint16_t rnti = params.oldGnbUeX2apId;
2902 ueManager->RecvHandoverPreparationFailure(params.targetCellId);
2907NrGnbRrc::DoRecvSnStatusTransfer(NrEpcX2SapUser::SnStatusTransferParams params)
2909 NS_LOG_FUNCTION(
this);
2911 NS_LOG_LOGIC(
"Recv X2 message: SN STATUS TRANSFER");
2913 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << params.oldGnbUeX2apId);
2914 NS_LOG_LOGIC(
"newGnbUeX2apId = " << params.newGnbUeX2apId);
2915 NS_LOG_LOGIC(
"erabsSubjectToStatusTransferList size = "
2916 << params.erabsSubjectToStatusTransferList.size());
2918 uint16_t rnti = params.newGnbUeX2apId;
2924 ueManager->RecvSnStatusTransfer(params);
2929NrGnbRrc::DoRecvUeContextRelease(NrEpcX2SapUser::UeContextReleaseParams params)
2931 NS_LOG_FUNCTION(
this);
2933 NS_LOG_LOGIC(
"Recv X2 message: UE CONTEXT RELEASE");
2935 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << params.oldGnbUeX2apId);
2936 NS_LOG_LOGIC(
"newGnbUeX2apId = " << params.newGnbUeX2apId);
2938 uint16_t rnti = params.oldGnbUeX2apId;
2949NrGnbRrc::DoRecvLoadInformation(NrEpcX2SapUser::LoadInformationParams params)
2951 NS_LOG_FUNCTION(
this);
2953 NS_LOG_LOGIC(
"Recv X2 message: LOAD INFORMATION");
2955 NS_LOG_LOGIC(
"Number of cellInformationItems = " << params.cellInformationList.size());
2959NrGnbRrc::DoRecvResourceStatusUpdate(NrEpcX2SapUser::ResourceStatusUpdateParams params)
2961 NS_LOG_FUNCTION(
this);
2963 NS_LOG_LOGIC(
"Recv X2 message: RESOURCE STATUS UPDATE");
2966 "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
2968 NS_ASSERT(
"Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
2972NrGnbRrc::DoRecvUeData(NrEpcX2SapUser::UeDataParams params)
2974 NS_LOG_FUNCTION(
this);
2976 NS_LOG_LOGIC(
"Recv UE DATA FORWARDING through X2 interface");
2977 NS_LOG_LOGIC(
"sourceCellId = " << params.sourceCellId);
2978 NS_LOG_LOGIC(
"targetCellId = " << params.targetCellId);
2979 NS_LOG_LOGIC(
"gtpTeid = " << params.gtpTeid);
2980 NS_LOG_LOGIC(
"ueData = " << params.ueData);
2981 NS_LOG_LOGIC(
"ueData size = " << params.ueData->GetSize());
2983 auto teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
2984 if (teidInfoIt != m_x2uTeidInfoMap.end())
2986 GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
2990 NS_FATAL_ERROR(
"X2-U data received but no X2uTeidInfo found");
2995NrGnbRrc::DoRecvHandoverCancel(NrEpcX2SapUser::HandoverCancelParams params)
2997 NS_LOG_FUNCTION(
this);
2999 NS_LOG_LOGIC(
"Recv X2 message: HANDOVER CANCEL");
3001 NS_LOG_LOGIC(
"oldGnbUeX2apId = " << params.oldGnbUeX2apId);
3002 NS_LOG_LOGIC(
"newGnbUeX2apId = " << params.newGnbUeX2apId);
3003 NS_LOG_LOGIC(
"sourceCellId = " << params.sourceCellId);
3004 NS_LOG_LOGIC(
"targetCellId = " << params.targetCellId);
3005 NS_LOG_LOGIC(
"cause = " << params.cause);
3007 uint16_t rnti = params.newGnbUeX2apId;
3011 ueManager->RecvHandoverCancel(params);
3012 GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3017NrGnbRrc::DoAllocateTemporaryCellRnti(uint8_t componentCarrierId)
3019 NS_LOG_FUNCTION(
this << +componentCarrierId);
3021 if (IsMaxSrsReached())
3023 NS_LOG_WARN(
"Not enough SRS configuration indices, UE context not created");
3026 return AddUe(NrUeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3030NrGnbRrc::DoRrcConfigurationUpdateInd(NrGnbCmacSapUser::UeConfig cmacParams)
3032 Ptr<NrUeManager> ueManager =
GetUeManager(cmacParams.m_rnti);
3033 ueManager->CmacUeConfigUpdateInd(cmacParams);
3037NrGnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid,
bool success)
3039 NS_LOG_FUNCTION(
this << (uint32_t)rnti);
3040 NS_FATAL_ERROR(
"not implemented");
3044NrGnbRrc::DoAddUeMeasReportConfigForHandover(NrRrcSap::ReportConfigEutra reportConfig)
3046 NS_LOG_FUNCTION(
this);
3048 m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3053NrGnbRrc::DoAddUeMeasReportConfigForComponentCarrier(NrRrcSap::ReportConfigEutra reportConfig)
3055 NS_LOG_FUNCTION(
this);
3057 m_componentCarrierMeasIds.insert(measId);
3062NrGnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3064 m_numberOfComponentCarriers = numberOfComponentCarriers;
3068NrGnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3070 NS_LOG_FUNCTION(
this << rnti << targetCellId);
3072 bool isHandoverAllowed =
true;
3075 NS_ASSERT_MSG(ueManager,
"Cannot find UE context with RNTI " << rnti);
3077 if (m_anrSapProvider !=
nullptr && !
HasCellId(targetCellId))
3080 bool noHo = m_anrSapProvider->
GetNoHo(targetCellId);
3081 bool noX2 = m_anrSapProvider->
GetNoX2(targetCellId);
3082 NS_LOG_DEBUG(
this <<
" cellId="
3084 <<
" targetCellId=" << targetCellId <<
" NRT.NoHo=" << noHo
3085 <<
" NRT.NoX2=" << noX2);
3089 isHandoverAllowed =
false;
3090 NS_LOG_LOGIC(
this <<
" handover to cell " << targetCellId <<
" is not allowed by ANR");
3094 if (ueManager->GetState() != NrUeManager::CONNECTED_NORMALLY)
3096 isHandoverAllowed =
false;
3097 NS_LOG_LOGIC(
this <<
" handover is not allowed because the UE"
3098 <<
" rnti=" << rnti <<
" is in " << ToString(ueManager->GetState())
3102 if (isHandoverAllowed)
3105 ueManager->PrepareHandover(targetCellId);
3110NrGnbRrc::DoAddUeMeasReportConfigForAnr(NrRrcSap::ReportConfigEutra reportConfig)
3112 NS_LOG_FUNCTION(
this);
3114 m_anrMeasIds.insert(measId);
3119NrGnbRrc::DoSetPdschConfigDedicated(uint16_t rnti,
3120 NrRrcSap::PdschConfigDedicated pdschConfigDedicated)
3122 NS_LOG_FUNCTION(
this);
3124 ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3128NrGnbRrc::DoSendLoadInformation(NrEpcX2Sap::LoadInformationParams params)
3130 NS_LOG_FUNCTION(
this);
3138 NS_LOG_FUNCTION(
this);
3141 for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3143 if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3150 NS_ASSERT_MSG(found,
"no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3151 m_lastAllocatedRnti = rnti;
3152 Ptr<NrUeManager> ueManager = CreateObject<NrUeManager>(
this, rnti, state, componentCarrierId);
3153 m_ccmRrcSapProvider->
AddUe(rnti, (uint8_t)state);
3154 m_ueMap.insert(std::pair<uint16_t, Ptr<NrUeManager>>(rnti, ueManager));
3155 ueManager->Configure();
3157 NS_LOG_DEBUG(
this <<
" New UE RNTI " << rnti <<
" cellId " << cellId <<
" srs CI "
3158 << ueManager->GetSrsConfigurationIndex());
3159 m_newUeContextTrace(cellId, rnti);
3164NrGnbRrc::RemoveUe(uint16_t rnti)
3166 NS_LOG_FUNCTION(
this << (uint32_t)rnti);
3167 auto it = m_ueMap.find(rnti);
3168 NS_ASSERT_MSG(it != m_ueMap.end(),
"request to remove UE info with unknown rnti " << rnti);
3169 uint64_t imsi = it->second->GetImsi();
3170 uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3172 it->second->CancelPendingEvents();
3174 m_connectionReleaseTrace(imsi,
3178 for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3180 m_cmacSapProvider.at(i)->RemoveUe(rnti);
3181 m_cphySapProvider.at(i)->RemoveUe(rnti);
3183 if (m_s1SapProvider !=
nullptr)
3187 m_ccmRrcSapProvider->
RemoveUe(rnti);
3191 RemoveSrsConfigurationIndex(srsCi);
3198NrGnbRrc::GetRlcType(NrEpsBearer bearer)
3200 switch (m_epsBearerToRlcMapping)
3212 if (bearer.GetPacketErrorLossRate() > 1.0e-5)
3229 NS_LOG_FUNCTION(
this << cellId);
3231 if (m_anrSapProvider !=
nullptr)
3240 NS_LOG_FUNCTION(
this << csgId << csgIndication);
3241 for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3242 componentCarrierId++)
3244 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3245 m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3246 m_cphySapProvider.at(componentCarrierId)
3247 ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3252NrGnbRrc::GetNewSrsConfigurationIndex()
3254 NS_LOG_FUNCTION(
this << m_ueSrsConfigurationIndexSet.size());
3256 uint16_t configIndex = 0;
3257 if (IsMaxSrsReached() && m_unusedUeSrsConfigurationIndexSet.empty())
3261 NS_ABORT_MSG(
"Out of SRS configuration indices");
3263 else if (!IsMaxSrsReached() && m_unusedUeSrsConfigurationIndexSet.empty())
3267 configIndex = m_lastAllocatedConfigurationIndex++;
3268 m_ueSrsConfigurationIndexSet.emplace(m_lastAllocatedConfigurationIndex);
3273 auto it = m_unusedUeSrsConfigurationIndexSet.begin();
3275 m_unusedUeSrsConfigurationIndexSet.erase(it);
3276 m_ueSrsConfigurationIndexSet.emplace(configIndex);
3282NrGnbRrc::RemoveSrsConfigurationIndex(uint16_t srcCi)
3284 NS_LOG_FUNCTION(
this << srcCi);
3285 auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3286 NS_ASSERT_MSG(it != m_ueSrsConfigurationIndexSet.end(),
3287 "request to remove unknown SRS CI " << srcCi);
3288 m_unusedUeSrsConfigurationIndexSet.emplace(*it);
3289 m_ueSrsConfigurationIndexSet.erase(it);
3293NrGnbRrc::IsMaxSrsReached()
const
3295 return m_cmacSapProvider.at(0)->IsMaxSrsReached();
3299NrGnbRrc::GetLogicalChannelGroup(NrEpsBearer bearer)
3301 if (bearer.GetResourceType() > 0)
3312NrGnbRrc::GetLogicalChannelPriority(NrEpsBearer bearer)
3318NrGnbRrc::SendSystemInformation()
3322 for (
auto& it : m_componentCarrierPhyConf)
3324 uint8_t ccId = it.first;
3326 NrRrcSap::SystemInformation si;
3328 si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3329 si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3330 si.sib2.radioResourceConfigCommon.pdschConfigCommon.referenceSignalPower =
3331 m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3332 si.sib2.radioResourceConfigCommon.pdschConfigCommon.pb = 0;
3334 NrGnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3335 NrRrcSap::RachConfigCommon rachConfigCommon;
3336 rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3337 rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3338 rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3339 rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3340 si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3349 Simulator::Schedule(m_systemInformationPeriodicity, &NrGnbRrc::SendSystemInformation,
this);
3353NrGnbRrc::IsRandomAccessCompleted(uint16_t rnti)
3355 NS_LOG_FUNCTION(
this << (uint32_t)rnti);
3357 switch (ueManager->GetState())
3359 case NrUeManager::CONNECTED_NORMALLY:
3360 case NrUeManager::CONNECTION_RECONFIGURATION:
GNB bandwidth part representation.
Service Access Point (SAP) offered by the ANR instance to the eNodeB RRC instance.
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 void AddNeighbourRelation(uint16_t cellId)=0
Add a new Neighbour Relation entry.
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.
Service Access Point (SAP) offered by the Component Carrier Manager (CCM) instance to the eNodeB RRC ...
virtual void RemoveUe(uint16_t rnti)=0
Remove an existing UE.
virtual void AddUe(uint16_t rnti, uint8_t state)=0
Add a new UE in the NrGnbComponentCarrierManager.
Service Access Point (SAP) offered by the eNodeB RRC instance to the component carrier manager (CCM) ...
virtual void UeContextRelease(uint16_t rnti)=0
virtual void DoSendReleaseIndication(uint64_t imsi, uint16_t rnti, uint8_t bearerId)=0
Triggers epc-gnb-application to send ERAB Release Indication message towards MME.
virtual void SendLoadInformation(LoadInformationParams params)=0
virtual void SendHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
virtual void SendHandoverCancel(HandoverCancelParams params)=0
Send handover Cancel to the target gNB.
virtual void SendHandoverRequestAck(HandoverRequestAckParams params)=0
This class contains the specification of EPS Bearers.
uint16_t GetPacketDelayBudgetMs() const
NrGbrQosInformation gbrQosInfo
GBR QOS information.
uint8_t GetResourceType() const
@ GBR_CONV_VOICE
GBR Conversational Voice.
void SetRnti(uint16_t rnti)
void SetForwardUpCallback(Callback< void, Ptr< Packet > > cb)
friend class NrMemberEpcGnbS1SapUser< NrGnbRrc >
allow MemberNrGnbRrcSapProvider<NrGnbRrc> class friend access
void ConfigureCarriers(std::map< uint8_t, Ptr< BandwidthPartGnb > > ccPhyConf)
Configure carriers.
NrGnbRrcSapProvider * GetNrGnbRrcSapProvider()
void ConnectionRejectedTimeout(uint16_t rnti)
friend class MemberNrAnrSapUser< NrGnbRrc >
allow MemberNrAnrSapUser<NrGnbRrc> class friend access
Ptr< NrUeManager > GetUeManager(uint16_t rnti)
void SetNrAnrSapProvider(NrAnrSapProvider *s)
friend class MemberNrCcmRrcSapUser< NrGnbRrc >
allow MemberNrCcmRrcSapUser<NrGnbRrc> class friend access
NrCcmRrcSapUser * GetNrCcmRrcSapUser()
uint8_t CellToComponentCarrierId(uint16_t cellId)
std::vector< uint8_t > AddUeMeasReportConfig(NrRrcSap::ReportConfigEutra config)
Add a new UE measurement reporting configuration.
friend class GnbRrcMemberNrGnbCmacSapUser
allow GnbRrcMemberNrGnbCmacSapUser class friend access
void AddX2Neighbour(uint16_t cellId)
NrHandoverManagementSapUser * GetNrHandoverManagementSapUser()
void SetNrCcmRrcSapProvider(NrCcmRrcSapProvider *s)
void HandoverJoiningTimeout(uint16_t rnti)
void ConnectionSetupTimeout(uint16_t rnti)
void SetNrGnbCphySapProvider(NrGnbCphySapProvider *s)
bool HasUeManager(uint16_t rnti) const
bool HasCellId(uint16_t cellId) const
NrGnbCmacSapUser * GetNrGnbCmacSapUser()
void SetEpcX2SapProvider(NrEpcX2SapProvider *s)
void DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
This function acts as an interface to trigger Release indication messages towards gNB and EPC.
void SetCellId(uint16_t m_cellId)
bool SendData(Ptr< Packet > p)
static TypeId GetTypeId()
Get the type ID.
void SendHandoverRequest(uint16_t rnti, uint16_t cellId)
friend class NrEpcX2SpecificEpcX2SapUser< NrGnbRrc >
allow NrMemberEpcGnbS1SapUser<NrGnbRrc> class friend access
uint16_t ComponentCarrierToCellId(uint8_t componentCarrierId)
NrGnbCphySapUser * GetNrGnbCphySapUser()
NrAnrSapUser * GetNrAnrSapUser()
void ConnectionRequestTimeout(uint16_t rnti)
friend class MemberNrHandoverManagementSapUser< NrGnbRrc >
allow MemberNrHandoverManagementSapUser<NrGnbRrc> class friend access
NrEpcGnbS1SapUser * GetS1SapUser()
void SetNrGnbRrcSapUser(NrGnbRrcSapUser *s)
void ConfigureCell(const std::map< uint8_t, Ptr< BandwidthPartGnb > > &ccPhyConf)
Configure cell-specific parameters.
NrEpcX2SapUser * GetEpcX2SapUser()
void SetCsgId(uint32_t csgId, bool csgIndication)
Associate this RRC entity with a particular CSG information.
void HandoverLeavingTimeout(uint16_t rnti)
void SetNrMacSapProvider(NrMacSapProvider *s)
void SetS1SapProvider(NrEpcGnbS1SapProvider *s)
friend class MemberNrGnbRrcSapProvider< NrGnbRrc >
allow MemberNrGnbRrcSapProvider<NrGnbRrc> class friend access
void SetNrHandoverManagementSapProvider(NrHandoverManagementSapProvider *s)
void SetNrGnbCmacSapProvider(NrGnbCmacSapProvider *s)
Part of the RRC protocol. This Service Access Point (SAP) is used to let the gNB RRC receive a messag...
Part of the RRC protocol. This Service Access Point (SAP) is used by the gNB RRC to send messages to ...
virtual void SendSystemInformation(uint16_t cellId, SystemInformation msg)=0
Send a SystemInformation message to all attached UEs during a system information acquisition procedur...
virtual void RemoveUe(uint16_t rnti)=0
Remove UE function.
virtual Ptr< Packet > EncodeHandoverCommand(RrcConnectionReconfiguration msg)=0
Encode handover command.
Service Access Point (SAP) offered by the handover algorithm instance to the eNodeB RRC instance.
Service Access Point (SAP) offered by the eNodeB RRC instance to the handover algorithm instance.
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
static TypeId GetTypeId()
Get the type ID.
void SetNrMacSapProvider(NrMacSapProvider *s)
static TypeId GetTypeId()
Get the type ID.
static TypeId GetTypeId()
Get the type ID.
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
NrRrcSap::RrcConnectionReconfiguration GetRrcConnectionReconfigurationForHandover(uint8_t componentCarrierId)
std::vector< NrEpcX2Sap::ErabToBeSetupItem > GetErabList()
void RecvRrcConnectionSetupCompleted(NrRrcSap::RrcConnectionSetupCompleted msg)
void SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
uint16_t GetSrsConfigurationIndex() const
void PrepareHandover(uint16_t cellId)
void RecvRrcConnectionRequest(NrRrcSap::RrcConnectionRequest msg)
void RecvHandoverCancel(NrEpcX2SapUser::HandoverCancelParams params)
void DoReceivePdcpSdu(NrPdcpSapUser::ReceivePdcpSduParameters params)
NrEpcX2Sap::HandoverPreparationFailureParams BuildHoPrepFailMsg()
build handover preparation failure message
void CancelPendingEvents()
void ScheduleRrcConnectionReconfiguration()
void SendData(uint8_t bid, Ptr< Packet > p)
void ConfigureMacPhy()
Configure MAC and PHY aspects.
void ReleaseDataRadioBearer(uint8_t drbid)
void Configure()
Perform post-creation configuration steps.
uint8_t GetComponentCarrierId() const
void CmacUeConfigUpdateInd(NrGnbCmacSapUser::UeConfig cmacParams)
void ConfigureSrb0()
Initialize the gNB side of SRB0.
void StartDataRadioBearers()
void RecvHandoverPreparationFailure(uint16_t cellId)
void InitialContextSetupRequest()
NrEpcX2Sap::HandoverCancelParams BuildHoCancelMsg()
build handover cancel message
void RecvRrcConnectionReestablishmentComplete(NrRrcSap::RrcConnectionReestablishmentComplete msg)
void SetImsi(uint64_t imsi)
void ConfigureSrb1()
Initialize the gNB side of SRB1.
void RecvRrcConnectionReconfigurationCompleted(NrRrcSap::RrcConnectionReconfigurationCompleted msg)
void SendRrcConnectionRelease()
This function acts as an interface to trigger the connection release towards gNB, EPC and UE.
void RecvHandoverRequestAck(NrEpcX2SapUser::HandoverRequestAckParams params)
void RecvUeContextRelease(NrEpcX2SapUser::UeContextReleaseParams params)
void RecvSnStatusTransfer(NrEpcX2SapUser::SnStatusTransferParams params)
void CompleteSetupUe(NrGnbRrcSapProvider::CompleteSetupUeParameters params)
void ConfigureSap()
Initialize the SAP objects.
void RecvRrcConnectionReestablishmentRequest(NrRrcSap::RrcConnectionReestablishmentRequest msg)
void SetSrsConfigurationIndex(uint16_t srsConfIndex)
void RecordDataRadioBearersToBeStarted()
void RecvMeasurementReport(NrRrcSap::MeasurementReport msg)
void SendUeContextRelease()
static TypeId GetTypeId()
Get the type ID.
void SetPdschConfigDedicated(NrRrcSap::PdschConfigDedicated pdschConfigDedicated)
NrRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo()
void RecvIdealUeContextRemoveRequest(uint16_t rnti)
void SetupDataRadioBearer(NrEpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress)
friend class NrPdcpSpecificNrPdcpSapUser< NrUeManager >
allow NrPdcpSpecificNrPdcpSapUser<NrUeManager> class friend access
BearerToBeSwitched structure.
uint8_t epsBearerId
Bearer ID.
PathSwitchRequestParameters structure.
std::list< BearerToBeSwitched > bearersToBeSwitched
list of bearers to be switched
uint32_t mmeUeS1Id
mmeUeS1Id in practice, we use the IMSI
NrEpsBearer erabLevelQosParameters
E-RAB level QOS parameters.
bool dlForwarding
DL forwarding.
Ipv4Address transportLayerAddress
transport layer address
ErabsSubjectToStatusTransferItem structure.
uint16_t dlPdcpSn
DL PDCP SN.
uint16_t ulPdcpSn
UL PDCP SN.
Parameters of the HANDOVER CANCEL message.
uint16_t targetCellId
target cell ID
uint16_t oldGnbUeX2apId
old gNB UE X2 AP ID
uint16_t newGnbUeX2apId
new gNB UE X2 AP ID
uint16_t sourceCellId
source cell ID
Parameters of the HANDOVER PREPARATION FAILURE message.
uint16_t oldGnbUeX2apId
old gNB UE X2 AP ID
uint16_t criticalityDiagnostics
criticality diagnostics
uint16_t targetCellId
target cell ID
uint16_t sourceCellId
source cell ID
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
std::vector< ErabNotAdmittedItem > notAdmittedBearers
not admitted bearers
Ptr< Packet > rrcContext
RRC context.
uint16_t newGnbUeX2apId
new gNB UE X2 AP ID
uint16_t oldGnbUeX2apId
old gNB UE X2 AP ID
uint16_t targetCellId
target cell ID
uint16_t sourceCellId
source cell ID
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
Parameters of the HANDOVER REQUEST message.
uint16_t sourceCellId
source cell ID
uint64_t ueAggregateMaxBitRateDownlink
UE aggregate max bit rate downlink.
uint16_t targetCellId
target cell ID
uint32_t mmeUeS1apId
MME UE S1 AP ID.
std::vector< ErabToBeSetupItem > bearers
bearers
Ptr< Packet > rrcContext
RRC context.
uint64_t ueAggregateMaxBitRateUplink
UE aggregate max bit rate uplink.
uint16_t oldGnbUeX2apId
old gNB UE X2 AP ID
Parameters of the SN STATUS TRANSFER message.
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
uint16_t oldGnbUeX2apId
old gNB UE X2 AP ID
uint16_t newGnbUeX2apId
new gNB UE X2 AP ID
uint16_t sourceCellId
source cell ID
uint16_t targetCellId
target cell ID
Parameters of the UE CONTEXT RELEASE message.
uint16_t oldGnbUeX2apId
old gNB UE X2 AP ID
uint16_t targetCellId
target cell ID
uint16_t sourceCellId
source cell ID
uint16_t newGnbUeX2apId
new gNB UE X2 AP ID
Parameters of the UE DATA primitive.
uint32_t gtpTeid
GTP TEID.
uint16_t targetCellId
target cell ID
uint16_t sourceCellId
source cell ID
Ptr< Packet > ueData
UE data.
AllocateNcRaPreambleReturnValue structure.
uint8_t raPrachMaskIndex
PRACH mask index.
bool valid
true if a valid RA config was allocated, false otherwise
uint8_t raPreambleId
random access preamble id
uint8_t connEstFailCount
the counter value for T300 timer expiration
uint8_t preambleTransMax
preamble transmit maximum
uint8_t raResponseWindowSize
RA response window size.
uint8_t numberOfRaPreambles
number of RA preambles
Parameters for [re]configuring the UE.
uint8_t m_transmissionMode
Parameters for [re]configuring the UE.
uint8_t m_transmissionMode
CompleteSetupUeParameters structure.
NrPdcpSapUser * srb1SapUser
SRB1 SAP user.
NrRlcSapUser * srb0SapUser
SRB0 SAP user.
SetupUeParameters structure.
NrPdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
NrRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
uint16_t rxSn
RX sequence number.
uint16_t txSn
TX sequence number.
uint8_t transmissionMode
transmission mode
SystemInformationBlockType1 sourceSystemInformationBlockType1
source system information block type 1
RadioResourceConfigDedicated sourceRadioResourceConfig
source radio resource config
MasterInformationBlock sourceMasterInformationBlock
source master information block
MeasConfig sourceMeasConfig
source measure config
uint16_t sourceUeIdentity
source UE identity
SystemInformationBlockType2 sourceSystemInformationBlockType2
source system information block type 2
uint32_t sourceDlCarrierFreq
source DL carrier frequency
uint16_t dlBandwidth
DL bandwidth.
uint16_t ulBandwidth
UL bandwidth.
uint32_t ulCarrierFreq
UL carrier frequency.
uint32_t dlCarrierFreq
DL carrier frequency.
int8_t qQualMin
INTEGER (-34..-3), actual value = IE value [dB].
int8_t qRxLevMin
INTEGER (-70..-22), actual value = IE value * 2 [dBm].
uint16_t ulBandwidth
UL bandwidth.
uint32_t ulCarrierFreq
UL carrier frequency.
HandoverPreparationInfo structure.
AsConfig asConfig
AS config.
std::list< ReportConfigToAddMod > reportConfigToAddModList
report config to add mod list
bool haveQuantityConfig
have quantity config?
bool haveSpeedStatePars
have speed state parameters?
std::list< MeasObjectToAddMod > measObjectToAddModList
measure object to add mod list
bool haveSmeasure
have S measure?
QuantityConfig quantityConfig
quantity config
bool haveMeasGapConfig
have measure gap config?
std::list< MeasIdToAddMod > measIdToAddModList
measure ID to add mod list
MeasIdToAddMod structure.
uint8_t measObjectId
measure object ID
uint8_t reportConfigId
report config ID
uint32_t carrierFreq
carrier frequency
uint16_t allowedMeasBandwidth
allowed measure bandwidth
uint8_t neighCellConfig
neighbor cell config
bool haveCellForWhichToReportCGI
have cell for which to report CGI?
bool presenceAntennaPort1
antenna port 1 present?
int8_t offsetFreq
offset frequency
MeasObjectToAddMod structure.
MeasObjectEutra measObjectEutra
measure object eutra
uint8_t measObjectId
measure object ID
uint8_t rsrpResult
the RSRP result
uint8_t rsrqResult
the RSRQ result
bool haveMeasResultNeighCells
have measure result neighbor cells
std::list< MeasResultServFreq > measResultServFreqList
MeasResultServFreqList-r10.
MeasResultPCell measResultPCell
measurement result primary cell
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
bool haveMeasResultServFreqList
has measResultServFreqList-r10
MeasurementReport structure.
MeasResults measResults
measure results
uint16_t newUeIdentity
new UE identity
RachConfigDedicated rachConfigDedicated
RACH config dedicated.
bool haveCarrierFreq
have carrier frequency?
uint16_t targetPhysCellId
target Phy cell ID
bool haveCarrierBandwidth
have carrier bandwidth?
bool haveRachConfigDedicated
Have RACH config dedicated?
CarrierBandwidthEutra carrierBandwidth
carrier bandwidth
CarrierFreqEutra carrierFreq
carrier frequency
RadioResourceConfigCommon radioResourceConfigCommon
radio resource config common
std::list< SCellToAddMod > sCellToAddModList
SCell to add mod list.
std::list< uint8_t > sCellToReleaseList
SCell to release list.
PdschConfigDedicated structure.
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
AntennaInfoDedicated antennaInfo
antenna info
bool havePdschConfigDedicated
have PDSCH config dedicated?
bool haveAntennaInfoDedicated
have antenna info dedicated?
uint32_t plmnIdentity
PLMN identity.
uint8_t numberOfRaPreambles
number of RA preambles
uint8_t filterCoefficientRSRP
filter coefficient RSRP
uint8_t filterCoefficientRSRQ
filter coefficient RSRQ
uint8_t raResponseWindowSize
RA response window size.
uint8_t preambleTransMax
preamble transmit maximum
PreambleInfo preambleInfo
preamble info
RaSupervisionInfo raSupervisionInfo
RA supervision info.
TxFailParam txFailParam
txFailParams
uint8_t raPreambleIndex
RA preamble index.
uint8_t raPrachMaskIndex
RA PRACH mask index.
RachConfigCommon rachConfigCommon
RACH config common.
RachConfigCommon rachConfigCommon
RACH config common.
RadioResourceConfigDedicated structure.
PhysicalConfigDedicated physicalConfigDedicated
physical config dedicated
std::list< uint8_t > drbToReleaseList
DRB to release list.
bool havePhysicalConfigDedicated
have physical config dedicated?
Specifies criteria for triggering of an E-UTRA measurement reporting event.
enum ns3::NrRrcSap::ReportConfigEutra::@5 triggerQuantity
Trigger type enumeration.
enum ns3::NrRrcSap::ReportConfigEutra::@6 reportQuantity
Report type enumeration.
@ RSRP
Reference Signal Received Power.
@ RSRQ
Reference Signal Received Quality.
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
@ EVENT_A4
Event A4: Neighbour becomes better than absolute threshold.
ThresholdEutra threshold2
Threshold for event A5.
enum ns3::NrRrcSap::ReportConfigEutra::@4 eventId
Event enumeration.
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
ReportConfigToAddMod structure.
uint8_t reportConfigId
report config ID
ReportConfigEutra reportConfigEutra
report config eutra
RrcConnectionReconfigurationCompleted structure.
RrcConnectionReconfiguration structure.
MobilityControlInfo mobilityControlInfo
mobility control info
bool haveNonCriticalExtension
bool haveMobilityControlInfo
have mobility control info
NonCriticalExtensionConfiguration nonCriticalExtension
bool haveMeasConfig
have measure config
RrcConnectionReestablishmentComplete structure.
RrcConnectionReestablishment structure.
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionReestablishmentRequest structure.
RrcConnectionReject structure.
uint8_t waitTime
wait time
RrcConnectionRelease structure.
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
RrcConnectionRequest structure.
uint64_t ueIdentity
UE identity.
RrcConnectionSetupCompleted structure.
RrcConnectionSetup structure.
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
uint16_t srsConfigIndex
SRS config index.
uint16_t srsBandwidth
SRS bandwidth.
enum ns3::NrRrcSap::ThresholdEutra::@2 choice
Threshold enumeration.
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
@ THRESHOLD_RSRP
RSRP is used for the threshold.
uint8_t connEstFailCount
Number of times that the UE detects T300 expiry on the same cell.