factory

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SmfDefaultTLSKeyLogPath      = "./log/smfsslkey.log"
	SmfDefaultCertPemPath        = "./cert/smf.pem"
	SmfDefaultPrivateKeyPath     = "./cert/smf.key"
	SmfDefaultConfigPath         = "./config/smfcfg.yaml"
	SmfDefaultUERoutingPath      = "./config/uerouting.yaml"
	SmfSbiDefaultIPv4            = "127.0.0.2"
	SmfSbiDefaultPort            = 8000
	SmfSbiDefaultScheme          = "https"
	SmfDefaultNrfUri             = "https://127.0.0.10:8000"
	SmfEventExposureResUriPrefix = "/nsmf_event-exposure/v1"
	SmfPdusessionResUriPrefix    = "/nsmf-pdusession/v1"
	SmfOamUriPrefix              = "/nsmf-oam/v1"
	SmfCallbackUriPrefix         = "/nsmf-callback"
	NrfDiscUriPrefix             = "/nnrf-disc/v1"
	UdmSdmUriPrefix              = "/nudm-sdm/v1"
	PcfSmpolicycontrolUriPrefix  = "/npcf-smpolicycontrol/v1"
	UpiUriPrefix                 = "/upi/v1"
)

Variables

View Source
var (
	SmfConfig       *Config
	UERoutingConfig *RoutingConfig
)

Functions

func InitConfigFactory

func InitConfigFactory(f string, cfg *Config) error

TODO: Support configuration update from REST api

func InitRoutingConfigFactory

func InitRoutingConfigFactory(f string, cfg *RoutingConfig) error

Types

type Config

type Config struct {
	Info          *Info          `yaml:"info" valid:"required"`
	Configuration *Configuration `yaml:"configuration" valid:"required"`
	Logger        *Logger        `yaml:"logger" valid:"required"`
	sync.RWMutex
}

func ReadConfig

func ReadConfig(cfgPath string) (*Config, error)

func (*Config) GetCertKeyPath

func (c *Config) GetCertKeyPath() string

func (*Config) GetCertPemPath

func (c *Config) GetCertPemPath() string

func (*Config) GetLogEnable

func (c *Config) GetLogEnable() bool

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() string

func (*Config) GetLogReportCaller

func (c *Config) GetLogReportCaller() bool

func (*Config) GetSbiScheme

func (c *Config) GetSbiScheme() string

func (*Config) GetVersion

func (c *Config) GetVersion() string

func (*Config) Print

func (c *Config) Print()

func (*Config) SetLogEnable

func (c *Config) SetLogEnable(enable bool)

func (*Config) SetLogLevel

func (c *Config) SetLogLevel(level string)

func (*Config) SetLogReportCaller

func (c *Config) SetLogReportCaller(reportCaller bool)

func (*Config) Validate

func (c *Config) Validate() (bool, error)

type Configuration

type Configuration struct {
	SmfName              string               `yaml:"smfName" valid:"type(string),required"`
	Sbi                  *Sbi                 `yaml:"sbi" valid:"required"`
	PFCP                 *PFCP                `yaml:"pfcp" valid:"required"`
	NrfUri               string               `yaml:"nrfUri" valid:"url,required"`
	NrfCertPem           string               `yaml:"nrfCertPem,omitempty" valid:"optional"`
	UserPlaneInformation UserPlaneInformation `yaml:"userplaneInformation" valid:"required"`
	ServiceNameList      []string             `yaml:"serviceNameList" valid:"required"`
	SNssaiInfo           []*SnssaiInfoItem    `yaml:"snssaiInfos" valid:"required"`
	ULCL                 bool                 `yaml:"ulcl" valid:"type(bool),optional"`
	PLMNList             []PlmnID             `yaml:"plmnList"  valid:"optional"`
	Locality             string               `yaml:"locality" valid:"type(string),optional"`
	UrrPeriod            uint16               `yaml:"urrPeriod,omitempty" valid:"optional"`
	UrrThreshold         uint64               `yaml:"urrThreshold,omitempty" valid:"optional"`
	T3591                *TimerValue          `yaml:"t3591" valid:"required"`
	T3592                *TimerValue          `yaml:"t3592" valid:"required"`
	NwInstFqdnEncoding   bool                 `yaml:"nwInstFqdnEncoding" valid:"type(bool),optional"`
	RequestedUnit        int32                `yaml:"requestedUnit,omitempty" valid:"optional"`
}

type DNS

type DNS struct {
	IPv4Addr string `yaml:"ipv4,omitempty" valid:"ipv4,required"`
	IPv6Addr string `yaml:"ipv6,omitempty" valid:"ipv6,optional"`
}

type DnnUpfInfoItem

