Skip to content

Commit

Permalink
fix: change openapi in event_exposure and fix lint err
Browse files Browse the repository at this point in the history
  • Loading branch information
donald1218 committed Aug 15, 2024
1 parent 3055b9a commit 152af6b
Show file tree
Hide file tree
Showing 18 changed files with 178 additions and 131 deletions.
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/free5gc/amf
go 1.21

require (
github.com/antihax/optional v1.0.0
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/davecgh/go-spew v1.1.1
github.com/free5gc/aper v1.0.6-0.20240503143507-2c4c4780b98f
Expand Down Expand Up @@ -41,8 +40,9 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.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/gopherjs/gopherjs v1.17.2 // indirect
github.com/h2non/gock v1.2.0 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
Expand Down Expand Up @@ -73,11 +73,10 @@ require (
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/h2non/gock.v1 v1.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/free5gc/openapi => github.com/yccodr/openapi v1.0.9-0.20240730144000-d94a13fcf6b4
replace github.com/free5gc/openapi => github.com/free5gc/openapi v1.0.9-0.20240815044523-d494170a5c3a

replace github.com/free5gc/nas => github.com/free5gc/nas v1.1.4-0.20240801045646-998afcbf3811

Expand Down
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1 h1:+JkXLHME8vLJafGhOH4aoV2Iu8bR55nU6iKMVfYVLjY=
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1/go.mod h1:nuudZmJhzWtx2212z+pkuy7B6nkBqa+xwNXZHL1j8cg=
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/bytedance/sonic v1.11.5 h1:G00FYjjqll5iQ1PYXynbg/hyzqBqavH8Mo9/oTopd9k=
Expand All @@ -29,6 +27,8 @@ github.com/free5gc/nas v1.1.4-0.20240801045646-998afcbf3811 h1:S/4FPVGQm4xYNxRLd
github.com/free5gc/nas v1.1.4-0.20240801045646-998afcbf3811/go.mod h1:mVpI5guYTI24b9/cqnzilfHZa5nQeiLAh39/pVz9WrI=
github.com/free5gc/ngap v1.0.9-0.20240801044503-4db04dae3900 h1:ZElji98JSdDEJuUtpHGuV0L+xCY5ePs3YolqVfDR9Ig=
github.com/free5gc/ngap v1.0.9-0.20240801044503-4db04dae3900/go.mod h1:HedQCbA/XoFgO3wnNSNhIpp5Dhv0f42lLMT/EiEyAQ0=
github.com/free5gc/openapi v1.0.9-0.20240815044523-d494170a5c3a h1:e+7cHpQHPOZGP5bhonzDWn8YEyrMNO/66BgjGjwXe+k=
github.com/free5gc/openapi v1.0.9-0.20240815044523-d494170a5c3a/go.mod h1:aKw6uGzEibGDrn9++w4/JpWxaaUBo7GaqsvuFKU9fl4=
github.com/free5gc/sctp v1.0.1 h1:g8WDO97r8B9ubkT5Hyk9b4I1fZUOii9Z39gQ2eRaASo=
github.com/free5gc/sctp v1.0.1/go.mod h1:7QXfRWCmlkBGD0EIu3qL5o71bslfIakydz4h2QDZdjQ=
github.com/free5gc/util v1.0.6 h1:dBt9drcXtYKE/cY5XuQcuffgsYclPIpIArhSeS6M+DQ=
Expand All @@ -54,15 +54,17 @@ github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
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/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE=
github.com/h2non/gock v1.2.0/go.mod h1:tNhoxHYW2W42cYkYb1WqzdbYIieALC99kpYr7rH/BQk=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down Expand Up @@ -134,8 +136,6 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA=
github.com/yccodr/openapi v1.0.9-0.20240730144000-d94a13fcf6b4 h1:iNXXo/g3V7nqQBlXp4duj91El+HluMVlKxWhzftKPgQ=
github.com/yccodr/openapi v1.0.9-0.20240730144000-d94a13fcf6b4/go.mod h1:oy68rqnHakRLUCuEOXcis7/PWGBuil+UaXMeTBeYY8Y=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0 h1:RtcvQ4iw3w9NBB5yRwgA4sSa82rfId7n4atVpvKx3bY=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0/go.mod h1:f/PbKbRd4cdUICWell6DmzvVJ7QrmBgFrRHjXmAXbK4=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk=
Expand Down Expand Up @@ -171,8 +171,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
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.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
46 changes: 26 additions & 20 deletions internal/context/amf_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ func (ue *AmfUe) RemoveAmPolicyAssociation() {
ue.PolicyAssociationId = ""
}

func (ue *AmfUe) CopyDataFromUeContextModel(ueContext models.UeContext) {
func (ue *AmfUe) CopyDataFromUeContextModel(ueContext *models.UeContext) {
if ueContext.Supi != "" {
ue.Supi = ueContext.Supi
ue.UnauthenticatedSupi = ueContext.SupiUnauthInd
Expand All @@ -683,9 +683,9 @@ func (ue *AmfUe) CopyDataFromUeContextModel(ueContext models.UeContext) {
if ue.AccessAndMobilitySubscriptionData == nil {
ue.AccessAndMobilitySubscriptionData = new(models.AccessAndMobilitySubscriptionData)
}
if ue.AccessAndMobilitySubscriptionData.SubscribedUeAmbr == nil {
ue.AccessAndMobilitySubscriptionData.SubscribedUeAmbr = new(models.AmbrRm)
}
// if ue.AccessAndMobilitySubscriptionData.SubscribedUeAmbr == nil {
// ue.AccessAndMobilitySubscriptionData.SubscribedUeAmbr = new(models.AmbrRm)
// }

subAmbr := ue.AccessAndMobilitySubscriptionData.SubscribedUeAmbr
subAmbr.Uplink = ueContext.SubUeAmbr.Uplink
Expand Down Expand Up @@ -755,34 +755,40 @@ func (ue *AmfUe) CopyDataFromUeContextModel(ueContext models.UeContext) {
for _, trigger := range ueContext.AmPolicyReqTriggerList {
switch trigger {
case models.PolicyReqTrigger_LOCATION_CHANGE:
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers, models.PcfAmPolicyControlRequestTrigger_LOC_CH)
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers,
models.PcfAmPolicyControlRequestTrigger_LOC_CH)
case models.PolicyReqTrigger_PRA_CHANGE:
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers, models.PcfAmPolicyControlRequestTrigger_PRA_CH)
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers,
models.PcfAmPolicyControlRequestTrigger_PRA_CH)
case models.PolicyReqTrigger_ALLOWED_NSSAI_CHANGE:
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers, models.PcfAmPolicyControlRequestTrigger_ALLOWED_NSSAI_CH)
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers,
models.PcfAmPolicyControlRequestTrigger_ALLOWED_NSSAI_CH)
case models.PolicyReqTrigger_NWDAF_DATA_CHANGE:
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers, models.PcfAmPolicyControlRequestTrigger_NWDAF_DATA_CH)
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers,
models.PcfAmPolicyControlRequestTrigger_NWDAF_DATA_CH)
case models.PolicyReqTrigger_SMF_SELECT_CHANGE:
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers, models.PcfAmPolicyControlRequestTrigger_SMF_SELECT_CH)
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers,
models.PcfAmPolicyControlRequestTrigger_SMF_SELECT_CH)
case models.PolicyReqTrigger_ACCESS_TYPE_CHANGE:
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers, models.PcfAmPolicyControlRequestTrigger_ACCESS_TYPE_CH)
ue.AmPolicyAssociation.Triggers = append(ue.AmPolicyAssociation.Triggers,
models.PcfAmPolicyControlRequestTrigger_ACCESS_TYPE_CH)
}
}
}

