upf

package
v0.0.0-...-40bead5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: NIST-PD-fallback Imports: 15 Imported by: 0

README

ndn-dpdk/app/upf

This package provides a 5G User Plane Function (UPF) that converts PFCP sessions to GTP-U faces. It works as follows:

  1. Listen for PFCP messages from a 5G Session Management Function (SMF).
  2. Gather PFCP session related messages, convert them into NDN-DPDK face creation/deletion commands with appropriate locators of GTP-U faces.
  3. These commands can then be sent to a running NDN-DPDK forwarder, to achieve NDN forwarding within a 5G network.

Currently, this package supports these PFCP message types:

  • heartbeat request/response
  • association setup request/response
  • session establishment request/response
  • session modification request/response
  • session deletion request/response

For each message, it only recognizes the most basic fields required for constructing GTP-U headers, but does not support all cases. It is tested to be compatible with several open-source SMF implementations, including free5GC and OAI-CN5G.

Documentation

Overview

Package upf provides a 5G User Plane Function that converts PFCP sessions to GTP-U faces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	CpSEID, UpSEID uint64
	Parser         SessionParser
	FaceID         string
}

Session represents a PFCP session and the associated face.

type SessionLocatorFields

type SessionLocatorFields struct {
	UlTEID        uint32     `json:"ulTEID"`
	DlTEID        uint32     `json:"dlTEID"`
	UlQFI         uint8      `json:"ulQFI"`
	DlQFI         uint8      `json:"dlQFI"`
	RemoteIP      netip.Addr `json:"remoteIP"`
	InnerRemoteIP netip.Addr `json:"innerRemoteIP"`
}

SessionLocatorFields contains GTP-U locator fields extracted from PFCP session.

type SessionParser

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

SessionParser parses PFCP messages to construct GTP-U face locator.

func (*SessionParser) EstablishmentRequest

func (sp *SessionParser) EstablishmentRequest(req *message.SessionEstablishmentRequest, rspIEs []*ie.IE) ([]*ie.IE, error)

EstablishmentRequest handles a SessionEstablishmentRequest message.

func (SessionParser) LocatorFields

func (sp SessionParser) LocatorFields() (loc SessionLocatorFields, ok bool)

LocatorFields returns GTP-U locator fields extracted from PFCP session. ok indicates whether the locator is valid.

func (*SessionParser) ModificationRequest

func (sp *SessionParser) ModificationRequest(req *message.SessionModificationRequest, rspIEs []*ie.IE) ([]*ie.IE, error)

ModificationRequest handles a SessionModificationRequest message.

type SessionTable

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

SessionTable stores PFCP sessions and instructs face creation.

func NewSessionTable

func NewSessionTable(
	createFace func(ctx context.Context, sloc SessionLocatorFields) (id string, e error),
	destroyFace func(ctx context.Context, id string) error,
) *SessionTable

NewSessionTable constructs SessionTable.

func (*SessionTable) DeletionRequest

func (st *SessionTable) DeletionRequest(ctx context.Context, req *message.SessionDeletionRequest) (sess *Session, e error)

DeletionRequest handles a SessionDeletionRequest message.

func (*SessionTable) EstablishmentRequest

func (st *SessionTable) EstablishmentRequest(ctx context.Context, req *message.SessionEstablishmentRequest, rspIEs []*ie.IE) (sess *Session, rspIEsRet []*ie.IE, e error)

EstablishmentRequest handles a SessionEstablishmentRequest message.

func (*SessionTable) ModificationRequest

func (st *SessionTable) ModificationRequest(ctx context.Context, req *message.SessionModificationRequest, rspIEs []*ie.IE) (sess *Session, rspIEsRet []*ie.IE, e error)

ModificationRequest handles a SessionModificationRequest message.

type UPF

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

UPF represents a User Plane Function.

func NewUPF

func NewUPF(
	params UpfParams,
	createFace func(ctx context.Context, loc any) (id string, e error),
	destroyFace func(ctx context.Context, id string) error,
) *UPF

NewUPF constructs UPF.

func (*UPF) AssociationSetupRequest

func (upf *UPF) AssociationSetupRequest(ctx context.Context, req *message.AssociationSetupRequest) (rsp *message.AssociationSetupResponse, e error)

AssociationSetupRequest handles an AssociationSetupRequest message.

func (*UPF) HeartbeatRequest

func (upf *UPF) HeartbeatRequest(ctx context.Context, req *message.HeartbeatRequest) (rsp *message.HeartbeatResponse, e error)

HeartbeatRequest handles a HeartbeatRequest message.

func (*UPF) Listen

func (upf *UPF) Listen(ctx context.Context) error

Listen listens for PFCP messages.

func (*UPF) ServePFCP

func (upf *UPF) ServePFCP(ctx context.Context, req message.Message) (rsp message.Message, e error)

ServePFCP handles a PFCP message.

rsp: the response message, may be nil.

func (*UPF) SessionDeletionRequest

func (upf *UPF) SessionDeletionRequest(ctx context.Context, req *message.SessionDeletionRequest) (rsp *message.SessionDeletionResponse, e error)

SessionDeletionRequest handles a SessionDeletionRequest message.

func (*UPF) SessionEstablishmentRequest

func (upf *UPF) SessionEstablishmentRequest(ctx context.Context, req *message.SessionEstablishmentRequest) (rsp *message.SessionEstablishmentResponse, e error)

SessionEstablishmentRequest handles a SessionEstablishmentRequest message.

func (*UPF) SessionModificationRequest

func (upf *UPF) SessionModificationRequest(ctx context.Context, req *message.SessionModificationRequest) (rsp *message.SessionModificationResponse, e error)

SessionModificationRequest handles a SessionModificationRequest message.

type UpfLocatorFields

type UpfLocatorFields struct {
	Scheme       string       `json:"scheme"`
	Local        macaddr.Flag `json:"local"`
	VLAN         int          `json:"vlan,omitempty"`
	LocalIP      netip.Addr   `json:"localIP"`
	InnerLocalIP netip.Addr   `json:"innerLocalIP"`
}

UpfLocatorFields contains GTP-U locator fields not related to a PFCP session.

type UpfParams

type UpfParams struct {
	SmfN4   netip.Addr
	UpfN4   netip.Addr
	Locator UpfLocatorFields
	MapN3   map[netip.Addr]macaddr.Flag

	RecoveryTimestamp *ie.IE
	UpfNodeID         *ie.IE
}

UpfParams contains UPF parameters.

func (*UpfParams) DefineFlags

func (p *UpfParams) DefineFlags(flags []cli.Flag) []cli.Flag

DefineFlags appends CLI flags.

func (UpfParams) MakeLocator

func (p UpfParams) MakeLocator(sloc SessionLocatorFields) (loc any, e error)

MakeLocator constructs GTP-U face locator.

func (*UpfParams) ProcessFlags

func (p *UpfParams) ProcessFlags(c *cli.Context) error

ProcessFlags validates and stores CLI flags.

Jump to

Keyboard shortcuts

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