From 833df6225ccd59cfa1594550ec38e9191adf29fa Mon Sep 17 00:00:00 2001 From: ubuntu Date: Wed, 14 Aug 2024 10:52:50 +0000 Subject: [PATCH] chore: update openapi version --- go.mod | 5 ++--- go.sum | 10 ++++------ internal/context/context.go | 8 ++++---- internal/sbi/api_eventexposure.go | 2 +- internal/sbi/consumer/nf_management_test.go | 6 ++++-- internal/sbi/processor/event_exposure.go | 9 ++++----- internal/sbi/processor/generate_auth_data.go | 7 +++---- internal/sbi/processor/generate_auth_data_test.go | 8 ++++---- internal/sbi/processor/subscriber_data_management.go | 4 ++-- 9 files changed, 28 insertions(+), 31 deletions(-) diff --git a/go.mod b/go.mod index 9e45931..914dbd2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d - github.com/free5gc/openapi v1.0.9-0.20240718074746-f272c26db1c3 + github.com/free5gc/openapi v1.0.9-0.20240814064656-cbf3ade43540 github.com/free5gc/util v1.0.6 github.com/gin-gonic/gin v1.9.1 github.com/google/uuid v1.3.0 @@ -32,7 +32,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -60,6 +60,5 @@ require ( golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/protobuf v1.33.0 // indirect - gopkg.in/h2non/gock.v1 v1.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index d474fcd..2472623 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/free5gc/openapi v1.0.9-0.20240718074746-f272c26db1c3 h1:IY37zQ+nXFGhCNy0V0jXTMVG00j61dtC67GMg+8j2kU= -github.com/free5gc/openapi v1.0.9-0.20240718074746-f272c26db1c3/go.mod h1:oy68rqnHakRLUCuEOXcis7/PWGBuil+UaXMeTBeYY8Y= +github.com/free5gc/openapi v1.0.9-0.20240814064656-cbf3ade43540 h1:8/Wxn6tJVcOrSEyAuSsyc6ye4gkU8tLLa8PtozCkK0U= +github.com/free5gc/openapi v1.0.9-0.20240814064656-cbf3ade43540/go.mod h1:aKw6uGzEibGDrn9++w4/JpWxaaUBo7GaqsvuFKU9fl4= github.com/free5gc/util v1.0.6 h1:dBt9drcXtYKE/cY5XuQcuffgsYclPIpIArhSeS6M+DQ= github.com/free5gc/util v1.0.6/go.mod h1:eSGN7POUM8LNTvg/E591XR6447a6/w1jFWGKNZPHcXw= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= @@ -40,8 +40,8 @@ github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= @@ -167,8 +167,6 @@ google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGm google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= -gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/internal/context/context.go b/internal/context/context.go index 99dd97e..dbf5a17 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -76,13 +76,13 @@ type UdmUeContext struct { TraceDataResponse models.TraceDataResponse TraceData *models.TraceData SessionManagementSubsData map[string]models.SessionManagementSubscriptionData - SubsDataSets *models.SubscriptionDataSets + SubsDataSets *models.UdmSdmSubscriptionDataSets SubscribeToNotifChange map[string]*models.SdmSubscription SubscribeToNotifSharedDataChange *models.SdmSubscription PduSessionID string UdrUri string UdmSubsToNotify map[string]*models.SubscriptionDataSubscriptions - EeSubscriptions map[string]*models.EeSubscription // subscriptionID as key + EeSubscriptions map[string]*models.UdmEeEeSubscription // subscriptionID as key amSubsDataLock sync.Mutex smfSelSubsDataLock sync.Mutex SmSubsDataLock sync.RWMutex @@ -90,7 +90,7 @@ type UdmUeContext struct { func (ue *UdmUeContext) Init() { ue.UdmSubsToNotify = make(map[string]*models.SubscriptionDataSubscriptions) - ue.EeSubscriptions = make(map[string]*models.EeSubscription) + ue.EeSubscriptions = make(map[string]*models.UdmEeEeSubscription) ue.SubscribeToNotifChange = make(map[string]*models.SdmSubscription) } @@ -221,7 +221,7 @@ func GetCorrespondingSupi(list models.IdentityData) (id string) { } // functions related to Retrieval of multiple datasets(GetSupi) -func (context *UDMContext) CreateSubsDataSetsForUe(supi string, body models.SubscriptionDataSets) { +func (context *UDMContext) CreateSubsDataSetsForUe(supi string, body models.UdmSdmSubscriptionDataSets) { ue, ok := context.UdmUeFindBySupi(supi) if !ok { ue = context.NewUdmUe(supi) diff --git a/internal/sbi/api_eventexposure.go b/internal/sbi/api_eventexposure.go index db06efb..4af2ff8 100644 --- a/internal/sbi/api_eventexposure.go +++ b/internal/sbi/api_eventexposure.go @@ -45,7 +45,7 @@ func (s *Server) getEventExposureRoutes() []Route { // HTTPCreateEeSubscription - Subscribe func (s *Server) HandleCreateEeSubscription(c *gin.Context) { - var eesubscription models.EeSubscription + var eesubscription models.UdmEeEeSubscription requestBody, err := c.GetRawData() if err != nil { diff --git a/internal/sbi/consumer/nf_management_test.go b/internal/sbi/consumer/nf_management_test.go index b185799..fd98fcc 100644 --- a/internal/sbi/consumer/nf_management_test.go +++ b/internal/sbi/consumer/nf_management_test.go @@ -16,8 +16,10 @@ import ( func TestSendRegisterNFInstance(t *testing.T) { defer gock.Off() // Flush pending mocks after test execution - gock.InterceptClient(openapi.GetHttpClient()) - defer gock.RestoreClient(openapi.GetHttpClient()) + openapi.InterceptH2CClient() + defer openapi.RestoreH2CClient() + // gock.InterceptClient(openapi.GetHttpClient()) + // defer gock.RestoreClient(openapi.GetHttpClient()) gock.New("http://127.0.0.10:8000"). Put("/nnrf-nfm/v1/nf-instances/1"). diff --git a/internal/sbi/processor/event_exposure.go b/internal/sbi/processor/event_exposure.go index ad083df..4807683 100644 --- a/internal/sbi/processor/event_exposure.go +++ b/internal/sbi/processor/event_exposure.go @@ -14,7 +14,7 @@ import ( // EE service func (p *Processor) CreateEeSubscriptionProcedure(c *gin.Context, ueIdentity string, - eesubscription models.EeSubscription, + eesubscription models.UdmEeEeSubscription, ) { udmSelf := p.Context() logger.EeLog.Debugf("udIdentity: %s", ueIdentity) @@ -34,10 +34,9 @@ func (p *Processor) CreateEeSubscriptionProcedure(c *gin.Context, ueIdentity str c.JSON(int(problemDetails.Status), problemDetails) return } - subscriptionID := strconv.Itoa(int(id)) ue.EeSubscriptions[subscriptionID] = &eesubscription - createdEeSubscription := &models.CreatedEeSubscription{ + createdEeSubscription := &models.UdmEeCreatedEeSubscription{ EeSubscription: &eesubscription, } c.JSON(http.StatusCreated, createdEeSubscription) @@ -60,7 +59,7 @@ func (p *Processor) CreateEeSubscriptionProcedure(c *gin.Context, ueIdentity str return } subscriptionID := strconv.Itoa(int(id)) - createdEeSubscription := &models.CreatedEeSubscription{ + createdEeSubscription := &models.UdmEeCreatedEeSubscription{ EeSubscription: &eesubscription, } @@ -84,7 +83,7 @@ func (p *Processor) CreateEeSubscriptionProcedure(c *gin.Context, ueIdentity str return } subscriptionID := strconv.Itoa(int(id)) - createdEeSubscription := &models.CreatedEeSubscription{ + createdEeSubscription := &models.UdmEeCreatedEeSubscription{ EeSubscription: &eesubscription, } udmSelf.UdmUePool.Range(func(key, value interface{}) bool { diff --git a/internal/sbi/processor/generate_auth_data.go b/internal/sbi/processor/generate_auth_data.go index fafad12..82729a2 100644 --- a/internal/sbi/processor/generate_auth_data.go +++ b/internal/sbi/processor/generate_auth_data.go @@ -124,7 +124,7 @@ func (p *Processor) GenerateAuthDataProcedure( } logger.UeauLog.Traceln("In GenerateAuthDataProcedure") - response := &models.AuthenticationInfoResult{} + response := &models.UdmUeauAuthenticationInfoResult{} rand.New(rand.NewSource(time.Now().UnixNano())) supi, err := suci.ToSupi(supiOrSuci, p.Context().SuciProfiles) if err != nil { @@ -449,7 +449,7 @@ func (p *Processor) GenerateAuthDataProcedure( var av models.AuthenticationVector if authSubs.AuthenticationSubscription.AuthenticationMethod == models.AuthMethod__5_G_AKA { - response.AuthType = models.AuthType__5_G_AKA + response.AuthType = models.UdmUeauAuthType__5_G_AKA // derive XRES* key := append(CK, IK...) @@ -483,8 +483,7 @@ func (p *Processor) GenerateAuthDataProcedure( av.Kausf = hex.EncodeToString(kdfValForKausf) av.AvType = models.AvType__5_G_HE_AKA } else { // EAP-AKA' - response.AuthType = models.AuthType_EAP_AKA_PRIME - + response.AuthType = models.UdmUeauAuthType_EAP_AKA_PRIME // derive CK' and IK' key := append(CK, IK...) FC := ueauth.FC_FOR_CK_PRIME_IK_PRIME_DERIVATION diff --git a/internal/sbi/processor/generate_auth_data_test.go b/internal/sbi/processor/generate_auth_data_test.go index 591e8f9..d8f8e52 100644 --- a/internal/sbi/processor/generate_auth_data_test.go +++ b/internal/sbi/processor/generate_auth_data_test.go @@ -20,8 +20,8 @@ import ( func TestGenerateAuthDataProcedure(t *testing.T) { defer gock.Off() // Flush pending mocks after test execution - gock.InterceptClient(openapi.GetHttpClient()) - defer gock.RestoreClient(openapi.GetHttpClient()) + openapi.InterceptH2CClient() + defer openapi.RestoreH2CClient() queryRes := models.AuthenticationSubscription{ AuthenticationMethod: models.AuthMethod__5_G_AKA, @@ -85,13 +85,13 @@ func TestGenerateAuthDataProcedure(t *testing.T) { t.Fatalf("Failed to read response body: %+v", errReadAll) } - var res models.AuthenticationInfoResult + var res models.UdmUeauAuthenticationInfoResult err = openapi.Deserialize(&res, rawBytes, httpResp.Header.Get("Content-Type")) if err != nil { t.Fatalf("Failed to deserialize response body: %+v", err) } - expectResponse := models.AuthenticationInfoResult{ + expectResponse := models.UdmUeauAuthenticationInfoResult{ AuthType: "5G_AKA", AuthenticationVector: &models.AuthenticationVector{ AvType: "5G_HE_AKA", diff --git a/internal/sbi/processor/subscriber_data_management.go b/internal/sbi/processor/subscriber_data_management.go index 0fb571e..ab7d990 100644 --- a/internal/sbi/processor/subscriber_data_management.go +++ b/internal/sbi/processor/subscriber_data_management.go @@ -126,7 +126,7 @@ func (p *Processor) GetSupiProcedure(c *gin.Context, return } - var subscriptionDataSets, subsDataSetBody models.SubscriptionDataSets + var subscriptionDataSets, subsDataSetBody models.UdmSdmSubscriptionDataSets var ueContextInSmfDataResp models.UeContextInSmfData pduSessionMap := make(map[string]models.PduSession) var pgwInfoArray []models.PgwInfo @@ -271,7 +271,7 @@ func (p *Processor) GetSupiProcedure(c *gin.Context, smData, _, _, _ := p.Context(). ManageSmData(sessionManagementSubscriptionDataRsp.SmSubsData.IndividualSmSubsData, "", "") udmUe.SetSMSubsData(smData) - subscriptionDataSets.SmData = sessionManagementSubscriptionDataRsp.SmSubsData.IndividualSmSubsData + subscriptionDataSets.SmData = &sessionManagementSubscriptionDataRsp.SmSubsData } if p.containDataSetName(dataSetNames, string(models.DataSetName_TRACE)) {