diff --git a/internal/context/sm_context.go b/internal/context/sm_context.go index 714ab250..0215a504 100644 --- a/internal/context/sm_context.go +++ b/internal/context/sm_context.go @@ -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 } diff --git a/internal/pfcp/handler/handler.go b/internal/pfcp/handler/handler.go index 88b32519..109a1208 100644 --- a/internal/pfcp/handler/handler.go +++ b/internal/pfcp/handler/handler.go @@ -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 diff --git a/internal/sbi/consumer/nf_discovery.go b/internal/sbi/consumer/nf_discovery.go index fd5fea3a..1b236a9f 100644 --- a/internal/sbi/consumer/nf_discovery.go +++ b/internal/sbi/consumer/nf_discovery.go @@ -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 } @@ -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 } @@ -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 } diff --git a/internal/sbi/consumer/nf_management.go b/internal/sbi/consumer/nf_management.go index d0d417c5..c1fa418e 100644 --- a/internal/sbi/consumer/nf_management.go +++ b/internal/sbi/consumer/nf_management.go @@ -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 } @@ -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 } diff --git a/internal/sbi/consumer/sm_policy.go b/internal/sbi/consumer/sm_policy.go index cde88bb9..79a0491e 100644 --- a/internal/sbi/consumer/sm_policy.go +++ b/internal/sbi/consumer/sm_policy.go @@ -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 } @@ -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 } @@ -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 } diff --git a/internal/sbi/consumer/ue_context_management.go b/internal/sbi/consumer/ue_context_management.go index 3196315e..b07b57cf 100644 --- a/internal/sbi/consumer/ue_context_management.go +++ b/internal/sbi/consumer/ue_context_management.go @@ -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 } @@ -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 } diff --git a/internal/sbi/producer/datapath.go b/internal/sbi/producer/datapath.go index c2149d35..167229b6 100644 --- a/internal/sbi/producer/datapath.go +++ b/internal/sbi/producer/datapath.go @@ -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 @@ -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 diff --git a/internal/sbi/producer/pdu_session.go b/internal/sbi/producer/pdu_session.go index 84249f59..cd0ad298 100644 --- a/internal/sbi/producer/pdu_session.go +++ b/internal/sbi/producer/pdu_session.go @@ -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 @@ -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 @@ -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 diff --git a/pkg/association/association.go b/pkg/association/association.go index 389d488f..0e834190 100644 --- a/pkg/association/association.go +++ b/pkg/association/association.go @@ -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 }