From 23685c75a23a72d4d4dc5359c5bbca5f9a66af96 Mon Sep 17 00:00:00 2001 From: pf-lin Date: Wed, 18 Sep 2024 06:19:38 +0000 Subject: [PATCH] chore: modify the type of notification --- internal/context/sm_context.go | 8 ++------ internal/sbi/processor/notifier.go | 7 +++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/context/sm_context.go b/internal/context/sm_context.go index c0b43b81..03433217 100644 --- a/internal/context/sm_context.go +++ b/internal/context/sm_context.go @@ -16,7 +16,6 @@ import ( "github.com/free5gc/nas/nasMessage" "github.com/free5gc/ngap/ngapType" "github.com/free5gc/openapi/models" - "github.com/free5gc/openapi/smf/EventExposure" "github.com/free5gc/pfcp/pfcpType" "github.com/free5gc/smf/internal/logger" "github.com/free5gc/smf/pkg/factory" @@ -717,7 +716,7 @@ func newEventExposureNotification( } type NotifCallback func(uri string, - notification *EventExposure.CreateIndividualSubcriptionMyNotificationPostRequest) + notification *models.NsmfEventExposureNotification) func (c *SMContext) SendUpPathChgNotification(chgType string, notifCb NotifCallback) { var notifications map[string]*EventExposureNotification @@ -730,10 +729,7 @@ func (c *SMContext) SendUpPathChgNotification(chgType string, notifCb NotifCallb } for k, n := range notifications { c.Log.Infof("Send UpPathChg Event Exposure Notification [%s][%s] to NEF/AF", chgType, n.NotifId) - notification := &EventExposure.CreateIndividualSubcriptionMyNotificationPostRequest{ - NsmfEventExposureNotification: n.NsmfEventExposureNotification, - } - go notifCb(n.Uri, notification) + go notifCb(n.Uri, n.NsmfEventExposureNotification) delete(notifications, k) } } diff --git a/internal/sbi/processor/notifier.go b/internal/sbi/processor/notifier.go index 74d09d34..17be4069 100644 --- a/internal/sbi/processor/notifier.go +++ b/internal/sbi/processor/notifier.go @@ -123,13 +123,16 @@ func (p *Processor) HandleSMPolicyUpdateNotify( } func SendUpPathChgEventExposureNotification( - uri string, notification *EventExposure.CreateIndividualSubcriptionMyNotificationPostRequest, + uri string, notification *models.NsmfEventExposureNotification, ) { configuration := EventExposure.NewConfiguration() client := EventExposure.NewAPIClient(configuration) + request := &EventExposure.CreateIndividualSubcriptionMyNotificationPostRequest{ + NsmfEventExposureNotification: notification, + } _, err := client. SubscriptionsCollectionApi. - CreateIndividualSubcriptionMyNotificationPost(context.Background(), uri, notification) + CreateIndividualSubcriptionMyNotificationPost(context.Background(), uri, request) switch err := err.(type) { case openapi.GenericOpenAPIError: