Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor #37

Merged
merged 25 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
23b2cdc
feat: consumer nrf_service
a3828162 Apr 24, 2024
f50f25d
feat: add nudm_service.go and nudr_service.go in consumer/
a3828162 Apr 27, 2024
21c90fb
feat: refactor processor ee, pp, callback
a3828162 Apr 29, 2024
aef8bce
feat: refactor uecm api_{SRV}.go and sdm api_{SRV}.go
a3828162 Apr 30, 2024
1e67491
feat: change func name http to handle, add (processor) method
a3828162 Apr 30, 2024
2d42b1a
feat: refactor server, processsor, consumer, router
a3828162 May 13, 2024
b8715f9
Merge branch 'main' into refactor/sbi-logic
a3828162 May 15, 2024
4076213
feat: refactor router
a3828162 May 15, 2024
d2386b3
Merge branch 'refactor/sbi-logic' of github.com:a3828162/udm into ref…
a3828162 May 15, 2024
c563d3e
fix: fix lint error
a3828162 May 15, 2024
dfb8312
feat: move procedure, hand func
a3828162 May 22, 2024
2decf1b
fix: name error
a3828162 May 23, 2024
f066b7c
fix: fix run error, remove unuse line
a3828162 May 26, 2024
e3f5dea
fix: consumer init error, url.Value init error
a3828162 May 27, 2024
bc28dff
fix: add mock app interface & fix unit test
ianchen0119 May 29, 2024
8f668bb
delete: remove legacy code
a3828162 May 29, 2024
76c53ec
fix: fix with PR comment
a3828162 Jun 4, 2024
6cf39c6
fix: fix PR comment & terminate problem
a3828162 Jun 21, 2024
2d138ca
fix: fix PR comment
a3828162 Jun 24, 2024
0465bd4
fix: fix log
a3828162 Jun 24, 2024
4e578fd
fix: fix wrong file name & fix implementation of processor follow sta…
a3828162 Jun 25, 2024
0001050
fix: fix PR comment
a3828162 Jun 25, 2024
d4025e0
fix: fix PR comment
a3828162 Jun 25, 2024
395e622
fix : fix PR comment
a3828162 Jun 26, 2024
972efcf
fix: fix PR comment
a3828162 Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix : fix PR comment
a3828162 committed Jun 26, 2024
commit 395e6225c9e85e3e12e1d569d30b768c7c2a3f18
1 change: 0 additions & 1 deletion internal/sbi/api_eventexposure.go
Original file line number Diff line number Diff line change
@@ -73,7 +73,6 @@ func (s *Server) HandleCreateEeSubscription(c *gin.Context) {
return
}

// Start
logger.EeLog.Infoln("Handle Create EE Subscription")

ueIdentity := c.Params.ByName("ueIdentity")
2 changes: 0 additions & 2 deletions internal/sbi/api_httpcallback.go
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ func (s *Server) getHttpCallBackRoutes() []Route {

func (s *Server) HandleDataChangeNotificationToNF(c *gin.Context) {
var dataChangeNotify models.DataChangeNotify
// step 1: retrieve http request body
requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -45,7 +44,6 @@ func (s *Server) HandleDataChangeNotificationToNF(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&dataChangeNotify, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
8 changes: 8 additions & 0 deletions internal/sbi/api_parameterprovision.go
Original file line number Diff line number Diff line change
@@ -61,6 +61,14 @@ func (s *Server) HandleUpdate(c *gin.Context) {
}

gpsi := c.Params.ByName("gpsi")
if gpsi == "" {
problemDetails := &models.ProblemDetails{
Status: http.StatusBadRequest,
Cause: "NO_GPSI",
}
c.JSON(int(problemDetails.Status), problemDetails)
return
}

logger.PpLog.Infoln("Handle UpdateRequest")

58 changes: 4 additions & 54 deletions internal/sbi/api_subscriberdatamanagement.go
Original file line number Diff line number Diff line change
@@ -30,10 +30,8 @@ func (s *Server) HandleGetAmData(c *gin.Context) {
query.Set("plmn-id", c.Query("plmn-id"))
query.Set("supported-features", c.Query("plmn-id"))

// step 1: log
logger.SdmLog.Infof("Handle GetAmData")

// step 2: retrieve request
supi := c.Params.ByName("supi")

plmnIDStruct, problemDetails := s.getPlmnIDStruct(query)
@@ -44,7 +42,6 @@ func (s *Server) HandleGetAmData(c *gin.Context) {
plmnID := plmnIDStruct.Mcc + plmnIDStruct.Mnc
supportedFeatures := query.Get("supported-features")

// step 3: handle the message
s.Processor().GetAmDataProcedure(c, supi, plmnID, supportedFeatures)
}

@@ -71,12 +68,12 @@ func (s *Server) getPlmnIDStruct(

// Info - Nudm_Sdm Info service operation
func (s *Server) HandleInfo(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{})
c.JSON(http.StatusNotImplemented, gin.H{})
}

// PutUpuAck - Nudm_Sdm Info for UPU service operation
func (s *Server) HandlePutUpuAck(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{})
c.JSON(http.StatusNotImplemented, gin.H{})
}

// GetSmfSelectData - retrieve a UE's SMF Selection Subscription Data
@@ -85,10 +82,8 @@ func (s *Server) HandleGetSmfSelectData(c *gin.Context) {
query.Set("plmn-id", c.Query("plmn-id"))
query.Set("supported-features", c.Query("supported-features"))

// step 1: log
logger.SdmLog.Infof("Handle GetSmfSelectData")

// step 2: retrieve request
supi := c.Params.ByName("supi")
plmnIDStruct, problemDetails := s.getPlmnIDStruct(query)
if problemDetails != nil {
@@ -98,7 +93,6 @@ func (s *Server) HandleGetSmfSelectData(c *gin.Context) {
plmnID := plmnIDStruct.Mcc + plmnIDStruct.Mnc
supportedFeatures := query.Get("supported-features")

// step 3: handle the message
s.Processor().GetSmfSelectDataProcedure(c, supi, plmnID, supportedFeatures)
}

@@ -119,10 +113,8 @@ func (s *Server) HandleGetSupi(c *gin.Context) {
query.Set("dataset-names", c.Query("dataset-names"))
query.Set("supported-features", c.Query("supported-features"))

// step 1: log
logger.SdmLog.Infof("Handle GetSupiRequest")

// step 2: retrieve request
supi := c.Params.ByName("supi")
plmnIDStruct, problemDetails := s.getPlmnIDStruct(query)
if problemDetails != nil {
@@ -133,26 +125,23 @@ func (s *Server) HandleGetSupi(c *gin.Context) {
dataSetNames := strings.Split(query.Get("dataset-names"), ",")
supportedFeatures := query.Get("supported-features")

// step 3: handle the message
s.Processor().GetSupiProcedure(c, supi, plmnID, dataSetNames, supportedFeatures)
}

// GetSharedData - retrieve shared data
func (s *Server) HandleGetSharedData(c *gin.Context) {
// step 1: log
logger.SdmLog.Infof("Handle GetSharedData")

// step 2: retrieve request
sharedDataIds := c.QueryArray("shared-data-ids")
supportedFeatures := c.QueryArray("supported-features")
// step 3: handle the message

s.Processor().GetSharedDataProcedure(c, sharedDataIds, supportedFeatures[0])
}

// SubscribeToSharedData - subscribe to notifications for shared data
func (s *Server) HandleSubscribeToSharedData(c *gin.Context) {
var sharedDataSubsReq models.SdmSubscription
// step 1: retrieve http request body

requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -166,7 +155,6 @@ func (s *Server) HandleSubscribeToSharedData(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&sharedDataSubsReq, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
@@ -180,20 +168,15 @@ func (s *Server) HandleSubscribeToSharedData(c *gin.Context) {
return
}

// step 1: log
logger.SdmLog.Infof("Handle SubscribeToSharedData")

// step 2: retrieve request

// step 3: handle the message
s.Processor().SubscribeToSharedDataProcedure(c, &sharedDataSubsReq)
}

// Subscribe - subscribe to notifications
func (s *Server) HandleSubscribe(c *gin.Context) {
var sdmSubscriptionReq models.SdmSubscription

// step 1: retrieve http request body
requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -207,7 +190,6 @@ func (s *Server) HandleSubscribe(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&sdmSubscriptionReq, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
@@ -221,42 +203,34 @@ func (s *Server) HandleSubscribe(c *gin.Context) {
return
}

// step 1: log
logger.SdmLog.Infof("Handle Subscribe")

// step 2: retrieve request
supi := c.Params.ByName("supi")

// step 3: handle the message
s.Processor().SubscribeProcedure(c, &sdmSubscriptionReq, supi)
}

// Unsubscribe - unsubscribe from notifications
func (s *Server) HandleUnsubscribe(c *gin.Context) {
logger.SdmLog.Infof("Handle Unsubscribe")

// step 2: retrieve request
supi := c.Params.ByName("supi")
subscriptionID := c.Params.ByName("subscriptionId")

// step 3: handle the message
s.Processor().UnsubscribeProcedure(c, supi, subscriptionID)
}

// UnsubscribeForSharedData - unsubscribe from notifications for shared data
func (s *Server) HandleUnsubscribeForSharedData(c *gin.Context) {
logger.SdmLog.Infof("Handle UnsubscribeForSharedData")

// step 2: retrieve request
subscriptionID := c.Params.ByName("subscriptionId")
// step 3: handle the message
s.Processor().UnsubscribeForSharedDataProcedure(c, subscriptionID)
}

// Modify - modify the subscription
func (s *Server) HandleModify(c *gin.Context) {
var sdmSubsModificationReq models.SdmSubsModification
// step 1: retrieve http request body
requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -270,7 +244,6 @@ func (s *Server) HandleModify(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&sdmSubsModificationReq, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
@@ -284,21 +257,17 @@ func (s *Server) HandleModify(c *gin.Context) {
return
}

// step 1: log
logger.SdmLog.Infof("Handle Modify")

// step 2: retrieve request
supi := c.Params.ByName("supi")
subscriptionID := c.Params.ByName("subscriptionId")

// step 3: handle the message
s.Processor().ModifyProcedure(c, &sdmSubsModificationReq, supi, subscriptionID)
}

// ModifyForSharedData - modify the subscription
func (s *Server) HandleModifyForSharedData(c *gin.Context) {
var sharedDataSubscriptions models.SdmSubsModification
// step 1: retrieve http request body
requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -312,7 +281,6 @@ func (s *Server) HandleModifyForSharedData(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&sharedDataSubscriptions, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
@@ -326,40 +294,31 @@ func (s *Server) HandleModifyForSharedData(c *gin.Context) {
return
}

// step 1: log
logger.SdmLog.Infof("Handle ModifyForSharedData")

// step 2: retrieve request
supi := c.Params.ByName("supi")
subscriptionID := c.Params.ByName("subscriptionId")

// step 3: handle the message
s.Processor().ModifyForSharedDataProcedure(c, &sharedDataSubscriptions, supi, subscriptionID)
}

// GetTraceData - retrieve a UE's Trace Configuration Data
func (s *Server) HandleGetTraceData(c *gin.Context) {
// step 1: log
logger.SdmLog.Infof("Handle GetTraceData")

// step 2: retrieve request
supi := c.Params.ByName("supi")
plmnID := c.Query("plmn-id")

// step 3: handle the message
s.Processor().GetTraceDataProcedure(c, supi, plmnID)
}

// GetUeContextInSmfData - retrieve a UE's UE Context In SMF Data
func (s *Server) HandleGetUeContextInSmfData(c *gin.Context) {
// step 1: log
logger.SdmLog.Infof("Handle GetUeContextInSmfData")

// step 2: retrieve request
supi := c.Params.ByName("supi")
supportedFeatures := c.Query("supported-features")

// step 3: handle the message
s.Processor().GetUeContextInSmfDataProcedure(c, supi, supportedFeatures)
}

@@ -374,10 +333,8 @@ func (s *Server) HandleGetNssai(c *gin.Context) {
query.Set("plmn-id", c.Query("plmn-id"))
query.Set("supported-features", c.Query("supported-features"))

// step 1: log
logger.SdmLog.Infof("Handle GetNssai")

// step 2: retrieve request
supi := c.Params.ByName("supi")
plmnIDStruct, problemDetails := s.getPlmnIDStruct(query)
if problemDetails != nil {
@@ -387,7 +344,6 @@ func (s *Server) HandleGetNssai(c *gin.Context) {
plmnID := plmnIDStruct.Mcc + plmnIDStruct.Mnc
supportedFeatures := query.Get("supported-features")

// step 3: handle the message
s.Processor().GetNssaiProcedure(c, supi, plmnID, supportedFeatures)
}

@@ -399,10 +355,8 @@ func (s *Server) HandleGetSmData(c *gin.Context) {
query.Set("single-nssai", c.Query("single-nssai"))
query.Set("supported-features", c.Query("supported-features"))

// step 1: log
logger.SdmLog.Infof("Handle GetSmData")

// step 2: retrieve request
supi := c.Params.ByName("supi")
plmnIDStruct, problemDetails := s.getPlmnIDStruct(query)
if problemDetails != nil {
@@ -414,21 +368,17 @@ func (s *Server) HandleGetSmData(c *gin.Context) {
Snssai := query.Get("single-nssai")
supportedFeatures := query.Get("supported-features")

// step 3: handle the message
s.Processor().GetSmDataProcedure(c, supi, plmnID, Dnn, Snssai, supportedFeatures)
}

// GetIdTranslationResult - retrieve a UE's SUPI
func (s *Server) HandleGetIdTranslationResult(c *gin.Context) {
// req.Query.Set("SupportedFeatures", c.Query("supported-features"))

// step 1: log
logger.SdmLog.Infof("Handle GetIdTranslationResultRequest")

// step 2: retrieve request
gpsi := c.Params.ByName("gpsi")

// step 3: handle the message
s.Processor().GetIdTranslationResultProcedure(c, gpsi)
}

7 changes: 0 additions & 7 deletions internal/sbi/api_ueauthentication.go
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ func (s *Server) getUEAuthenticationRoutes() []Route {
// ConfirmAuth - Create a new confirmation event
func (s *Server) HandleConfirmAuth(c *gin.Context) {
var authEvent models.AuthEvent
// step 1: retrieve http request body
requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -46,7 +45,6 @@ func (s *Server) HandleConfirmAuth(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&authEvent, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
@@ -71,7 +69,6 @@ func (s *Server) HandleConfirmAuth(c *gin.Context) {
func (s *Server) HandleGenerateAuthData(c *gin.Context) {
var authInfoReq models.AuthenticationInfoRequest

// step 1: retrieve http request body
requestBody, err := c.GetRawData()
if err != nil {
problemDetail := models.ProblemDetails{
@@ -85,7 +82,6 @@ func (s *Server) HandleGenerateAuthData(c *gin.Context) {
return
}

// step 2: convert requestBody to openapi models
err = openapi.Deserialize(&authInfoReq, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
@@ -99,13 +95,10 @@ func (s *Server) HandleGenerateAuthData(c *gin.Context) {
return
}

// step 1: log
logger.UeauLog.Infoln("Handle GenerateAuthDataRequest")

// step 2: retrieve request
supiOrSuci := c.Param("supiOrSuci")

// step 3: handle the message
s.Processor().GenerateAuthDataProcedure(c, authInfoReq, supiOrSuci)
}

Loading