Skip to content

Commit

Permalink
chore: modify the type of notification
Browse files Browse the repository at this point in the history
  • Loading branch information
pf-lin committed Sep 18, 2024
1 parent fb6ecbf commit 23685c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 2 additions & 6 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
}
Expand Down
7 changes: 5 additions & 2 deletions internal/sbi/processor/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 23685c7

Please sign in to comment.