Skip to content

Commit

Permalink
chore: update openapi version
Browse files Browse the repository at this point in the history
  • Loading branch information
a3828162 committed Aug 14, 2024
1 parent ef45d07 commit 833df62
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 31 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
)
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
8 changes: 4 additions & 4 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,21 @@ 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
}

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)
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/api_eventexposure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions internal/sbi/consumer/nf_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down
9 changes: 4 additions & 5 deletions internal/sbi/processor/event_exposure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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,
}

Expand All @@ -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 {
Expand Down
7 changes: 3 additions & 4 deletions internal/sbi/processor/generate_auth_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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...)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/sbi/processor/generate_auth_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/processor/subscriber_data_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 833df62

Please sign in to comment.