Skip to content

Commit

Permalink
feat: add r17 new service server route & r17 new service api
Browse files Browse the repository at this point in the history
  • Loading branch information
a3828162 committed Aug 13, 2024
1 parent fc69b8a commit ef45d07
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 0 deletions.
40 changes: 40 additions & 0 deletions internal/sbi/api_mt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package sbi

import (
"net/http"

"github.com/gin-gonic/gin"
)

func (s *Server) getMTRoutes() []Route {
return []Route{
{
"Index",
"GET",
"/",
s.HandleIndex,
},

{
"ProvideLocationInfo",
"Post",
"/:supi/loc-info/provide-loc-info",
s.HandleProvideLocationInfo,
},

{
"QueryUeInfo",
"GET",
"/:supi",
s.HandleQueryUeInfo,
},
}
}

func (s *Server) HandleProvideLocationInfo(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HandleQueryUeInfo(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
29 changes: 29 additions & 0 deletions internal/sbi/api_niddauthentication.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package sbi

import (
"net/http"

"github.com/gin-gonic/gin"
)

func (s *Server) getNIDDAuthenticationRoutes() []Route {
return []Route{
{
"Index",
"GET",
"/",
s.HandleIndex,
},

{
"AuthorizeNiddData",
"Post",
"/:ueIdentity/authorize",
s.HandleAuthorizeNiddData,
},
}
}

func (s *Server) HandleAuthorizeNiddData(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
29 changes: 29 additions & 0 deletions internal/sbi/api_reportsmdeliverystatus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package sbi

import (
"net/http"

"github.com/gin-gonic/gin"
)

func (s *Server) getReportSMDeliveryStatusRoutes() []Route {
return []Route{
{
"Index",
"GET",
"/",
s.HandleIndex,
},

{
"ReportSMDeliveryStatus",
"Post",
"/:ueIdentity/sm-delivery-status",
s.HandleReportSMDeliveryStatus,
},
}
}

func (s *Server) HandleReportSMDeliveryStatus(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
40 changes: 40 additions & 0 deletions internal/sbi/api_servicespecificauthorization.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package sbi

import (
"net/http"

"github.com/gin-gonic/gin"
)

func (s *Server) getServiceSpecificAuthorizationRoutes() []Route {
return []Route{
{
"Index",
"GET",
"/",
s.HandleIndex,
},

{
"ServiceSpecificAuthorization",
"Post",
"/:ueIdentity/:serviceType/authorize",
s.HandleServiceSpecificAuthorization,
},

{
"ServiceSpecificAuthorizationRemoval",
"Post",
"/:ueIdentity/:serviceType/remove",
s.HandleServiceSpecificAuthorizationRemoval,
},
}
}

func (s *Server) HandleServiceSpecificAuthorization(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HandleServiceSpecificAuthorizationRemoval(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
29 changes: 29 additions & 0 deletions internal/sbi/api_ueid.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package sbi

import (
"net/http"

"github.com/gin-gonic/gin"
)

func (s *Server) getUEIDRoutes() []Route {
return []Route{
{
"Index",
"GET",
"/",
s.HandleIndex,
},

{
"Deconceal",
"Post",
"/deconceal",
s.HandleDeconceal,
},
}
}

func (s *Server) HandleDeconceal(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
45 changes: 45 additions & 0 deletions internal/sbi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,50 @@ func newRouter(s *Server) *gin.Engine {
})
AddService(udmPPGroup, udmPPRoutes)

// MT
udmMTRoutes := s.getMTRoutes()
udmMTGroup := s.router.Group(factory.UdmMtResUrdPrefix)
routerAuthorizationCheck = util.NewRouterAuthorizationCheck(models.ServiceName_NUDM_MT)
udmMTGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, udm_context.GetSelf())
})
AddService(udmMTGroup, udmMTRoutes)

// NIDDAU
udmNIDDAURoutes := s.getNIDDAuthenticationRoutes()
udmNIDDAUGroup := s.router.Group(factory.UdmNiddauResUriPrefix)
routerAuthorizationCheck = util.NewRouterAuthorizationCheck(models.ServiceName_NUDM_NIDDAU)
udmNIDDAUGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, udm_context.GetSelf())
})
AddService(udmNIDDAUGroup, udmNIDDAURoutes)

// RSDS
udmRSDSRoutes := s.getReportSMDeliveryStatusRoutes()
udmRSDSGroup := s.router.Group(factory.UdmRsdsResUriPrefix)
routerAuthorizationCheck = util.NewRouterAuthorizationCheck(models.ServiceName_NUDM_RSDS)
udmRSDSGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, udm_context.GetSelf())
})
AddService(udmRSDSGroup, udmRSDSRoutes)

// SSAU
udmSSAURoutes := s.getServiceSpecificAuthorizationRoutes()
udmSSAUGroup := s.router.Group(factory.UdmSsauResUriPrefix)
routerAuthorizationCheck = util.NewRouterAuthorizationCheck(models.ServiceName_NUDM_SSAU)
udmSSAUGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, udm_context.GetSelf())
})
AddService(udmSSAUGroup, udmSSAURoutes)

// UEID
udmUEIDRoutes := s.getUEIDRoutes()
udmUEIDGroup := s.router.Group(factory.UdmUeidResUriPrefix)
routerAuthorizationCheck = util.NewRouterAuthorizationCheck(models.ServiceName_NUDM_UEID)
udmUEIDGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, udm_context.GetSelf())
})
AddService(udmUEIDGroup, udmUEIDRoutes)

return router
}
5 changes: 5 additions & 0 deletions pkg/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const (
UdmUecmResUriPrefix = "/nudm-uecm/v1"
UdmPpResUriPrefix = "/nudm-pp/v1"
UdmUeauResUriPrefix = "/nudm-ueau/v1"
UdmMtResUrdPrefix = "/nudm-mt/v1"
UdmNiddauResUriPrefix = "/nudm-niddau/v1"
UdmRsdsResUriPrefix = "/nudm-rsds/v1"
UdmSsauResUriPrefix = "/nudm-ssau/v1"
UdmUeidResUriPrefix = "/nudm-ueid/v1"
)

type Config struct {
Expand Down

0 comments on commit ef45d07

Please sign in to comment.