From fb824b1d1b7f06b231674ac41391e87d09f7fb65 Mon Sep 17 00:00:00 2001 From: ubuntu Date: Tue, 10 Sep 2024 10:23:03 +0000 Subject: [PATCH] fix: PR comment change --- internal/sbi/api_eventexposure.go | 7 +- internal/sbi/api_httpcallback.go | 3 +- internal/sbi/api_mt.go | 4 +- internal/sbi/api_niddauthentication.go | 2 +- internal/sbi/api_parameterprovision.go | 25 ++++--- internal/sbi/api_reportsmdeliverystatus.go | 2 +- .../sbi/api_servicespecificauthorization.go | 4 +- internal/sbi/api_subscriberdatamanagement.go | 72 +++++++++---------- internal/sbi/api_ueauthentication.go | 15 ++-- internal/sbi/api_uecontextmanagement.go | 63 ++++++++-------- internal/sbi/api_ueid.go | 2 +- internal/sbi/consumer/nrf_service.go | 28 ++------ internal/sbi/consumer/udr_service.go | 14 ++-- 13 files changed, 109 insertions(+), 132 deletions(-) diff --git a/internal/sbi/api_eventexposure.go b/internal/sbi/api_eventexposure.go index 4af2ff8..4027c7d 100644 --- a/internal/sbi/api_eventexposure.go +++ b/internal/sbi/api_eventexposure.go @@ -2,7 +2,6 @@ package sbi import ( "net/http" - "strings" "github.com/gin-gonic/gin" @@ -22,21 +21,21 @@ func (s *Server) getEventExposureRoutes() []Route { { "CreateEeSubscription", - strings.ToUpper("Post"), + http.MethodPost, "/:ueIdentity/ee-subscriptions", s.HandleCreateEeSubscription, }, { "DeleteEeSubscription", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueIdentity/ee-subscriptions/:subscriptionId", s.HandleDeleteEeSubscription, }, { "UpdateEeSubscription", - strings.ToUpper("Patch"), + http.MethodPatch, "/:ueIdentity/ee-subscriptions/:subscriptionId", s.HandleUpdateEeSubscription, }, diff --git a/internal/sbi/api_httpcallback.go b/internal/sbi/api_httpcallback.go index 6c79ce6..85a07e9 100644 --- a/internal/sbi/api_httpcallback.go +++ b/internal/sbi/api_httpcallback.go @@ -2,7 +2,6 @@ package sbi import ( "net/http" - "strings" "github.com/gin-gonic/gin" @@ -22,7 +21,7 @@ func (s *Server) getHttpCallBackRoutes() []Route { { "DataChangeNotificationToNF", - strings.ToUpper("Post"), + http.MethodPost, "/sdm-subscriptions", s.HandleDataChangeNotificationToNF, }, diff --git a/internal/sbi/api_mt.go b/internal/sbi/api_mt.go index da6621b..844e59b 100644 --- a/internal/sbi/api_mt.go +++ b/internal/sbi/api_mt.go @@ -17,14 +17,14 @@ func (s *Server) getMTRoutes() []Route { { "ProvideLocationInfo", - "Post", + http.MethodPost, "/:supi/loc-info/provide-loc-info", s.HandleProvideLocationInfo, }, { "QueryUeInfo", - "GET", + http.MethodGet, "/:supi", s.HandleQueryUeInfo, }, diff --git a/internal/sbi/api_niddauthentication.go b/internal/sbi/api_niddauthentication.go index f973921..a0f9223 100644 --- a/internal/sbi/api_niddauthentication.go +++ b/internal/sbi/api_niddauthentication.go @@ -17,7 +17,7 @@ func (s *Server) getNIDDAuthenticationRoutes() []Route { { "AuthorizeNiddData", - "Post", + http.MethodPost, "/:ueIdentity/authorize", s.HandleAuthorizeNiddData, }, diff --git a/internal/sbi/api_parameterprovision.go b/internal/sbi/api_parameterprovision.go index 582897b..3045d35 100644 --- a/internal/sbi/api_parameterprovision.go +++ b/internal/sbi/api_parameterprovision.go @@ -2,7 +2,6 @@ package sbi import ( "net/http" - "strings" "github.com/gin-gonic/gin" @@ -22,84 +21,84 @@ func (s *Server) getParameterProvisionRoutes() []Route { { "Update", - strings.ToUpper("Patch"), + http.MethodPatch, "/:ueId/pp-data", s.HandleUpdate, }, { "Create5GMBSGroup", - strings.ToUpper("Put"), + http.MethodPut, "/mbs-group-membership/:extGroupId", s.HandleCreate5GMBSGroup, }, { "Create5GVNGroup", - strings.ToUpper("Put"), + http.MethodPut, "/5g-vn-groups/:extGroupId", s.HandleCreate5GVNGroup, }, { "CreatePPDataEntry", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/pp-data-store/:afInstanceId", s.HandleCreatePPDataEntry, }, { "Delete5GMBSGroup", - strings.ToUpper("Delete"), + http.MethodDelete, "/mbs-group-membership/:extGroupId", s.HandleDelete5GMBSGroup, }, { "Delete5GVNGroup", - strings.ToUpper("Delete"), + http.MethodDelete, "/5g-vn-groups/:extGroupId", s.HandleDelete5GVNGroup, }, { "DeletePPDataEntry", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueId/pp-data-store/:afInstanceId", s.HandleDeletePPDataEntry, }, { "Get5GMBSGroup", - strings.ToUpper("Get"), + http.MethodGet, "/mbs-group-membership/:extGroupId", s.HandleGet5GMBSGroup, }, { "Get5GVNGroup", - strings.ToUpper("Get"), + http.MethodGet, "/5g-vn-groups/:extGroupId", s.HandleGet5GVNGroup, }, { "GetPPDataEntry", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/pp-data-store/:afInstanceId", s.HandleGetPPDataEntry, }, { "Modify5GMBSGroup", - strings.ToUpper("Patch"), + http.MethodPatch, "/mbs-group-membership/:extGroupId", s.HandleModify5GMBSGroup, }, { "Modify5GVNGroup", - strings.ToUpper("Patch"), + http.MethodPatch, "/5g-vn-groups/:extGroupId", s.HandleModify5GVNGroup, }, diff --git a/internal/sbi/api_reportsmdeliverystatus.go b/internal/sbi/api_reportsmdeliverystatus.go index fd9a582..598fd9a 100644 --- a/internal/sbi/api_reportsmdeliverystatus.go +++ b/internal/sbi/api_reportsmdeliverystatus.go @@ -17,7 +17,7 @@ func (s *Server) getReportSMDeliveryStatusRoutes() []Route { { "ReportSMDeliveryStatus", - "Post", + http.MethodPost, "/:ueIdentity/sm-delivery-status", s.HandleReportSMDeliveryStatus, }, diff --git a/internal/sbi/api_servicespecificauthorization.go b/internal/sbi/api_servicespecificauthorization.go index adb5094..ddfb3e3 100644 --- a/internal/sbi/api_servicespecificauthorization.go +++ b/internal/sbi/api_servicespecificauthorization.go @@ -17,14 +17,14 @@ func (s *Server) getServiceSpecificAuthorizationRoutes() []Route { { "ServiceSpecificAuthorization", - "Post", + http.MethodPost, "/:ueIdentity/:serviceType/authorize", s.HandleServiceSpecificAuthorization, }, { "ServiceSpecificAuthorizationRemoval", - "Post", + http.MethodPost, "/:ueIdentity/:serviceType/remove", s.HandleServiceSpecificAuthorizationRemoval, }, diff --git a/internal/sbi/api_subscriberdatamanagement.go b/internal/sbi/api_subscriberdatamanagement.go index df045c0..b873888 100644 --- a/internal/sbi/api_subscriberdatamanagement.go +++ b/internal/sbi/api_subscriberdatamanagement.go @@ -457,7 +457,7 @@ func (s *Server) OneLayerPathHandlerFunc(c *gin.Context) { } // special case for :supi - if c.Request.Method == strings.ToUpper("Get") { + if c.Request.Method == http.MethodGet { s.HandleGetSupi(c) return } @@ -470,26 +470,26 @@ func (s *Server) TwoLayerPathHandlerFunc(c *gin.Context) { op := c.Param("subscriptionId") // for "/shared-data-subscriptions/:subscriptionId" - if supi == "shared-data-subscriptions" && strings.ToUpper("Delete") == c.Request.Method { + if supi == "shared-data-subscriptions" && http.MethodDelete == c.Request.Method { s.HandleUnsubscribeForSharedData(c) return } // for "/shared-data-subscriptions/:subscriptionId" - if supi == "shared-data-subscriptions" && strings.ToUpper("Patch") == c.Request.Method { + if supi == "shared-data-subscriptions" && http.MethodPatch == c.Request.Method { s.HandleModifyForSharedData(c) return } // for "/:ueId/id-translation-result" - if op == "id-translation-result" && strings.ToUpper("Get") == c.Request.Method { + if op == "id-translation-result" && http.MethodGet == c.Request.Method { c.Params = append(c.Params, gin.Param{Key: "ueId", Value: c.Param("supi")}) s.HandleGetIdTranslationResult(c) return } // for "/shared-data/:sharedDataId" - if supi == "shared-data" && strings.ToUpper("Get") == c.Request.Method { + if supi == "shared-data" && http.MethodGet == c.Request.Method { s.HandleGetIndividualSharedData(c) return } @@ -510,7 +510,7 @@ func (s *Server) ThreeLayerPathHandlerFunc(c *gin.Context) { thirdLayer := c.Param("thirdLayer") // for "/:ueId/sdm-subscriptions/:subscriptionId" - if op == "sdm-subscriptions" && strings.ToUpper("Delete") == c.Request.Method { + if op == "sdm-subscriptions" && http.MethodDelete == c.Request.Method { var tmpParams gin.Params tmpParams = append(tmpParams, gin.Param{Key: "ueId", Value: c.Param("supi")}) tmpParams = append(tmpParams, gin.Param{Key: "subscriptionId", Value: c.Param("thirdLayer")}) @@ -520,44 +520,44 @@ func (s *Server) ThreeLayerPathHandlerFunc(c *gin.Context) { } // for "/:supi/am-data/sor-ack" - if op == "am-data" && strings.ToUpper("Put") == c.Request.Method && thirdLayer == "sor-ack" { + if op == "am-data" && http.MethodPut == c.Request.Method && thirdLayer == "sor-ack" { s.HandleInfo(c) return } // for "/:supi/am-data/cag-ack" - if op == "am-data" && strings.ToUpper("Put") == c.Request.Method && thirdLayer == "cag-ack" { + if op == "am-data" && http.MethodPut == c.Request.Method && thirdLayer == "cag-ack" { s.HandleCAGAck(c) return } // for "/:supi/am-data/ecr-data" - if op == "am-data" && strings.ToUpper("Get") == c.Request.Method && thirdLayer == "ecr-data" { + if op == "am-data" && http.MethodGet == c.Request.Method && thirdLayer == "ecr-data" { s.HandleGetEcrData(c) return } // for "/:supi/am-data/subscribed-snssais-ack" - if op == "am-data" && strings.ToUpper("Put") == c.Request.Method && + if op == "am-data" && http.MethodPut == c.Request.Method && thirdLayer == "subscribed-snssais-ack" { s.HandleSNSSAIsAck(c) return } // for "/:supi/am-data/update-sor" - if op == "am-data" && strings.ToUpper("Post") == c.Request.Method && thirdLayer == "update-sor" { + if op == "am-data" && http.MethodPost == c.Request.Method && thirdLayer == "update-sor" { s.HandleUpdateSORInfo(c) return } // for "/:supi/am-data/upu-ack" - if op == "am-data" && strings.ToUpper("Put") == c.Request.Method && thirdLayer == "upu-ack" { + if op == "am-data" && http.MethodPut == c.Request.Method && thirdLayer == "upu-ack" { s.HandleUpuAck(c) return } // for "/:ueId/sdm-subscriptions/:subscriptionId" - if op == "sdm-subscriptions" && strings.ToUpper("Patch") == c.Request.Method { + if op == "sdm-subscriptions" && http.MethodPatch == c.Request.Method { var tmpParams gin.Params tmpParams = append(tmpParams, gin.Param{Key: "ueId", Value: c.Param("supi")}) tmpParams = append(tmpParams, gin.Param{Key: "subscriptionId", Value: c.Param("thirdLayer")}) @@ -573,28 +573,28 @@ func (s *Server) getOneLayerRoutes() []Route { return []Route{ { "GetDataSets", - strings.ToUpper("Get"), + http.MethodGet, "/:supi", s.HandleGetSupi, }, { "GetSharedData", - strings.ToUpper("Get"), + http.MethodGet, "/shared-data", s.HandleGetSharedData, }, { "SubscribeToSharedData", - strings.ToUpper("Post"), + http.MethodPost, "/shared-data-subscriptions", s.HandleSubscribeToSharedData, }, { "GetMultipleIdentifiers", - strings.ToUpper("Get"), + http.MethodGet, "/multiple-identifiers", s.HandleGetMultipleIdentifiers, }, @@ -605,133 +605,133 @@ func (s *Server) getTwoLayerRoutes() []Route { return []Route{ { "GetAmData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/am-data", s.HandleGetAmData, }, { "GetSmfSelData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/smf-select-data", s.HandleGetSmfSelectData, }, { "GetSmsMngtData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/sms-mng-data", s.HandleGetSmsMngData, }, { "GetSmsData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/sms-data", s.HandleGetSmsData, }, { "GetSmData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/sm-data", s.HandleGetSmData, }, { "GetNSSAI", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/nssai", s.HandleGetNssai, }, { "Subscribe", - strings.ToUpper("Post"), + http.MethodPost, "/:ueId/sdm-subscriptions", s.HandleSubscribe, }, { "GetTraceConfigData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/trace-data", s.HandleGetTraceData, }, { "GetUeCtxInSmfData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/ue-context-in-smf-data", s.HandleGetUeContextInSmfData, }, { "GetUeCtxInSmsfData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/ue-context-in-smsf-data", s.HandleGetUeContextInSmsfData, }, { "GetGroupIdentifiers", - strings.ToUpper("Get"), + http.MethodGet, "/group-data/group-identifiers", s.HandleGetGroupIdentifiers, }, { "GetLcsBcaData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/lcs-bca-data", s.HandleGetLcsBcaData, }, { "GetLcsMoData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/lcs-mo-data", s.HandleGetLcsMoData, }, { "GetLcsPrivacyData", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/lcs-privacy-data", s.HandleGetLcsPrivacyData, }, { "GetMbsData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/5mbs-data", s.HandleGetMbsData, }, { "GetProseData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/prose-data", s.HandleGetProseData, }, { "GetUcData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/uc-data", s.HandleGetUcData, }, { "GetUeCtxInAmfData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/ue-context-in-amf-data", s.HandleGetUeCtxInAmfData, }, { "GetV2xData", - strings.ToUpper("Get"), + http.MethodGet, "/:supi/v2x-data", s.HandleGetV2xData, }, diff --git a/internal/sbi/api_ueauthentication.go b/internal/sbi/api_ueauthentication.go index f80c802..0c2d5e4 100644 --- a/internal/sbi/api_ueauthentication.go +++ b/internal/sbi/api_ueauthentication.go @@ -2,7 +2,6 @@ package sbi import ( "net/http" - "strings" "github.com/gin-gonic/gin" @@ -22,42 +21,42 @@ func (s *Server) getUEAuthenticationRoutes() []Route { { "ConfirmAuth", - strings.ToUpper("Post"), + http.MethodPost, "/:supi/auth-events", s.HandleConfirmAuth, }, { "DeleteAuth", - strings.ToUpper("Put"), + http.MethodPut, "/:supi/auth-events/:authEventId", s.HandleDeleteAuth, }, { "GenerateAv", - strings.ToUpper("Post"), + http.MethodPost, "/:supi/hss-security-information/:hssAuthType/generate-av", s.HandleGenerateAv, }, { "GenerateGbaAv", - strings.ToUpper("Post"), + http.MethodPost, "/:supi/gba-security-information/generate-av", s.HandleGenerateGbaAv, }, { "GenerateProseAV", - strings.ToUpper("Post"), + http.MethodPost, "/:supiOrSuci/prose-security-information/generate-av", s.HandleGenerateProseAV, }, { "GetRgAuthData", - strings.ToUpper("Get"), + http.MethodGet, "/:supiOrSuci/security-information-rg", s.HandleGetRgAuthData, }, @@ -138,7 +137,7 @@ func (s *Server) HandleGenerateAuthData(c *gin.Context) { } func (s *Server) GenAuthDataHandlerFunc(c *gin.Context) { - if strings.ToUpper("Post") == c.Request.Method { + if http.MethodPost == c.Request.Method { s.HandleGenerateAuthData(c) return } diff --git a/internal/sbi/api_uecontextmanagement.go b/internal/sbi/api_uecontextmanagement.go index f78ac4f..ad48839 100644 --- a/internal/sbi/api_uecontextmanagement.go +++ b/internal/sbi/api_uecontextmanagement.go @@ -2,7 +2,6 @@ package sbi import ( "net/http" - "strings" "github.com/gin-gonic/gin" @@ -23,217 +22,217 @@ func (s *Server) getUEContextManagementRoutes() []Route { { "Get3GppRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/amf-3gpp-access", s.HandleGetAmf3gppAccess, }, { "GetNon3GppRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/amf-non-3gpp-access", s.HandleGetAmfNon3gppAccess, }, { "Call3GppRegistration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/amf-3gpp-access", s.HandleRegistrationAmf3gppAccess, }, { "Non3GppRegistration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/amf-non-3gpp-access", s.HandleRegistrationAmfNon3gppAccess, }, { "Update3GppRegistration", - strings.ToUpper("Patch"), + http.MethodPatch, "/:ueId/registrations/amf-3gpp-access", s.HandleUpdateAmf3gppAccess, }, { "UpdateNon3GppRegistration", - strings.ToUpper("Patch"), + http.MethodPatch, "/:ueId/registrations/amf-non-3gpp-access", s.HandleUpdateAmfNon3gppAccess, }, { "SmfDeregistration", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueId/registrations/smf-registrations/:pduSessionId", s.HandleDeregistrationSmfRegistrations, }, { "Registration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/smf-registrations/:pduSessionId", s.HandleRegistrationSmfRegistrations, }, { "Get3GppSmsfRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/smsf-3gpp-access", s.HandleGetSmsf3gppAccess, }, { "Call3GppSmsfDeregistration", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueId/registrations/smsf-3gpp-access", s.HandleDeregistrationSmsf3gppAccess, }, { "Non3GppSmsfDeregistration", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueId/registrations/smsf-non-3gpp-access", s.HandleDeregistrationSmsfNon3gppAccess, }, { "GetNon3GppSmsfRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/smsf-non-3gpp-access", s.HandleGetSmsfNon3gppAccess, }, { "Call3GppSmsfRegistration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/smsf-3gpp-access", s.HandleUpdateSMSFReg3GPP, }, { "Non3GppSmsfRegistration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/smsf-non-3gpp-access", s.HandleRegistrationSmsfNon3gppAccess, }, { "DeregAMF", - strings.ToUpper("Post"), + http.MethodPost, "/:ueId/registrations/amf-3gpp-access/dereg-amf", s.HandleDeregAMF, }, { "GetIpSmGwRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/ip-sm-gw", s.HandleGetIpSmGwRegistration, }, { "GetLocationInfo", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/location", s.HandleGetLocationInfo, }, { "GetNwdafRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/nwdaf-registrations", s.HandleGetNwdafRegistration, }, { "GetRegistrations", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations", s.HandleGetRegistrations, }, { "GetSmfRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/smf-registrations", s.HandleGetSmfRegistration, }, { "IpSmGwDeregistration", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueId/registrations/ip-sm-gw", s.HandleIpSmGwDeregistration, }, { "IpSmGwRegistration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/ip-sm-gw", s.HandleIpSmGwRegistration, }, { "NwdafDeregistration", - strings.ToUpper("Delete"), + http.MethodDelete, "/:ueId/registrations/nwdaf-registrations/:nwdafRegistrationId", s.HandleNwdafDeregistration, }, { "NwdafRegistration", - strings.ToUpper("Put"), + http.MethodPut, "/:ueId/registrations/nwdaf-registrations/:nwdafRegistrationId", s.HandleNwdafRegistration, }, { "PeiUpdate", - strings.ToUpper("Post"), + http.MethodPost, "/:ueId/registrations/amf-3gpp-access/pei-update", s.HandlePeiUpdate, }, { "RetrieveSmfRegistration", - strings.ToUpper("Get"), + http.MethodGet, "/:ueId/registrations/smf-registrations/:pduSessionId", s.HandleRetrieveSmfRegistration, }, { "SendRoutingInfoSm", - strings.ToUpper("Post"), + http.MethodPost, "/:ueId/registrations/send-routing-info-sm", s.HandleSendRoutingInfoSm, }, { "TriggerPCSCFRestoration", - strings.ToUpper("Post"), + http.MethodPost, "/restore-pcscf", s.HandleTriggerPCSCFRestoration, }, { "UpdateNwdafRegistration", - strings.ToUpper("Patch"), + http.MethodPatch, "/:ueId/registrations/nwdaf-registrations/:nwdafRegistrationId", s.HandleUpdateNwdafRegistration, }, { "UpdateRoamingInformation", - strings.ToUpper("Post"), + http.MethodPost, "/:ueId/registrations/amf-3gpp-access/roaming-info-update", s.HandleUpdateRoamingInformation, }, { "UpdateSmfRegistration", - strings.ToUpper("Patch"), + http.MethodPatch, "/:ueId/registrations/smf-registrations/:pduSessionId", s.HandleUpdateSmfRegistration, }, diff --git a/internal/sbi/api_ueid.go b/internal/sbi/api_ueid.go index a2a1120..804cb64 100644 --- a/internal/sbi/api_ueid.go +++ b/internal/sbi/api_ueid.go @@ -17,7 +17,7 @@ func (s *Server) getUEIDRoutes() []Route { { "Deconceal", - "Post", + http.MethodPost, "/deconceal", s.HandleDeconceal, }, diff --git a/internal/sbi/consumer/nrf_service.go b/internal/sbi/consumer/nrf_service.go index a1b644d..82cdc96 100644 --- a/internal/sbi/consumer/nrf_service.go +++ b/internal/sbi/consumer/nrf_service.go @@ -2,7 +2,6 @@ package consumer import ( "context" - "fmt" "strings" "sync" "time" @@ -95,7 +94,7 @@ func (s *nnrfService) SendSearchNFInstances( return &result, nil } -func (s *nnrfService) SendNFIntancesUDR(id string, types int) string { +func (s *nnrfService) SendNFInstancesUDR(id string, types int) string { self := udm_context.GetSelf() targetNfType := models.NrfNfManagementNfType_UDR requestNfType := models.NrfNfManagementNfType_UDM @@ -104,15 +103,7 @@ func (s *nnrfService) SendNFIntancesUDR(id string, types int) string { } searchNFinstanceRequest.RequesterNfType = &requestNfType searchNFinstanceRequest.TargetNfType = &targetNfType - // switch types { - // case NFDiscoveryToUDRParamSupi: - // localVarOptionals.Supi = optional.NewString(id) - // case NFDiscoveryToUDRParamExtGroupId: - // localVarOptionals.ExternalGroupIdentity = optional.NewString(id) - // case NFDiscoveryToUDRParamGpsi: - // localVarOptionals.Gpsi = optional.NewString(id) - // } - fmt.Println(self.NrfUri) + result, err := s.SendSearchNFInstances(self.NrfUri, searchNFinstanceRequest) if err != nil { logger.ConsumerLog.Error(err.Error()) @@ -158,21 +149,19 @@ func (s *nnrfService) RegisterNFInstance(ctx context.Context) ( var res *Nnrf_NFManagement.RegisterNFInstanceResponse res, err = client.NFInstanceIDDocumentApi.RegisterNFInstance(ctx, ®isterNfInstanceRequest) - var status int32 if err != nil || res == nil { problem, ok := err.(openapi.GenericOpenAPIError).Model().(models.ProblemDetails) if !ok { - logger.ConsumerLog.Errorf("UDM register to NRF Error[%v]", err) + logger.ConsumerLog.Errorf("UDM register to NRF Error[%v]", problem) time.Sleep(2 * time.Second) continue } - status = problem.Status } if res.Location == "" { // NFUpdate break - } else if res.Location != "" { + } else { // http.statusCreated // NFRegister resourceUri := res.Location resouceNrfUri = resourceUri[:strings.Index(resourceUri, "/nnrf-nfm/")] @@ -192,9 +181,6 @@ func (s *nnrfService) RegisterNFInstance(ctx context.Context) ( } break - } else { - fmt.Println(fmt.Errorf("handler returned wrong status code %d", status)) - fmt.Println("NRF return wrong status code", status) } } return resouceNrfUri, retrieveNfInstanceID, err @@ -207,12 +193,8 @@ func (s *nnrfService) buildNfProfile(udmContext *udm_context.UDMContext) ( profile.NfType = models.NrfNfManagementNfType_UDM profile.NfStatus = models.NrfNfManagementNfStatus_REGISTERED profile.Ipv4Addresses = append(profile.Ipv4Addresses, udmContext.RegisterIPv4) - services := []models.NrfNfManagementNfService{} for _, nfService := range udmContext.NfService { - services = append(services, nfService) - } - if len(services) > 0 { - profile.NfServices = services + profile.NfServices = append(profile.NfServices, nfService) } profile.UdmInfo = &models.UdmInfo{ // Todo diff --git a/internal/sbi/consumer/udr_service.go b/internal/sbi/consumer/udr_service.go index c326880..766925a 100644 --- a/internal/sbi/consumer/udr_service.go +++ b/internal/sbi/consumer/udr_service.go @@ -54,12 +54,12 @@ func (s *nudrService) getUdrURI(id string) string { ue, ok := udm_context.GetSelf().UdmUeFindBySupi(id) if ok { if ue.UdrUri == "" { - ue.UdrUri = s.consumer.SendNFIntancesUDR(id, NFDiscoveryToUDRParamSupi) + ue.UdrUri = s.consumer.SendNFInstancesUDR(id, NFDiscoveryToUDRParamSupi) } return ue.UdrUri } else { ue = udm_context.GetSelf().NewUdmUe(id) - ue.UdrUri = s.consumer.SendNFIntancesUDR(id, NFDiscoveryToUDRParamSupi) + ue.UdrUri = s.consumer.SendNFInstancesUDR(id, NFDiscoveryToUDRParamSupi) return ue.UdrUri } } else if strings.Contains(id, "pei") { @@ -68,13 +68,13 @@ func (s *nudrService) getUdrURI(id string) string { ue := value.(*udm_context.UdmUeContext) if ue.Amf3GppAccessRegistration != nil && ue.Amf3GppAccessRegistration.Pei == id { if ue.UdrUri == "" { - ue.UdrUri = s.consumer.SendNFIntancesUDR(ue.Supi, NFDiscoveryToUDRParamSupi) + ue.UdrUri = s.consumer.SendNFInstancesUDR(ue.Supi, NFDiscoveryToUDRParamSupi) } udrURI = ue.UdrUri return false } else if ue.AmfNon3GppAccessRegistration != nil && ue.AmfNon3GppAccessRegistration.Pei == id { if ue.UdrUri == "" { - ue.UdrUri = s.consumer.SendNFIntancesUDR(ue.Supi, NFDiscoveryToUDRParamSupi) + ue.UdrUri = s.consumer.SendNFInstancesUDR(ue.Supi, NFDiscoveryToUDRParamSupi) } udrURI = ue.UdrUri return false @@ -84,10 +84,10 @@ func (s *nudrService) getUdrURI(id string) string { return udrURI } else if strings.Contains(id, "extgroupid") { // extra group id - return s.consumer.SendNFIntancesUDR(id, NFDiscoveryToUDRParamExtGroupId) + return s.consumer.SendNFInstancesUDR(id, NFDiscoveryToUDRParamExtGroupId) } else if strings.Contains(id, "msisdn") || strings.Contains(id, "extid") { // gpsi - return s.consumer.SendNFIntancesUDR(id, NFDiscoveryToUDRParamGpsi) + return s.consumer.SendNFInstancesUDR(id, NFDiscoveryToUDRParamGpsi) } - return s.consumer.SendNFIntancesUDR("", NFDiscoveryToUDRParamNone) + return s.consumer.SendNFInstancesUDR("", NFDiscoveryToUDRParamNone) }