context

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

View Source
const DefaultBdtRefId = "BdtPolicyId-"

BdtPolicy default value

Variables

View Source
var (
	PolicyAuthorizationUri = "/npcf-policyauthorization/v1/app-sessions/"
	SmUri                  = "/npcf-smpolicycontrol/v1"
	IPv4Address            = "192.168."
	IPv6Address            = "ffab::"
	CheckNotifiUri         = "/npcf-callback/v1/nudr-notify/"
	Ipv4_pool              = make(map[string]string)
	Ipv6_pool              = make(map[string]string)
)
View Source
var (
	BdtPolicyData_store    []models.BdtPolicyData
	CreateFailBdtDateStore []models.BdtData
)

BdtPolicyData_store -

View Source
var AppSessionContextStore []AppSessionIdStore

Functions

func ConvertBitRateToKbps

func ConvertBitRateToKbps(bitRate string) (kBitRate float64, err error)

Convert bitRate string to float64 with uint Kbps

func ConvertBitRateToString

func ConvertBitRateToString(kBitRate float64) (bitRate string)

Convert bitRate from float64 to String

func DecreaseRamainBitRate

func DecreaseRamainBitRate(remainBitRate *float64, reqBitRate string) error

Decrease remain Bit Rate

func DecreaseRamainBitRateToZero

func DecreaseRamainBitRateToZero(remainBitRate *float64) string

Returns remin Bit rate string and decrease ir to zero

func DeleteIpv4index

func DeleteIpv4index(Ipv4index int32)

func DeleteIpv6index

func DeleteIpv6index(Ipv6index int32)

func GetIpv4Address

func GetIpv4Address(ipindex int32) string

func GetIpv6Address

func GetIpv6Address(ipindex int32) string

func GetTimeformat

func GetTimeformat() string

func GetUri

func GetUri(name models.ServiceName) string

func IncreaseRamainBitRate

func IncreaseRamainBitRate(remainBitRate *float64, reqBitRate string) (orig *float64)

Increase remain Bit Rate and returns original Bit Rate

func Ipv4Index

func Ipv4Index() int32

func Ipv4Pool

func Ipv4Pool(ipindex int32) string

func Ipv6Index

func Ipv6Index() int32

func Ipv6Pool

func Ipv6Pool(ipindex int32) string

Types

type AMFStatusSubscriptionData

type AMFStatusSubscriptionData struct {
	AmfUri       string
	AmfStatusUri string
	GuamiList    []models.Guami
}

type AppSessionData

type AppSessionData struct {
	AppSessionId      string
	AppSessionContext *models.AppSessionContext
	// (compN/compN-subCompN/appId-%s) map to PccRule
	RelatedPccRuleIds    map[string]string
	PccRuleIdMapToCompId map[string]string
	// EventSubscription
	Events   map[models.AfEvent]models.AfNotifMethod
	EventUri string
	// related Session
	SmPolicyData *UeSmPolicyData
}

type AppSessionIdStore

type AppSessionIdStore struct {
	AppSessionId      string
	AppSessionContext models.AppSessionContext
}

AppSessionIdStore -

type PCFContext

type PCFContext struct {
	NfId            string
	Name            string
	UriScheme       models.UriScheme
	BindingIPv4     string
	RegisterIPv4    string
	SBIPort         int
	TimeFormat      string
	DefaultBdtRefId string
	NfService       map[models.ServiceName]models.NfService
	PcfServiceUris  map[models.ServiceName]string
	PcfSuppFeats    map[models.ServiceName]openapi.SupportedFeature
	NrfUri          string
	DefaultUdrURI   string
	// UePool          map[string]*UeContext
	UePool sync.Map
	// Bdt Policy related
	BdtPolicyPool        sync.Map
	BdtPolicyIDGenerator *idgenerator.IDGenerator
	// App Session related
	AppSessionPool sync.Map
	// AMF Status Change Subscription related
	AMFStatusSubsData sync.Map // map[string]AMFStatusSubscriptionData; subscriptionID as key

	// lock
	DefaultUdrURILock sync.RWMutex
}

func PCF_Self

func PCF_Self() *PCFContext

Create new PCF context

