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 DUT
- func (d *DUT) DialCLI(ctx context.Context) (binding.StreamClient, error)
- func (d *DUT) DialConsole(ctx context.Context) (binding.StreamClient, error)
- func (d *DUT) DialGNMI(ctx context.Context, opts ...grpc.DialOption) (gpb.GNMIClient, error)
- func (d *DUT) DialGNOI(ctx context.Context, opts ...grpc.DialOption) (binding.GNOIClients, 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
- type StreamClient
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 DUT ¶
type DUT struct { *binding.AbstractDUT PushConfigFn func(context.Context, string, bool) error DialCLIFn func(context.Context) (binding.StreamClient, error) DialConsoleFn func(context.Context) (binding.StreamClient, error) DialGNMIFn func(context.Context, ...grpc.DialOption) (gpb.GNMIClient, error) DialGNOIFn func(context.Context, ...grpc.DialOption) (binding.GNOIClients, 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) DialGNOI ¶
func (d *DUT) DialGNOI(ctx context.Context, opts ...grpc.DialOption) (binding.GNOIClients, error)
DialGNOI delegates to d.DialGNOIFn.
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.
type StreamClient ¶
type StreamClient struct { *binding.AbstractStreamClient InReader *io.PipeReader OutWriter *io.PipeWriter ErrWriter *io.PipeWriter // contains filtered or unexported fields }
StreamClient is a fake implementation of StreamClient for use in testing.
func NewStreamClient ¶
func NewStreamClient() *StreamClient
NewStreamClient returns a new StreamClient. Users should just access the test sides of the pipes for testing via exported fields.
func (*StreamClient) Close ¶
func (f *StreamClient) Close() error
Close will return a configured err.
func (*StreamClient) SendCommand ¶
SendCommand will echo whatever command is sent. If the cmd is "error" an error till be returned.
func (*StreamClient) Stderr ¶
func (f *StreamClient) Stderr() io.ReadCloser
Stderr returns the configured stderr buffer.
func (*StreamClient) Stdin ¶
func (f *StreamClient) Stdin() io.WriteCloser
Stdin returns the configured stdin buffer.
func (*StreamClient) Stdout ¶
func (f *StreamClient) Stdout() io.ReadCloser
Stdout returns the configured stdout buffer.