Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/gmm/common/user_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ func AttachRanUeToAmfUeAndReleaseOldHandover(amfUe *context.AmfUe, sourceRanUe,
logger.GmmLog.Errorln("AttachRanUeToAmfUeAndReleaseOldHandover() is called but sourceRanUe is nil")
}
amfUe.AttachRanUe(targetRanUe)
if sourceRanUe != nil && sourceRanUe.Ran != nil &&
amfUe.OnGoing(sourceRanUe.Ran.AnType).Procedure == context.OnGoingProcedureN2Handover {
amfUe.SetOnGoing(sourceRanUe.Ran.AnType, &context.OnGoing{
Procedure: context.OnGoingProcedureNothing,
})
}
}

func ClearHoldingRanUe(ranUe *context.RanUe) {
Expand Down
29 changes: 28 additions & 1 deletion internal/ngap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ func handleInitialUEMessageMain(ran *context.AmfRan,
// last Registration Request procedure
// Described in TS 23.502 4.2.2.2.2 step 4 (without UDSF deployment)
ranUe.Log.Infof("find AmfUe [%q:%q]", idType, id)
// TODO: Redesign overlapping ongoing procedures before narrowing this to SMC-vs-N2 handover.
if procedure := amfUe.OnGoing(ran.AnType).Procedure; procedure == context.OnGoingProcedureN2Handover {
ranUe.Log.Warn("Reject InitialUEMessage because N2 handover is ongoing")
gmm_message.SendRegistrationReject(ranUe, nasMessage.Cause5GMMCongestion, "")
ngap_message.SendUEContextReleaseCommand(ranUe, context.UeContextN2NormalRelease,
ngapType.CausePresentNas, ngapType.CauseNasPresentNormalRelease)
return
}
ranUe.Log.Debugf("AmfUe Attach RanUe [RanUeNgapID: %d]", ranUe.RanUeNgapId)
ranUe.HoldingAmfUe = amfUe
} else if regReqType != nasMessage.RegistrationType5GSInitialRegistration {
Expand Down Expand Up @@ -1634,6 +1642,20 @@ func handleHandoverRequiredMain(ran *context.AmfRan,
return
}

// TODO: Redesign overlapping ongoing procedures before narrowing this to SMC-vs-N2 handover.
if procedure := amfUe.OnGoing(sourceUe.Ran.AnType).Procedure; procedure == context.OnGoingProcedureRegistration {
sourceUe.Log.Warn("Reject Handover Required while registration is ongoing")
cause = &ngapType.Cause{
Present: ngapType.CausePresentRadioNetwork,
RadioNetwork: &ngapType.CauseRadioNetwork{
Value: ngapType.CauseRadioNetworkPresentInteractionWithOtherProcedure,
},
}
hoFailCause = ngap.GetCauseErrorStr(cause)
ngap_message.SendHandoverPreparationFailure(sourceUe, *cause, nil)
return
}

amfUe.SetOnGoing(sourceUe.Ran.AnType, &context.OnGoing{
Procedure: context.OnGoingProcedureN2Handover,
})
Expand Down Expand Up @@ -1734,14 +1756,19 @@ func handleHandoverCancelMain(ran *context.AmfRan,
if cause != nil {
causePresent, causeValue = printAndGetCause(ran, cause)
}
amfUe := sourceUe.AmfUe
if amfUe != nil && amfUe.OnGoing(sourceUe.Ran.AnType).Procedure == context.OnGoingProcedureN2Handover {
amfUe.SetOnGoing(sourceUe.Ran.AnType, &context.OnGoing{
Procedure: context.OnGoingProcedureNothing,
})
}
targetUe := sourceUe.TargetUe
if targetUe == nil {
// Described in (23.502 4.11.1.2.3) step 2
// Todo : send to T-AMF invoke Namf_UeContextReleaseRequest(targetUe)
ran.Log.Error("N2 Handover between AMF has not been implemented yet")
} else {
ran.Log.Tracef("Target : RAN_UE_NGAP_ID[%d] AMF_UE_NGAP_ID[%d]", targetUe.RanUeNgapId, targetUe.AmfUeNgapId)
amfUe := sourceUe.AmfUe
if amfUe != nil {
amfUe.SmContextList.Range(func(key, value interface{}) bool {
pduSessionID := key.(int32)
Expand Down
8 changes: 5 additions & 3 deletions internal/ngap/message/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,11 @@ func SendHandoverPreparationFailure(sourceUe *context.RanUe, cause ngapType.Caus
sourceUe.Log.Error("amfUe is nil")
return
}
amfUe.SetOnGoing(sourceUe.Ran.AnType, &context.OnGoing{
Procedure: context.OnGoingProcedureNothing,
})
if amfUe.OnGoing(sourceUe.Ran.AnType).Procedure == context.OnGoingProcedureN2Handover {
amfUe.SetOnGoing(sourceUe.Ran.AnType, &context.OnGoing{
Procedure: context.OnGoingProcedureNothing,
})
}
pkt, err := BuildHandoverPreparationFailure(sourceUe, cause, criticalityDiagnostics)
if err != nil {
additionalCause = ngap_metrics.NGAP_MSG_BUILD_ERR
Expand Down
Loading