Documentation
¶
Overview ¶
Copyright 2024 Ella Networks
Copyright 2024 Ella Networks ¶
Copyright 2024 Ella Networks ¶
Copyright 2024 Ella Networks
Index ¶
- func BuildFlowReportRequest(flow ebpf.N3N6EntrypointFlow, stats ebpf.N3N6EntrypointFlowStats) *models.FlowReportRequest
- func SetN3InterfaceIndex(idx int)
- type FteIDResourceManager
- type PDRCreationContext
- type SMFReportHandler
- type SPDRInfo
- type SdfIndexAllocator
- type Session
- func (s *Session) GetFar(id uint32) ebpf.FarInfo
- func (s *Session) GetPDR(id uint32) SPDRInfo
- func (s *Session) GetQer(id uint32) ebpf.QerInfo
- func (s *Session) HasPDR(id uint32) bool
- func (s *Session) ListFARs() map[uint32]ebpf.FarInfo
- func (s *Session) ListPDRs() map[uint32]SPDRInfo
- func (s *Session) ListQERs() map[uint32]ebpf.QerInfo
- func (s *Session) NewQer(id uint32, qerInfo ebpf.QerInfo)
- func (s *Session) PolicyID() int64
- func (s *Session) PutFar(id uint32, farInfo ebpf.FarInfo)
- func (s *Session) PutPDR(id uint32, info SPDRInfo)
- func (s *Session) RemoveFar(id uint32)
- func (s *Session) RemovePDR(id uint32) SPDRInfo
- func (s *Session) SetPolicyID(id int64)
- type SessionEngine
- func (pc *SessionEngine) AddSession(seid uint64, session *Session)
- func (conn *SessionEngine) DeleteSession(ctx context.Context, req *models.DeleteRequest) error
- func (conn *SessionEngine) EstablishSession(ctx context.Context, req *models.EstablishRequest) (*models.EstablishResponse, error)
- func (pc *SessionEngine) GetAdvertisedN3Address() netip.Addr
- func (pc *SessionEngine) GetSession(seid uint64) *Session
- func (pc *SessionEngine) InitializeFiltersFromDB(ctx context.Context, dbInstance *db.Database) error
- func (pc *SessionEngine) ListSessions() map[uint64]*Session
- func (conn *SessionEngine) ModifySession(ctx context.Context, req *models.ModifyRequest) error
- func (connection *SessionEngine) ReleaseResources(seID uint64)
- func (conn *SessionEngine) SendDownlinkDataReport(ctx context.Context, smf SMFReportHandler, localSeid uint64, pdrid uint16, ...) error
- func (conn *SessionEngine) SendUsageReport(ctx context.Context, smf SMFReportHandler, localSeid uint64, uvol uint64, ...) error
- func (pc *SessionEngine) SetAdvertisedN3Address(newN3Addr netip.Addr)
- func (pc *SessionEngine) SetBPFObjects(ctx context.Context, bpfObjects *ebpf.BpfObjects, dbInstance *db.Database)
- func (conn *SessionEngine) UpdateFilters(_ context.Context, policyID int64, direction models.Direction, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFlowReportRequest ¶
func BuildFlowReportRequest(flow ebpf.N3N6EntrypointFlow, stats ebpf.N3N6EntrypointFlowStats) *models.FlowReportRequest
BuildFlowReportRequest converts an eBPF flow record to a FlowReportRequest without sending it. Used by the batch reporting path.
func SetN3InterfaceIndex ¶
func SetN3InterfaceIndex(idx int)
SetN3InterfaceIndex records the N3 (radio-side) network interface index so that flow direction can be derived: ingress on N3 means uplink, otherwise downlink.
Types ¶
type FteIDResourceManager ¶
type FteIDResourceManager struct {
// contains filtered or unexported fields
}
func NewFteIDResourceManager ¶
func NewFteIDResourceManager(teidRange uint32) (*FteIDResourceManager, error)
func (*FteIDResourceManager) AllocateTEID ¶
func (m *FteIDResourceManager) AllocateTEID(seID uint64) (uint32, error)
func (*FteIDResourceManager) ReleaseTEID ¶
func (m *FteIDResourceManager) ReleaseTEID(seID uint64)
type PDRCreationContext ¶
type PDRCreationContext struct {
Session *Session
FteIDResourceManager *FteIDResourceManager
TEIDCache map[uint8]uint32
}
func NewPDRCreationContext ¶
func NewPDRCreationContext(session *Session, resourceManager *FteIDResourceManager) *PDRCreationContext
func (*PDRCreationContext) ExtractPDR ¶
func (pdrContext *PDRCreationContext) ExtractPDR(pdr models.PDR, spdrInfo *SPDRInfo, farMap map[uint32]ebpf.FarInfo, qerMap map[uint32]ebpf.QerInfo) error
ExtractPDR populates spdrInfo from a models.PDR, looking up the referenced FAR and QER from the provided maps.
type SMFReportHandler ¶
type SMFReportHandler interface {
HandleDownlinkDataReport(context.Context, *models.DownlinkDataReport) error
HandleUsageReport(context.Context, *models.UsageReport) error
SendFlowReports(context.Context, []*models.FlowReportRequest) error
}
SMFReportHandler is the callback interface the UPF uses to deliver reports (downlink data notifications, usage measurements, flow stats) back to the SMF.
type SdfIndexAllocator ¶
type SdfIndexAllocator struct {
// contains filtered or unexported fields
}
SdfIndexAllocator manages allocation of slots in the sdf_filters BPF array. Index 0 is permanently reserved as "no filter".
func NewSdfIndexAllocator ¶
func NewSdfIndexAllocator(maxSlots uint32) *SdfIndexAllocator
func (*SdfIndexAllocator) Allocate ¶
func (a *SdfIndexAllocator) Allocate() (uint32, error)
func (*SdfIndexAllocator) Release ¶
func (a *SdfIndexAllocator) Release(idx uint32)
type Session ¶
type Session struct {
SEID uint64
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) SetPolicyID ¶
type SessionEngine ¶
type SessionEngine struct {
BpfObjects *ebpf.BpfObjects
FteIDResourceManager *FteIDResourceManager
SdfIndexAllocator *SdfIndexAllocator
// contains filtered or unexported fields
}
func NewSessionEngine ¶
func NewSessionEngine(addr string, nodeID string, n3Ip string, advertisedN3Ip string, bpfObjects *ebpf.BpfObjects, resourceManager *FteIDResourceManager) (*SessionEngine, error)
func (*SessionEngine) AddSession ¶
func (pc *SessionEngine) AddSession(seid uint64, session *Session)
func (*SessionEngine) DeleteSession ¶
func (conn *SessionEngine) DeleteSession(ctx context.Context, req *models.DeleteRequest) error
DeleteSession deletes an existing UPF session by SEID.
func (*SessionEngine) EstablishSession ¶
func (conn *SessionEngine) EstablishSession(ctx context.Context, req *models.EstablishRequest) (*models.EstablishResponse, error)
EstablishSession creates a new UPF session from typed Go structs, bypassing PFCP message encoding/decoding.
func (*SessionEngine) GetAdvertisedN3Address ¶
func (pc *SessionEngine) GetAdvertisedN3Address() netip.Addr
func (*SessionEngine) GetSession ¶
func (pc *SessionEngine) GetSession(seid uint64) *Session
func (*SessionEngine) InitializeFiltersFromDB ¶
func (*SessionEngine) ListSessions ¶
func (pc *SessionEngine) ListSessions() map[uint64]*Session
func (*SessionEngine) ModifySession ¶
func (conn *SessionEngine) ModifySession(ctx context.Context, req *models.ModifyRequest) error
ModifySession modifies an existing UPF session from typed Go structs.
func (*SessionEngine) ReleaseResources ¶
func (connection *SessionEngine) ReleaseResources(seID uint64)
func (*SessionEngine) SendDownlinkDataReport ¶
func (conn *SessionEngine) SendDownlinkDataReport(ctx context.Context, smf SMFReportHandler, localSeid uint64, pdrid uint16, qfi uint8) error
func (*SessionEngine) SendUsageReport ¶
func (conn *SessionEngine) SendUsageReport(ctx context.Context, smf SMFReportHandler, localSeid uint64, uvol uint64, dvol uint64) error
func (*SessionEngine) SetAdvertisedN3Address ¶
func (pc *SessionEngine) SetAdvertisedN3Address(newN3Addr netip.Addr)
func (*SessionEngine) SetBPFObjects ¶
func (pc *SessionEngine) SetBPFObjects(ctx context.Context, bpfObjects *ebpf.BpfObjects, dbInstance *db.Database)
func (*SessionEngine) UpdateFilters ¶
func (conn *SessionEngine) UpdateFilters(_ context.Context, policyID int64, direction models.Direction, rules []models.FilterRule) error
UpdateFilters is an idempotent PUT-style operation for the sdf_filters BPF slot of a given (PolicyID, Direction) pair.
- Non-empty rules: allocate or update the BPF slot, propagate to PDRs.
- Empty rules: deallocate the slot and reset PDRs to NoFilterIndex.