Skip to content

Commit

Permalink
fix: add route name and new api
Browse files Browse the repository at this point in the history
  • Loading branch information
donald1218 committed Sep 10, 2024
1 parent d977321 commit 517100e
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 2 deletions.
20 changes: 20 additions & 0 deletions internal/sbi/api_communication.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ func (s *Server) getCommunicationRoutes() []Route {
Pattern: "/ue-contexts/:ueContextId/transfer",
APIFunc: s.HTTPUEContextTransfer,
},
{
Name: "RelocateUEContext",
Method: http.MethodPost,
Pattern: "/ue-contexts/:ueContextId/relocate",
APIFunc: s.HTTPRelocateUEContext,
},
{
Name: "CancelRelocateUEContext",
Method: http.MethodPost,
Pattern: "/ue-contexts/:ueContextId/cancel-relocate",
APIFunc: s.HTTPCancelRelocateUEContext,
},
{
Name: "N1N2MessageUnSubscribe",
Method: http.MethodDelete,
Expand Down Expand Up @@ -334,6 +346,14 @@ func (s *Server) HTTPUEContextTransfer(c *gin.Context) {
s.Processor().HandleUEContextTransferRequest(c, ueContextTransferRequest)
}

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

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

func (s *Server) HTTPN1N2MessageUnSubscribe(c *gin.Context) {
s.Processor().HandleN1N2MessageUnSubscribeRequest(c)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/sbi/api_eventexposure.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ func (s *Server) getEventexposureRoutes() []Route {
},
},
{
Name: "DeleteSubscription",
Method: http.MethodDelete,
Pattern: "/subscriptions/:subscriptionId",
APIFunc: s.HTTPDeleteSubscription,
},
{
Name: "ModifySubscription",
Method: http.MethodPatch,
Pattern: "/subscriptions/:subscriptionId",
APIFunc: s.HTTPModifySubscription,
},
{
Name: "CreateSubscription",
Method: http.MethodPost,
Pattern: "/subscriptions",
APIFunc: s.HTTPCreateSubscription,
Expand Down
6 changes: 5 additions & 1 deletion internal/sbi/api_httpcallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,33 @@ import (
func (s *Server) getHttpCallBackRoutes() []Route {
return []Route{
{

Method: http.MethodGet,
Pattern: "/",
APIFunc: func(c *gin.Context) {
c.String(http.StatusOK, "Hello World!")
},
},
{
Name: "AmPolicyControlUpdateNotifyUpdate",
Method: http.MethodPost,
Pattern: "/am-policy/:polAssoId/update",
APIFunc: s.HTTPAmPolicyControlUpdateNotifyUpdate,
},
{
Name: "AmPolicyControlUpdateNotifyTerminate",
Method: http.MethodPost,
Pattern: "/am-policy/:polAssoId/terminate",
APIFunc: s.HTTPAmPolicyControlUpdateNotifyTerminate,
},
{
Name: "N1MessageNotify",
Method: http.MethodPost,
Pattern: "/n1-message-notify",
APIFunc: s.HTTPN1MessageNotify,
},
{
Name: "HandleDeregistrationNotification",
Method: http.MethodPost,
Pattern: "/deregistration/:ueid",
APIFunc: s.HTTPHandleDeregistrationNotification,
Expand Down Expand Up @@ -76,7 +81,6 @@ func (s *Server) HTTPAmPolicyControlUpdateNotifyUpdate(c *gin.Context) {

func (s *Server) HTTPAmPolicyControlUpdateNotifyTerminate(c *gin.Context) {
var terminationNotification models.PcfAmPolicyControlTerminationNotification


requestBody, err := c.GetRawData()
if err != nil {
Expand Down
12 changes: 12 additions & 0 deletions internal/sbi/api_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,23 @@ func (s *Server) getLocationRoutes() []Route {
},
},
{
Name: "ProvideLocationInfo",
Method: http.MethodPost,
Pattern: "/:ueContextId/provide-loc-info",
APIFunc: s.HTTPProvideLocationInfo,
},
{
Name: "ProvidePositioningInfo",
Method: http.MethodPost,
Pattern: "/:ueContextId/provide-pos-info",
APIFunc: s.HTTPProvidePositioningInfo,
},
{
Name: "CancelLocation",
Method: http.MethodPost,
Pattern: "/:ueContextId/cancel-loc-info",
APIFunc: s.HTTPCancelLocation,
},
}
}

Expand Down Expand Up @@ -78,3 +86,7 @@ func (s *Server) HTTPProvidePositioningInfo(c *gin.Context) {
logger.LocationLog.Warnf("Handle Provide Positioning Info is not implemented.")
c.JSON(http.StatusNotImplemented, gin.H{})
}

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

import (
"net/http"

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

func (s *Server) getMbsBroadcastRoutes() []Route {
return []Route{
{
Method: http.MethodGet,
Pattern: "/",
APIFunc: func(c *gin.Context) {
c.String(http.StatusOK, "Hello World!")
},
},
{
Name: "ContextCreate",
Method: http.MethodPost,
Pattern: "/mbs-contexts",
APIFunc: s.HTTPContextCreate,
},
{
Name: "ContextUpdate",
Method: http.MethodPost,
Pattern: "/mbs-contexts/:mbsContextRef/update",
APIFunc: s.HTTPContextUpdate,
},
{
Name: "ContextReleas",
Method: http.MethodDelete,
Pattern: "/mbs-contexts/:mbsContextRef",
APIFunc: s.HTTPContextRelease,
},
}
}

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

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

func (s *Server) HTTPContextRelease(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
29 changes: 29 additions & 0 deletions internal/sbi/api_mbscommunication.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) getMbsCommunicationRoutes() []Route {
return []Route{
{
Method: http.MethodGet,
Pattern: "/",
APIFunc: func(c *gin.Context) {
c.String(http.StatusOK, "Hello World!")
},
},
{
Name: "N2MessageTransfer",
Method: http.MethodPost,
Pattern: "/n2-messages/transfer",
APIFunc: s.HTTPN2MessageTransfer,
},
}
}

func (s *Server) HTTPN2MessageTransfer(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
14 changes: 13 additions & 1 deletion internal/sbi/api_mt.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@ func (s *Server) getMTRoutes() []Route {
},
},
{
Name: "ProvideDomainSelectionInfo",
Method: http.MethodGet,
Pattern: "/ue-contexts/:ueContextId",
APIFunc: s.HTTPProvideDomainSelectionInfo,
},
{
Method: http.MethodPost,
Name: "EnableUeReachability",
Method: http.MethodPut,
Pattern: "/ue-contexts/:ueContextId/ue-reachind",
APIFunc: s.HTTPEnableUeReachability,
},
{
Name: "EnableGroupReachability",
Method: http.MethodPost,
Pattern: "/ue-contexts/enable-group-reachability",
APIFunc: s.HTTPEnableGroupReachability,
},
}
}

Expand All @@ -39,3 +47,7 @@ func (s *Server) HTTPEnableUeReachability(c *gin.Context) {
logger.MtLog.Warnf("Handle Enable Ue Reachability is not implemented.")
c.JSON(http.StatusNotImplemented, gin.H{})
}

func (s *Server) HTTPEnableGroupReachability(c *gin.Context) {
c.JSON(http.StatusNotImplemented, gin.H{})
}
2 changes: 2 additions & 0 deletions internal/sbi/api_oam.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ func (s *Server) getOAMRoutes() []Route {
},
},
{
Name: "RegisteredUEContext",
Method: http.MethodGet,
Pattern: "/registered-ue-context",
APIFunc: s.HTTPRegisteredUEContext,
},
{
Name: "RegisteredUEContext",
Method: http.MethodGet,
Pattern: "/registered-ue-context/:supi",
APIFunc: s.HTTPRegisteredUEContext,
Expand Down
16 changes: 16 additions & 0 deletions internal/sbi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ func newRouter(s *Server) *gin.Engine {
routerAuthorizationCheck.Check(c, amf_context.GetSelf())
})
applyRoutes(amfOAMGroup, amfOAMRoutes)
case models.ServiceName_NAMF_MBS_COMM:
amfMbsComGroup := router.Group(factory.AmfMbsComResUriPrefix)
amfMbsComRoutes := s.getMbsCommunicationRoutes()
routerAuthorizationCheck := util_oauth.NewRouterAuthorizationCheck(models.ServiceName_NAMF_MBS_COMM)
amfMbsComGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, amf_context.GetSelf())
})
applyRoutes(amfMbsComGroup, amfMbsComRoutes)
case models.ServiceName_NAMF_MBS_BC:
amfMbsBCGroup := router.Group(factory.AmfMbsBCResUriPrefix)
amfMbsBCRoutes := s.getMbsBroadcastRoutes()
routerAuthorizationCheck := util_oauth.NewRouterAuthorizationCheck(models.ServiceName_NAMF_MBS_BC)
amfMbsBCGroup.Use(func(c *gin.Context) {
routerAuthorizationCheck.Check(c, amf_context.GetSelf())
})
applyRoutes(amfMbsBCGroup, amfMbsBCRoutes)
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
AmfLocResUriPrefix = "/namf-loc/v1"
AmfMtResUriPrefix = "/namf-mt/v1"
AmfOamResUriPrefix = "/namf-oam/v1"
AmfMbsComResUriPrefix = "/namf-mbs-comm/v1"
AmfMbsBCResUriPrefix = "/namf-mbs-bc/v1"
)

type Config struct {
Expand Down

0 comments on commit 517100e

Please sign in to comment.