diff --git a/pkg/factory/factory.go b/pkg/factory/factory.go index 35e57da0..3629452a 100644 --- a/pkg/factory/factory.go +++ b/pkg/factory/factory.go @@ -7,6 +7,7 @@ package factory import ( "fmt" "io/ioutil" + "strings" "github.com/asaskevich/govalidator" "gopkg.in/yaml.v2" @@ -19,6 +20,23 @@ var ( UERoutingConfig *RoutingConfig ) +func changeSdToLowercase(cfg *Config) { + // snssaiInfos + SNssaiInfo := cfg.Configuration.SNssaiInfo + for i := range SNssaiInfo { + SNssaiInfo[i].SNssai.Sd = strings.ToLower(SNssaiInfo[i].SNssai.Sd) + } + + // userplaneInformation + UPNodes := cfg.Configuration.UserPlaneInformation.UPNodes + for i := range UPNodes { + SNssaiInfos := UPNodes[i].SNssaiInfos + for j := range SNssaiInfos { + SNssaiInfos[j].SNssai.Sd = strings.ToLower(SNssaiInfos[j].SNssai.Sd) + } + } +} + // TODO: Support configuration update from REST api func InitConfigFactory(f string, cfg *Config) error { if f == "" { @@ -34,6 +52,7 @@ func InitConfigFactory(f string, cfg *Config) error { return fmt.Errorf("[Factory] %+v", yamlErr) } } + changeSdToLowercase(cfg) return nil }