type DnnUpfInfoItem struct {
	Dnn             string                  `json:"dnn" yaml:"dnn" valid:"required"`
	DnaiList        []string                `json:"dnaiList" yaml:"dnaiList" valid:"optional"`
	PduSessionTypes []models.PduSessionType `json:"pduSessionTypes" yaml:"pduSessionTypes" valid:"optional"`
	Pools           []*UEIPPool             `json:"pools" yaml:"pools" valid:"optional"`
	StaticPools     []*UEIPPool             `json:"staticPools" yaml:"staticPools" valid:"optional"`
}

type Info

type Info struct {
	Version     string `yaml:"version,omitempty" valid:"required,in(1.0.7)"`
	Description string `yaml:"description,omitempty" valid:"type(string)"`
}

type InterfaceUpfInfoItem

type InterfaceUpfInfoItem struct {
	InterfaceType    models.UpInterfaceType `json:"interfaceType" yaml:"interfaceType" valid:"required"`
	Endpoints        []string               `json:"endpoints" yaml:"endpoints" valid:"required"`
	NetworkInstances []string               `json:"networkInstances" yaml:"networkInstances" valid:"required"`
}

type Logger

type Logger struct {
	Enable       bool   `yaml:"enable" valid:"type(bool)"`
	Level        string `yaml:"level" valid:"required,in(trace|debug|info|warn|error|fatal|panic)"`
	ReportCaller bool   `yaml:"reportCaller" valid:"type(bool)"`
}

type PCSCF

type PCSCF struct {
	IPv4Addr string `yaml:"ipv4,omitempty" valid:"ipv4,required"`
}

type PFCP

type PFCP struct {
	ListenAddr   string `yaml:"listenAddr,omitempty" valid:"host,required"`
	ExternalAddr string `yaml:"externalAddr,omitempty" valid:"host,required"`
	NodeID       string `yaml:"nodeID,omitempty" valid:"host,required"`
	// interval at which PFCP Association Setup error messages are output.
	AssocFailAlertInterval time.Duration `yaml:"assocFailAlertInterval,omitempty" valid:"type(time.Duration),optional"`
	AssocFailRetryInterval time.Duration `yaml:"assocFailRetryInterval,omitempty" valid:"type(time.Duration),optional"`
	HeartbeatInterval      time.Duration `yaml:"heartbeatInterval,omitempty" valid:"type(time.Duration),optional"`
}

type Path

type Path struct {
	DestinationIP   string   `yaml:"DestinationIP,omitempty" valid:"ipv4,required"`
	DestinationPort string   `yaml:"DestinationPort,omitempty" valid:"port,optional"`
	UPF             []string `yaml:"UPF,omitempty" valid:"required"`
}

type PfdContent

type PfdContent struct {
	// Identifies a PFD of an application identifier.
	PfdID string `yaml:"pfdID,omitempty" valid:"type(string),minstringlength(1),required"`
	// Represents a 3-tuple with protocol, server ip and server port for
	// UL/DL application traffic.
	FlowDescriptions []string `yaml:"flowDescriptions,omitempty" valid:"optional"`
	// Indicates a URL or a regular expression which is used to match the
	// significant parts of the URL.
	Urls []string `yaml:"urls,omitempty" valid:"optional"`
	// Indicates an FQDN or a regular expression as a domain name matching
	// criteria.
	DomainNames []string `yaml:"domainNames,omitempty" valid:"optional"`
}

PfdContent represents the flow of the application

type PfdDataForApp

type PfdDataForApp struct {
	// Identifier of an application.
	AppID string `yaml:"applicationId" valid:"type(string),minstringlength(1),required"`
	// PFDs for the application identifier.
	Pfds []PfdContent `yaml:"pfds" valid:"required"`
	// Caching time for an application identifier.
	CachingTime *time.Time `yaml:"cachingTime,omitempty" valid:"optional"`
}

PfdDataForApp represents the PFDs for an application identifier

type PlmnID

type PlmnID struct {
	Mcc string `yaml:"mcc"`
	Mnc string `yaml:"mnc"`
}

type RouteProfID

type RouteProfID string

RouteProfID is string providing a Route Profile identifier.

type RouteProfile

type RouteProfile struct {
	// Forwarding Policy ID of the route profile
	ForwardingPolicyID string `yaml:"forwardingPolicyID,omitempty" valid:"type(string),stringlength(1|255),required"`
}

RouteProfile maintains the mapping between RouteProfileID and ForwardingPolicyID of UPF

type RoutingConfig

type RoutingConfig struct {
	Info          *Info                        `yaml:"info" valid:"required"`
	UERoutingInfo map[string]UERoutingInfo     `yaml:"ueRoutingInfo" valid:"optional"`
	RouteProf     map[RouteProfID]RouteProfile `yaml:"routeProfile,omitempty" valid:"optional"`
	PfdDatas      []*PfdDataForApp             `yaml:"pfdDataForApp,omitempty" valid:"optional"`
	sync.RWMutex
}

