From c92ca0330345160a6fc275cd8c68b8969b245e98 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 11 Aug 2023 14:48:00 +0800 Subject: [PATCH] configure notifNfProfile --- internal/sbi/producer/nf_management.go | 54 +++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/internal/sbi/producer/nf_management.go b/internal/sbi/producer/nf_management.go index 6ad8dee..f6efaa2 100644 --- a/internal/sbi/producer/nf_management.go +++ b/internal/sbi/producer/nf_management.go @@ -329,7 +329,7 @@ func NFDeregisterProcedure(nfInstanceID string) *models.ProblemDetails { Notification_event := models.NotificationEventType_DEREGISTERED for _, uri := range uriList { - problemDetails := SendNFStatusNotify(Notification_event, nfInstanceUri, uri) + problemDetails := SendNFStatusNotify(Notification_event, nfInstanceUri, uri, nil) if problemDetails != nil { return problemDetails } @@ -388,7 +388,7 @@ func UpdateNFInstanceProcedure(nfInstanceID string, patchJSON []byte) map[string nfInstanceUri := nrf_context.GetNfInstanceURI(nfInstanceID) for _, uri := range uriList { - SendNFStatusNotify(Notification_event, nfInstanceUri, uri) + SendNFStatusNotify(Notification_event, nfInstanceUri, uri, &nfProfiles[0]) } return nf @@ -479,7 +479,7 @@ func NFRegisterProcedure( // receive the rsp from handler for _, uri := range uriList { - problemDetails := SendNFStatusNotify(Notification_event, nfInstanceUri, uri) + problemDetails := SendNFStatusNotify(Notification_event, nfInstanceUri, uri, &nfProfile) if problemDetails != nil { return nil, nil, true, problemDetails } @@ -496,7 +496,7 @@ func NFRegisterProcedure( nfInstanceUri := locationHeaderValue for _, uri := range uriList { - problemDetails := SendNFStatusNotify(Notification_event, nfInstanceUri, uri) + problemDetails := SendNFStatusNotify(Notification_event, nfInstanceUri, uri, nil) if problemDetails != nil { return nil, nil, false, problemDetails } @@ -517,8 +517,48 @@ func NFRegisterProcedure( } } +func configureNotifNfProfile(NotifProfile *models.NfProfileNotificationData, nfProfile models.NfProfile) { + NotifProfile.NfInstanceId = nfProfile.NfInstanceId + NotifProfile.NfType = nfProfile.NfType + NotifProfile.NfStatus = nfProfile.NfStatus + NotifProfile.HeartBeatTimer = nfProfile.HeartBeatTimer + NotifProfile.PlmnList = *nfProfile.PlmnList + NotifProfile.SNssais = *nfProfile.SNssais + NotifProfile.PerPlmnSnssaiList = nfProfile.PerPlmnSnssaiList + NotifProfile.NsiList = nfProfile.NsiList + NotifProfile.Fqdn = nfProfile.Fqdn + NotifProfile.InterPlmnFqdn = nfProfile.InterPlmnFqdn + NotifProfile.Ipv4Addresses = nfProfile.Ipv4Addresses + NotifProfile.Ipv6Addresses = nfProfile.Ipv6Addresses + NotifProfile.AllowedPlmns = *nfProfile.AllowedPlmns + NotifProfile.AllowedNfTypes = nfProfile.AllowedNfTypes + NotifProfile.AllowedNfDomains = nfProfile.AllowedNfDomains + NotifProfile.AllowedNssais = *nfProfile.AllowedNssais + NotifProfile.Priority = nfProfile.Priority + NotifProfile.Capacity = nfProfile.Capacity + NotifProfile.Load = nfProfile.Load + NotifProfile.Locality = nfProfile.Locality + NotifProfile.UdrInfo = nfProfile.UdrInfo + NotifProfile.UdmInfo = nfProfile.UdmInfo + NotifProfile.AusfInfo = nfProfile.AusfInfo + NotifProfile.AmfInfo = nfProfile.AmfInfo + NotifProfile.SmfInfo = nfProfile.SmfInfo + NotifProfile.UpfInfo = nfProfile.UpfInfo + NotifProfile.PcfInfo = nfProfile.PcfInfo + NotifProfile.BsfInfo = nfProfile.BsfInfo + NotifProfile.ChfInfo = nfProfile.ChfInfo + NotifProfile.NrfInfo = nfProfile.NrfInfo + NotifProfile.CustomInfo = nfProfile.CustomInfo + NotifProfile.RecoveryTime = nfProfile.RecoveryTime + NotifProfile.NfServicePersistence = nfProfile.NfServicePersistence + NotifProfile.NfServices = *nfProfile.NfServices + NotifProfile.NfProfileChangesSupportInd = nfProfile.NfProfileChangesSupportInd + NotifProfile.NfProfileChangesInd = nfProfile.NfProfileChangesInd + NotifProfile.DefaultNotificationSubscriptions = nfProfile.DefaultNotificationSubscriptions +} + func SendNFStatusNotify(Notification_event models.NotificationEventType, nfInstanceUri string, - url string, + url string, nfProfile *models.NfProfile, ) *models.ProblemDetails { // Set client and set url configuration := Nnrf_NFManagement.NewConfiguration() @@ -529,6 +569,10 @@ func SendNFStatusNotify(Notification_event models.NotificationEventType, nfInsta Event: Notification_event, NfInstanceUri: nfInstanceUri, } + if nfProfile != nil { + configureNotifNfProfile(notifcationData.NfProfile, *nfProfile) + } + client := Nnrf_NFManagement.NewAPIClient(configuration) res, err := client.NotificationApi.NotificationPost(context.TODO(), notifcationData)