util

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: 20 Imported by: 7

Documentation

Index

Constants

View Source
const TimeFormat = time.RFC3339

Variables

View Source
var (
	PCF_LOG_PATH                                 = path_util.Free5gcPath("free5gc/pcfsslkey.log")
	PCF_PEM_PATH                                 = path_util.Free5gcPath("free5gc/support/TLS/pcf.pem")
	PCF_KEY_PATH                                 = path_util.Free5gcPath("free5gc/support/TLS/pcf.key")
	PCF_CONFIG_PATH                              = path_util.Free5gcPath("free5gc/config/pcfcfg.yaml")
	PCF_BASIC_PATH                               = "https://localhost:29507"
	ERROR_REQUEST_PARAMETERS                     = "ERROR_REQUEST_PARAMETERS"
	USER_UNKNOWN                                 = "USER_UNKNOWN"
	CONTEXT_NOT_FOUND                            = "CONTEXT_NOT_FOUND"
	ERROR_INITIAL_PARAMETERS                     = "ERROR_INITIAL_PARAMETERS"
	POLICY_CONTEXT_DENIED                        = "POLICY_CONTEXT_DENIED"
	ERROR_TRIGGER_EVENT                          = "ERROR_TRIGGER_EVENT"
	ERROR_TRAFFIC_MAPPING_INFO_REJECTED          = "ERROR_TRAFFIC_MAPPING_INFO_REJECTED"
	BDT_POLICY_NOT_FOUND                         = "BDT_POLICY_NOT_FOUND"
	REQUESTED_SERVICE_NOT_AUTHORIZED             = "REQUESTED_SERVICE_NOT_AUTHORIZED"
	REQUESTED_SERVICE_TEMPORARILY_NOT_AUTHORIZED = "REQUESTED_SERVICE_TEMPORARILY_NOT_AUTHORIZED" // NWDAF
	UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY     = "UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY"
	PDU_SESSION_NOT_AVAILABLE                    = "PDU_SESSION_NOT_AVAILABLE"
	APPLICATION_SESSION_CONTEXT_NOT_FOUND        = "APPLICATION_SESSION_CONTEXT_NOT_FOUND"
	PcpErrHttpStatusMap                          = map[string]int32{
		ERROR_REQUEST_PARAMETERS:                     http.StatusBadRequest,
		USER_UNKNOWN:                                 http.StatusBadRequest,
		ERROR_INITIAL_PARAMETERS:                     http.StatusBadRequest,
		ERROR_TRIGGER_EVENT:                          http.StatusBadRequest,
		POLICY_CONTEXT_DENIED:                        http.StatusForbidden,
		ERROR_TRAFFIC_MAPPING_INFO_REJECTED:          http.StatusForbidden,
		REQUESTED_SERVICE_NOT_AUTHORIZED:             http.StatusForbidden,
		REQUESTED_SERVICE_TEMPORARILY_NOT_AUTHORIZED: http.StatusForbidden,
		UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY:     http.StatusForbidden,
		CONTEXT_NOT_FOUND:                            http.StatusNotFound,
		BDT_POLICY_NOT_FOUND:                         http.StatusNotFound,
		APPLICATION_SESSION_CONTEXT_NOT_FOUND:        http.StatusNotFound,
		PDU_SESSION_NOT_AVAILABLE:                    http.StatusInternalServerError,
	}
)

Path of HTTP2 key and log file

Functions

func AndBytes

func AndBytes(bytes1, bytes2 []byte) []byte

do AND on two byte array

func CheckPolicyControlReqTrig

func CheckPolicyControlReqTrig(
	triggers []models.PolicyControlRequestTrigger, reqTrigger models.PolicyControlRequestTrigger) bool

func CheckStopTime

func CheckStopTime(StopTime time.Time) bool

func CheckSuppFeat

func CheckSuppFeat(suppFeat string, number int) bool

Check if Feature is Supported or not

func Convert

func Convert(bytes int64) (DateRate string)

Convert int data rate bytes to string data rate bits

func ConvertPacketInfoToFlowInformation

func ConvertPacketInfoToFlowInformation(infos []models.PacketFilterInfo) (flowInfos []models.FlowInformation)

Convert Packet Filter information list to Flow Information List(Packet Filter Usage always true), EthDescription is Not Supported

func CreateCondData

func CreateCondData(id int32) models.ConditionData

func CreateDefalutPccRules

func CreateDefalutPccRules(id int32) *models.PccRule

Create default pcc rule in PCF, TODO: use config file to pass default pcc rule