if len(ueContext.SessionContextList) > 0 {
for _, pduSessionContext := range ueContext.SessionContextList {
for index := range ueContext.SessionContextList {
smContext := SmContext{
pduSessionID: pduSessionContext.PduSessionId,
smContextRef: pduSessionContext.SmContextRef,
snssai: *pduSessionContext.SNssai,
dnn: pduSessionContext.Dnn,
accessType: pduSessionContext.AccessType,
hSmfID: pduSessionContext.HsmfId,
vSmfID: pduSessionContext.VsmfId,
nsInstance: pduSessionContext.NsInstance,
pduSessionID: ueContext.SessionContextList[index].PduSessionId,
smContextRef: ueContext.SessionContextList[index].SmContextRef,
snssai: *ueContext.SessionContextList[index].SNssai,
dnn: ueContext.SessionContextList[index].Dnn,
accessType: ueContext.SessionContextList[index].AccessType,
hSmfID: ueContext.SessionContextList[index].HsmfId,
vSmfID: ueContext.SessionContextList[index].VsmfId,
nsInstance: ueContext.SessionContextList[index].NsInstance,
}
ue.StoreSmContext(pduSessionContext.PduSessionId, &smContext)
ue.StoreSmContext(ueContext.SessionContextList[index].PduSessionId, &smContext)
}
}

Expand Down
10 changes: 7 additions & 3 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ type AMFContextEventSubscription struct {
IsGroupUe bool
UeSupiList []string
Expiry *time.Time
EventSubscription models.ExtAmfEventSubscription
EventSubscription models.AmfEventSubscription
}

type SecurityAlgorithm struct {
Expand Down Expand Up @@ -241,7 +241,9 @@ func (context *AMFContext) AllocateRegistrationArea(ue *AmfUe, anType models.Acc
}
}

func (context *AMFContext) NewAMFStatusSubscription(subscriptionData models.AmfCommunicationSubscriptionData) (subscriptionID string) {
func (context *AMFContext) NewAMFStatusSubscription(subscriptionData models.AmfCommunicationSubscriptionData) (
subscriptionID string,
) {
id, err := amfStatusSubscriptionIDGenerator.Allocate()
if err != nil {
logger.CtxLog.Errorf("Allocate subscriptionID error: %+v", err)
Expand All @@ -254,7 +256,9 @@ func (context *AMFContext) NewAMFStatusSubscription(subscriptionData models.AmfC
}

// Return Value: (subscriptionData *models.SubScriptionData, ok bool)
func (context *AMFContext) FindAMFStatusSubscription(subscriptionID string) (*models.AmfCommunicationSubscriptionData, bool) {
func (context *AMFContext) FindAMFStatusSubscription(subscriptionID string) (
*models.AmfCommunicationSubscriptionData, bool,
) {
if value, ok := context.AMFStatusSubscriptions.Load(subscriptionID); ok {
subscriptionData := value.(models.AmfCommunicationSubscriptionData)
return &subscriptionData, ok
Expand Down
43 changes: 23 additions & 20 deletions internal/gmm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func transport5GSMMessage(ue *context.AmfUe, anType models.AccessType,
}
ue.GmmLog.Warningf("Duplicated PDU session ID[%d]", pduSessionID)
smContext.SetDuplicatedPduSessionID(true)
response, _, _, err := consumer.GetConsumer().SendUpdateSmContextRequest(smContext, updateData, nil, nil)
response, _, _, err := consumer.GetConsumer().SendUpdateSmContextRequest(smContext, &updateData, nil, nil)
if err != nil {
ue.GmmLog.Errorf("Failed to update smContext, local release SmContext[%d]", pduSessionID)
ue.SmContextList.Delete(pduSessionID)
Expand Down Expand Up @@ -314,7 +314,7 @@ func forward5GSMMessageToSMF(
}

response, errResponse, problemDetail, err := consumer.GetConsumer().SendUpdateSmContextRequest(smContext,
smContextUpdateData, smMessage, nil)
&smContextUpdateData, smMessage, nil)

if err != nil {
// TODO: error handling
Expand Down Expand Up @@ -574,7 +574,7 @@ func contextTransferFromOldAmf(ue *context.AmfUe, anType models.AccessType, oldA
Guami: &oldAmfGuami,
}
if err := consumer.GetConsumer().SearchAmfCommunicationInstance(ue, amfSelf.NrfUri, models.NrfNfManagementNfType_AMF,
models.NrfNfManagementNfType_AMF, searchOpt); err != nil {
models.NrfNfManagementNfType_AMF, &searchOpt); err != nil {
return err
}

Expand Down Expand Up @@ -604,7 +604,7 @@ func contextTransferFromOldAmf(ue *context.AmfUe, anType models.AccessType, oldA
ue.MacFailed = false
}

ue.CopyDataFromUeContextModel(*ueContextTransferRspData.UeContext)
ue.CopyDataFromUeContextModel(ueContextTransferRspData.UeContext)
if ue.SecurityContextAvailable {
ue.DerivateAlgKey()
}
Expand Down Expand Up @@ -697,17 +697,17 @@ func HandleInitialRegistration(ue *context.AmfUe, anType models.AccessType) erro
// }
for {
resp, err := consumer.GetConsumer().SendSearchNFInstances(
amfSelf.NrfUri, models.NrfNfManagementNfType_PCF, models.NrfNfManagementNfType_AMF, param)
amfSelf.NrfUri, models.NrfNfManagementNfType_PCF, models.NrfNfManagementNfType_AMF, &param)
if err != nil {
ue.GmmLog.Error("AMF can not select an PCF by NRF")
} else {
// select the first PCF, TODO: select base on other info
var pcfUri string
for _, nfProfile := range resp.NfInstances {
pcfUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NPCF_AM_POLICY_CONTROL,
for index := range resp.NfInstances {
pcfUri = util.SearchNFServiceUri(&resp.NfInstances[index], models.ServiceName_NPCF_AM_POLICY_CONTROL,
models.NfServiceStatus_REGISTERED)
if pcfUri != "" {
ue.PcfId = nfProfile.NfInstanceId
ue.PcfId = resp.NfInstances[index].NfInstanceId
break
}
}
Expand Down Expand Up @@ -1001,16 +1001,18 @@ func communicateWithUDM(ue *context.AmfUe, accessType models.AccessType) error {
Supi: &ue.Supi,
}
resp, err := consumer.GetConsumer().SendSearchNFInstances(
amfSelf.NrfUri, models.NrfNfManagementNfType_UDM, models.NrfNfManagementNfType_AMF, param)
amfSelf.NrfUri, models.NrfNfManagementNfType_UDM, models.NrfNfManagementNfType_AMF, &param)
if err != nil {
return errors.Errorf("AMF can not select an UDM by NRF: SendSearchNFInstances failed")
}

var uecmUri, sdmUri string
for _, nfProfile := range resp.NfInstances {
ue.UdmId = nfProfile.NfInstanceId
uecmUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NUDM_UECM, models.NfServiceStatus_REGISTERED)
sdmUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NUDM_SDM, models.NfServiceStatus_REGISTERED)
for index := range resp.NfInstances {
ue.UdmId = resp.NfInstances[index].NfInstanceId
uecmUri = util.SearchNFServiceUri(&resp.NfInstances[index], models.ServiceName_NUDM_UECM,
models.NfServiceStatus_REGISTERED)
sdmUri = util.SearchNFServiceUri(&resp.NfInstances[index], models.ServiceName_NUDM_SDM,
models.NfServiceStatus_REGISTERED)
if uecmUri != "" && sdmUri != "" {
break
}
Expand Down Expand Up @@ -1070,7 +1072,7 @@ func getSubscribedNssai(ue *context.AmfUe) {
}
for {
err := consumer.GetConsumer().SearchUdmSdmInstance(
ue, amfSelf.NrfUri, models.NrfNfManagementNfType_UDM, models.NrfNfManagementNfType_AMF, param)
ue, amfSelf.NrfUri, models.NrfNfManagementNfType_UDM, models.NrfNfManagementNfType_AMF, &param)
if err != nil {
ue.GmmLog.Errorf("AMF can not select an Nudm_SDM Instance by NRF[Error: %+v]", err)
time.Sleep(2 * time.Second)
Expand Down Expand Up @@ -1135,7 +1137,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
for {
reqparam := Nnrf_NFDiscovery.SearchNFInstancesRequest{}
errSearchNssf := consumer.GetConsumer().SearchNssfNSSelectionInstance(
ue, amfSelf.NrfUri, models.NrfNfManagementNfType_NSSF, models.NrfNfManagementNfType_AMF, reqparam)
ue, amfSelf.NrfUri, models.NrfNfManagementNfType_NSSF, models.NrfNfManagementNfType_AMF, &reqparam)
if errSearchNssf != nil {
ue.GmmLog.Errorf("AMF can not select an NSSF Instance by NRF[Error: %+v]", errSearchNssf)
time.Sleep(2 * time.Second)
Expand Down Expand Up @@ -1198,7 +1200,7 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {

sendReroute := true
err = consumer.GetConsumer().SearchAmfCommunicationInstance(ue, amfSelf.NrfUri,
models.NrfNfManagementNfType_AMF, models.NrfNfManagementNfType_AMF, searchTargetAmfQueryParam)
models.NrfNfManagementNfType_AMF, models.NrfNfManagementNfType_AMF, &searchTargetAmfQueryParam)
if err == nil {
// Condition (A) Step 7: initial AMF find Target AMF via NRF ->
// Send Namf_Communication_N1MessageNotify to Target AMF
Expand Down Expand Up @@ -1643,7 +1645,7 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b
// TODO: consider ausf group id, Routing ID part of SUCI
param := Nnrf_NFDiscovery.SearchNFInstancesRequest{}
resp, err := consumer.GetConsumer().SendSearchNFInstances(
amfSelf.NrfUri, models.NrfNfManagementNfType_AUSF, models.NrfNfManagementNfType_AMF, param)
amfSelf.NrfUri, models.NrfNfManagementNfType_AUSF, models.NrfNfManagementNfType_AMF, &param)
if err != nil {
ue.GmmLog.Error("AMF can not select an AUSF by NRF")
gmm_message.SendRegistrationReject(ue.RanUe[accessType], nasMessage.Cause5GMMCongestion, "")
Expand All @@ -1652,9 +1654,10 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b

// select the first AUSF, TODO: select base on other info
var ausfUri string
for _, nfProfile := range resp.NfInstances {
ue.AusfId = nfProfile.NfInstanceId
ausfUri = util.SearchNFServiceUri(nfProfile, models.ServiceName_NAUSF_AUTH, models.NfServiceStatus_REGISTERED)
for index := range resp.NfInstances {
ue.AusfId = resp.NfInstances[index].NfInstanceId
ausfUri = util.SearchNFServiceUri(&resp.NfInstances[index], models.ServiceName_NAUSF_AUTH,
models.NfServiceStatus_REGISTERED)
if ausfUri != "" {
break
}
Expand Down
1 change: 0 additions & 1 deletion internal/sbi/api_httpcallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
func (s *Server) getHttpCallBackRoutes() []Route {
return []Route{
{

Method: http.MethodGet,
Pattern: "/",
APIFunc: func(c *gin.Context) {
Expand Down
2 changes: 0 additions & 2 deletions internal/sbi/consumer/amf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/free5gc/amf/internal/logger"
"github.com/free5gc/nas/nasMessage"
"github.com/free5gc/openapi"

// "github.com/free5gc/openapi/Namf_Communication"
Namf_Communication "github.com/free5gc/openapi/amf/Communication"
"github.com/free5gc/openapi/models"
Expand Down Expand Up @@ -220,7 +219,6 @@ func (s *namfService) ReleaseUEContextRequest(ue *amf_context.AmfUe, ngapCause m

_, err = client.IndividualUeContextDocumentApi.ReleaseUEContext(
ctx, &ueCtxReleaseReq)

if err != nil {
if apiErr, ok := err.(openapi.GenericOpenAPIError); ok {
problemDetails = apiErr.Model().(*models.ProblemDetails)
Expand Down
Loading

0 comments on commit 152af6b

Please sign in to comment.