lab

package
v0.0.0-...-4f1e891 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOperatorStatusCommand

func BuildOperatorStatusCommand(scopes []OperatorScope) string

BuildOperatorStatusCommand renders the per-scope status command for the given scopes: every probe runs without short-circuiting and prints one marked line per scope, so a single guest command bounds the complete reporting pass. Exported so the generated wire format can be exercised on any scope table, not only the pinned AD-11 one.

func CheckOperators

func CheckOperators(fw *framework.TestFramework) error

CheckOperators verifies the complete operator-owned lab profile.

func ForwardingExpectedBytes

func ForwardingExpectedBytes() []byte

ForwardingExpectedBytes returns a copy of the canonical operator forwarding probe packet bytes. The returned slice is a copy; callers may freely mutate it. The underlying fixture is private to prevent accidental shared state.

func MatchesForwardingProbe

func MatchesForwardingProbe(packet []byte) bool

func OperatorFingerprintFiles

func OperatorFingerprintFiles() []string

OperatorFingerprintFiles lists source files that invalidate the lab operator snapshot.

func PrepareOperators

func PrepareOperators(fw *framework.TestFramework) error

PrepareOperators stages the lab-only operator and BIRD artifacts in guest tmpfs.

func RequiredArtifacts

func RequiredArtifacts(root string) []string

RequiredArtifacts lists host files needed to prepare the operator baseline.

func ScopeNames

func ScopeNames() []string

ScopeNames returns the pinned Operator Profile scope names in execution order (AD-11).

func ShellJoin

func ShellJoin(argv []string) string

ShellJoin quotes each argument with single-quote escaping and joins them with spaces, suitable for passing a command and arguments to a POSIX shell.

func StartOperators

func StartOperators(fw *framework.TestFramework) error

StartOperators launches the complete operator-owned lab configuration.

func TruncateOutput

func TruncateOutput(output string) string

TruncateOutput caps output to maxResultOutput bytes, appending a truncation notice if the original exceeded the limit.

func WaitOperators

func WaitOperators(fw *framework.TestFramework) error

WaitOperators waits for the complete operator-owned lab profile.

func WithoutEthernetPadding

func WithoutEthernetPadding(packet []byte) []byte

WithoutEthernetPadding strips Ethernet padding from a packet, returning only the bytes up to and including the IP payload as indicated by the IP header length field. Returns the original packet if the header is too short.

Types

type Boot

type Boot struct {
	Dataplane    string `yaml:"dataplane,omitempty" json:"dataplane,omitempty"`
	Controlplane string `yaml:"controlplane,omitempty" json:"controlplane,omitempty"`
}

type File

type File struct {
	Source      string `yaml:"source" json:"source"`
	Destination string `yaml:"destination" json:"destination"`
}

type Manifest

type Manifest struct {
	Schema      string  `yaml:"$schema,omitempty" json:"$schema,omitempty"`
	Version     int     `yaml:"version" json:"version"`
	Name        string  `yaml:"name" json:"name"`
	Description string  `yaml:"description,omitempty" json:"description,omitempty"`
	Boot        Boot    `yaml:"boot,omitempty" json:"boot"`
	Files       []File  `yaml:"files,omitempty" json:"files,omitempty"`
	Steps       []Step  `yaml:"steps,omitempty" json:"steps,omitempty"`
	Probes      []Probe `yaml:"probes,omitempty" json:"probes,omitempty"`
}

func LoadManifest

func LoadManifest(path string) (*Manifest, error)

func ParseManifest

func ParseManifest(data []byte, baseDir string) (*Manifest, error)

type ManifestRuntime

type ManifestRuntime interface {
	CommonConfigCommands() []string
	ExecuteCommand(string) (string, error)
	ExecuteCommandWithTimeout(string, time.Duration) (string, error)
	ExecuteCommands(...string) ([]string, error)
	ResetConnections()
	RestoreClean(string) error
	SendPacketAndCaptureAllUnfiltered(int, int, []byte, time.Duration) ([][]byte, error)
	StartYANET(string, string) error
	WaitForDatapathReady(time.Duration) error
}

ManifestRuntime provides the VM operations needed to execute a manifest.

type OperatorScope

type OperatorScope struct {
	Name    string
	Command string
	Reason  string
}

OperatorScope is one named probe of the pinned Operator Profile (AD-11). The Command exits zero while the scope is ready in the guest and Reason names the failure the probe detects.

type Probe

type Probe struct {
	Name    string      `yaml:"name" json:"name"`
	Ingress int         `yaml:"ingress" json:"ingress"`
	Egress  int         `yaml:"egress" json:"egress"`
	Timeout string      `yaml:"timeout,omitempty" json:"timeout,omitempty"`
	Send    ProbeSend   `yaml:"send" json:"send"`
	Expect  ProbeExpect `yaml:"expect" json:"expect"`
}

type ProbeExpect

type ProbeExpect struct {
	PCAP string `yaml:"pcap,omitempty" json:"pcap,omitempty"`
	Drop bool   `yaml:"drop,omitempty" json:"drop,omitempty"`
}

type ProbeSend

type ProbeSend struct {
	PCAP string `yaml:"pcap" json:"pcap"`
}

type Result

type Result struct {
	Name     string        `json:"name"`
	Kind     string        `json:"kind"`
	Success  bool          `json:"success"`
	Duration time.Duration `json:"duration"`
	Output   string        `json:"output,omitempty"`
	Error    string        `json:"error,omitempty"`
}

type RunReport

type RunReport struct {
	Manifest string    `json:"manifest"`
	Started  time.Time `json:"started"`
	Finished time.Time `json:"finished"`
	Success  bool      `json:"success"`
	Results  []Result  `json:"results"`
}

func RunManifest

func RunManifest(runtime ManifestRuntime, path string) RunReport

RunManifest executes a validated lab manifest against runtime.

type ScopeResult

type ScopeResult struct {
	// Name identifies the scope.
	Name string `json:"name"`
	// State is ready when the scope's probe succeeded.
	State ScopeState `json:"state"`
	// Reason names the failure, empty while the scope is ready.
	Reason string `json:"reason,omitempty"`
}

ScopeResult is the outcome of one Operator Profile scope probe.

func CheckStatus

func CheckStatus(fw *framework.TestFramework) ([]ScopeResult, error)

CheckStatus runs every Operator Profile scope probe as one guest command and returns the parsed per-scope outcomes. It changes no Lab state and does not run the forwarding packet probe, which stays in startup health only.

func ParseScopeStatus

func ParseScopeStatus(output string) []ScopeResult

ParseScopeStatus parses the marked per-scope lines of the Operator Profile status command into one result per scope. It fails closed: a scope whose line is absent, truncated, duplicated, or otherwise malformed is reported NOT_READY with an explicit parse reason and is never assumed healthy.

func ParseScopeStatusFor

func ParseScopeStatusFor(output string, scopes []OperatorScope) []ScopeResult

ParseScopeStatusFor parses marked per-scope output against an explicit scope table, failing closed exactly like ParseScopeStatus. Exported so the parser can be pinned to the output of BuildOperatorStatusCommand on any scope set.

type ScopeState

type ScopeState string

ScopeState is the readiness state of one Operator Profile scope.

const (
	StateReady    ScopeState = "ready"
	StateNotReady ScopeState = "not_ready"
)

Operator Profile scope states reported by the status parser.

type Step

type Step struct {
	Name    string   `yaml:"name" json:"name"`
	Argv    []string `yaml:"argv" json:"argv"`
	Timeout string   `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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