Skip to content

Commit

Permalink
changed sd to lowercase (#81)
Browse files Browse the repository at this point in the history
* change sd to lowercase

* gofumpt-ed

* deleted if
  • Loading branch information
danielh1204 authored Aug 1, 2023
1 parent 2bd15d8 commit abec5ee
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package factory
import (
"fmt"
"io/ioutil"
"strings"

"github.com/asaskevich/govalidator"
"gopkg.in/yaml.v2"
Expand All @@ -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 == "" {
Expand All @@ -34,6 +52,7 @@ func InitConfigFactory(f string, cfg *Config) error {
return fmt.Errorf("[Factory] %+v", yamlErr)
}
}
changeSdToLowercase(cfg)

return nil
}
Expand Down

0 comments on commit abec5ee

Please sign in to comment.