Skip to content

Commit

Permalink
Fix: use models serviceName in GetTokenCtx
Browse files Browse the repository at this point in the history
  • Loading branch information
andy89923 committed Feb 6, 2024
1 parent 6f8f9a6 commit 1877d4a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (smContext *SMContext) PDUAddressToNAS() ([12]byte, uint8) {

// PCFSelection will select PCF for this SM Context
func (smContext *SMContext) PCFSelection() error {
ctx, _, err := GetSelf().GetTokenCtx("nnrf-disc", "NRF")
ctx, _, err := GetSelf().GetTokenCtx(models.ServiceName_NNRF_DISC, "NRF")
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/pfcp/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func HandlePfcpSessionReportRequest(msg *pfcpUdp.Message) {
},
}

ctx, _, err := smf_context.GetSelf().GetTokenCtx("namf-comm", models.NfType_AMF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_COMM, models.NfType_AMF)
if err != nil {
logger.PfcpLog.Warnf("Get NAMF_COMM context failed: %s", err)
return
Expand Down
6 changes: 3 additions & 3 deletions internal/sbi/consumer/nf_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func SendNFDiscoveryUDM() (*models.ProblemDetails, error) {
ctx, pd, err := smf_context.GetSelf().GetTokenCtx("nnrf-disc", models.NfType_NRF)
ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_DISC, models.NfType_NRF)
if err != nil {
return pd, err
}
Expand Down Expand Up @@ -61,7 +61,7 @@ func SendNFDiscoveryUDM() (*models.ProblemDetails, error) {
}

func SendNFDiscoveryPCF() (problemDetails *models.ProblemDetails, err error) {
ctx, pd, err := smf_context.GetSelf().GetTokenCtx("nnrf-disc", models.NfType_NRF)
ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_DISC, models.NfType_NRF)
if err != nil {
return pd, err
}
Expand Down Expand Up @@ -101,7 +101,7 @@ func SendNFDiscoveryPCF() (problemDetails *models.ProblemDetails, err error) {
}

func SendNFDiscoveryServingAMF(smContext *smf_context.SMContext) (*models.ProblemDetails, error) {
ctx, pd, err := smf_context.GetSelf().GetTokenCtx("nnrf-disc", models.NfType_NRF)
ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_DISC, models.NfType_NRF)
if err != nil {
return pd, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/consumer/nf_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func RetrySendNFRegistration(MaxRetry int) error {
func SendNFDeregistration() error {
// Check data (Use RESTful DELETE)

ctx, _, err := smf_context.GetSelf().GetTokenCtx("nnrf-nfm", models.NfType_NRF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_NFM, models.NfType_NRF)
if err != nil {
return err
}
Expand Down Expand Up @@ -136,7 +136,7 @@ func SendNFDeregistration() error {
func SendDeregisterNFInstance() (*models.ProblemDetails, error) {
logger.ConsumerLog.Infof("Send Deregister NFInstance")

ctx, pd, err := smf_context.GetSelf().GetTokenCtx("nnrf-nfm", models.NfType_NRF)
ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_NFM, models.NfType_NRF)
if err != nil {
return pd, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/sbi/consumer/sm_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func SendSMPolicyAssociationCreate(smContext *smf_context.SMContext) (string, *m
}
smPolicyData.SuppFeat = "F"

ctx, _, err := smf_context.GetSelf().GetTokenCtx("npcf-smpolicycontrol", models.NfType_PCF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NPCF_SMPOLICYCONTROL, models.NfType_PCF)
if err != nil {
return "", nil, err
}
Expand Down Expand Up @@ -148,7 +148,7 @@ func SendSMPolicyAssociationUpdateByUERequestModification(
}
}

ctx, _, err := smf_context.GetSelf().GetTokenCtx("npcf-smpolicycontrol", models.NfType_PCF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NPCF_SMPOLICYCONTROL, models.NfType_PCF)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -374,7 +374,7 @@ func SendSMPolicyAssociationTermination(smContext *smf_context.SMContext) error
return errors.Errorf("smContext not selected PCF")
}

ctx, _, err := smf_context.GetSelf().GetTokenCtx("npcf-smpolicycontrol", models.NfType_PCF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NPCF_SMPOLICYCONTROL, models.NfType_PCF)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/consumer/ue_context_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func UeCmRegistration(smCtx *smf_context.SMContext) (
" PduSessionId:", registrationData.PduSessionId, " SNssai:", registrationData.SingleNssai,
" Dnn:", registrationData.Dnn, " PlmnId:", registrationData.PlmnId)

ctx, pd, err := smf_context.GetSelf().GetTokenCtx("nudm-uecm", models.NfType_UDM)
ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_UECM, models.NfType_UDM)
if err != nil {
return pd, err
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func UeCmDeregistration(smCtx *smf_context.SMContext) (*models.ProblemDetails, e
configuration.SetBasePath(uecmUri)
client := Nudm_UEContextManagement.NewAPIClient(configuration)

ctx, pd, err := smf_context.GetSelf().GetTokenCtx("nudm-uecm", models.NfType_UDM)
ctx, pd, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_UECM, models.NfType_UDM)
if err != nil {
return pd, err
}
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/producer/datapath.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func sendPDUSessionEstablishmentReject(
},
}

ctx, _, err := smf_context.GetSelf().GetTokenCtx("namf-comm", models.NfType_AMF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_COMM, models.NfType_AMF)
if err != nil {
logger.PduSessLog.Warnf("Get NAMF_COMM context failed: %s", err)
return
Expand Down Expand Up @@ -306,7 +306,7 @@ func sendPDUSessionEstablishmentAccept(
},
}

ctx, _, err := smf_context.GetSelf().GetTokenCtx("namf-comm", models.NfType_AMF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_COMM, models.NfType_AMF)
if err != nil {
logger.PduSessLog.Warnf("Get NAMF_COMM context failed: %s", err)
return
Expand Down
6 changes: 3 additions & 3 deletions internal/sbi/producer/pdu_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func HandlePDUSessionSMContextCreate(isDone <-chan struct{},

SubscriberDataManagementClient := smf_context.GetSelf().SubscriberDataManagementClient

ctx, _, oauthErr := smf_context.GetSelf().GetTokenCtx("nudm-sdm", models.NfType_UDM)
ctx, _, oauthErr := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_SDM, models.NfType_UDM)
if oauthErr != nil {
smContext.Log.Errorf("Get Token Context Error[%v]", oauthErr)
return nil
Expand Down Expand Up @@ -1098,7 +1098,7 @@ func sendGSMPDUSessionReleaseCommand(smContext *smf_context.SMContext, nasPdu []
// Start T3592
t3592 := factory.SmfConfig.Configuration.T3592
if t3592.Enable {
ctx, _, err := smf_context.GetSelf().GetTokenCtx("namf-comm", models.NfType_AMF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_COMM, models.NfType_AMF)
if err != nil {
smContext.Log.Warnf("Get namf-comm token failed: %+v", err)
return
Expand Down Expand Up @@ -1149,7 +1149,7 @@ func sendGSMPDUSessionModificationCommand(smContext *smf_context.SMContext, nasP
// Start T3591
t3591 := factory.SmfConfig.Configuration.T3591
if t3591.Enable {
ctx, _, err := smf_context.GetSelf().GetTokenCtx("namf-comm", models.NfType_AMF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_COMM, models.NfType_AMF)
if err != nil {
smContext.Log.Warnf("Get namf-comm token failed: %+v", err)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/association/association.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func requestAMFToReleasePDUResources(smContext *smf_context.SMContext) (sendNoti
}
}

ctx, _, err := smf_context.GetSelf().GetTokenCtx("namf-comm", models.NfType_AMF)
ctx, _, err := smf_context.GetSelf().GetTokenCtx(models.ServiceName_NAMF_COMM, models.NfType_AMF)
if err != nil {
return false, false
}
Expand Down

0 comments on commit 1877d4a

Please sign in to comment.