fakebind

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package fakebind implements a fake testbed binding, backed by a fake SSH server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ATE

type ATE struct {
	*binding.AbstractATE
	DialIxNetworkFn func(context.Context) (*binding.IxNetwork, error)
	DialGNMIFn      func(context.Context, ...grpc.DialOption) (gpb.GNMIClient, error)
	DialOTGFn       func(context.Context, ...grpc.DialOption) (gosnappi.GosnappiApi, error)
}

ATE is a fake implementation of binding.ATE comprised of stubs.

func (*ATE) DialGNMI

func (a *ATE) DialGNMI(ctx context.Context, opts ...grpc.DialOption) (gpb.GNMIClient, error)

DialGNMI delegates to a.DialGNMIFn.

func (*ATE) DialIxNetwork

func (a *ATE) DialIxNetwork(ctx context.Context) (*binding.IxNetwork, error)

DialIxNetwork delegates to a.DialIxNetworkFn.

func (*ATE) DialOTG

func (a *ATE) DialOTG(ctx context.Context, opts ...grpc.DialOption) (gosnappi.GosnappiApi, error)

DialOTG delegates to a.DialOTGFn.

type Binding

type Binding struct {
	ReserveFn          func(context.Context, *opb.Testbed, time.Duration, time.Duration, map[string]string) (*binding.Reservation, error)
	ReleaseFn          func(context.Context) error
	FetchReservationFn func(context.Context, string) (*binding.Reservation, error)
}

Binding is a fake binding.Binding implementation comprised of stubs.

func Setup

func Setup() *Binding

Setup initializes Ondatra with a new fake binding, initializes the testbed to an unreserved state, and returns the fake binding for further stubbing.

func (*Binding) FetchReservation

func (b *Binding) FetchReservation(ctx context.Context, id string) (*binding.Reservation, error)

FetchReservation delegates to b.FetchReservationFn.

func (*Binding) Release

func (b *Binding) Release(ctx context.Context) error

Release delegates to b.ReleaseFN.

func (*Binding) Reserve

func (b *Binding) Reserve(ctx context.Context, tb *opb.Testbed, runTime, waitTime time.Duration, partial map[string]string) (*binding.Reservation, error)

Reserve delegates to b.ReserveFn.

func (*Binding) WithReservation

func (b *Binding) WithReservation(res *binding.Reservation) *Binding

WithReservation sets Ondatra to a state in which the specified reservation has been reserved. It does not alter the implementation of this binding's stub functions in any way. If a nil reservation is supplied, Ondatra is set to an unreserved state.

type ConsoleClient added in v0.2.8

type ConsoleClient struct {
	*binding.AbstractConsoleClient

	InReader  *io.PipeReader
	OutWriter *io.PipeWriter
	ErrWriter *io.PipeWriter
	// contains filtered or unexported fields
}

ConsoleClient is a fake implementation of ConsoleClient for use in testing.

func NewConsoleClient added in v0.2.8

func NewConsoleClient() *ConsoleClient

NewConsoleClient returns a new ConsoleClient. Tests should access the stub side of the pipes via exported fields.

func (*ConsoleClient) Close added in v0.2.8

func (f *ConsoleClient) Close() error

Close will return a configured err.

func (*ConsoleClient) Stderr added in v0.2.8

func (f *ConsoleClient) Stderr() io.ReadCloser

Stderr returns the configured stderr buffer.

func (*ConsoleClient) Stdin added in v0.2.8

func (f *ConsoleClient) Stdin() io.WriteCloser

Stdin returns the configured stdin buffer.

func (*ConsoleClient) Stdout added in v0.2.8

func (f *ConsoleClient) Stdout() io.ReadCloser

Stdout returns the configured stdout buffer.

type DUT

type DUT struct {
	*binding.AbstractDUT
	PushConfigFn  func(context.Context, string, bool) error
	DialCLIFn     func(context.Context) (binding.CLIClient, error)
	DialConsoleFn func(context.Context) (binding.ConsoleClient, error)
	DialGNMIFn    func(context.Context, ...grpc.DialOption) (gpb.GNMIClient, error)
	DialGNOIFn    func(context.Context, ...grpc.DialOption) (gnoigo.Clients, error)
	DialGNSIFn    func(context.Context, ...grpc.DialOption) (binding.GNSIClients, error)
	DialGRIBIFn   func(context.Context, ...grpc.DialOption) (grpb.GRIBIClient, error)
	DialP4RTFn    func(context.Context, ...grpc.DialOption) (p4pb.P4RuntimeClient, error)
}

DUT is a fake implementation of binding.DUT comprised of stubs.

func (*DUT) DialCLI

func (d *DUT) DialCLI(ctx context.Context) (binding.CLIClient, error)

DialCLI delegates to d.DialCLIFn.

func (*DUT) DialConsole

func (d *DUT) DialConsole(ctx context.Context) (binding.ConsoleClient, error)

DialConsole delegates to d.DialConsoleFn.

func (*DUT) DialGNMI

func (d *DUT) DialGNMI(ctx context.Context, opts ...grpc.DialOption) (gpb.GNMIClient, error)

DialGNMI delegates to d.DialGNMIFn.

func (*DUT) DialGNOI

func (d *DUT) DialGNOI(ctx context.Context, opts ...grpc.DialOption) (gnoigo.Clients, error)

DialGNOI delegates to d.DialGNOIFn.

func (*DUT) DialGNSI added in v0.2.1

func (d *DUT) DialGNSI(ctx context.Context, opts ...grpc.DialOption) (binding.GNSIClients, error)

DialGNSI delegates to d.DialGNSIFn.

func (*DUT) DialGRIBI

func (d *DUT) DialGRIBI(ctx context.Context, opts ...grpc.DialOption) (grpb.GRIBIClient, error)

DialGRIBI delegates to d.DialGRIBIFn.

func (*DUT) DialP4RT

func (d *DUT) DialP4RT(ctx context.Context, opts ...grpc.DialOption) (p4pb.P4RuntimeClient, error)

DialP4RT delegates to d.DialP4RTFn.

func (*DUT) PushConfig

func (d *DUT) PushConfig(ctx context.Context, config string, reset bool) error

PushConfig delegates to d.PushConfigFn.

Jump to

Keyboard shortcuts

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