core

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	N4PFCPKeyName  = "n4"
	SxaPFCPKeyName = "Sxa"
	SxbPFCPKeyName = "Sxb"

	GTPPortStr = ":2152"
)

Variables

View Source
var (
	ErrNilBPFObj         = errors.New("BpfObjects is nil")
	ErrNilGtpPathManager = errors.New("GtpPathManager is nil")
	ErrNilInterface      = errors.New("interface is nil")
	ErrAttachXDP         = errors.New("could not attach XDP program")
	ErrLookupIface       = errors.New("lookup network iface failed")
	ErrCloseOldLink      = errors.New("close old link failed")
	ErrNonePFCPConn      = errors.New("none PFCP connection")
)
View Source
var (
	PfcpMessageRx = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "upf_pfcp_rx",
		Help: "The total number of received PFCP messages",
	}, []string{"message_name"})

	PfcpMessageTx = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "upf_pfcp_tx",
		Help: "The total number of transmitted PFCP messages",
	}, []string{"message_name"})

	PfcpMessageRxErrors = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "upf_pfcp_rx_errors",
		Help: "The total number of received PFCP messages with cause code",
	}, []string{"message_name", "cause_code"})

	UpfXdpAborted            prometheus.CounterFunc
	UpfXdpDrop               prometheus.CounterFunc
	UpfXdpPass               prometheus.CounterFunc
	UpfXdpTx                 prometheus.CounterFunc
	UpfXdpRedirect           prometheus.CounterFunc
	UpfPfcpSessions          prometheus.GaugeFunc
	UpfPfcpAssociationsTotal prometheus.GaugeFunc

	UpfRx = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "upf_rx",
		Help: "The total number of received packets",
	}, []string{"packet_type"})

	UpfRoute = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "upf_route",
		Help: "The total number of packets routed",
	}, []string{"packet_type"})

	UpfMessageRxLatency = promauto.NewSummaryVec(prometheus.SummaryOpts{
		Name:       "upf_pfcp_rx_latency",
		Subsystem:  "pfcp",
		Help:       "Duration of the PFCP message processing",
		Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
	}, []string{"message_type"})

	UpfPfcpAssociations = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "upf_pfcp_associations",
		Help: "The current status of PFCP associations",
	}, []string{"node_id"})
)
View Source
var (
	ErrSessionNotFound = errors.New("session not found")
)

Functions

func BindDataPlaneInterfaces

func BindDataPlaneInterfaces(
	bpfObjects *ebpf.BpfObjects,
	links *[]link.Link,
	interfaceNames []string,
	xdpAttachMode string,
) error

func DecodeDigitsFromBytes

func DecodeDigitsFromBytes(buffer []byte) string

func EncodeFQDN

func EncodeFQDN(fqdn string) []byte

EncodeFQDN encodes the given string as the Name Syntax defined in RFC 2181, RFC 1035 and RFC 1123.

func EncodeFQDNHuawei

func EncodeFQDNHuawei(fqdn string) []byte

func GatherMetrics added in v0.7.0

func GatherMetrics(stats ebpf.UpfXdpActionStatistic)

func GetFSEID

func GetFSEID(CPFSEID *ie.IE) uint64

func GetTransportLevelMarking added in v0.3.4

func GetTransportLevelMarking(far *ie.IE) (uint16, error)

func GetURRIDs added in v0.7.0

func GetURRIDs(i *ie.IE) ([]uint32, error)

func HandlePfcpAssociationReleaseRequest

func HandlePfcpAssociationReleaseRequest(
	conn *PfcpConnection,
	msg message.Message,
	addr string,
) (message.Message, bool, error)

func HandlePfcpAssociationSetupResponse added in v0.7.0

