Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add plmn list support to udm profile #12

Merged
merged 1 commit into from Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions consumer/nf_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func BuildNFInstance(udmContext *udm_context.UDMContext) (profile models.NfProfi
}

var plmns []models.PlmnId
for _, plmn := range udmContext.PlmnList {
plmns = append(plmns, plmn)
for _, plmnItem := range udmContext.PlmnList {
plmns = append(plmns, plmnItem.PlmnId)
}
if len(plmns) > 0 {
profile.PlmnList = &plmns
Expand Down
2 changes: 1 addition & 1 deletion context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type UDMContext struct {
SubscriptionOfSharedDataChange sync.Map // subscriptionID as key
Keys *factory.Keys
EeSubscriptionIDGenerator *idgenerator.IDGenerator
PlmnList []models.PlmnId
PlmnList []factory.PlmnSupportItem
}

type UdmUeContext struct {
Expand Down
5 changes: 5 additions & 0 deletions factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Configuration struct {
NrfUri string `yaml:"nrfUri,omitempty"`
Keys *Keys `yaml:"keys,omitempty"`
PlmnSupportList []models.PlmnId `yaml:"plmnSupportList,omitempty"`
PlmnList []PlmnSupportItem `yaml:"plmnList,omitempty"`
}

type Sbi struct {
Expand All @@ -66,6 +67,10 @@ type Keys struct {
UdmProfileBHNPublicKey string `yaml:"udmProfileBHNPublicKey,omitempty"`
}

type PlmnSupportItem struct {
PlmnId models.PlmnId `yaml:"plmnId"`
}

func (c *Config) GetVersion() string {
if c.Info != nil && c.Info.Version != "" {
return c.Info.Version
Expand Down
9 changes: 4 additions & 5 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/free5gc/http2_util"
"github.com/free5gc/logger_util"
openApiLogger "github.com/free5gc/openapi/logger"
"github.com/free5gc/openapi/models"
"github.com/free5gc/path_util"
pathUtilLogger "github.com/free5gc/path_util/logger"
"github.com/free5gc/udm/consumer"
Expand Down Expand Up @@ -316,17 +315,17 @@ func (udm *UDM) updateConfig(commChannel chan *protos.NetworkSliceResponse) bool
for _, ns := range rsp.NetworkSlice {
logger.GrpcLog.Infoln("Network Slice Name ", ns.Name)
if ns.Site != nil {
temp := models.PlmnId{}
temp := factory.PlmnSupportItem{}
var found bool = false
logger.GrpcLog.Infoln("Network Slice has site name present ")
site := ns.Site
logger.GrpcLog.Infoln("Site name ", site.SiteName)
if site.Plmn != nil {
temp.Mcc = site.Plmn.Mcc
temp.Mnc = site.Plmn.Mnc
temp.PlmnId.Mcc = site.Plmn.Mcc
temp.PlmnId.Mnc = site.Plmn.Mnc
logger.GrpcLog.Infoln("Plmn mcc ", site.Plmn.Mcc)
for _, item := range self.PlmnList {
if item.Mcc == temp.Mcc && item.Mnc == temp.Mnc {
if item.PlmnId.Mcc == temp.PlmnId.Mcc && item.PlmnId.Mnc == temp.PlmnId.Mnc {
found = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion util/init_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ func InitUDMContext(udmContext *context.UDMContext) {
servingNameList := configuration.ServiceNameList

udmContext.Keys = configuration.Keys

udmContext.PlmnList = configuration.PlmnList
udmContext.InitNFService(servingNameList, config.Info.Version)
}