func (*PCFContext) AllocBdtPolicyID

func (c *PCFContext) AllocBdtPolicyID() (bdtPolicyID string, err error)

Return Bdt Policy Id with format "BdtPolicyId-%d" which be allocated

func (*PCFContext) GetIPv4Uri

func (c *PCFContext) GetIPv4Uri() string

func (*PCFContext) InitNFService

func (c *PCFContext) InitNFService(serviceList []factory.Service, version string)

Init NfService with supported service list ,and version of services

func (*PCFContext) NewAmfStatusSubscription

func (c *PCFContext) NewAmfStatusSubscription(subscriptionID string, subscriptionData AMFStatusSubscriptionData)

func (*PCFContext) NewPCFUe

func (c *PCFContext) NewPCFUe(Supi string) (*UeContext, error)

Allocate PCF Ue with supi and add to pcf Context and returns allocated ue

func (*PCFContext) PCFUeFindByAppSessionId

func (c *PCFContext) PCFUeFindByAppSessionId(appSessionId string) *UeContext

Find PcfUe which the AppSessionId belongs to

func (*PCFContext) PCFUeFindByPolicyId

func (c *PCFContext) PCFUeFindByPolicyId(PolicyId string) *UeContext

Find PcfUe which the policyId belongs to

func (*PCFContext) PcfUeFindByIPv4

func (c *PCFContext) PcfUeFindByIPv4(v4 string) *UeContext

Find PcfUe which Ipv4 belongs to

func (*PCFContext) PcfUeFindByIPv6

func (c *PCFContext) PcfUeFindByIPv6(v6 string) *UeContext

Find PcfUe which Ipv6 belongs to

func (*PCFContext) SessionBinding

func (c *PCFContext) SessionBinding(req *models.AppSessionContextReqData) (*UeSmPolicyData, error)

SessionBinding from application request to get corresponding Sm policy

func (*PCFContext) SetDefaultUdrURI

func (c *PCFContext) SetDefaultUdrURI(uri string)

SetDefaultUdrURI ... function to set DefaultUdrURI

type UeAMPolicyData

type UeAMPolicyData struct {
	PolAssoId         string
	AccessType        models.AccessType
	NotificationUri   string
	ServingPlmn       *models.NetworkId
	AltNotifIpv4Addrs []string
	AltNotifIpv6Addrs []string
	// TODO: AMF Status Change
	AmfStatusUri string
	Guami        *models.Guami
	ServiveName  string
	// TraceReq *TraceData
	// Policy Association
	Triggers    []models.RequestTrigger
	ServAreaRes *models.ServiceAreaRestriction
	Rfsp        int32
	UserLoc     *models.UserLocation
	TimeZone    string
	SuppFeat    string
	// about AF request
	Pras map[string]models.PresenceInfo
	// related to UDR Subscription Data
	AmPolicyData *models.AmPolicyData // Svbscription Data
	// Corresponding UE
	PcfUe *UeContext
}

type UeContext

type UeContext struct {
	// Ue Context
	Supi                      string
	Gpsi                      string
	Pei                       string
	GroupIds                  []string
	PolAssociationIDGenerator uint32
	AMPolicyData              map[string]*UeAMPolicyData // use PolAssoId(ue.Supi-numPolId) as key

	// Udr Ref
	UdrUri string
	// SMPolicy
	SmPolicyData map[string]*UeSmPolicyData // use smPolicyId(ue.Supi-pduSessionId) as key
	// App Session Related
	// AppSessionIDGenerator uint64
	AppSessionIDGenerator *idgenerator.IDGenerator
	// PolicyAuth
	AfRoutReq *models.AfRoutingRequirement
	AspId     string
	// Policy Decision
	AppSessionIdStore           *AppSessionIdStore
	PolicyDataSubscriptionStore *models.PolicyDataSubscription
	PolicyDataChangeStore       *models.PolicyDataChangeNotification
}

key is supi

func (*UeContext) AllocUeAppSessionId

func (ue *UeContext) AllocUeAppSessionId(context *PCFContext) string

Return App Session Id with format "ue.Supi-%d" which be allocated

func (*UeContext) FindAMPolicy