func CreatePccRule

func CreatePccRule(id, precedence int32, flowInfo []models.FlowInformation, appID string) *models.PccRule

Create Pcc Rule with param id, precedence, flow information, appID

func CreateQosData

func CreateQosData(id, var5qi, arp int32) models.QosData

func CreateTcData

func CreateTcData(id int32, fullID string, flowStatus models.FlowStatus) *models.TrafficControlData

func CreateUmData

func CreateUmData(umId string, thresh models.UsageThreshold) models.UsageMonitoringData

func GetChgId

func GetChgId(id int32) string

Get Charging Identity(ChgId-%d)

func GetCondId

func GetCondId(id int32) string

Get Cond Identity(CondId-%d)

func GetDefaultDataRate

func GetDefaultDataRate() models.UsageThreshold

func GetDefaultTime

func GetDefaultTime() models.TimeWindow

func GetNamfClient

func GetNamfClient(uri string) *Namf_Communication.APIClient

func GetNegotiateSuppFeat

func GetNegotiateSuppFeat(suppFeat string, serviceSuppFeat []byte) string

Negotiate Support Feture with PCF

func GetNpcfAMPolicyCallbackClient

func GetNpcfAMPolicyCallbackClient() *Npcf_AMPolicy.APIClient

func GetNpcfPolicyAuthorizationCallbackClient

func GetNpcfPolicyAuthorizationCallbackClient() *Npcf_PolicyAuthorization.APIClient

func GetNpcfSMPolicyCallbackClient

func GetNpcfSMPolicyCallbackClient() *Npcf_SMPolicyControl.APIClient

func GetNudrClient

func GetNudrClient(uri string) *Nudr_DataRepository.APIClient

func GetPackFiltId

func GetPackFiltId(id int32) string

Get Packet Filter Identity(PackFiltId-%d)

func GetPccRuleByAfAppId

func GetPccRuleByAfAppId(pccRules map[string]*models.PccRule, afAppId string) *models.PccRule

func GetPccRuleByFlowInfos

func GetPccRuleByFlowInfos(pccRules map[string]*models.PccRule, flowInfos []models.FlowInformation) *models.PccRule

func GetPccRuleId

func GetPccRuleId(id int32) string

Get pcc rule Identity(PccRuleId-%d)

func GetProblemDetail

func GetProblemDetail(errString, cause string) models.ProblemDetails

Return ProblemDatail, errString represent Detail, cause represent Cause of the fields

func GetQosId

func GetQosId(id int32) string

Get qos Identity(QosId-%d)

func GetResourceUri

func GetResourceUri(name models.ServiceName, id string) string

Get Resource Uri (location Header) with param id string

func GetSMPolicyDnnData

func GetSMPolicyDnnData(data models.SmPolicyData, snssai *models.Snssai, dnn string) (result *models.SmPolicyDnnData)

GetSMPolicyDnnData returns SMPolicyDnnData derived from SmPolicy data which snssai and dnn match

func GetTcId

func GetTcId(id int32) string

Get Traffic Control Identity(TcId-%d)

func GetUmId

func GetUmId(sponId, aspId string) string

Get Charging Identity(ChgId-%d)

func InitpcfContext

func InitpcfContext(context *context.PCFContext)

Init PCF Context from config flie

func MarshToJsonString

func MarshToJsonString(v interface{}) (result []string)

MarshToJsonString returns value which can put into NewInterface()

func PolicyControlReqTrigToArray

func PolicyControlReqTrigToArray(bitMap uint64) (trigger []models.PolicyControlRequestTrigger)

Use BitMap to generate requested policy control triggers, 1 means yes, 0 means no, see subscaulse 5.6.3.6-1 in TS29512

func SearchNFServiceUri

func SearchNFServiceUri(nfProfile models.NfProfile, serviceName models.ServiceName,
	nfServiceStatus models.NfServiceStatus) (nfUri string)

SearchNFServiceUri returns NF Uri derived from NfProfile with corresponding service

func SetPccRuleRelatedData

func SetPccRuleRelatedData(decicion *models.SmPolicyDecision, pccRule *models.PccRule,
	tcData *models.TrafficControlData, qosData *models.QosData, chgData *models.ChargingData,
	umData *models.UsageMonitoringData)

func SnssaiModelsToHex

func SnssaiModelsToHex(snssai models.Snssai) string

Convert Snssai form models to hexString(sst(2)+sd(6))

Types

This section is empty.

Jump to

Keyboard shortcuts

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