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

feat(udm): Maintain multiple previsioned home network keys #6

Merged
merged 1 commit into from
Aug 9, 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
20 changes: 2 additions & 18 deletions context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/free5gc/openapi"
"github.com/free5gc/openapi/Nnrf_NFDiscovery"
"github.com/free5gc/openapi/models"
"github.com/free5gc/udm/factory"
"github.com/free5gc/util_3gpp/suci"
)

var udmContext UDMContext
Expand Down Expand Up @@ -44,7 +44,7 @@ type UDMContext struct {
GpsiSupiList models.IdentityData
SharedSubsDataMap map[string]models.SharedData // sharedDataIds as key
SubscriptionOfSharedDataChange sync.Map // subscriptionID as key
Keys *factory.Keys
SuciProfiles []suci.SuciProfile
EeSubscriptionIDGenerator *idgenerator.IDGenerator
}

Expand Down Expand Up @@ -85,22 +85,6 @@ type UdmNFContext struct {
SubscribeToNotifSharedDataChange *models.SdmSubscription // SubscriptionID as key
}

func (context *UDMContext) GetUdmProfileAHNPublicKey() string {
return context.Keys.UdmProfileAHNPublicKey
}

func (context *UDMContext) GetUdmProfileAHNPrivateKey() string {
return context.Keys.UdmProfileAHNPrivateKey
}

func (context *UDMContext) GetUdmProfileBHNPublicKey() string {
return context.Keys.UdmProfileBHNPublicKey
}

func (context *UDMContext) GetUdmProfileBHNPrivateKey() string {
return context.Keys.UdmProfileBHNPrivateKey
}

func (context *UDMContext) ManageSmData(smDatafromUDR []models.SessionManagementSubscriptionData, snssaiFromReq string,
dnnFromReq string) (mp map[string]models.SessionManagementSubscriptionData, ind string,
Dnns []models.DnnConfiguration, allDnns []map[string]models.DnnConfiguration) {
Expand Down
20 changes: 7 additions & 13 deletions factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ package factory

import (
"github.com/free5gc/logger_util"
"github.com/free5gc/util_3gpp/suci"
)

const (
UDM_EXPECTED_CONFIG_VERSION = "1.0.0"
UDM_EXPECTED_CONFIG_VERSION = "1.0.1"
)

type Config struct {
Expand All @@ -30,11 +31,11 @@ const (
)

type Configuration struct {
UdmName string `yaml:"udmName,omitempty"`
Sbi *Sbi `yaml:"sbi,omitempty"`
ServiceNameList []string `yaml:"serviceNameList,omitempty"`
NrfUri string `yaml:"nrfUri,omitempty"`
Keys *Keys `yaml:"keys,omitempty"`
UdmName string `yaml:"udmName,omitempty"`
Sbi *Sbi `yaml:"sbi,omitempty"`
ServiceNameList []string `yaml:"serviceNameList,omitempty"`
NrfUri string `yaml:"nrfUri,omitempty"`
SuciProfiles []suci.SuciProfile `yaml:"SuciProfile,omitempty"`
}

type Sbi struct {
Expand All @@ -52,13 +53,6 @@ type Tls struct {
Key string `yaml:"key,omitempty"`
}

type Keys struct {
UdmProfileAHNPrivateKey string `yaml:"udmProfileAHNPrivateKey,omitempty"`
UdmProfileAHNPublicKey string `yaml:"udmProfileAHNPublicKey,omitempty"`
UdmProfileBHNPrivateKey string `yaml:"udmProfileBHNPrivateKey,omitempty"`
UdmProfileBHNPublicKey string `yaml:"udmProfileBHNPublicKey,omitempty"`
}

func (c *Config) GetVersion() string {
if c.Info != nil && c.Info.Version != "" {
return c.Info.Version
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/free5gc/milenage v1.0.0
github.com/free5gc/openapi v1.0.0
github.com/free5gc/path_util v1.0.0
github.com/free5gc/util_3gpp v1.0.0
github.com/free5gc/util_3gpp v1.0.1
github.com/free5gc/version v1.0.0
github.com/gin-gonic/gin v1.6.3
github.com/google/uuid v1.1.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ github.com/free5gc/openapi v1.0.0 h1:DaGVt05b1pSDBOailKAlLj6hAk6vunN0Nhzvl/xcWCY
github.com/free5gc/openapi v1.0.0/go.mod h1:7OzxoWBj6KQgznMW2ZiUtZdCGY+t89v4wtgKLhluKgU=
github.com/free5gc/path_util v1.0.0 h1:vJPGTymaWtavz6fJ/7k6WKEYv5BQLAq/O04RP54sab0=
github.com/free5gc/path_util v1.0.0/go.mod h1:OpmcebEKrMPnH7Jg5lZ8y9ZWJNAjQ4l9FGWXUv58Mo0=
github.com/free5gc/util_3gpp v1.0.0 h1:yDuCFVlzLWKu6+vKBNG/PVAxjtrr8hPlJaTE/00hX8A=
github.com/free5gc/util_3gpp v1.0.0/go.mod h1:6uI6CB6SD/yWpalo17gc5eWUVFMAIKkWDiQpkOX3+c8=
github.com/free5gc/util_3gpp v1.0.1 h1:Ds93Ll9e3tKT5Wz50W5pAKgYpjHR+oxOeNKqSCWP+zI=
github.com/free5gc/util_3gpp v1.0.1/go.mod h1:Pk9xccNPnppwcND6MJqR7duZhjuGl6VlMeONARxiLv4=
github.com/free5gc/version v1.0.0 h1:Kn4uOhyHT1IAgerBgWRHag4xLMDXrRsqubLeMv5Nb/w=
github.com/free5gc/version v1.0.0/go.mod h1:wOTwzjk7sqeysX1b/Z4x+pWBHFuZOPtQj3h+IJXSpmQ=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
Expand Down
2 changes: 1 addition & 1 deletion producer/generate_auth_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func GenerateAuthDataProcedure(authInfoRequest models.AuthenticationInfoRequest,

response = &models.AuthenticationInfoResult{}
rand.Seed(time.Now().UnixNano())
supi, err := suci.ToSupi(supiOrSuci, udm_context.UDM_Self().GetUdmProfileAHNPrivateKey())
supi, err := suci.ToSupi(supiOrSuci, udm_context.UDM_Self().SuciProfiles)
if err != nil {
problemDetails = &models.ProblemDetails{
Status: http.StatusForbidden,
Expand Down
2 changes: 1 addition & 1 deletion util/init_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func InitUDMContext(udmContext *context.UDMContext) {
udmContext.NrfUri = configuration.NrfUri
servingNameList := configuration.ServiceNameList

udmContext.Keys = configuration.Keys
udmContext.SuciProfiles = configuration.SuciProfiles

udmContext.InitNFService(servingNameList, config.Info.Version)
}