From 7481562ad60fcd5e06f9580ad4e53a68fb8022a9 Mon Sep 17 00:00:00 2001 From: squishy me <69491904+Leon777-coder@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:53:17 +0800 Subject: [PATCH 1/7] Update handler.go --- internal/gmm/handler.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index 2c0fa29c..dc65b1b8 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1120,8 +1120,17 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { needSliceSelection = true break } - } + + reqSnssai := models.Snssai{ + Sst: requestedSnssai.ServingSnssai.Sst, + Sd: requestedSnssai.ServingSnssai.Sd, + } + if !amfSelf.InPlmnSupportList(reqSnssai) { + needSliceSelection = true + break + } + } if needSliceSelection { if ue.NssfUri == "" { for { From b65603e2e25f2b9f5f72d1ded92dafd219ca6507 Mon Sep 17 00:00:00 2001 From: Leon777-coder Date: Wed, 22 Nov 2023 11:02:39 +0000 Subject: [PATCH 2/7] fix: target AMF should not be self --- internal/gmm/handler.go | 11 +++++++++-- internal/sbi/consumer/nf_discovery.go | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index dc65b1b8..b9da73f7 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1120,12 +1120,19 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { needSliceSelection = true break } - - reqSnssai := models.Snssai{ + + reqSnssai := models.Snssai { Sst: requestedSnssai.ServingSnssai.Sst, Sd: requestedSnssai.ServingSnssai.Sd, } + if !amfSelf.InPlmnSupportList(reqSnssai) { + needSliceSelection = true + break + } + + } + if !amfSelf.InPlmnSupportList(reqSnssai) { needSliceSelection = true break diff --git a/internal/sbi/consumer/nf_discovery.go b/internal/sbi/consumer/nf_discovery.go index 421d4a0c..be8f7daf 100644 --- a/internal/sbi/consumer/nf_discovery.go +++ b/internal/sbi/consumer/nf_discovery.go @@ -99,6 +99,9 @@ func SearchAmfCommunicationInstance(ue *amf_context.AmfUe, nrfUri string, target // select the first AMF, TODO: select base on other info var amfUri string for _, nfProfile := range resp.NfInstances { + if nfProfile.NfInstanceId == amf_context.GetSelf().NfId { + continue + } ue.TargetAmfProfile = &nfProfile amfUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NAMF_COMM, models.NfServiceStatus_REGISTERED) if amfUri != "" { From e65bdd9fd245937f3a3e80c33661c49d44e59fbd Mon Sep 17 00:00:00 2001 From: Leon777-coder Date: Wed, 22 Nov 2023 11:13:52 +0000 Subject: [PATCH 3/7] style: linter error --- internal/gmm/handler.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index b9da73f7..6f436989 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1121,7 +1121,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { break } - reqSnssai := models.Snssai { + reqSnssai := models.Snssai{ Sst: requestedSnssai.ServingSnssai.Sst, Sd: requestedSnssai.ServingSnssai.Sd, } @@ -1130,14 +1130,8 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { needSliceSelection = true break } - } - if !amfSelf.InPlmnSupportList(reqSnssai) { - needSliceSelection = true - break - } - } if needSliceSelection { if ue.NssfUri == "" { for { From edc094df45548f5d8ff9a6af62240234328b20b5 Mon Sep 17 00:00:00 2001 From: brianchennn Date: Mon, 27 Nov 2023 14:07:18 +0000 Subject: [PATCH 4/7] fix: typo --- internal/gmm/handler.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index 6f436989..2405eb05 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1171,12 +1171,12 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { // Step 6 searchTargetAmfQueryParam := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{} if ue.NetworkSliceInfo != nil { - netwotkSliceInfo := ue.NetworkSliceInfo - if netwotkSliceInfo.TargetAmfSet != "" { + networkSliceInfo := ue.NetworkSliceInfo + if networkSliceInfo.TargetAmfSet != "" { // TS 29.531 // TargetAmfSet format: ^[0-9]{3}-[0-9]{2-3}-[A-Fa-f0-9]{2}-[0-3][A-Fa-f0-9]{2}$ // mcc-mnc-amfRegionId(8 bit)-AmfSetId(10 bit) - targetAmfSetToken := strings.Split(netwotkSliceInfo.TargetAmfSet, "-") + targetAmfSetToken := strings.Split(networkSliceInfo.TargetAmfSet, "-") guami := amfSelf.ServedGuamiList[0] targetAmfPlmnId := models.PlmnId{ Mcc: targetAmfSetToken[0], @@ -1192,9 +1192,9 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { searchTargetAmfQueryParam.AmfRegionId = optional.NewString(targetAmfSetToken[2]) searchTargetAmfQueryParam.AmfSetId = optional.NewString(targetAmfSetToken[3]) - } else if len(netwotkSliceInfo.CandidateAmfList) > 0 { + } else if len(networkSliceInfo.CandidateAmfList) > 0 { // TODO: select candidate Amf based on local poilcy - searchTargetAmfQueryParam.TargetNfInstanceId = optional.NewInterface(netwotkSliceInfo.CandidateAmfList[0]) + searchTargetAmfQueryParam.TargetNfInstanceId = optional.NewInterface(networkSliceInfo.CandidateAmfList[0]) } } From 76557fc2404ed4c3967b9e2cbeea127be7057252 Mon Sep 17 00:00:00 2001 From: brianchennn Date: Mon, 27 Nov 2023 14:48:48 +0000 Subject: [PATCH 5/7] fix: After SendRerouteNasRequest(), it should return err --- internal/gmm/handler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index 2405eb05..10df56fe 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1236,6 +1236,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { // 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) + return err } return nil } From 735f79503009b51c9141cf5207facb332085cf8e Mon Sep 17 00:00:00 2001 From: squishy me <69491904+Leon777-coder@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:44:31 +0800 Subject: [PATCH 6/7] Update handler.go return error added --- internal/gmm/handler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index 10df56fe..f02f7d1b 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1232,6 +1232,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { return fmt.Errorf("re-encoding registration request message is failed: %w", err) } callback.SendN1MessageNotifyAtAMFReAllocation(ue, n1Message.Bytes(), ®isterContext) + return nil } else { // 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]) From dde7556e56e6ba892668f6515417764048192cb4 Mon Sep 17 00:00:00 2001 From: squishy me <69491904+Leon777-coder@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:44:30 +0800 Subject: [PATCH 7/7] Update handler.go line 1235 [return nill] deleted, since it will reach the following return --- internal/gmm/handler.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index f02f7d1b..10df56fe 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -1232,7 +1232,6 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { return fmt.Errorf("re-encoding registration request message is failed: %w", err) } callback.SendN1MessageNotifyAtAMFReAllocation(ue, n1Message.Bytes(), ®isterContext) - return nil } else { // 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])