func ReadUERoutingConfig

func ReadUERoutingConfig(cfgPath string) (*RoutingConfig, error)

func (*RoutingConfig) GetVersion

func (r *RoutingConfig) GetVersion() string

func (*RoutingConfig) Validate

func (r *RoutingConfig) Validate() (bool, error)

type Sbi

type Sbi struct {
	Scheme       string `yaml:"scheme" valid:"scheme,required"`
	Tls          *Tls   `yaml:"tls" valid:"optional"`
	RegisterIPv4 string `yaml:"registerIPv4,omitempty" valid:"host,optional"` // IP that is registered at NRF.
	// IPv6Addr string `yaml:"ipv6Addr,omitempty"`
	BindingIPv4 string `yaml:"bindingIPv4,omitempty" valid:"host,required"` // IP used to run the server in the node.
	Port        int    `yaml:"port,omitempty" valid:"port,optional"`
}

type SnssaiDnnInfoItem

type SnssaiDnnInfoItem struct {
	Dnn   string `yaml:"dnn" valid:"type(string),minstringlength(1),required"`
	DNS   *DNS   `yaml:"dns" valid:"required"`
	PCSCF *PCSCF `yaml:"pcscf,omitempty" valid:"optional"`
}

type SnssaiInfoItem

type SnssaiInfoItem struct {
	SNssai   *models.Snssai       `yaml:"sNssai" valid:"required"`
	DnnInfos []*SnssaiDnnInfoItem `yaml:"dnnInfos" valid:"required"`
}

type SnssaiUpfInfoItem

type SnssaiUpfInfoItem struct {
	SNssai         *models.Snssai    `json:"sNssai" yaml:"sNssai" valid:"required"`
	DnnUpfInfoList []*DnnUpfInfoItem `json:"dnnUpfInfoList" yaml:"dnnUpfInfoList" valid:"required"`
}

type SpecificPath

type SpecificPath struct {
	DestinationIP   string   `yaml:"dest,omitempty" valid:"cidr,required"`
	DestinationPort string   `yaml:"DestinationPort,omitempty" valid:"port,optional"`
	Path            []string `yaml:"path" valid:"required"`
}

type TimerValue

type TimerValue struct {
	Enable        bool          `yaml:"enable" valid:"type(bool)"`
	ExpireTime    time.Duration `yaml:"expireTime" valid:"type(time.Duration)"`
	MaxRetryTimes int           `yaml:"maxRetryTimes,omitempty" valid:"type(int)"`
}

type Tls

type Tls struct {
	Pem string `yaml:"pem,omitempty" valid:"type(string),minstringlength(1),required"`
	Key string `yaml:"key,omitempty" valid:"type(string),minstringlength(1),required"`
}

type UEIPPool

type UEIPPool struct {
	Cidr string `yaml:"cidr" valid:"cidr,required"`
}

type UERoutingInfo

type UERoutingInfo struct {
	Members       []string       `yaml:"members" valid:"required"`
	AN            string         `yaml:"AN,omitempty" valid:"ipv4,optional"`
	PathList      []Path         `yaml:"PathList,omitempty" valid:"optional"`
	Topology      []UPLink       `yaml:"topology" valid:"required"`
	SpecificPaths []SpecificPath `yaml:"specificPath,omitempty" valid:"optional"`
}
type UPLink struct {
	A string `json:"A" yaml:"A" valid:"required"`
	B string `json:"B" yaml:"B" valid:"required"`
}

type UPNode

type UPNode struct {
	Type                 string                  `json:"type" yaml:"type" valid:"upNodeType,required"`
	NodeID               string                  `json:"nodeID" yaml:"nodeID" valid:"host,optional"`
	Addr                 string                  `json:"addr" yaml:"addr" valid:"host,optional"`
	ANIP                 string                  `json:"anIP" yaml:"anIP" valid:"host,optional"`
	Dnn                  string                  `json:"dnn" yaml:"dnn" valid:"type(string),minstringlength(1),optional"`
	SNssaiInfos          []*SnssaiUpfInfoItem    `json:"sNssaiUpfInfos" yaml:"sNssaiUpfInfos,omitempty" valid:"optional"`
	InterfaceUpfInfoList []*InterfaceUpfInfoItem `json:"interfaces" yaml:"interfaces,omitempty" valid:"optional"`
}

UPNode represent the user plane node

type UserPlaneInformation

type UserPlaneInformation struct {
	UPNodes map[string]*UPNode `json:"upNodes" yaml:"upNodes" valid:"required"`
	Links   []*UPLink          `json:"links" yaml:"links" valid:"required"`
}

UserPlaneInformation describe core network userplane information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL