From 5a699f70e56f1b981e1fa3662d551eaa0d45f01a Mon Sep 17 00:00:00 2001 From: Leon777-coder Date: Wed, 22 Nov 2023 11:02:39 +0000 Subject: [PATCH] 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 != "" {