#Cause (please tell me if I’m wrong)
Although free5gc tried to communicate with new AMF and old AMF via NRF, free5gc could not obtain the information of old AMF from NRF. (Data could not be acquired from NRF because old AMF is undefined.)
#soure code
free5gc/NFs/amf/gmm/handler.go
// TODO (TS 23.502 4.2.2.2 step 4): if UE's 5g-GUTI is included & serving AMF has changed
// since last registration procedure, new AMF may invoke Namf_Communication_UEContextTransfer
// to old AMF, including the complete registration request nas msg, to request UE's SUPI & UE Context
if ue.ServingAmfChanged {
var transferReason models.TransferReason
switch ue.RegistrationType5GS {
case nasMessage.RegistrationType5GSInitialRegistration:
transferReason = models.TransferReason_INIT_REG
case nasMessage.RegistrationType5GSMobilityRegistrationUpdating:
fallthrough
case nasMessage.RegistrationType5GSPeriodicRegistrationUpdating:
transferReason = models.TransferReason_MOBI_REG
}
searchOpt := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{
Guami: optional.NewInterface(util.MarshToJsonString(guamiFromUeGuti)),
}
err := consumer.SearchAmfCommunicationInstance(ue, amfSelf.NrfUri, models.NfType_AMF, models.NfType_AMF, &searchOpt)
if err != nil {
ue.GmmLog.Errorf("[GMM] %+v", err)
gmm_message.SendRegistrationReject(ue.RanUe[anType], nasMessage.Cause5GMMUEIdentityCannotBeDerivedByTheNetwork, "")
return err
}
ueContextTransferRspData, problemDetails, err := consumer.UEContextTransferRequest(ue, anType, transferReason)
if problemDetails != nil {
if problemDetails.Cause == "INTEGRITY_CHECK_FAIL" || problemDetails.Cause == "CONTEXT_NOT_FOUND" {
ue.GmmLog.Warnf("Can not retrieve UE Context from old AMF[Cause: %s]", problemDetails.Cause)
} else {
ue.GmmLog.Warnf("UE Context Transfer Request Failed Problem[%+v]", problemDetails)
}
ue.SecurityContextAvailable = false // need to start authentication procedure later
} else if err != nil {
ue.GmmLog.Errorf("UE Context Transfer Request Error[%+v]", err)
gmm_message.SendRegistrationReject(ue.RanUe[anType], nasMessage.Cause5GMMUEIdentityCannotBeDerivedByTheNetwork, "")
} else {
ue.CopyDataFromUeContextModel(*ueContextTransferRspData.UeContext)
}
}
return nil
free5gc/NFs/amf/consumer/nf_discovery.go
func SearchAmfCommunicationInstance(ue *amf_context.AmfUe, nrfUri string, targetNfType,
requestNfType models.NfType, param *Nnrf_NFDiscovery.SearchNFInstancesParamOpts) (err error) {
resp, localErr := SendSearchNFInstances(nrfUri, targetNfType, requestNfType, param)
if localErr != nil {
err = localErr
return
}
// select the first AMF, TODO: select base on other info
var amfUri string
for _, nfProfile := range resp.NfInstances {
ue.TargetAmfProfile = &nfProfile
amfUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NAMF_COMM, models.NfServiceStatus_REGISTERED)
if amfUri != "" {
break
}
}
ue.TargetAmfUri = amfUri
if ue.TargetAmfUri == "" {
err = fmt.Errorf("AMF can not select an target AMF by NRF")
}
return
}
#3gpp
TS 23.502 4.2.2.2
step 4(Namf_Communication_UEContextTransfer)