Skip to content

Commit

Permalink
configure notifNfProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
danielh1204 committed Aug 11, 2023
1 parent aa91870 commit c92ca03
Showing 1 changed file with 49 additions and 5 deletions.
54 changes: 49 additions & 5 deletions internal/sbi/producer/nf_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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()
Expand All @@ -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)
Expand Down

0 comments on commit c92ca03

Please sign in to comment.