internal

package
v0.0.0-...-e8e7305 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package internal provides internal implementations of the replayer API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalLogEntry

func UnmarshalLogEntry(data []byte) (proto.Message, error)

UnmarshalLogEntry attempts to unmarshal the given data into a supported binary log message type.

Types

type Config

type Config struct {
	GNMI   gnmipb.GNMIClient
	GRIBI  gribipb.GRIBIClient
	P4RT   p4pb.P4RuntimeClient
	P4Info *p4infopb.P4Info
}

Config holds configuration for the replay, including RPC clients for g* protocols.

type Event

type Event struct {
	Timestamp time.Time
	Message   proto.Message
}

Event is one logged event from a binarylog.

func GenerateReplayEvents

func GenerateReplayEvents(r *Recording) ([]*Event, error)

GenerateReplayEvents generates the list of events to be replayed in order. This will generate initial events from the recorded snapshots and generate later events by transforming the parsed events into ready-to-send events.

func (*Event) String

func (e *Event) String() string

type Interface

type Interface struct {
	Name, Speed string
}

Interface is an interface present in a replay log.

type Recording

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

Recording is a parsed binary log.

func ParseBytes

func ParseBytes(bytes []byte) (*Recording, error)

ParseBytes parses an SFE binary log with the specified bytes.

func (*Recording) FinalGRIBI

func (r *Recording) FinalGRIBI() *gribipb.GetResponse

FinalGRIBI returns the final gRIBI GetResponse in the recorded log, representing the recorded final gRIBI state of the device.

func (*Recording) Interfaces

func (r *Recording) Interfaces() (map[string][]Interface, error)

Interfaces returns a map where the keys are interface names found in the gRIBI events and the values are the members of the bundle interface specified in the gNMI snapshot. If the key is not a bundle interface, the length of the slice will be zero.

func (*Recording) P4RTDevices

func (r *Recording) P4RTDevices() []uint64

P4RTDevices returns a list of the P4RT Device IDs that are programmed in the recording.

func (*Recording) SetInterfaceMap

func (r *Recording) SetInterfaceMap(oldToNew map[string]string) error

SetInterfaceMap sets the interfaces to be used during replay according to the input map. When replaying, any un-mapped interfaces and bundles containing unmapped interfaces will be ignored.

func (*Recording) String

func (r *Recording) String() string

type Results

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

Results contains the results of replayed requests.

func Replay

func Replay(ctx context.Context, r *Recording, config *Config) (*Results, error)

Replay sends the parsed recording over the given clients.

func (*Results) FinalGRIBI

func (r *Results) FinalGRIBI() *gribipb.GetResponse

FinalGRIBI returns the gRIBI GetResponse representing the gRIBI state on the device after replay.

func (*Results) GNMI

func (r *Results) GNMI() []*gnmipb.SetResponse

GNMI returns the results from the replayed gNMI requests.

func (*Results) GRIBI

func (r *Results) GRIBI() []*client.OpResult

GRIBI returns the results from the replayed gRIBI requests.

Jump to

Keyboard shortcuts

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