From 0b55d5ba22e081e7fca9480a059afea80f3beca8 Mon Sep 17 00:00:00 2001 From: CTFang Date: Wed, 15 Nov 2023 17:57:16 +0800 Subject: [PATCH] Fix: Rename function name GetSelf() (#27) Co-authored-by: CTFang@WireLab --- internal/context/context.go | 16 ++-- internal/sbi/consumer/nf_discovery.go | 2 +- internal/sbi/consumer/nf_management.go | 2 +- internal/sbi/producer/callback/callback.go | 2 +- internal/sbi/producer/event_exposure.go | 6 +- internal/sbi/producer/generate_auth_data.go | 4 +- .../producer/subscriber_data_management.go | 74 +++++++++---------- .../sbi/producer/ue_context_management.go | 38 +++++----- pkg/service/init.go | 2 +- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/internal/context/context.go b/internal/context/context.go index 76cf5a6..03fc149 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -30,8 +30,8 @@ const ( ) func Init() { - Getself().NfService = make(map[models.ServiceName]models.NfService) - Getself().EeSubscriptionIDGenerator = idgenerator.NewGenerator(1, math.MaxInt32) + GetSelf().NfService = make(map[models.ServiceName]models.NfService) + GetSelf().EeSubscriptionIDGenerator = idgenerator.NewGenerator(1, math.MaxInt32) } type UDMContext struct { @@ -386,12 +386,12 @@ func (context *UDMContext) GetAmfNon3gppRegContext(supi string) *models.AmfNon3G func (ue *UdmUeContext) GetLocationURI(types int) string { switch types { case LocationUriAmf3GppAccessRegistration: - return Getself().GetIPv4Uri() + factory.UdmUecmResUriPrefix + "/" + ue.Supi + "/registrations/amf-3gpp-access" + return GetSelf().GetIPv4Uri() + factory.UdmUecmResUriPrefix + "/" + ue.Supi + "/registrations/amf-3gpp-access" case LocationUriAmfNon3GppAccessRegistration: - return Getself().GetIPv4Uri() + factory.UdmUecmResUriPrefix + "/" + ue.Supi + "/registrations/amf-non-3gpp-access" + return GetSelf().GetIPv4Uri() + factory.UdmUecmResUriPrefix + "/" + ue.Supi + "/registrations/amf-non-3gpp-access" case LocationUriSmfRegistration: - return Getself().GetIPv4Uri() + + return GetSelf().GetIPv4Uri() + factory.UdmUecmResUriPrefix + "/" + ue.Supi + "/registrations/smf-registrations/" + ue.PduSessionID } return "" @@ -400,9 +400,9 @@ func (ue *UdmUeContext) GetLocationURI(types int) string { func (ue *UdmUeContext) GetLocationURI2(types int, supi string) string { switch types { case LocationUriSharedDataSubscription: - // return Getself().GetIPv4Uri() + UdmSdmResUriPrefix +"/shared-data-subscriptions/" + nf.SubscriptionID + // return GetSelf().GetIPv4Uri() + UdmSdmResUriPrefix +"/shared-data-subscriptions/" + nf.SubscriptionID case LocationUriSdmSubscription: - return Getself().GetIPv4Uri() + factory.UdmSdmResUriPrefix + "/" + supi + "/sdm-subscriptions/" + return GetSelf().GetIPv4Uri() + factory.UdmSdmResUriPrefix + "/" + supi + "/sdm-subscriptions/" } return "" } @@ -478,6 +478,6 @@ func (context *UDMContext) InitNFService(serviceName []string, version string) { } } -func Getself() *UDMContext { +func GetSelf() *UDMContext { return &udmContext } diff --git a/internal/sbi/consumer/nf_discovery.go b/internal/sbi/consumer/nf_discovery.go index ab8cf1f..b30cc8e 100644 --- a/internal/sbi/consumer/nf_discovery.go +++ b/internal/sbi/consumer/nf_discovery.go @@ -45,7 +45,7 @@ func SendNFIntances(nrfUri string, targetNfType, requestNfType models.NfType, } func SendNFIntancesUDR(id string, types int) string { - self := udm_context.Getself() + self := udm_context.GetSelf() targetNfType := models.NfType_UDR requestNfType := models.NfType_UDM localVarOptionals := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{ diff --git a/internal/sbi/consumer/nf_management.go b/internal/sbi/consumer/nf_management.go index 6c3fc1e..34bbdbf 100644 --- a/internal/sbi/consumer/nf_management.go +++ b/internal/sbi/consumer/nf_management.go @@ -81,7 +81,7 @@ func SendRegisterNFInstance(nrfUri, nfInstanceId string, profile models.NfProfil func SendDeregisterNFInstance() (problemDetails *models.ProblemDetails, err error) { logger.ConsumerLog.Infof("Send Deregister NFInstance") - udmSelf := udm_context.Getself() + udmSelf := udm_context.GetSelf() // Set client and set url configuration := Nnrf_NFManagement.NewConfiguration() configuration.SetBasePath(udmSelf.NrfUri) diff --git a/internal/sbi/producer/callback/callback.go b/internal/sbi/producer/callback/callback.go index a9dcf98..6937eb2 100644 --- a/internal/sbi/producer/callback/callback.go +++ b/internal/sbi/producer/callback/callback.go @@ -12,7 +12,7 @@ import ( ) func DataChangeNotificationProcedure(notifyItems []models.NotifyItem, supi string) *models.ProblemDetails { - ue, _ := udm_context.Getself().UdmUeFindBySupi(supi) + ue, _ := udm_context.GetSelf().UdmUeFindBySupi(supi) configuration := Nudm_SubscriberDataManagement.NewConfiguration() clientAPI := Nudm_SubscriberDataManagement.NewAPIClient(configuration) diff --git a/internal/sbi/producer/event_exposure.go b/internal/sbi/producer/event_exposure.go index d588978..aa8eb80 100644 --- a/internal/sbi/producer/event_exposure.go +++ b/internal/sbi/producer/event_exposure.go @@ -35,7 +35,7 @@ func HandleCreateEeSubscription(request *httpwrapper.Request) *httpwrapper.Respo func CreateEeSubscriptionProcedure(ueIdentity string, eesubscription models.EeSubscription, ) (*models.CreatedEeSubscription, *models.ProblemDetails) { - udmSelf := udm_context.Getself() + udmSelf := udm_context.GetSelf() logger.EeLog.Debugf("udIdentity: %s", ueIdentity) switch { @@ -135,7 +135,7 @@ func HandleDeleteEeSubscription(request *httpwrapper.Request) *httpwrapper.Respo // TODO: complete this procedure based on TS 29503 5.5 func DeleteEeSubscriptionProcedure(ueIdentity string, subscriptionID string) { - udmSelf := udm_context.Getself() + udmSelf := udm_context.GetSelf() switch { case strings.HasPrefix(ueIdentity, "msisdn-"): @@ -186,7 +186,7 @@ func HandleUpdateEeSubscription(request *httpwrapper.Request) *httpwrapper.Respo func UpdateEeSubscriptionProcedure(ueIdentity string, subscriptionID string, patchList []models.PatchItem, ) *models.ProblemDetails { - udmSelf := udm_context.Getself() + udmSelf := udm_context.GetSelf() switch { case strings.HasPrefix(ueIdentity, "msisdn-"): diff --git a/internal/sbi/producer/generate_auth_data.go b/internal/sbi/producer/generate_auth_data.go index 79cef93..8a2a5e3 100644 --- a/internal/sbi/producer/generate_auth_data.go +++ b/internal/sbi/producer/generate_auth_data.go @@ -155,7 +155,7 @@ func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest, response = &models.AuthenticationInfoResult{} rand.Seed(time.Now().UnixNano()) - supi, err := suci.ToSupi(supiOrSuci, udm_context.Getself().SuciProfiles) + supi, err := suci.ToSupi(supiOrSuci, udm_context.GetSelf().SuciProfiles) if err != nil { problemDetails = &models.ProblemDetails{ Status: http.StatusForbidden, @@ -417,7 +417,7 @@ func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest, keyIndex) } else { logger.UeauLog.Errorln("Re-Sync Failed UDM Public Key ", - udm_context.Getself().SuciProfiles[keyIndex-1].PublicKey) + udm_context.GetSelf().SuciProfiles[keyIndex-1].PublicKey) } } logger.UeauLog.Errorln("MACS ", macS) diff --git a/internal/sbi/producer/subscriber_data_management.go b/internal/sbi/producer/subscriber_data_management.go index 6a5a6aa..2e0d834 100644 --- a/internal/sbi/producer/subscriber_data_management.go +++ b/internal/sbi/producer/subscriber_data_management.go @@ -85,9 +85,9 @@ func getAmDataProcedure(supi string, plmnID string, supportedFeatures string) ( }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.SetAMSubsriptionData(&accessAndMobilitySubscriptionDataResp) return &accessAndMobilitySubscriptionDataResp, nil @@ -248,11 +248,11 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support queryAmDataParamOpts.SupportedFeatures = optional.NewString(supportedFeatures) querySmfSelectDataParamOpts.SupportedFeatures = optional.NewString(supportedFeatures) - udm_context.Getself().CreateSubsDataSetsForUe(supi, subsDataSetBody) + udm_context.GetSelf().CreateSubsDataSetsForUe(supi, subsDataSetBody) if containDataSetName(dataSetNames, string(models.DataSetName_AM)) { var body models.AccessAndMobilitySubscriptionData - udm_context.Getself().CreateAccessMobilitySubsDataForUe(supi, body) + udm_context.GetSelf().CreateAccessMobilitySubsDataForUe(supi, body) amData, res, err := clientAPI.AccessAndMobilitySubscriptionDataDocumentApi.QueryAmData( context.Background(), supi, plmnID, &queryAmDataParamOpts) if err != nil { @@ -276,9 +276,9 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support } }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.SetAMSubsriptionData(&amData) subscriptionDataSets.AmData = &amData @@ -294,7 +294,7 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support if containDataSetName(dataSetNames, string(models.DataSetName_SMF_SEL)) { var smfSelSubsbody models.SmfSelectionSubscriptionData - udm_context.Getself().CreateSmfSelectionSubsDataforUe(supi, smfSelSubsbody) + udm_context.GetSelf().CreateSmfSelectionSubsDataforUe(supi, smfSelSubsbody) smfSelData, res, err := clientAPI.SMFSelectionSubscriptionDataDocumentApi.QuerySmfSelectData(context.Background(), supi, plmnID, &querySmfSelectDataParamOpts) if err != nil { @@ -318,9 +318,9 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support } }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.SetSmfSelectionSubsData(&smfSelData) subscriptionDataSets.SmfSelData = &smfSelData @@ -338,7 +338,7 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support var UeContextInSmfbody models.UeContextInSmfData var querySmfRegListParamOpts Nudr.QuerySmfRegListParamOpts querySmfRegListParamOpts.SupportedFeatures = optional.NewString(supportedFeatures) - udm_context.Getself().CreateUeContextInSmfDataforUe(supi, UeContextInSmfbody) + udm_context.GetSelf().CreateUeContextInSmfDataforUe(supi, UeContextInSmfbody) pdusess, res, err := clientAPI.SMFRegistrationsCollectionApi.QuerySmfRegList( context.Background(), supi, &querySmfRegListParamOpts) if err != nil { @@ -381,9 +381,9 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support ueContextInSmfDataResp.PgwInfo = pgwInfoArray if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.UeCtxtInSmfData = &ueContextInSmfDataResp subscriptionDataSets.UecSmfData = &ueContextInSmfDataResp @@ -426,11 +426,11 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support } }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } - smData, _, _, _ := udm_context.Getself().ManageSmData(sessionManagementSubscriptionData, "", "") + smData, _, _, _ := udm_context.GetSelf().ManageSmData(sessionManagementSubscriptionData, "", "") udmUe.SetSMSubsData(smData) subscriptionDataSets.SmData = sessionManagementSubscriptionData } else { @@ -445,7 +445,7 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support if containDataSetName(dataSetNames, string(models.DataSetName_TRACE)) { var TraceDatabody models.TraceData - udm_context.Getself().CreateTraceDataforUe(supi, TraceDatabody) + udm_context.GetSelf().CreateTraceDataforUe(supi, TraceDatabody) traceData, res, err := clientAPI.TraceDataDocumentApi.QueryTraceData( context.Background(), supi, plmnID, &queryTraceDataParamOpts) if err != nil { @@ -468,9 +468,9 @@ func getSupiProcedure(supi string, plmnID string, dataSetNames []string, support } }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.TraceData = &traceData udmUe.TraceDataResponse.TraceData = &traceData @@ -554,7 +554,7 @@ func getSharedDataProcedure(sharedDataIds []string, supportedFeatures string) ( }() if res.StatusCode == http.StatusOK { - udm_context.Getself().SharedSubsDataMap = udm_context.MappingSharedData(sharedDataResp) + udm_context.GetSelf().SharedSubsDataMap = udm_context.MappingSharedData(sharedDataResp) sharedData := udm_context.ObtainRequiredSharedData(sharedDataIds, sharedDataResp) return sharedData, nil } else { @@ -638,11 +638,11 @@ func getSmDataProcedure(supi string, plmnID string, Dnn string, Snssai string, s }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } - smData, snssaikey, AllDnnConfigsbyDnn, AllDnns := udm_context.Getself().ManageSmData( + smData, snssaikey, AllDnnConfigsbyDnn, AllDnns := udm_context.GetSelf().ManageSmData( sessionManagementSubscriptionDataResp, Snssai, Dnn) udmUe.SetSMSubsData(smData) @@ -750,9 +750,9 @@ func getNssaiProcedure(supi string, plmnID string, supportedFeatures string) ( nssaiResp = *accessAndMobilitySubscriptionDataResp.Nssai if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.Nssai = &nssaiResp return udmUe.Nssai, nil @@ -809,7 +809,7 @@ func getSmfSelectDataProcedure(supi string, plmnID string, supportedFeatures str return nil, openapi.ProblemDetailsSystemFailure(err.Error()) } - udm_context.Getself().CreateSmfSelectionSubsDataforUe(supi, body) + udm_context.GetSelf().CreateSmfSelectionSubsDataforUe(supi, body) smfSelectionSubscriptionDataResp, res, err := clientAPI.SMFSelectionSubscriptionDataDocumentApi. QuerySmfSelectData(context.Background(), supi, plmnID, &querySmfSelectDataParamOpts) @@ -836,9 +836,9 @@ func getSmfSelectDataProcedure(supi string, plmnID string, supportedFeatures str }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.SetSmfSelectionSubsData(&smfSelectionSubscriptionDataResp) return udmUe.SmfSelSubsData, nil @@ -904,8 +904,8 @@ func subscribeToSharedDataProcedure(sdmSubscription *models.SdmSubscription) ( if res.StatusCode == http.StatusCreated { header = make(http.Header) - udm_context.Getself().CreateSubstoNotifSharedData(sdmSubscriptionResp.SubscriptionId, &sdmSubscriptionResp) - reourceUri := udm_context.Getself().GetSDMUri() + "//shared-data-subscriptions/" + sdmSubscriptionResp.SubscriptionId + udm_context.GetSelf().CreateSubstoNotifSharedData(sdmSubscriptionResp.SubscriptionId, &sdmSubscriptionResp) + reourceUri := udm_context.GetSelf().GetSDMUri() + "//shared-data-subscriptions/" + sdmSubscriptionResp.SubscriptionId header.Set("Location", reourceUri) return header, &sdmSubscriptionResp, nil } else if res.StatusCode == http.StatusNotFound { @@ -982,9 +982,9 @@ func subscribeProcedure(sdmSubscription *models.SdmSubscription, supi string) ( if res.StatusCode == http.StatusCreated { header = make(http.Header) - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(supi) if udmUe == nil { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.CreateSubscriptiontoNotifChange(sdmSubscriptionResp.SubscriptionId, &sdmSubscriptionResp) header.Set("Location", udmUe.GetLocationURI2(udm_context.LocationUriSdmSubscription, supi)) @@ -1305,7 +1305,7 @@ func getTraceDataProcedure(supi string, plmnID string) ( return nil, openapi.ProblemDetailsSystemFailure(err.Error()) } - udm_context.Getself().CreateTraceDataforUe(supi, body) + udm_context.GetSelf().CreateTraceDataforUe(supi, body) traceDataRes, res, err := clientAPI.TraceDataDocumentApi.QueryTraceData( context.Background(), supi, plmnID, &queryTraceDataParamOpts) @@ -1331,9 +1331,9 @@ func getTraceDataProcedure(supi string, plmnID string) ( }() if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.TraceData = &traceDataRes udmUe.TraceDataResponse.TraceData = &traceDataRes @@ -1389,7 +1389,7 @@ func getUeContextInSmfDataProcedure(supi string, supportedFeatures string) ( } pduSessionMap := make(map[string]models.PduSession) - udm_context.Getself().CreateUeContextInSmfDataforUe(supi, body) + udm_context.GetSelf().CreateUeContextInSmfDataforUe(supi, body) pdusess, res, err := clientAPI.SMFRegistrationsCollectionApi.QuerySmfRegList( context.Background(), supi, &querySmfRegListParamOpts) @@ -1434,9 +1434,9 @@ func getUeContextInSmfDataProcedure(supi string, supportedFeatures string) ( ueContextInSmfData.PgwInfo = pgwInfoArray if res.StatusCode == http.StatusOK { - udmUe, ok := udm_context.Getself().UdmUeFindBySupi(supi) + udmUe, ok := udm_context.GetSelf().UdmUeFindBySupi(supi) if !ok { - udmUe = udm_context.Getself().NewUdmUe(supi) + udmUe = udm_context.GetSelf().NewUdmUe(supi) } udmUe.UeCtxtInSmfData = &ueContextInSmfData return udmUe.UeCtxtInSmfData, nil diff --git a/internal/sbi/producer/ue_context_management.go b/internal/sbi/producer/ue_context_management.go index e3d4723..0a39eae 100644 --- a/internal/sbi/producer/ue_context_management.go +++ b/internal/sbi/producer/ue_context_management.go @@ -33,20 +33,20 @@ func createUDMClientToUDR(id string) (*Nudr_DataRepository.APIClient, error) { func getUdrURI(id string) string { if strings.Contains(id, "imsi") || strings.Contains(id, "nai") { // supi - ue, ok := udm_context.Getself().UdmUeFindBySupi(id) + ue, ok := udm_context.GetSelf().UdmUeFindBySupi(id) if ok { if ue.UdrUri == "" { ue.UdrUri = consumer.SendNFIntancesUDR(id, consumer.NFDiscoveryToUDRParamSupi) } return ue.UdrUri } else { - ue = udm_context.Getself().NewUdmUe(id) + ue = udm_context.GetSelf().NewUdmUe(id) ue.UdrUri = consumer.SendNFIntancesUDR(id, consumer.NFDiscoveryToUDRParamSupi) return ue.UdrUri } } else if strings.Contains(id, "pei") { var udrURI string - udm_context.Getself().UdmUePool.Range(func(key, value interface{}) bool { + udm_context.GetSelf().UdmUePool.Range(func(key, value interface{}) bool { ue := value.(*udm_context.UdmUeContext) if ue.Amf3GppAccessRegistration != nil && ue.Amf3GppAccessRegistration.Pei == id { if ue.UdrUri == "" { @@ -218,12 +218,12 @@ func RegistrationAmf3gppAccessProcedure(registerRequest models.Amf3GppAccessRegi var oldAmf3GppAccessRegContext *models.Amf3GppAccessRegistration var ue *udm_context.UdmUeContext - if udm_context.Getself().UdmAmf3gppRegContextExists(ueID) { - ue, _ = udm_context.Getself().UdmUeFindBySupi(ueID) + if udm_context.GetSelf().UdmAmf3gppRegContextExists(ueID) { + ue, _ = udm_context.GetSelf().UdmUeFindBySupi(ueID) oldAmf3GppAccessRegContext = ue.Amf3GppAccessRegistration } - udm_context.Getself().CreateAmf3gppRegContext(ueID, registerRequest) + udm_context.GetSelf().CreateAmf3gppRegContext(ueID, registerRequest) clientAPI, err := createUDMClientToUDR(ueID) if err != nil { @@ -279,7 +279,7 @@ func RegistrationAmf3gppAccessProcedure(registerRequest models.Amf3GppAccessRegi return nil, ®isterRequest, nil } else { header = make(http.Header) - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) header.Set("Location", udmUe.GetLocationURI(udm_context.LocationUriAmf3GppAccessRegistration)) return header, ®isterRequest, nil } @@ -312,12 +312,12 @@ func RegisterAmfNon3gppAccessProcedure(registerRequest models.AmfNon3GppAccessRe header http.Header, response *models.AmfNon3GppAccessRegistration, problemDetails *models.ProblemDetails, ) { var oldAmfNon3GppAccessRegContext *models.AmfNon3GppAccessRegistration - if udm_context.Getself().UdmAmfNon3gppRegContextExists(ueID) { - ue, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + if udm_context.GetSelf().UdmAmfNon3gppRegContextExists(ueID) { + ue, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) oldAmfNon3GppAccessRegContext = ue.AmfNon3GppAccessRegistration } - udm_context.Getself().CreateAmfNon3gppRegContext(ueID, registerRequest) + udm_context.GetSelf().CreateAmfNon3gppRegContext(ueID, registerRequest) clientAPI, err := createUDMClientToUDR(ueID) if err != nil { @@ -356,7 +356,7 @@ func RegisterAmfNon3gppAccessProcedure(registerRequest models.AmfNon3GppAccessRe return nil, nil, nil } else { header = make(http.Header) - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) header.Set("Location", udmUe.GetLocationURI(udm_context.LocationUriAmfNon3GppAccessRegistration)) return header, ®isterRequest, nil } @@ -386,7 +386,7 @@ func UpdateAmf3gppAccessProcedure(request models.Amf3GppAccessRegistrationModifi problemDetails *models.ProblemDetails, ) { var patchItemReqArray []models.PatchItem - currentContext := udm_context.Getself().GetAmf3gppRegContext(ueID) + currentContext := udm_context.GetSelf().GetAmf3gppRegContext(ueID) if currentContext == nil { logger.UecmLog.Errorln("[UpdateAmf3gppAccess] Empty Amf3gppRegContext") problemDetails = &models.ProblemDetails{ @@ -397,7 +397,7 @@ func UpdateAmf3gppAccessProcedure(request models.Amf3GppAccessRegistrationModifi } if request.Guami != nil { - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) if udmUe.SameAsStoredGUAMI3gpp(*request.Guami) { // deregistration logger.UecmLog.Infoln("UpdateAmf3gppAccess - deregistration") request.PurgeFlag = true @@ -467,7 +467,7 @@ func UpdateAmf3gppAccessProcedure(request models.Amf3GppAccessRegistrationModifi } if request.PurgeFlag { - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) udmUe.Amf3GppAccessRegistration = nil } @@ -504,7 +504,7 @@ func UpdateAmfNon3gppAccessProcedure(request models.AmfNon3GppAccessRegistration problemDetails *models.ProblemDetails, ) { var patchItemReqArray []models.PatchItem - currentContext := udm_context.Getself().GetAmfNon3gppRegContext(ueID) + currentContext := udm_context.GetSelf().GetAmfNon3gppRegContext(ueID) if currentContext == nil { logger.UecmLog.Errorln("[UpdateAmfNon3gppAccess] Empty AmfNon3gppRegContext") problemDetails = &models.ProblemDetails{ @@ -515,7 +515,7 @@ func UpdateAmfNon3gppAccessProcedure(request models.AmfNon3GppAccessRegistration } if request.Guami != nil { - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) if udmUe.SameAsStoredGUAMINon3gpp(*request.Guami) { // deregistration logger.UecmLog.Infoln("UpdateAmfNon3gppAccess - deregistration") request.PurgeFlag = true @@ -663,8 +663,8 @@ func RegistrationSmfRegistrationsProcedure(request *models.SmfRegistration, ueID header http.Header, response *models.SmfRegistration, problemDetails *models.ProblemDetails, ) { contextExisted := false - udm_context.Getself().CreateSmfRegContext(ueID, pduSessionID) - if !udm_context.Getself().UdmSmfRegContextNotExists(ueID) { + udm_context.GetSelf().CreateSmfRegContext(ueID, pduSessionID) + if !udm_context.GetSelf().UdmSmfRegContextNotExists(ueID) { contextExisted = true } @@ -704,7 +704,7 @@ func RegistrationSmfRegistrationsProcedure(request *models.SmfRegistration, ueID return nil, nil, nil } else { header = make(http.Header) - udmUe, _ := udm_context.Getself().UdmUeFindBySupi(ueID) + udmUe, _ := udm_context.GetSelf().UdmUeFindBySupi(ueID) header.Set("Location", udmUe.GetLocationURI(udm_context.LocationUriSmfRegistration)) return header, request, nil } diff --git a/pkg/service/init.go b/pkg/service/init.go index aa30c42..e8d9b6f 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -35,7 +35,7 @@ func NewApp(cfg *factory.Config) (*UdmApp, error) { udm.SetLogLevel(cfg.GetLogLevel()) udm.SetReportCaller(cfg.GetLogReportCaller()) udm_context.Init() - udm.udmCtx = udm_context.Getself() + udm.udmCtx = udm_context.GetSelf() return udm, nil }