diff --git a/internal/context/context.go b/internal/context/context.go index 33c154d..bfc1fd0 100644 --- a/internal/context/context.go +++ b/internal/context/context.go @@ -126,11 +126,11 @@ func InitUdmContext(context *UDMContext) { if configuration.NrfCertPem != "" { context.NrfCertPem = configuration.NrfCertPem } + servingNameList := configuration.ServiceNameList - serviceList := configuration.ServiceList udmContext.SuciProfiles = configuration.SuciProfiles - udmContext.InitNFService(serviceList, config.Info.Version) + udmContext.InitNFService(servingNameList, config.Info.Version) } func (context *UDMContext) ManageSmData(smDatafromUDR []models.SessionManagementSubscriptionData, snssaiFromReq string, @@ -455,15 +455,11 @@ func (context *UDMContext) GetSDMUri() string { return context.GetIPv4Uri() + factory.UdmSdmResUriPrefix } -func (context *UDMContext) InitNFService(serviceList []factory.ServiceList, version string) { +func (context *UDMContext) InitNFService(serviceName []string, version string) { tmpVersion := strings.Split(version, ".") versionUri := "v" + tmpVersion[0] - for index, service := range serviceList { - name := models.ServiceName(service.ServiceName) - allowNfTypes := make([]models.NfType, len(service.AllowedNfTypes)) - for idx, nf := range service.AllowedNfTypes { - allowNfTypes[idx] = models.NfType(nf) - } + for index, nameString := range serviceName { + name := models.ServiceName(nameString) context.NfService[name] = models.NfService{ ServiceInstanceId: strconv.Itoa(index), ServiceName: name, @@ -483,7 +479,6 @@ func (context *UDMContext) InitNFService(serviceList []factory.ServiceList, vers Port: int32(context.SBIPort), }, }, - AllowedNfTypes: allowNfTypes, } } } diff --git a/internal/util/init_context.go b/internal/util/init_context.go index d964fb8..6f749ef 100644 --- a/internal/util/init_context.go +++ b/internal/util/init_context.go @@ -43,9 +43,9 @@ func InitUDMContext(udmContext *context.UDMContext) { } } udmContext.NrfUri = configuration.NrfUri - serviceList := configuration.ServiceList + servingNameList := configuration.ServiceNameList udmContext.SuciProfiles = configuration.SuciProfiles - udmContext.InitNFService(serviceList, config.Info.Version) + udmContext.InitNFService(servingNameList, config.Info.Version) } diff --git a/internal/util/nf_authorization.go b/internal/util/nf_authorization.go index 0f6def5..b96f654 100644 --- a/internal/util/nf_authorization.go +++ b/internal/util/nf_authorization.go @@ -13,7 +13,7 @@ import ( func AuthorizationCheck(c *gin.Context, serviceName string) error { if udm_context.GetSelf().OAuth2Required { oauth_err := oauth.VerifyOAuth(c.Request.Header.Get("Authorization"), serviceName, - udm_context.GetSelf().NrfCerPem) + udm_context.GetSelf().NrfCertPem) if oauth_err != nil { c.JSON(http.StatusUnauthorized, gin.H{"error": oauth_err.Error()}) return oauth_err diff --git a/pkg/factory/config.go b/pkg/factory/config.go index 58b1a96..13e68ed 100644 --- a/pkg/factory/config.go +++ b/pkg/factory/config.go @@ -58,11 +58,6 @@ type Info struct { Description string `yaml:"description,omitempty" valid:"type(string)"` } -type ServiceList struct { - ServiceName string `yaml:"serviceName" valid:"required"` - AllowedNfTypes []string `yaml:"allowedNfTypes,omitempty" valid:"optional"` -} - type Configuration struct { Sbi *Sbi `yaml:"sbi,omitempty" valid:"required"` ServiceNameList []string `yaml:"serviceNameList,omitempty" valid:"required"` @@ -83,10 +78,9 @@ func (c *Configuration) validate() (bool, error) { } } - if c.ServiceList != nil { + if c.ServiceNameList != nil { var errs govalidator.Errors - for _, service := range c.ServiceList { - v := service.ServiceName + for _, v := range c.ServiceNameList { if v != "nudm-sdm" && v != "nudm-uecm" && v != "nudm-ueau" && v != "nudm-ee" && v != "nudm-pp" { err := fmt.Errorf("Invalid ServiceNameList: [%s],"+ " value should be nudm-sdm or nudm-uecm or nudm-ueau or nudm-ee or nudm-pp", v)