func (ue *UeContext) FindAMPolicy(anType models.AccessType, plmnId *models.NetworkId) *UeAMPolicyData

returns AM Policy which AccessType and plmnId match

func (*UeContext) NewUeAMPolicyData

func (ue *UeContext) NewUeAMPolicyData(assolId string, req models.PolicyAssociationRequest) *UeAMPolicyData

NewUeAMPolicyData returns created UeAMPolicyData data and insert this data to Ue.AMPolicyData with assolId as key

func (*UeContext) NewUeSmPolicyData

func (ue *UeContext) NewUeSmPolicyData(
	key string, request models.SmPolicyContextData, smData *models.SmPolicyData) *UeSmPolicyData

returns UeSmPolicyData and insert related info to Ue with smPolId

func (*UeContext) SMPolicyFindByIdentifiersIpv4

func (ue *UeContext) SMPolicyFindByIdentifiersIpv4(
	v4 string, sNssai *models.Snssai, dnn string, ipDomain string) *UeSmPolicyData

returns SM Policy by IPv4

func (*UeContext) SMPolicyFindByIdentifiersIpv6

func (ue *UeContext) SMPolicyFindByIdentifiersIpv6(v6 string, sNssai *models.Snssai, dnn string) *UeSmPolicyData

returns SM Policy by IPv6

func (*UeContext) SMPolicyFindByIpv4

func (ue *UeContext) SMPolicyFindByIpv4(v4 string) *UeSmPolicyData

returns SM Policy by IPv4

func (*UeContext) SMPolicyFindByIpv6

func (ue *UeContext) SMPolicyFindByIpv6(v6 string) *UeSmPolicyData

returns SM Policy by IPv6

type UeSmPolicyData

type UeSmPolicyData struct {
	// PduSessionId    int32
	// DNN             string
	// NotificationUri string
	// Snssai                 models.Snssai
	// PduSessionType         models.PduSessionType
	// IPAddress              models.IpAddress
	// IPDomain               string
	// Var3gppPsDataOffStatus bool
	// SmfId                  string
	// TraceReq *TraceData
	// RecoveryTime     *time.Time
	PackFiltIdGenarator int32
	PccRuleIdGenarator  int32
	ChargingIdGenarator int32
	// FlowMapsToPackFiltIds  map[string][]string // use Flow Description(in TS 29214) as key map to pcc rule ids
	PackFiltMapToPccRuleId map[string]string // use PackFiltId as Key
	// Related to GBR
	RemainGbrUL *float64
	RemainGbrDL *float64
	// related to UDR Subscription Data
	SmPolicyData *models.SmPolicyData // Svbscription Data
	// related to Policy
	PolicyContext  *models.SmPolicyContextData
	PolicyDecision *models.SmPolicyDecision
	// related to AppSession
	AppSessions map[string]bool // related appSessionId
	// Corresponding UE
	PcfUe *UeContext
}

func (*UeSmPolicyData) ArrangeExistEventSubscription

func (policy *UeSmPolicyData) ArrangeExistEventSubscription() (changed bool)

Arrange Exist Event policy Sm policy about afevents and return if it changes or not and

func (*UeSmPolicyData) CheckRelatedAfEvent

func (policy *UeSmPolicyData) CheckRelatedAfEvent(event models.AfEvent) (found bool)

Check if the afEvent exists in smPolicy

func (*UeSmPolicyData) DecreaseRemainGBR

func (policy *UeSmPolicyData) DecreaseRemainGBR(req *models.RequestedQos) (gbrDl, gbrUl string, err error)

Decrease remain GBR of this policy and returns UL DL GBR

func (*UeSmPolicyData) IncreaseRemainGBR

func (policy *UeSmPolicyData) IncreaseRemainGBR(qosId string) (origUl, origDl *float64)

Increase remain GBR of this policy and returns original UL DL GBR for resume case

func (*UeSmPolicyData) RemovePccRule

func (policy *UeSmPolicyData) RemovePccRule(pccRuleId string, deletedSmPolicyDec *models.SmPolicyDecision) error

Remove Pcc rule which PccRuleId in the policy

Jump to

Keyboard shortcuts

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