Skip to content

Commit

Permalink
fix: fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
a3828162 committed May 15, 2024
1 parent d2386b3 commit c563d3e
Show file tree
Hide file tree
Showing 32 changed files with 113 additions and 107 deletions.
1 change: 0 additions & 1 deletion internal/sbi/api_eventexposure.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ func (s *Server) getEventExposureRoutes() []Route {
s.Processor().HandleUpdateEeSubscription,
},
}

}
9 changes: 6 additions & 3 deletions internal/sbi/consumer/nrf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"sync"
"time"

"github.com/pkg/errors"

"github.com/free5gc/openapi"
"github.com/free5gc/openapi/Nnrf_NFDiscovery"
"github.com/free5gc/openapi/Nnrf_NFManagement"
"github.com/free5gc/openapi/models"
udm_context "github.com/free5gc/udm/internal/context"
"github.com/free5gc/udm/internal/logger"
"github.com/pkg/errors"
)

type nnrfService struct {
Expand Down Expand Up @@ -73,7 +74,8 @@ func (s *nnrfService) getNFDiscClient(uri string) *Nnrf_NFDiscovery.APIClient {

func (s *nnrfService) SendSearchNFInstances(
nrfUri string, targetNfType, requestNfType models.NfType, param Nnrf_NFDiscovery.SearchNFInstancesParamOpts) (
*models.SearchResult, error) {
*models.SearchResult, error,
) {
// Set client and set url
chfContext := s.consumer.Context()

Expand Down Expand Up @@ -134,7 +136,8 @@ func (s *nnrfService) SendDeregisterNFInstance() (problemDetails *models.Problem
}

func (s *nnrfService) RegisterNFInstance(ctx context.Context) (
resouceNrfUri string, retrieveNfInstanceID string, err error) {
resouceNrfUri string, retrieveNfInstanceID string, err error,
) {
udmContext := s.consumer.Context()
client := s.getNFManagementClient(udmContext.NrfUri)
nfProfile, err := s.buildNfProfile(udmContext)
Expand Down
9 changes: 7 additions & 2 deletions internal/sbi/consumer/udm_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ func (s *nudmService) SubscribeToSharedDataProcedure(sdmSubscription *models.Sdm
if res.StatusCode == http.StatusCreated {
header = make(http.Header)
udm_context.GetSelf().CreateSubstoNotifSharedData(sdmSubscriptionResp.SubscriptionId, &sdmSubscriptionResp)
reourceUri := udm_context.GetSelf().GetSDMUri() + "//shared-data-subscriptions/" + sdmSubscriptionResp.SubscriptionId
reourceUri := udm_context.GetSelf().
GetSDMUri() +
"//shared-data-subscriptions/" + sdmSubscriptionResp.SubscriptionId
header.Set("Location", reourceUri)
return header, &sdmSubscriptionResp, nil
} else if res.StatusCode == http.StatusNotFound {
Expand Down Expand Up @@ -163,7 +165,10 @@ func (s *nudmService) UnsubscribeForSharedDataProcedure(subscriptionID string) *
}
}

func (s *nudmService) DataChangeNotificationProcedure(notifyItems []models.NotifyItem, supi string) *models.ProblemDetails {
func (s *nudmService) DataChangeNotificationProcedure(
notifyItems []models.NotifyItem,
supi string,
) *models.ProblemDetails {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_SDM, models.NfType_UDM)
if err != nil {
return pd
Expand Down
53 changes: 43 additions & 10 deletions internal/sbi/consumer/udr_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"time"

"github.com/antihax/optional"

"github.com/free5gc/openapi"
"github.com/free5gc/openapi/Nudr_DataRepository"
"github.com/free5gc/openapi/models"
Expand Down Expand Up @@ -366,7 +367,10 @@ func (s *nudrService) UpdateEeSubscriptionProcedure(ueIdentity string, subscript
}
}

func (s *nudrService) ConfirmAuthDataProcedure(authEvent models.AuthEvent, supi string) (problemDetails *models.ProblemDetails) {
func (s *nudrService) ConfirmAuthDataProcedure(
authEvent models.AuthEvent,
supi string,
) (problemDetails *models.ProblemDetails) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
if err != nil {
return pd
Expand Down Expand Up @@ -411,7 +415,7 @@ func (s *nudrService) GenerateAuthDataProcedure(authInfoRequest models.Authentic
logger.UeauLog.Traceln("In GenerateAuthDataProcedure")

response = &models.AuthenticationInfoResult{}
rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))
supi, err := suci.ToSupi(supiOrSuci, udm_context.GetSelf().SuciProfiles)
if err != nil {
problemDetails = &models.ProblemDetails{
Expand Down Expand Up @@ -839,7 +843,10 @@ func (s *nudrService) GenerateAuthDataProcedure(authInfoRequest models.Authentic
return response, nil
}

func (s *nudrService) UpdateProcedure(updateRequest models.PpData, gpsi string) (problemDetails *models.ProblemDetails) {
func (s *nudrService) UpdateProcedure(
updateRequest models.PpData,
gpsi string,
) (problemDetails *models.ProblemDetails) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
if err != nil {
return pd
Expand Down Expand Up @@ -1315,7 +1322,13 @@ func (s *nudrService) GetSharedDataProcedure(sharedDataIds []string, supportedFe
}
}

func (s *nudrService) GetSmDataProcedure(supi string, plmnID string, Dnn string, Snssai string, supportedFeatures string) (
func (s *nudrService) GetSmDataProcedure(
supi string,
plmnID string,
Dnn string,
Snssai string,
supportedFeatures string,
) (
response interface{}, problemDetails *models.ProblemDetails,
) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
Expand Down Expand Up @@ -1616,7 +1629,11 @@ func (s *nudrService) UnsubscribeProcedure(supi string, subscriptionID string) *
}
}

func (s *nudrService) ModifyProcedure(sdmSubsModification *models.SdmSubsModification, supi string, subscriptionID string) (
func (s *nudrService) ModifyProcedure(
sdmSubsModification *models.SdmSubsModification,
supi string,
subscriptionID string,
) (
response *models.SdmSubscription, problemDetails *models.ProblemDetails,
) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
Expand Down Expand Up @@ -1873,7 +1890,10 @@ func (s *nudrService) GetAmfNon3gppAccessProcedure(queryAmfContextNon3gppParamOp
return &amfNon3GppAccessRegistration, nil
}

func (s *nudrService) RegistrationAmf3gppAccessProcedure(registerRequest models.Amf3GppAccessRegistration, ueID string) (
func (s *nudrService) RegistrationAmf3gppAccessProcedure(
registerRequest models.Amf3GppAccessRegistration,
ueID string,
) (
header http.Header, response *models.Amf3GppAccessRegistration, problemDetails *models.ProblemDetails,
) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
Expand Down Expand Up @@ -1951,7 +1971,10 @@ func (s *nudrService) RegistrationAmf3gppAccessProcedure(registerRequest models.
}
}

func (s *nudrService) RegisterAmfNon3gppAccessProcedure(registerRequest models.AmfNon3GppAccessRegistration, ueID string) (
func (s *nudrService) RegisterAmfNon3gppAccessProcedure(
registerRequest models.AmfNon3GppAccessRegistration,
ueID string,
) (
header http.Header, response *models.AmfNon3GppAccessRegistration, problemDetails *models.ProblemDetails,
) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
Expand Down Expand Up @@ -2112,7 +2135,10 @@ func (s *nudrService) UpdateAmf3gppAccessProcedure(request models.Amf3GppAccessR
return nil
}

func (s *nudrService) UpdateAmfNon3gppAccessProcedure(request models.AmfNon3GppAccessRegistrationModification, ueID string) (
func (s *nudrService) UpdateAmfNon3gppAccessProcedure(
request models.AmfNon3GppAccessRegistrationModification,
ueID string,
) (
problemDetails *models.ProblemDetails,
) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
Expand Down Expand Up @@ -2206,7 +2232,10 @@ func (s *nudrService) UpdateAmfNon3gppAccessProcedure(request models.AmfNon3GppA
return problemDetails
}

func (s *nudrService) DeregistrationSmfRegistrationsProcedure(ueID string, pduSessionID string) (problemDetails *models.ProblemDetails) {
func (s *nudrService) DeregistrationSmfRegistrationsProcedure(
ueID string,
pduSessionID string,
) (problemDetails *models.ProblemDetails) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
if err != nil {
return pd
Expand Down Expand Up @@ -2234,7 +2263,11 @@ func (s *nudrService) DeregistrationSmfRegistrationsProcedure(ueID string, pduSe
return nil
}

func (s *nudrService) RegistrationSmfRegistrationsProcedure(request *models.SmfRegistration, ueID string, pduSessionID string) (
func (s *nudrService) RegistrationSmfRegistrationsProcedure(
request *models.SmfRegistration,
ueID string,
pduSessionID string,
) (
header http.Header, response *models.SmfRegistration, problemDetails *models.ProblemDetails,
) {
ctx, pd, err := udm_context.GetSelf().GetTokenCtx(models.ServiceName_NUDR_DR, models.NfType_UDR)
Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/eventexposure/api_create_ee_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func HTTPCreateEeSubscription(c *gin.Context) {
return
}

//err = openapi.Deserialize(&eeSubscription, requestBody, "application/json")
// err = openapi.Deserialize(&eeSubscription, requestBody, "application/json")
err = openapi.Deserialize(nil, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ func (p *Processor) HandleGetAmData(c *gin.Context) {
}
}

func (p *Processor) getPlmnIDStruct(queryParameters url.Values) (plmnIDStruct *models.PlmnId, problemDetails *models.ProblemDetails) {
func (p *Processor) getPlmnIDStruct(
queryParameters url.Values,
) (plmnIDStruct *models.PlmnId, problemDetails *models.ProblemDetails) {
if queryParameters["plmn-id"] != nil {
plmnIDJson := queryParameters["plmn-id"][0]
plmnIDStruct := &models.PlmnId{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package processor
import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// GetAmf3gppAccess - retrieve the AMF registration for 3GPP access information
func (p *Processor) HandleGetAmf3gppAccess(c *gin.Context) {

// step 1: log
logger.UecmLog.Infof("Handle HandleGetAmf3gppAccessRequest")

Expand All @@ -37,5 +37,4 @@ func (p *Processor) HandleGetAmf3gppAccess(c *gin.Context) {
c.JSON(http.StatusForbidden, problemDetails)
return
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import (
"net/http"

"github.com/antihax/optional"
"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/Nudr_DataRepository"
"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// GetAmfNon3gppAccess - retrieve the AMF registration for non-3GPP access information
func (p *Processor) HandleGetAmfNon3gppAccess(c *gin.Context) {

// step 1: log
logger.UecmLog.Infoln("Handle GetAmfNon3gppAccessRequest")

Expand Down Expand Up @@ -42,5 +42,4 @@ func (p *Processor) HandleGetAmfNon3gppAccess(c *gin.Context) {
c.JSON(http.StatusForbidden, problemDetails)
return
}

}
3 changes: 2 additions & 1 deletion internal/sbi/processor/amf_registration_for3_gpp_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package processor
import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi"
"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// RegistrationAmf3gppAccess - register as AMF for 3GPP access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package processor
import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi"
"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// Register - register as AMF for non-3GPP access
Expand Down Expand Up @@ -64,5 +65,4 @@ func (p *Processor) HandleRegistrationAmfNon3gppAccess(c *gin.Context) {
c.Status(http.StatusNoContent)
return
}

}
2 changes: 0 additions & 2 deletions internal/sbi/processor/ee_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func (p *Processor) HandleCreateEeSubscription(c *gin.Context) {
}

func (p *Processor) HandleDeleteEeSubscription(c *gin.Context) {

ueIdentity := c.Params.ByName("ueIdentity")
subscriptionID := c.Params.ByName("subscriptionId")

Expand Down Expand Up @@ -124,5 +123,4 @@ func (p *Processor) HandleUpdateEeSubscription(c *gin.Context) {
c.Status(http.StatusNoContent)
return
}

}
2 changes: 1 addition & 1 deletion internal/sbi/processor/gpsi_to_supi_translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

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

// step 1: log
logger.SdmLog.Infof("Handle GetIdTranslationResultRequest")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package processor
import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi"
"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// UpdateAmf3gppAccess - Update a parameter in the AMF registration for 3GPP access
Expand Down Expand Up @@ -58,5 +59,4 @@ func (p *Processor) HandleUpdateAmf3gppAccess(c *gin.Context) {
c.Status(http.StatusNoContent)
return
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package processor
import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi"
"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// UpdateAmfNon3gppAccess - update a parameter in the AMF registration for non-3GPP access
Expand Down Expand Up @@ -57,5 +58,4 @@ func (p *Processor) HandleUpdateAmfNon3gppAccess(c *gin.Context) {
c.Status(http.StatusNoContent)
return
}

}
3 changes: 2 additions & 1 deletion internal/sbi/processor/retrieval_of_multiple_data_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"net/url"
"strings"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// GetSupi - retrieve multiple data sets
Expand Down
3 changes: 2 additions & 1 deletion internal/sbi/processor/retrieval_of_shared_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package processor
import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// GetSharedData - retrieve shared data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"net/http"
"net/url"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/internal/logger"
"github.com/gin-gonic/gin"
)

// GetSmData - retrieve a UE's Session Management Subscription Data
Expand Down Expand Up @@ -51,5 +52,4 @@ func (p *Processor) HandleGetSmData(c *gin.Context) {
c.JSON(http.StatusForbidden, problemDetails)
return
}

}
Loading

0 comments on commit c563d3e

Please sign in to comment.