Documentation
¶
Overview ¶
Package fixture provides per-subtest builders over the Ella Core client SDK for provisioning scenario fixtures (operator, profiles, slices, data networks, policies, subscribers).
Index ¶
- func AssertEachBytesIs(t *testing.T, flows []client.FlowReport, expected uint64)
- func AssertEachTimestampsWithin(t *testing.T, flows []client.FlowReport, lower, upper time.Time)
- func AssertFlowReports(ctx context.Context, t *testing.T, c *client.Client, ...) []client.FlowReport
- func AssertUsagePositive(ctx context.Context, t *testing.T, c *client.Client, imsis []string, ...)
- type DataNetworkSpec
- type F
- func (f *F) Apply(spec scenarios.FixtureSpec)
- func (f *F) DataNetwork(spec DataNetworkSpec)
- func (f *F) HomeNetworkKey(spec HomeNetworkKeySpec)
- func (f *F) Operator(spec OperatorSpec)
- func (f *F) OperatorDefault()
- func (f *F) Policy(spec PolicySpec)
- func (f *F) Profile(spec ProfileSpec)
- func (f *F) Slice(spec SliceSpec)
- type FlowReportPredicate
- func And(preds ...FlowReportPredicate) FlowReportPredicate
- func Count(n int) FlowReportPredicate
- func DistinctImsis(n int) FlowReportPredicate
- func EachAction(a string) FlowReportPredicate
- func EachBytesAtLeast(b uint64) FlowReportPredicate
- func EachDestinationIPInCIDR(cidr string) FlowReportPredicate
- func EachDestinationIPIs(ip string) FlowReportPredicate
- func EachDirection(d string) FlowReportPredicate
- func EachIMSIDistinctTuplesIs(n int) FlowReportPredicate
- func EachIMSITotalBytesInRange(lo, hi uint64) FlowReportPredicate
- func EachIMSITotalPacketsInRange(lo, hi uint64) FlowReportPredicate
- func EachPackets(n uint64) FlowReportPredicate
- func EachProtocol(p uint8) FlowReportPredicate
- func EachSourceIPInCIDR(cidr string) FlowReportPredicate
- func EachSourceIPIs(ip string) FlowReportPredicate
- func EachTupleHasAtMost(n int) FlowReportPredicate
- func HasAtLeast(n int) FlowReportPredicate
- func HasBothDirections() FlowReportPredicate
- func ImsisAre(expected []string) FlowReportPredicate
- type HomeNetworkKeySpec
- type OperatorSpec
- type PolicySpec
- type ProfileSpec
- type SliceSpec
- type SubscriberSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEachBytesIs ¶ added in v1.11.0
func AssertEachBytesIs(t *testing.T, flows []client.FlowReport, expected uint64)
AssertEachBytesIs records (t.Errorf, non-fatal) every flow whose Bytes differs from expected, printing the actual value so the constant can be recalibrated from a single run.
func AssertEachTimestampsWithin ¶ added in v1.11.0
AssertEachTimestampsWithin records (t.Errorf, non-fatal) every flow whose StartTime/EndTime is unparseable, outside [lower, upper], or inverted (EndTime before StartTime).
func AssertFlowReports ¶ added in v1.11.0
func AssertFlowReports( ctx context.Context, t *testing.T, c *client.Client, params *client.ListFlowReportsParams, predicate FlowReportPredicate, timeout time.Duration, ) []client.FlowReport
AssertFlowReports polls the flow-reports endpoint with the given filter every 500 ms until predicate returns true or timeout elapses. Returns the snapshot that satisfied predicate; fails the subtest on timeout or API error.
Types ¶
type DataNetworkSpec ¶
DataNetworkSpec describes a PDU session anchor (DNN + IP pool).
func DefaultDataNetworkSpec ¶
func DefaultDataNetworkSpec() DataNetworkSpec
type F ¶
type F struct {
// contains filtered or unexported fields
}
F is a fixture builder bound to one subtest. Methods fail the test via t.Fatalf on API error.
func (*F) Apply ¶
func (f *F) Apply(spec scenarios.FixtureSpec)
Apply provisions every scenario-owned resource in spec and registers t.Cleanup handlers to delete them when the subtest ends. LIFO cleanup order gives the correct reverse-dependency teardown: subscribers, policies, data networks, slices, profiles.
Scoped resources use strict-create semantics — a name collision fails the test so that stray state from a prior run surfaces immediately instead of silently mutating shared state.
Non-scoped resources (operator singleton, home network keys) are applied idempotently and are not cleaned up; they belong to the baseline shared across all subtests.
Rule for scenario authors: reference baseline names (default profile/slice/DN/policy) only when assertions match baseline values. Anything else must be declared under a scoped name.
func (*F) DataNetwork ¶
func (f *F) DataNetwork(spec DataNetworkSpec)
DataNetwork upserts the baseline data network: when it already exists (e.g. Core's seeded "internet"), its configuration is overwritten to match spec. A pre-existing DN is never left with mismatched parameters; scenarios needing specific DN parameters must use a distinct name.
func (*F) HomeNetworkKey ¶
func (f *F) HomeNetworkKey(spec HomeNetworkKeySpec)
HomeNetworkKey creates a home network key unless the operator already serves one with the matching public key.
func (*F) Operator ¶
func (f *F) Operator(spec OperatorSpec)
Operator writes the operator ID and tracking TACs.
func (*F) OperatorDefault ¶
func (f *F) OperatorDefault()
OperatorDefault writes scenarios-package defaults to the operator.
func (*F) Policy ¶
func (f *F) Policy(spec PolicySpec)
Policy upserts the baseline policy: when it already exists (e.g. Core's seeded "default"), its config is overwritten to match spec.
func (*F) Profile ¶
func (f *F) Profile(spec ProfileSpec)
Profile upserts the baseline profile: when it already exists (e.g. Core's seeded "default"), its UE-AMBR is overwritten to match spec.
type FlowReportPredicate ¶ added in v1.11.0
type FlowReportPredicate func([]client.FlowReport) bool
FlowReportPredicate evaluates a snapshot of flow reports. Each-prefixed predicates return false on an empty snapshot to avoid vacuous-truth matches during polling.
func And ¶ added in v1.11.0
func And(preds ...FlowReportPredicate) FlowReportPredicate
func Count ¶ added in v1.11.0
func Count(n int) FlowReportPredicate
func DistinctImsis ¶ added in v1.11.0
func DistinctImsis(n int) FlowReportPredicate
func EachAction ¶ added in v1.11.0
func EachAction(a string) FlowReportPredicate
func EachBytesAtLeast ¶ added in v1.11.0
func EachBytesAtLeast(b uint64) FlowReportPredicate
func EachDestinationIPInCIDR ¶ added in v1.11.0
func EachDestinationIPInCIDR(cidr string) FlowReportPredicate
EachDestinationIPInCIDR panics if cidr is malformed.
func EachDestinationIPIs ¶ added in v1.11.0
func EachDestinationIPIs(ip string) FlowReportPredicate
func EachDirection ¶ added in v1.11.0
func EachDirection(d string) FlowReportPredicate
func EachIMSIDistinctTuplesIs ¶ added in v1.11.1
func EachIMSIDistinctTuplesIs(n int) FlowReportPredicate
EachIMSIDistinctTuplesIs requires every distinct IMSI to be associated with exactly n distinct (SourcePort, DestinationPort) tuples — one per connection attempt. Records that share a tuple (e.g. a NetFlow-style split of one connection across multiple observation periods) collapse into the same count.
func EachIMSITotalBytesInRange ¶ added in v1.11.1
func EachIMSITotalBytesInRange(lo, hi uint64) FlowReportPredicate
EachIMSITotalBytesInRange requires the sum of Bytes across each distinct IMSI to fall within [lo, hi].
func EachIMSITotalPacketsInRange ¶ added in v1.11.1
func EachIMSITotalPacketsInRange(lo, hi uint64) FlowReportPredicate
EachIMSITotalPacketsInRange requires the sum of Packets across each distinct IMSI to fall within [lo, hi].
func EachPackets ¶ added in v1.11.0
func EachPackets(n uint64) FlowReportPredicate
func EachProtocol ¶ added in v1.11.0
func EachProtocol(p uint8) FlowReportPredicate
func EachSourceIPInCIDR ¶ added in v1.11.0
func EachSourceIPInCIDR(cidr string) FlowReportPredicate
EachSourceIPInCIDR panics if cidr is malformed.
func EachSourceIPIs ¶ added in v1.11.0
func EachSourceIPIs(ip string) FlowReportPredicate
func EachTupleHasAtMost ¶ added in v1.11.1
func EachTupleHasAtMost(n int) FlowReportPredicate
EachTupleHasAtMost requires every distinct (IMSI, SourcePort, DestinationPort) tuple to be backed by at most n flow records. Used to bound NetFlow-style flow-record splitting.
func HasAtLeast ¶ added in v1.11.0
func HasAtLeast(n int) FlowReportPredicate
func HasBothDirections ¶ added in v1.11.0
func HasBothDirections() FlowReportPredicate
func ImsisAre ¶ added in v1.11.0
func ImsisAre(expected []string) FlowReportPredicate
ImsisAre requires the items' SubscriberID multiset to exactly equal expected: each IMSI must appear with the same multiplicity in items as it does in expected, with no extras.
type HomeNetworkKeySpec ¶
HomeNetworkKeySpec carries a hex-encoded X25519 private key and a key identifier.
type OperatorSpec ¶
OperatorSpec captures the singleton operator settings.
type PolicySpec ¶
type PolicySpec struct {
Name string
ProfileName string
SliceName string
DataNetworkName string
SessionAmbrUplink string
SessionAmbrDownlink string
Var5qi int32
Arp int32
}
PolicySpec describes a QoS policy for a (profile, slice, data network) triple.
func DefaultPolicySpec ¶
func DefaultPolicySpec() PolicySpec
type ProfileSpec ¶
ProfileSpec describes a subscriber profile (UE-AMBR bucket).
func DefaultProfileSpec ¶
func DefaultProfileSpec() ProfileSpec
type SliceSpec ¶
SliceSpec describes a network slice.
func DefaultSliceSpec ¶
func DefaultSliceSpec() SliceSpec