Documentation ¶
Overview ¶
Package fakebind implements a fake testbed binding, backed by a fake SSH server.
Index ¶
- type ATE
- type Binding
- func (b *Binding) FetchReservation(ctx context.Context, id string) (*binding.Reservation, error)
- func (b *Binding) Release(ctx context.Context) error
- func (b *Binding) Reserve(ctx context.Context, tb *opb.Testbed, runTime, waitTime time.Duration, ...) (*binding.Reservation, error)
- func (b *Binding) WithReservation(res *binding.Reservation) *Binding
- type ConsoleClient
- type DUT
- func (d *DUT) DialCLI(ctx context.Context) (binding.CLIClient, error)
- func (d *DUT) DialConsole(ctx context.Context) (binding.ConsoleClient, error)
- func (d *DUT) DialGNMI(ctx context.Context, opts ...grpc.DialOption) (gpb.GNMIClient, error)
- func (d *DUT) DialGNOI(ctx context.Context, opts ...grpc.DialOption) (gnoigo.Clients, error)
- func (d *DUT) DialGNSI(ctx context.Context, opts ...grpc.DialOption) (binding.GNSIClients, error)
- func (d *DUT) DialGRIBI(ctx context.Context, opts ...grpc.DialOption) (grpb.GRIBIClient, error)
- func (d *DUT) DialP4RT(ctx context.Context, opts ...grpc.DialOption) (p4pb.P4RuntimeClient, error)
- func (d *DUT) PushConfig(ctx context.Context, config string, reset bool) error
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 ¶
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 ¶
FetchReservation delegates to b.FetchReservationFn.
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) DialConsole ¶
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) 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.