Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotificationData fix #22

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, &nfProfile)
if problemDetails != nil {
return nil, nil, false, problemDetails
}
Expand All @@ -517,8 +517,48 @@ func NFRegisterProcedure(
}
}

func copyNotificationNfProfile(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 {
copyNotificationNfProfile(notifcationData.NfProfile, nfProfile)
}

client := Nnrf_NFManagement.NewAPIClient(configuration)

res, err := client.NotificationApi.NotificationPost(context.TODO(), notifcationData)
Expand Down