Skip to content

Commit

Permalink
Merge branch 'master' into fix-nrf-old-ip
Browse files Browse the repository at this point in the history
  • Loading branch information
gab-arrobo authored Nov 22, 2023
2 parents 768ba19 + a54dd6c commit cbdd2b5
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 66 deletions.
20 changes: 10 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,28 +218,28 @@ linters-settings:

linters:
enable:
- gofmt
# - gofmt
- govet
- errcheck
- staticcheck
- unused
- gosimple
- ineffassign
# - staticcheck
# - unused
# - gosimple
# - ineffassign
- typecheck
# Additional
- lll
# - lll
- godox
#- gomnd
#- goconst
# - gocognit
# - maligned
# - nestif
# - gomodguard
- nakedret
- gci
# - nakedret
# - gci
- misspell
- gofumpt
- whitespace
# - gofumpt
# - whitespace
- unconvert
- predeclared
- noctx
Expand Down
3 changes: 2 additions & 1 deletion consumer/nf_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const (
)

func SendNFIntances(nrfUri string, targetNfType, requestNfType models.NfType,
param Nnrf_NFDiscovery.SearchNFInstancesParamOpts) (result models.SearchResult, err error) {
param Nnrf_NFDiscovery.SearchNFInstancesParamOpts,
) (result models.SearchResult, err error) {
configuration := Nnrf_NFDiscovery.NewConfiguration()
configuration.SetBasePath(nrfUri) // addr
clientNRF := Nnrf_NFDiscovery.NewAPIClient(configuration)
Expand Down
3 changes: 2 additions & 1 deletion consumer/nf_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func BuildNFInstance(udmContext *udm_context.UDMContext) (profile models.NfProfi
}

var SendRegisterNFInstance = func(nrfUri, nfInstanceId string, profile models.NfProfile) (prof models.NfProfile, resouceNrfUri string,
retrieveNfInstanceId string, err error) {
retrieveNfInstanceId string, err error,
) {
configuration := Nnrf_NFManagement.NewConfiguration()
configuration.SetBasePath(nrfUri)
client := Nnrf_NFManagement.NewAPIClient(configuration)
Expand Down
6 changes: 4 additions & 2 deletions context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (context *UDMContext) GetUdmProfileBHNPrivateKey() string {

func (context *UDMContext) ManageSmData(smDatafromUDR []models.SessionManagementSubscriptionData, snssaiFromReq string,
dnnFromReq string) (mp map[string]models.SessionManagementSubscriptionData, ind string,
Dnns []models.DnnConfiguration, allDnns []map[string]models.DnnConfiguration) {
Dnns []models.DnnConfiguration, allDnns []map[string]models.DnnConfiguration,
) {
smDataMap := make(map[string]models.SessionManagementSubscriptionData)
sNssaiList := make([]string, len(smDatafromUDR))
// to obtain all DNN configurations identified by "dnn" for all network slices where such DNN is available
Expand Down Expand Up @@ -280,7 +281,8 @@ func (context *UDMContext) UdmUeFindByGpsi(gpsi string) (*UdmUeContext, bool) {

// Function to create the AccessAndMobilitySubscriptionData for Ue
func (context *UDMContext) CreateAccessMobilitySubsDataForUe(supi string,
body models.AccessAndMobilitySubscriptionData) {
body models.AccessAndMobilitySubscriptionData,
) {
ue, ok := context.UdmUeFindBySupi(supi)
if !ok {
ue = context.NewUdmUe(supi)
Expand Down
3 changes: 1 addition & 2 deletions factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import (
"fmt"
"io/ioutil"

"gopkg.in/yaml.v2"

"github.com/omec-project/udm/logger"
"gopkg.in/yaml.v2"
)

var UdmConfig Config
Expand Down
1 change: 0 additions & 1 deletion httpcallback/data_change_notification_to_nf.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"net/http"

"github.com/gin-gonic/gin"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/models"
Expand Down
3 changes: 1 addition & 2 deletions httpcallback/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import (
"strings"

"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"

"github.com/omec-project/logger_util"
"github.com/omec-project/udm/logger"
"github.com/sirupsen/logrus"
)

var HttpLog *logrus.Entry
Expand Down
3 changes: 2 additions & 1 deletion producer/callback/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func DataChangeNotificationProcedure(notifyItems []models.NotifyItem, supi strin
}

func SendOnDeregistrationNotification(ueId string, onDeregistrationNotificationUrl string,
deregistData models.DeregistrationData) *models.ProblemDetails {
deregistData models.DeregistrationData,
) *models.ProblemDetails {
configuration := Nudm_UEContextManagement.NewConfiguration()
clientAPI := Nudm_UEContextManagement.NewAPIClient(configuration)

Expand Down
6 changes: 4 additions & 2 deletions producer/event_exposure.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func HandleCreateEeSubscription(request *http_wrapper.Request) *http_wrapper.Res

// TODO: complete this procedure based on TS 29503 5.5
func CreateEeSubscriptionProcedure(ueIdentity string,
eesubscription models.EeSubscription) (*models.CreatedEeSubscription, *models.ProblemDetails) {
eesubscription models.EeSubscription,
) (*models.CreatedEeSubscription, *models.ProblemDetails) {
udmSelf := udm_context.UDM_Self()

logger.EeLog.Debugf("udIdentity: %s", ueIdentity)
Expand Down Expand Up @@ -188,7 +189,8 @@ func HandleUpdateEeSubscription(request *http_wrapper.Request) *http_wrapper.Res

// TODO: complete this procedure based on TS 29503 5.5
func UpdateEeSubscriptionProcedure(ueIdentity string, subscriptionID string,
patchList []models.PatchItem) *models.ProblemDetails {
patchList []models.PatchItem,
) *models.ProblemDetails {
udmSelf := udm_context.UDM_Self()

switch {
Expand Down
4 changes: 2 additions & 2 deletions producer/generate_auth_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"time"

"github.com/antihax/optional"

"github.com/omec-project/UeauCommon"
"github.com/omec-project/http_wrapper"
"github.com/omec-project/milenage"
Expand Down Expand Up @@ -159,7 +158,8 @@ func ConfirmAuthDataProcedure(authEvent models.AuthEvent, supi string) (problemD
}

func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest, supiOrSuci string) (
response *models.AuthenticationInfoResult, problemDetails *models.ProblemDetails) {
response *models.AuthenticationInfoResult, problemDetails *models.ProblemDetails,
) {
logger.UeauLog.Traceln("In GenerateAuthDataProcedure")

response = &models.AuthenticationInfoResult{}
Expand Down
46 changes: 28 additions & 18 deletions producer/subscriber_data_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strconv"

"github.com/antihax/optional"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/Nudm_SubscriberDataManagement"
Expand Down Expand Up @@ -51,7 +50,8 @@ func HandleGetAmDataRequest(request *http_wrapper.Request) *http_wrapper.Respons

// GetAmDataProcedure
func getAmDataProcedure(supi string, plmnID string, supportedFeatures string) (
response *models.AccessAndMobilitySubscriptionData, problemDetails *models.ProblemDetails) {
response *models.AccessAndMobilitySubscriptionData, problemDetails *models.ProblemDetails,
) {
var queryAmDataParamOpts Nudr.QueryAmDataParamOpts
queryAmDataParamOpts.SupportedFeatures = optional.NewString(supportedFeatures)

Expand Down Expand Up @@ -120,7 +120,8 @@ func HandleGetIdTranslationResultRequest(request *http_wrapper.Request) *http_wr
}

func getIdTranslationResultProcedure(gpsi string) (response *models.IdTranslationResult,
problemDetails *models.ProblemDetails) {
problemDetails *models.ProblemDetails,
) {
var idTranslationResult models.IdTranslationResult
var getIdentityDataParamOpts Nudr.GetIdentityDataParamOpts

Expand Down Expand Up @@ -153,11 +154,9 @@ func getIdTranslationResultProcedure(gpsi string) (response *models.IdTranslatio
}()

if res.StatusCode == http.StatusOK {
idList := udm_context.UDM_Self().GpsiSupiList
idList = idTranslationResultResp
if idList.SupiList != nil {
if idTranslationResultResp.SupiList != nil {
// GetCorrespondingSupi get corresponding Supi(here IMSI) matching the given Gpsi from the queried SUPI list from UDR
idTranslationResult.Supi = udm_context.GetCorrespondingSupi(idList)
idTranslationResult.Supi = udm_context.GetCorrespondingSupi(idTranslationResultResp)
idTranslationResult.Gpsi = gpsi

return &idTranslationResult, nil
Expand Down Expand Up @@ -207,7 +206,8 @@ func HandleGetSupiRequest(request *http_wrapper.Request) *http_wrapper.Response
}

func getSupiProcedure(supi string, plmnID string, dataSetNames []string, supportedFeatures string) (
response *models.SubscriptionDataSets, problemDetails *models.ProblemDetails) {
response *models.SubscriptionDataSets, problemDetails *models.ProblemDetails,
) {
clientAPI, err := createUDMClientToUDR(supi)
if err != nil {
return nil, util.ProblemDetailsSystemFailure(err.Error())
Expand Down Expand Up @@ -469,7 +469,8 @@ func HandleGetSharedDataRequest(request *http_wrapper.Request) *http_wrapper.Res
}

func getSharedDataProcedure(sharedDataIds []string, supportedFeatures string) (
response []models.SharedData, problemDetails *models.ProblemDetails) {
response []models.SharedData, problemDetails *models.ProblemDetails,
) {
clientAPI, err := createUDMClientToUDR("")
if err != nil {
return nil, util.ProblemDetailsSystemFailure(err.Error())
Expand Down Expand Up @@ -544,7 +545,8 @@ func HandleGetSmDataRequest(request *http_wrapper.Request) *http_wrapper.Respons
}

func getSmDataProcedure(supi string, plmnID string, Dnn string, Snssai string, supportedFeatures string) (
response interface{}, problemDetails *models.ProblemDetails) {
response interface{}, problemDetails *models.ProblemDetails,
) {
logger.SdmLog.Infof("getSmDataProcedure: SUPI[%s] PLMNID[%s] DNN[%s] SNssai[%s]", supi, plmnID, Dnn, Snssai)

clientAPI, err := createUDMClientToUDR(supi)
Expand Down Expand Up @@ -646,7 +648,8 @@ func HandleGetNssaiRequest(request *http_wrapper.Request) *http_wrapper.Response
}

func getNssaiProcedure(supi string, plmnID string, supportedFeatures string) (
*models.Nssai, *models.ProblemDetails) {
*models.Nssai, *models.ProblemDetails,
) {
var queryAmDataParamOpts Nudr.QueryAmDataParamOpts
queryAmDataParamOpts.SupportedFeatures = optional.NewString(supportedFeatures)
var nssaiResp models.Nssai
Expand Down Expand Up @@ -721,7 +724,8 @@ func HandleGetSmfSelectDataRequest(request *http_wrapper.Request) *http_wrapper.
}

func getSmfSelectDataProcedure(supi string, plmnID string, supportedFeatures string) (
response *models.SmfSelectionSubscriptionData, problemDetails *models.ProblemDetails) {
response *models.SmfSelectionSubscriptionData, problemDetails *models.ProblemDetails,
) {
var querySmfSelectDataParamOpts Nudr.QuerySmfSelectDataParamOpts
querySmfSelectDataParamOpts.SupportedFeatures = optional.NewString(supportedFeatures)
var body models.SmfSelectionSubscriptionData
Expand Down Expand Up @@ -792,7 +796,8 @@ func HandleSubscribeToSharedDataRequest(request *http_wrapper.Request) *http_wra
}

func subscribeToSharedDataProcedure(sdmSubscription *models.SdmSubscription) (
header http.Header, response *models.SdmSubscription, problemDetails *models.ProblemDetails) {
header http.Header, response *models.SdmSubscription, problemDetails *models.ProblemDetails,
) {
cfg := Nudm_SubscriberDataManagement.NewConfiguration()
udmClientAPI := Nudm_SubscriberDataManagement.NewAPIClient(cfg)

Expand Down Expand Up @@ -864,7 +869,8 @@ func HandleSubscribeRequest(request *http_wrapper.Request) *http_wrapper.Respons
}

func subscribeProcedure(sdmSubscription *models.SdmSubscription, supi string) (
header http.Header, response *models.SdmSubscription, problemDetails *models.ProblemDetails) {
header http.Header, response *models.SdmSubscription, problemDetails *models.ProblemDetails,
) {
clientAPI, err := createUDMClientToUDR(supi)
if err != nil {
return nil, nil, util.ProblemDetailsSystemFailure(err.Error())
Expand Down Expand Up @@ -1055,7 +1061,8 @@ func HandleModifyRequest(request *http_wrapper.Request) *http_wrapper.Response {
}

func modifyProcedure(sdmSubsModification *models.SdmSubsModification, supi string, subscriptionID string) (
response *models.SdmSubscription, problemDetails *models.ProblemDetails) {
response *models.SdmSubscription, problemDetails *models.ProblemDetails,
) {
clientAPI, err := createUDMClientToUDR(supi)
if err != nil {
return nil, util.ProblemDetailsSystemFailure(err.Error())
Expand Down Expand Up @@ -1126,7 +1133,8 @@ func HandleModifyForSharedDataRequest(request *http_wrapper.Request) *http_wrapp
}

func modifyForSharedDataProcedure(sdmSubsModification *models.SdmSubsModification, supi string,
subscriptionID string) (response *models.SdmSubscription, problemDetails *models.ProblemDetails) {
subscriptionID string,
) (response *models.SdmSubscription, problemDetails *models.ProblemDetails) {
clientAPI, err := createUDMClientToUDR(supi)
if err != nil {
return nil, util.ProblemDetailsSystemFailure(err.Error())
Expand Down Expand Up @@ -1198,7 +1206,8 @@ func HandleGetTraceDataRequest(request *http_wrapper.Request) *http_wrapper.Resp
}

func getTraceDataProcedure(supi string, plmnID string) (
response *models.TraceData, problemDetails *models.ProblemDetails) {
response *models.TraceData, problemDetails *models.ProblemDetails,
) {
var body models.TraceData
var queryTraceDataParamOpts Nudr.QueryTraceDataParamOpts

Expand Down Expand Up @@ -1274,7 +1283,8 @@ func HandleGetUeContextInSmfDataRequest(request *http_wrapper.Request) *http_wra
}

func getUeContextInSmfDataProcedure(supi string, supportedFeatures string) (
response *models.UeContextInSmfData, problemDetails *models.ProblemDetails) {
response *models.UeContextInSmfData, problemDetails *models.ProblemDetails,
) {
var body models.UeContextInSmfData
var ueContextInSmfData models.UeContextInSmfData
var pgwInfoArray []models.PgwInfo
Expand Down
23 changes: 15 additions & 8 deletions producer/ue_context_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"strings"

"github.com/antihax/optional"

"github.com/omec-project/http_wrapper"
"github.com/omec-project/openapi"
"github.com/omec-project/openapi/Nudr_DataRepository"
Expand Down Expand Up @@ -106,7 +105,8 @@ func HandleGetAmf3gppAccessRequest(request *http_wrapper.Request) *http_wrapper.
}

func GetAmf3gppAccessProcedure(ueID string, supportedFeatures string) (
response *models.Amf3GppAccessRegistration, problemDetails *models.ProblemDetails) {
response *models.Amf3GppAccessRegistration, problemDetails *models.ProblemDetails,
) {
var queryAmfContext3gppParamOpts Nudr_DataRepository.QueryAmfContext3gppParamOpts
queryAmfContext3gppParamOpts.SupportedFeatures = optional.NewString(supportedFeatures)

Expand Down Expand Up @@ -163,7 +163,8 @@ func HandleGetAmfNon3gppAccessRequest(request *http_wrapper.Request) *http_wrapp

func GetAmfNon3gppAccessProcedure(queryAmfContextNon3gppParamOpts Nudr_DataRepository.
QueryAmfContextNon3gppParamOpts, ueID string) (response *models.AmfNon3GppAccessRegistration,
problemDetails *models.ProblemDetails) {
problemDetails *models.ProblemDetails,
) {
clientAPI, err := createUDMClientToUDR(ueID)
if err != nil {
return nil, util.ProblemDetailsSystemFailure(err.Error())
Expand Down Expand Up @@ -213,7 +214,8 @@ func HandleRegistrationAmf3gppAccessRequest(request *http_wrapper.Request) *http

// TS 29.503 5.3.2.2.2
func RegistrationAmf3gppAccessProcedure(registerRequest models.Amf3GppAccessRegistration, ueID string) (
header http.Header, response *models.Amf3GppAccessRegistration, problemDetails *models.ProblemDetails) {
header http.Header, response *models.Amf3GppAccessRegistration, problemDetails *models.ProblemDetails,
) {
// TODO: EPS interworking with N26 is not supported yet in this stage
var oldAmf3GppAccessRegContext *models.Amf3GppAccessRegistration
if udm_context.UDM_Self().UdmAmf3gppRegContextExists(ueID) {
Expand Down Expand Up @@ -291,7 +293,8 @@ func HandleRegisterAmfNon3gppAccessRequest(request *http_wrapper.Request) *http_
}

func RegisterAmfNon3gppAccessProcedure(registerRequest models.AmfNon3GppAccessRegistration, ueID string) (
header http.Header, response *models.AmfNon3GppAccessRegistration, problemDetails *models.ProblemDetails) {
header http.Header, response *models.AmfNon3GppAccessRegistration, problemDetails *models.ProblemDetails,
) {
var oldAmfNon3GppAccessRegContext *models.AmfNon3GppAccessRegistration
if udm_context.UDM_Self().UdmAmfNon3gppRegContextExists(ueID) {
ue, _ := udm_context.UDM_Self().UdmUeFindBySupi(ueID)
Expand Down Expand Up @@ -364,7 +367,8 @@ func HandleUpdateAmf3gppAccessRequest(request *http_wrapper.Request) *http_wrapp
}

func UpdateAmf3gppAccessProcedure(request models.Amf3GppAccessRegistrationModification, ueID string) (
problemDetails *models.ProblemDetails) {
problemDetails *models.ProblemDetails,
) {
var patchItemReqArray []models.PatchItem
currentContext := udm_context.UDM_Self().GetAmf3gppRegContext(ueID)
if currentContext == nil {
Expand Down Expand Up @@ -475,7 +479,8 @@ func HandleUpdateAmfNon3gppAccessRequest(request *http_wrapper.Request) *http_wr
}

func UpdateAmfNon3gppAccessProcedure(request models.AmfNon3GppAccessRegistrationModification, ueID string) (
problemDetails *models.ProblemDetails) {
problemDetails *models.ProblemDetails,
) {
var patchItemReqArray []models.PatchItem
currentContext := udm_context.UDM_Self().GetAmfNon3gppRegContext(ueID)
if currentContext == nil {
Expand All @@ -498,6 +503,7 @@ func UpdateAmfNon3gppAccessProcedure(request models.AmfNon3GppAccessRegistration
Status: http.StatusForbidden,
Cause: "INVALID_GUAMI",
}
return problemDetails
}

var patchItemTmp models.PatchItem
Expand Down Expand Up @@ -633,7 +639,8 @@ func HandleRegistrationSmfRegistrationsRequest(request *http_wrapper.Request) *h

// SmfRegistrationsProcedure
func RegistrationSmfRegistrationsProcedure(request *models.SmfRegistration, ueID string, pduSessionID string) (
header http.Header, response *models.SmfRegistration, problemDetails *models.ProblemDetails) {
header http.Header, response *models.SmfRegistration, problemDetails *models.ProblemDetails,
) {
contextExisted := false
udm_context.UDM_Self().CreateSmfRegContext(ueID, pduSessionID)
if !udm_context.UDM_Self().UdmSmfRegContextNotExists(ueID) {
Expand Down
Loading

0 comments on commit cbdd2b5

Please sign in to comment.