Skip to content

Commit

Permalink
Fix: rollback callback and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Feb 2, 2024
1 parent 77a752b commit aa30a90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
11 changes: 0 additions & 11 deletions internal/sbi/httpcallback/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ import (

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
pcf_context "github.com/free5gc/pcf/internal/context"
"github.com/free5gc/pcf/internal/logger"
"github.com/free5gc/pcf/internal/util"
"github.com/free5gc/pcf/pkg/factory"
logger_util "github.com/free5gc/util/logger"
)

const serviceName string = string(models.ServiceName_NPCF_SMPOLICYCONTROL)

// Route is the information for every URI.
type Route struct {
// Name is the name of this Route.
Expand All @@ -40,12 +35,6 @@ func NewRouter() *gin.Engine {

func AddService(engine *gin.Engine) *gin.RouterGroup {
group := engine.Group(factory.PcfCallbackResUriPrefix)
// https://localhost:29507/{factory.PcfCallbackResUriPrefix}/route

routerAuthorizationCheck := util.NewRouterAuthorizationCheck(serviceName)
group.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, pcf_context.GetSelf())
})

for _, route := range routes {
switch route.Method {
Expand Down
11 changes: 6 additions & 5 deletions internal/sbi/producer/smpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,16 @@ func createSMPolicyProcedure(request models.SmPolicyContextData) (
PcfIpEndPoints: *policyAuthorizationService.IpEndPoints,
}

ctx, pd, err = pcf_context.GetSelf().GetTokenCtx("nbsf-management", models.NfType_BSF)
if err != nil {
return nil, nil, pd
}

// TODO: Record BSF URI instead of discovering from NRF every time
bsfUri := consumer.SendNFInstancesBSF(pcf_context.GetSelf().NrfUri)
if bsfUri != "" {
bsfClient := util.GetNbsfClient(bsfUri)

ctx, pd, err = pcf_context.GetSelf().GetTokenCtx("nbsf-management", models.NfType_BSF)
if err != nil {
return nil, nil, pd
}

_, resp, err = bsfClient.PCFBindingsCollectionApi.CreatePCFBinding(ctx, pcfBinding)
if err != nil || resp == nil || resp.StatusCode != http.StatusCreated {
logger.SmPolicyLog.Warnf("Create PCF binding data in BSF error[%+v]", err)
Expand Down

0 comments on commit aa30a90

Please sign in to comment.