func HandlePfcpAssociationSetupResponse(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpAssociationUpdateRequest added in v0.7.0

func HandlePfcpAssociationUpdateRequest(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpAssociationUpdateResponse

func HandlePfcpAssociationUpdateResponse(
	conn *PfcpConnection,
	msg message.Message,
	addr string,
) (message.Message, bool, error)

func HandlePfcpHeartbeatRequest

func HandlePfcpHeartbeatRequest(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpHeartbeatResponse added in v0.3.3

func HandlePfcpHeartbeatResponse(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpSessionDeletionRequest

func HandlePfcpSessionDeletionRequest(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpSessionEstablishmentRequest

func HandlePfcpSessionEstablishmentRequest(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpSessionModificationRequest

func HandlePfcpSessionModificationRequest(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func HandlePfcpSessionReportResponse

func HandlePfcpSessionReportResponse(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

func InitLogger added in v0.5.0

func InitLogger()

func IsMessageTraceable

func IsMessageTraceable(msgType uint8) bool

func NewNodeIDHuawei

func NewNodeIDHuawei(ipv4, ipv6, fqdn string) *ie.IE

func ParseCidrIp added in v0.5.0

func ParseCidrIp(ipStr, maskStr string) (ebpf.IpWMask, error)

func ParsePort added in v0.5.0

func ParsePort(str string) (uint16, error)

func ParsePortRange added in v0.5.0

func ParsePortRange(str string) (ebpf.PortRange, error)

func ParseProtocol added in v0.5.0

func ParseProtocol(protocol string) (uint8, error)

func ParseSdfFilter added in v0.5.0

func ParseSdfFilter(flowDescription string) (ebpf.SdfFilter, error)

func RegisterMetrics

func RegisterMetrics(stats ebpf.UpfXdpActionStatistic, conn []*PfcpConnection)

func SendAssociationUpdate

func SendAssociationUpdate(
	conn *PfcpConnection,
	assoc *NodeAssociation,
	traced bool,
	release bool,
) error

func SendDownlinkNotificationReport

func SendDownlinkNotificationReport(
	conn *PfcpConnection,
	seid uint64,
	sequenceID uint32,
	associationAddr string,
	pdrID uint16,
	traced bool,
	vendorSpecificIEs ...*ie.IE,
)

func SendHeartbeatRequest added in v0.3.3

func SendHeartbeatRequest(conn *PfcpConnection, sequenceID uint32, associationAddr string)

func SendSessionReportADC

func SendSessionReportADC(conn *PfcpConnection, seid uint64, sequenceID uint32, associationAddr string,
	urrid uint32,
	sessionSeq uint32,
	reportSeq uint32,
	sdfFilter string,
	traced bool)

func SendSessionReportSessionRelease

func SendSessionReportSessionRelease(conn *PfcpConnection, seid uint64, sequenceID uint32, associationAddr string, traced bool, pdrList []uint16)

func SendSessionReportUsage

func SendSessionReportUsage(conn *PfcpConnection, seid uint64, sequenceID uint32, associationAddr string,
	urrid uint32,
	sessionSeq uint32,
	reportSeq uint32,
	uplink uint64,
	downlink uint64,
	traced bool)

func SetLoggerCaller

func SetLoggerCaller(enableCaller bool)

func SetLoggerLevel added in v0.5.0

func SetLoggerLevel(loggingLevel string) error

func StartMetrics

func StartMetrics(addr string) error

func StringToXDPAttachMode

func StringToXDPAttachMode(Mode string) link.XDPAttachFlags

func UpdateAssociationSetupTimeout

func UpdateAssociationSetupTimeout(
	pfcpSrv map[string]*PfcpConnection,
	associationSetupTimeout uint32,
)

func UpdateDataPlaneAddresses

func UpdateDataPlaneAddresses(
	pfcpConnection map[string]*PfcpConnection,
	gtpPathManager *GtpPathManager,
	n3Addr net.IP,
	n9Addr net.IP,
) error

func UpdateGTPManager

func UpdateGTPManager(
	gtpPathManager *GtpPathManager,
	gtpPeerAddresses []string,
	GtpEchoInterval uint32,
)

func UpdateHeartbeatTimeout

func UpdateHeartbeatTimeout(
	pfcpSrv map[string]*PfcpConnection,
	heartbeatTimeout uint32,
)

func UpdateLogCaller

func UpdateLogCaller(enableCaller bool)

func UpdateLogLevel

func UpdateLogLevel(logLevel string) error

func UpdatePFCPConnections

func UpdatePFCPConnections(
	pfcpSrv map[string]*PfcpConnection,
	keyName string,
	address string,
	nodeID string,
	remoteNodes []string,
) error

Types

type AssociationConnector added in v0.7.0

type AssociationConnector interface {
	// contains filtered or unexported methods
}

type DefaultAssociationConnector added in v0.7.0

type DefaultAssociationConnector struct {
	// contains filtered or unexported fields
}

func NewDefaultAssociationConnector added in v0.7.0

func NewDefaultAssociationConnector(address string) (*DefaultAssociationConnector, error)

type DefaultProfile

type DefaultProfile struct{}

DefaultProfile implements the standard 3GPP PFCP dialect using the go-pfcp library. It does not parse enterprise-specific IEs and uses standard URR sequence numbering.

func (DefaultProfile) HeartbeatRequestAdditionalIEs

func (DefaultProfile) HeartbeatRequestAdditionalIEs() []*ie.IE

func (DefaultProfile) N4Connector

func (DefaultProfile) N4Connector(remoteNode string) (AssociationConnector, error)

func (DefaultProfile) NodeID

func (DefaultProfile) NodeID(nodeID string) *ie.IE

func (DefaultProfile) ParseOuterHeaderCreation

func (DefaultProfile) ParseOuterHeaderCreation(i *ie.IE) (FarHeaderFields, error)

func (DefaultProfile) ParseQFI

func (DefaultProfile) ParseQFI(qer *ie.IE) (uint8, bool)

func (DefaultProfile) ParseSubscriberData

func (DefaultProfile) ParseSubscriberData(ieArr []*ie.IE) (imsi, msisdn string)

func (DefaultProfile) SessionEstablishmentResponseAdditionalIEs

func (DefaultProfile) SessionEstablishmentResponseAdditionalIEs(localSEID uint64, nodeAddrV4 net.IP) []*ie.IE

func (DefaultProfile) SessionReportReleaseVendorIE

func (DefaultProfile) SessionReportReleaseVendorIE(pdrList []uint16) *ie.IE

func (DefaultProfile) SxaConnector

func (DefaultProfile) SxaConnector(remoteNode string) (AssociationConnector, error)

func (DefaultProfile) SxbConnector

func (DefaultProfile) SxbConnector(remoteNode string) (AssociationConnector, error)

func (DefaultProfile) URSEQN

func (DefaultProfile) URSEQN(sessionSeq, reportSeq uint32) *ie.IE

func (DefaultProfile) UsageReportADCVendorIEs

func (DefaultProfile) UsageReportADCVendorIEs(sdfFilter string) []*ie.IE

func (DefaultProfile) UsageReportDeletionVendorIEs

func (DefaultProfile) UsageReportDeletionVendorIEs() []*ie.IE

func (DefaultProfile) UsageReportSessionReportVendorIEs

func (DefaultProfile) UsageReportSessionReportVendorIEs() []*ie.IE

type FarHeaderFields

type FarHeaderFields struct {
	// OuterHeaderCreation is the pre-computed ebpf.FarInfo.OuterHeaderCreation
	// value (profile-specific bit transformation of Description).
	OuterHeaderCreation uint8
	// Description is the raw OuterHeaderCreationDescription for display.
	Description uint16
	Teid        uint32
	IPv4Address net.IP
	IPv6Address net.IP
	PortNumber  uint16
	CTag        uint32
	STag        uint32
}

FarHeaderFields is the profile-agnostic result of parsing an Outer Header Creation IE. Profiles project their dialect-specific representation into this struct so that the downstream code can map it to ebpf.FarInfo uniformly.

type GtpPathManager added in v0.6.0

type GtpPathManager struct {
	// contains filtered or unexported fields
}

func NewGtpPathManager added in v0.6.0

func NewGtpPathManager(localAddress string, interval time.Duration) *GtpPathManager

func (*GtpPathManager) AddGtpPath added in v0.6.0

func (gtpPathManager *GtpPathManager) AddGtpPath(gtpPeerAddress string)

func (*GtpPathManager) Run added in v0.6.0

func (gtpPathManager *GtpPathManager) Run()

func (*GtpPathManager) Stop added in v0.6.0

func (gtpPathManager *GtpPathManager) Stop()

func (*GtpPathManager) UpdateCheckTicker

func (gtpPathManager *GtpPathManager) UpdateCheckTicker(newTicker *time.Ticker)

func (*GtpPathManager) UpdateGtpPath

func (gtpPathManager *GtpPathManager) UpdateGtpPath(gtpPeerAddresses []string)

func (*GtpPathManager) UpdateLocalAddress

func (gtpPathManager *GtpPathManager) UpdateLocalAddress(newLocalAddress string)

type HuaweiProfile

type HuaweiProfile struct {
	S1UAddress  string
	S5S8Address string
	PAAddress   string
}

HuaweiProfile implements the Huawei SPGW-C PFCP dialect. It uses Huawei's Outer Header Creation encoding, enterprise-specific IEs for subscriber data and QFI, Huawei Node ID format, session-level URR sequence numbering, and a vendor-specific IE in usage reports.

func (HuaweiProfile) HeartbeatRequestAdditionalIEs

func (h HuaweiProfile) HeartbeatRequestAdditionalIEs() []*ie.IE

func (HuaweiProfile) N4Connector

func (h HuaweiProfile) N4Connector(remoteNode string) (AssociationConnector, error)

func (HuaweiProfile) NodeID

func (h HuaweiProfile) NodeID(nodeID string) *ie.IE

func (HuaweiProfile) ParseOuterHeaderCreation

func (h HuaweiProfile) ParseOuterHeaderCreation(i *ie.IE) (FarHeaderFields, error)

func (HuaweiProfile) ParseQFI

func (h HuaweiProfile) ParseQFI(qer *ie.IE) (uint8, bool)

func (HuaweiProfile) ParseSubscriberData

func (h HuaweiProfile) ParseSubscriberData(ieArr []*ie.IE) (imsi, msisdn string)

func (HuaweiProfile) SessionEstablishmentResponseAdditionalIEs

func (h HuaweiProfile) SessionEstablishmentResponseAdditionalIEs(localSEID uint64, nodeAddrV4 net.IP) []*ie.IE

func (HuaweiProfile) SessionReportReleaseVendorIE

func (h HuaweiProfile) SessionReportReleaseVendorIE(pdrList []uint16) *ie.IE

func (HuaweiProfile) SxaConnector

func (h HuaweiProfile) SxaConnector(remoteNode string) (AssociationConnector, error)

func (HuaweiProfile) SxbConnector

func (h HuaweiProfile) SxbConnector(remoteNode string) (AssociationConnector, error)

func (HuaweiProfile) URSEQN

func (h HuaweiProfile) URSEQN(sessionSeq, reportSeq uint32) *ie.IE

func (HuaweiProfile) UsageReportADCVendorIEs

func (h HuaweiProfile) UsageReportADCVendorIEs(sdfFilter string) []*ie.IE

func (HuaweiProfile) UsageReportDeletionVendorIEs

func (h HuaweiProfile) UsageReportDeletionVendorIEs() []*ie.IE

func (HuaweiProfile) UsageReportSessionReportVendorIEs

func (h HuaweiProfile) UsageReportSessionReportVendorIEs() []*ie.IE

type NeValidator

type NeValidator struct {
	// contains filtered or unexported fields
}

func NewNeValidator

func NewNeValidator(allowed string, denied string) (*NeValidator, error)

func (*NeValidator) IsNeAllowed

func (v *NeValidator) IsNeAllowed(networkInstance string) bool

func (*NeValidator) IsNeDenied

func (v *NeValidator) IsNeDenied(networkInstance string) bool

func (*NeValidator) Validate

func (v *NeValidator) Validate(networkInstance string) bool

type NodeAssociation

type NodeAssociation struct {
	ID               string
	Addr             string
	NextSessionID    uint64
	NextSequenceID   uint32
	Sessions         map[uint64]*Session
	HeartbeatChannel chan uint32 `json:"-"`
	HeartbeatsActive bool
	sync.Mutex       `json:"-"`
	HeartbeatTimeout *time.Timer
	// contains filtered or unexported fields
}

func NewNodeAssociation added in v0.3.3

func NewNodeAssociation(remoteNodeID string, addr string) *NodeAssociation

func (*NodeAssociation) Close

func (association *NodeAssociation) Close()

func (*NodeAssociation) HandleHeartbeat added in v0.6.1

func (association *NodeAssociation) HandleHeartbeat(sequence uint32)

func (*NodeAssociation) NewLocalSEID

func (association *NodeAssociation) NewLocalSEID() uint64

func (*NodeAssociation) NewSequenceID added in v0.3.5

func (association *NodeAssociation) NewSequenceID() uint32

func (*NodeAssociation) ScheduleHeartbeat added in v0.6.1

func (association *NodeAssociation) ScheduleHeartbeat(conn *PfcpConnection)

type Operation

type Operation struct {
	Apply    func() error
	Rollback func() error
}

type OperationPool

type OperationPool struct {
	// contains filtered or unexported fields
}

func NewOperationPool

func NewOperationPool() *OperationPool

func (*OperationPool) Add

func (op *OperationPool) Add(operation Operation)

func (*OperationPool) Commit

func (op *OperationPool) Commit() error

func (*OperationPool) Rollback

func (op *OperationPool) Rollback()

type OuterHeaderCreationFields

type OuterHeaderCreationFields struct {
	OuterHeaderCreationDescription uint16
	TEID                           uint32
	IPv4Address                    net.IP
	IPv6Address                    net.IP
	PortNumber                     uint16
	CTag                           uint32
	STag                           uint32
}

OuterHeaderCreationFields represents a fields contained in OuterHeaderCreation IE.

func HuaweiOuterHeaderCreation

func HuaweiOuterHeaderCreation(i *ie.IE) (*OuterHeaderCreationFields, error)

HuaweiOuterHeaderCreation extracts OuterHeaderCreationFields from the given IE using the Huawei SPGW-C dialect of Outer Header Creation encoding.

func NewOuterHeaderCreationFields

func NewOuterHeaderCreationFields(desc uint16, teid uint32, v4, v6 string, port uint16, ctag, stag uint32) *OuterHeaderCreationFields

NewOuterHeaderCreationFields creates a new OuterHeaderCreationFields.

func ParseOuterHeaderCreationFields

func ParseOuterHeaderCreationFields(b []byte) (*OuterHeaderCreationFields, error)

ParseOuterHeaderCreationFields parses b into OuterHeaderCreationFields.

func (*OuterHeaderCreationFields) HasCTag

func (f *OuterHeaderCreationFields) HasCTag() bool

HasCTag reports wether C-TAG field is set.

func (*OuterHeaderCreationFields) HasIPv4

func (f *OuterHeaderCreationFields) HasIPv4() bool

HasIPv4 reports wether IPv4 Address field is set.

func (*OuterHeaderCreationFields) HasIPv6

func (f *OuterHeaderCreationFields) HasIPv6() bool

HasIPv6 reports wether IPv6 Address field is set.

func (*OuterHeaderCreationFields) HasPortNumber

func (f *OuterHeaderCreationFields) HasPortNumber() bool

HasPortNumber reports wether Port Number field is set.

func (*OuterHeaderCreationFields) HasSTag

func (f *OuterHeaderCreationFields) HasSTag() bool

HasSTag reports wether S-TAG field is set.

func (*OuterHeaderCreationFields) HasTEID

func (f *OuterHeaderCreationFields) HasTEID() bool

HasTEID reports wether TEID field is set.

func (*OuterHeaderCreationFields) IsLLSSMCTEID

func (f *OuterHeaderCreationFields) IsLLSSMCTEID() bool

IsLLSSMCTEID reports wether Outer Header Creation Description has Low Layer SSM and C-TEID This bit has been introduced in release 17.2

func (*OuterHeaderCreationFields) IsN6

func (f *OuterHeaderCreationFields) IsN6() bool

IsN6 reports wether Outer Header Creation Description has N9 Indication

func (*OuterHeaderCreationFields) IsN19

func (f *OuterHeaderCreationFields) IsN19() bool

IsN19 reports wether Outer Header Creation Description has N19 Indication.

func (*OuterHeaderCreationFields) Marshal

func (f *OuterHeaderCreationFields) Marshal() ([]byte, error)

Marshal returns the serialized bytes of OuterHeaderCreationFields.

func (*OuterHeaderCreationFields) MarshalLen

func (f *OuterHeaderCreationFields) MarshalLen() int

MarshalLen returns field length in integer.

func (*OuterHeaderCreationFields) MarshalTo

func (f *OuterHeaderCreationFields) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*OuterHeaderCreationFields) UnmarshalBinary

func (f *OuterHeaderCreationFields) UnmarshalBinary(b []byte) error

UnmarshalBinary parses b into IE.

type PCCInfo

type PCCInfo struct {
	PCCName      string
	Notify       bool
	RawSDFFilter string
	SDFFilter    ebpf.SdfFilter
	FAR          ebpf.FarInfo
	QER          ebpf.QerInfo
}

type PDRCreationContext added in v0.6.0

type PDRCreationContext struct {
	Session         *Session
	ResourceManager *service.ResourceManager
	TEIDCache       map[uint8]uint32
}

func NewPDRCreationContext added in v0.6.0

func NewPDRCreationContext(session *Session, resourceManager *service.ResourceManager) *PDRCreationContext

type PfcpConnection

type PfcpConnection struct {
	NodeAssociations map[string]*NodeAssociation

	RecoveryTimestamp time.Time

	ResourceManager *service.ResourceManager

	AssociationSetupTicker *time.Ticker
	PCCRules               map[string]PCCInfo
	PCCRulesNameLinkURRID  map[uint32][]string
	// contains filtered or unexported fields
}

func NewPfcpConnection added in v0.7.0

func NewPfcpConnection(
	addr string,
	nodeId string,
	n3Ip string,
	n9Ip string,
	mapOperations ebpf.ForwardingPlaneController,
	resourceManager *service.ResourceManager,
	dumper utils.Dumper,
	sdfNotifyC <-chan ebpf.SdfFlowNotification,
	profile PfcpProfile,
) (*PfcpConnection, error)

func (*PfcpConnection) Close

func (connection *PfcpConnection) Close()

func (*PfcpConnection) DeleteAllAssociations

func (connection *PfcpConnection) DeleteAllAssociations()

func (*PfcpConnection) DeleteAssociation added in v0.3.3

func (connection *PfcpConnection) DeleteAssociation(assocAddr string)

DeleteAssociation deletes an association and all sessions associated with it.

func (*PfcpConnection) DeleteSession added in v0.3.3

func (connection *PfcpConnection) DeleteSession(session *Session)

DeleteSession deletes a session and all PDRs, FARs and QERs associated with it.

func (*PfcpConnection) DisableTracing

func (connection *PfcpConnection) DisableTracing() ([]tracing.TraceRecord, error)

func (*PfcpConnection) DisableTracingByImsi

func (connection *PfcpConnection) DisableTracingByImsi(imsi string) (tracing.TraceRecord, error)

func (*PfcpConnection) DisableTracingByMsisdn

func (connection *PfcpConnection) DisableTracingByMsisdn(msisdn string) (tracing.TraceRecord, error)

func (*PfcpConnection) EnableTracingByImsi

func (connection *PfcpConnection) EnableTracingByImsi(imsi string) error

func (*PfcpConnection) EnableTracingByMsisdn

func (connection *PfcpConnection) EnableTracingByMsisdn(msisdn string) error

func (*PfcpConnection) GetAllTracingRecords

func (connection *PfcpConnection) GetAllTracingRecords() ([]tracing.TraceRecord, error)

func (*PfcpConnection) GetAssiciationCount added in v0.3.6

func (connection *PfcpConnection) GetAssiciationCount() int

func (*PfcpConnection) GetAssociation added in v0.3.3

func (connection *PfcpConnection) GetAssociation(assocAddr string) *NodeAssociation

func (*PfcpConnection) GetConnAddr

func (connection *PfcpConnection) GetConnAddr() string

func (*PfcpConnection) GetDumper

func (connection *PfcpConnection) GetDumper() utils.Dumper

func (*PfcpConnection) GetLocalAddr

func (connection *PfcpConnection) GetLocalAddr() string

func (*PfcpConnection) GetMapOperations

func (connection *PfcpConnection) GetMapOperations() ebpf.ForwardingPlaneController

func (*PfcpConnection) GetN3Addr

func (connection *PfcpConnection) GetN3Addr() string

func (*PfcpConnection) GetN9Addr

func (connection *PfcpConnection) GetN9Addr() string

func (*PfcpConnection) GetResourceManager

func (connection *PfcpConnection) GetResourceManager() *service.ResourceManager

func (*PfcpConnection) GetSessionCount added in v0.3.6

func (connection *PfcpConnection) GetSessionCount() int

func (*PfcpConnection) GetTracingRecordByImsi

func (connection *PfcpConnection) GetTracingRecordByImsi(imsi string) (tracing.TraceRecord, error)

func (*PfcpConnection) GetTracingRecordByMsisdn

func (connection *PfcpConnection) GetTracingRecordByMsisdn(msisdn string) (tracing.TraceRecord, error)

func (*PfcpConnection) Handle

func (connection *PfcpConnection) Handle(b []byte, addr *net.UDPAddr)

func (*PfcpConnection) NeedSessionTrace

func (connection *PfcpConnection) NeedSessionTrace(imsi, msisdn string) bool

func (*PfcpConnection) Receive

func (connection *PfcpConnection) Receive(b []byte) (n int, addr *net.UDPAddr, err error)

func (*PfcpConnection) RefreshAssociations added in v0.3.3

func (connection *PfcpConnection) RefreshAssociations()

func (*PfcpConnection) ReleaseResources added in v0.6.0

func (connection *PfcpConnection) ReleaseResources(seID uint64)

func (*PfcpConnection) ReleaseSessionByID

func (connection *PfcpConnection) ReleaseSessionByID(seid uint64) bool

func (*PfcpConnection) ReleaseSessionByUserID

func (connection *PfcpConnection) ReleaseSessionByUserID(imsi string, msisdn string) bool

func (*PfcpConnection) Run

func (connection *PfcpConnection) Run()

func (*PfcpConnection) Send

func (connection *PfcpConnection) Send(b []byte, addr *net.UDPAddr) (int, error)

func (*PfcpConnection) SendAssociationReleaseRequest

func (connection *PfcpConnection) SendAssociationReleaseRequest()

func (*PfcpConnection) SendMessage

func (connection *PfcpConnection) SendMessage(msg message.Message, addr *net.UDPAddr) error

func (*PfcpConnection) SendMessageWithTrace

func (connection *PfcpConnection) SendMessageWithTrace(msg message.Message, addr *net.UDPAddr, trace bool) error

func (*PfcpConnection) SendReports

func (connection *PfcpConnection) SendReports()

func (*PfcpConnection) SendReportsSDF

func (connection *PfcpConnection) SendReportsSDF(referenceID uint32, sdfFilter string)

func (*PfcpConnection) SetRemoteNodes added in v0.7.0

func (connection *PfcpConnection) SetRemoteNodes(nodes []AssociationConnector)

func (*PfcpConnection) TraceMessage

func (connection *PfcpConnection) TraceMessage(b []byte, addr *net.UDPAddr, rx bool)

func (*PfcpConnection) Update

func (connection *PfcpConnection) Update(
	pfcpAddress string,
	pfcpNodeId string,
) error

func (*PfcpConnection) UpdateN3Address

func (connection *PfcpConnection) UpdateN3Address(n3addr net.IP)

func (*PfcpConnection) UpdateN9Address

func (connection *PfcpConnection) UpdateN9Address(n9addr net.IP)

func (*PfcpConnection) ValidateNetworkInstance

func (connection *PfcpConnection) ValidateNetworkInstance(networkInstance string) bool

type PfcpFunc

type PfcpFunc func(conn *PfcpConnection, msg message.Message, addr string) (message.Message, bool, error)

type PfcpHandlerMap

type PfcpHandlerMap map[uint8]PfcpFunc

func (PfcpHandlerMap) Handle

func (handlerMap PfcpHandlerMap) Handle(conn *PfcpConnection, buf []byte, addr *net.UDPAddr) error

type PfcpProfile

type PfcpProfile interface {
	// SxaConnector builds the AssociationConnector for an Sxa (S1U/S5S8) peer.
	SxaConnector(remoteNode string) (AssociationConnector, error)
	// SxbConnector builds the AssociationConnector for an Sxb (PA) peer.
	SxbConnector(remoteNode string) (AssociationConnector, error)
	// N4Connector builds the AssociationConnector for an N4 (5G SMF) peer.
	// Both profiles use NewDefaultAssociationConnector (N4 is always
	// standard 3GPP), but the method exists for symmetry with
	// SxaConnector/SxbConnector.
	N4Connector(remoteNode string) (AssociationConnector, error)

	// ParseOuterHeaderCreation extracts FarHeaderFields from an Outer Header
	// Creation IE (or a wrapping ForwardingParameters/UpdateForwardingParameters
	// IE) according to the profile's dialect.
	ParseOuterHeaderCreation(i *ie.IE) (FarHeaderFields, error)
	// ParseSubscriberData extracts IMSI and MSISDN from enterprise-specific
	// IEs if the profile supports them. Returns empty strings otherwise.
	ParseSubscriberData(ieArr []*ie.IE) (imsi, msisdn string)
	// ParseQFI extracts the QoS Flow Identifier from a QER IE. Returns false
	// if the QFI could not be determined.
	ParseQFI(qer *ie.IE) (uint8, bool)

	// NodeID encodes a Node ID IE for every PFCP message that carries one
	// (Association Setup/Update, Session Establishment Response, etc.).
	NodeID(nodeID string) *ie.IE

	// URSEQN builds a URSEQN IE for usage reports. The profile decides whether
	// to use the session-level sequence (Huawei) or the per-URR report sequence
	// (standard 3GPP).
	URSEQN(sessionSeq, reportSeq uint32) *ie.IE

	// HeartbeatRequestAdditionalIEs returns extra IEs to append to PFCP
	// Heartbeat Request messages, or nil if none. HuaweiProfile adds
	// ie.NewMetric(25); DefaultProfile adds none.
	HeartbeatRequestAdditionalIEs() []*ie.IE

	// SessionEstablishmentResponseAdditionalIEs returns extra IEs to append
	// to the Session Establishment Response after the standard IEs, or nil.
	// HuaweiProfile adds a second FSEID with a profile-specific IP;
	// DefaultProfile adds none.
	SessionEstablishmentResponseAdditionalIEs(localSEID uint64, nodeAddrV4 net.IP) []*ie.IE

	// UsageReportDeletionVendorIEs returns vendor-specific IEs for the
	// Usage Report within Session Deletion Response, or nil.
	// HuaweiProfile returns Huawei enterprise IEs (enterprise-id 2011);
	// DefaultProfile returns nil.
	UsageReportDeletionVendorIEs() []*ie.IE

	// UsageReportSessionReportVendorIEs returns vendor-specific IEs for
	// SendSessionReportUsage (volume threshold report), or nil.
	// HuaweiProfile returns Huawei enterprise IEs (enterprise-id 2011);
	// DefaultProfile returns nil.
	UsageReportSessionReportVendorIEs() []*ie.IE

	// UsageReportADCVendorIEs returns vendor-specific IEs for
	// SendSessionReportADC, or nil. sdfFilter is passed for the
	// conditional 36017 IE.
	// HuaweiProfile returns Huawei enterprise IEs (enterprise-id 2011);
	// DefaultProfile returns nil.
	UsageReportADCVendorIEs(sdfFilter string) []*ie.IE

	// SessionReportReleaseVendorIE returns the vendor-specific grouped IE
	// for Session Report Release (pdr-id-list), or nil. HuaweiProfile
	// returns ie.NewVendorSpecificGroupedIE(32799, 2011, pdrListIE...);
	// DefaultProfile returns nil.
	SessionReportReleaseVendorIE(pdrList []uint16) *ie.IE
}

PfcpProfile encapsulates the dialect of PFCP interaction with a particular control plane (CP). Implementations decide how connectors are built, how IEs are parsed/encoded, and how URR sequence numbering works.

The profile is selected once at startup (see cmd/main.go) and injected into every PfcpConnection, replacing the scattered "if config.Conf.HuaweiSupport" branches that previously gated Huawei-specific behavior.

type SFarInfo

type SFarInfo struct {
	FarInfo  ebpf.FarInfo
	GlobalId uint32
}

type SPDRInfo

type SPDRInfo struct {
	PdrID           uint32
	PdrInfo         ebpf.PdrInfo
	Teid            uint32
	Ipv4            net.IP
	Ipv6            net.IP
	NetworkInstance string
	SourceInterface uint8
	Allocated       bool
	PCCInfo         *PCCInfo
}

type SQerInfo

type SQerInfo struct {
	QerInfo  ebpf.QerInfo
	GlobalId uint32
}

type SUrrInfo added in v0.7.0

type SUrrInfo struct {
	UrrInfo         ebpf.UrrInfo
	GlobalId        uint32
	ReportSeqNumber uint32
}

type Session

type Session struct {
	LocalSEID   uint64
	RemoteSEID  uint64
	IMSI        string
	MSISDN      string
	PDRs        map[uint32]SPDRInfo
	FARs        map[uint32]SFarInfo
	QERs        map[uint32]SQerInfo
	URRs        map[uint32]SUrrInfo
	URRSequence uint32
	Traced      bool
	Is5G        bool
}

func NewSession added in v0.3.3

func NewSession(localSEID, remoteSEID uint64, IMSI, MSISDN string, traced bool) *Session

func (*Session) GetFar

func (s *Session) GetFar(id uint32) SFarInfo

func (*Session) GetPDR added in v0.4.0

func (s *Session) GetPDR(id uint16) SPDRInfo

func (*Session) GetQer

func (s *Session) GetQer(id uint32) SQerInfo

func (*Session) GetSessionImsi

func (s *Session) GetSessionImsi() string

func (*Session) GetSessionMsisdn

func (s *Session) GetSessionMsisdn() string

func (*Session) GetUrr added in v0.7.0

func (s *Session) GetUrr(id uint32) SUrrInfo

func (*Session) IsSessionTraced

func (s *Session) IsSessionTraced() bool

func (*Session) NewFar

func (s *Session) NewFar(id uint32, internalId uint32, farInfo ebpf.FarInfo)

func (*Session) NewQer

func (s *Session) NewQer(id uint32, internalId uint32, qerInfo ebpf.QerInfo)

func (*Session) NewUrr added in v0.7.0

func (s *Session) NewUrr(id uint32, internalId uint32, urrInfo ebpf.UrrInfo)

func (*Session) PutPDR added in v0.4.0

func (s *Session) PutPDR(id uint32, info SPDRInfo)

func (*Session) RemoveFar

func (s *Session) RemoveFar(id uint32) (SFarInfo, error)

func (*Session) RemovePDR added in v0.4.0

func (s *Session) RemovePDR(id uint32) (SPDRInfo, error)

func (*Session) RemoveQer

func (s *Session) RemoveQer(id uint32) (SQerInfo, error)

func (*Session) RemoveUrr added in v0.7.0

func (s *Session) RemoveUrr(id uint32) (SUrrInfo, error)

func (*Session) UpdateFar

func (s *Session) UpdateFar(id uint32, farInfo ebpf.FarInfo)

func (*Session) UpdateQer

func (s *Session) UpdateQer(id uint32, qerInfo ebpf.QerInfo)

func (*Session) UpdateUrr added in v0.7.0

func (s *Session) UpdateUrr(id uint32, urrInfo ebpf.UrrInfo)

type SxaAssociationConnector

type SxaAssociationConnector struct {
	// contains filtered or unexported fields
}

func NewSxaAssociationConnector

func NewSxaAssociationConnector(address string, s1uAddress string, s5s8Address string) (*SxaAssociationConnector, error)

type SxbAssociationConnector

type SxbAssociationConnector struct {
	// contains filtered or unexported fields
}

func NewSxbAssociationConnector

func NewSxbAssociationConnector(address string, paAddress string) (*SxbAssociationConnector, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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