Skip to content

Commit

Permalink
send reroute nas msg if SendN1MessageNotifyAtAMFReAllocation failed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ianchen0119 authored Jan 4, 2024
1 parent 21aa437 commit 68013ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 13 additions & 3 deletions internal/gmm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
amfSelf := context.GetSelf()

if ue.RegistrationRequest.RequestedNSSAI != nil {
logger.GmmLog.Infof("RequestedNssai: %+v", ue.RegistrationRequest.RequestedNSSAI)
requestedNssai, err := nasConvert.RequestedNssaiToModels(ue.RegistrationRequest.RequestedNSSAI)
if err != nil {
return fmt.Errorf("Decode failed at RequestedNSSAI[%s]", err)
Expand Down Expand Up @@ -1128,6 +1129,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {

if !amfSelf.InPlmnSupportList(reqSnssai) {
needSliceSelection = true
logger.GmmLog.Warnf("RequestedNssai[%+v] is not supported by AMF", reqSnssai)
break
}
}
Expand Down Expand Up @@ -1198,6 +1200,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
}
}

sendReroute := true
err = consumer.SearchAmfCommunicationInstance(ue, amfSelf.NrfUri,
models.NfType_AMF, models.NfType_AMF, &searchTargetAmfQueryParam)
if err == nil {
Expand Down Expand Up @@ -1229,10 +1232,17 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
var n1Message bytes.Buffer
err = ue.RegistrationRequest.EncodeRegistrationRequest(&n1Message)
if err != nil {
return fmt.Errorf("re-encoding registration request message is failed: %w", err)
logger.GmmLog.Errorf("re-encoding registration request message is failed: %+v", err)
} else {
err = callback.SendN1MessageNotifyAtAMFReAllocation(ue, n1Message.Bytes(), &registerContext)
if err != nil {
logger.GmmLog.Errorf("send N1MessageNotify failed: %+v", err)
} else {
sendReroute = false
}
}
callback.SendN1MessageNotifyAtAMFReAllocation(ue, n1Message.Bytes(), &registerContext)
} else {
}
if sendReroute {
// Condition (B) Step 7: initial AMF can not find Target AMF via NRF -> Send Reroute NAS Request to RAN
allowedNssaiNgap := ngapConvert.AllowedNssaiToNgap(ue.AllowedNssai[anType])
ngap_message.SendRerouteNasRequest(ue, anType, nil, ue.RanUe[anType].InitialUEMessage, &allowedNssaiNgap)
Expand Down
5 changes: 4 additions & 1 deletion internal/sbi/producer/callback/n1n2message.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ func SendN1MessageNotify(ue *amf_context.AmfUe, n1class models.N1MessageClass, n
// TS 29.518 5.2.2.3.5.2
func SendN1MessageNotifyAtAMFReAllocation(
ue *amf_context.AmfUe, n1Msg []byte, registerContext *models.RegistrationContextContainer,
) {
) error {
logger.CommLog.Infoln("Send N1 Message Notify at AMF Re-allocation")
configuration := Namf_Communication.NewConfiguration()
client := Namf_Communication.NewAPIClient(configuration)

Expand Down Expand Up @@ -122,7 +123,9 @@ func SendN1MessageNotifyAtAMFReAllocation(
} else if err.Error() != httpResp.Status {
HttpLog.Errorln(err.Error())
}
return err
}
return nil
}

func SendN2InfoNotify(ue *amf_context.AmfUe, n2class models.N2InformationClass, n1Msg, n2Msg []byte) {
Expand Down

0 comments on commit 68013ee

Please sign in to comment.