From ef45d07f356cf3c0f90827e3e39979f893a15789 Mon Sep 17 00:00:00 2001 From: ubuntu Date: Tue, 13 Aug 2024 09:59:57 +0000 Subject: [PATCH] feat: add r17 new service server route & r17 new service api --- internal/sbi/api_mt.go | 40 +++++++++++++++++ internal/sbi/api_niddauthentication.go | 29 ++++++++++++ internal/sbi/api_reportsmdeliverystatus.go | 29 ++++++++++++ .../sbi/api_servicespecificauthorization.go | 40 +++++++++++++++++ internal/sbi/api_ueid.go | 29 ++++++++++++ internal/sbi/server.go | 45 +++++++++++++++++++ pkg/factory/config.go | 5 +++ 7 files changed, 217 insertions(+) create mode 100644 internal/sbi/api_mt.go create mode 100644 internal/sbi/api_niddauthentication.go create mode 100644 internal/sbi/api_reportsmdeliverystatus.go create mode 100644 internal/sbi/api_servicespecificauthorization.go create mode 100644 internal/sbi/api_ueid.go diff --git a/internal/sbi/api_mt.go b/internal/sbi/api_mt.go new file mode 100644 index 0000000..da6621b --- /dev/null +++ b/internal/sbi/api_mt.go @@ -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{}) +} diff --git a/internal/sbi/api_niddauthentication.go b/internal/sbi/api_niddauthentication.go new file mode 100644 index 0000000..f973921 --- /dev/null +++ b/internal/sbi/api_niddauthentication.go @@ -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{}) +} diff --git a/internal/sbi/api_reportsmdeliverystatus.go b/internal/sbi/api_reportsmdeliverystatus.go new file mode 100644 index 0000000..fd9a582 --- /dev/null +++ b/internal/sbi/api_reportsmdeliverystatus.go @@ -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{}) +} diff --git a/internal/sbi/api_servicespecificauthorization.go b/internal/sbi/api_servicespecificauthorization.go new file mode 100644 index 0000000..adb5094 --- /dev/null +++ b/internal/sbi/api_servicespecificauthorization.go @@ -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{}) +} diff --git a/internal/sbi/api_ueid.go b/internal/sbi/api_ueid.go new file mode 100644 index 0000000..a2a1120 --- /dev/null +++ b/internal/sbi/api_ueid.go @@ -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{}) +} diff --git a/internal/sbi/server.go b/internal/sbi/server.go index e4a08a3..1ebd60a 100644 --- a/internal/sbi/server.go +++ b/internal/sbi/server.go @@ -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 } diff --git a/pkg/factory/config.go b/pkg/factory/config.go index 3aeb89a..447c904 100644 --- a/pkg/factory/config.go +++ b/pkg/factory/config.go @@ -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 {