Documentation ¶
Overview ¶
Package gnmi contains test-friendly gNMI funcs.
Index ¶
- func Await[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T], ...) *ygnmi.Value[T]
- func BatchDelete[T any](sb *SetBatch, q ygnmi.ConfigQuery[T])
- func BatchReplace[T any](sb *SetBatch, q ygnmi.ConfigQuery[T], val T)
- func BatchUpdate[T any](sb *SetBatch, q ygnmi.ConfigQuery[T], val T)
- func Delete[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T]) *ygnmi.Result
- func Get[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T]) T
- func GetAll[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.WildcardQuery[T]) []T
- func GetConfig[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T]) T
- func Lookup[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T]) *ygnmi.Value[T]
- func LookupAll[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.WildcardQuery[T]) []*ygnmi.Value[T]
- func LookupConfig[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T]) *ygnmi.Value[T]
- func OC() *ocpath.RootPath
- func OCBatch() *ocpath.Batch
- func OTG() *otgpath.RootPath
- func OTGBatch() *otgpath.Batch
- func Replace[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T], val T) *ygnmi.Result
- func Update[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T], val T) *ygnmi.Result
- type Collector
- type DeviceOrOpts
- type Opts
- type SetBatch
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Await ¶
func Await[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T], timeout time.Duration, val T) *ygnmi.Value[T]
Await observes values at Query with a STREAM subscription, blocking until a value that is deep equal to the specified val is received or the timeout is reached. To wait for a generic predicate, or to make a non-blocking call, use the Watch method instead.
func BatchDelete ¶
func BatchDelete[T any](sb *SetBatch, q ygnmi.ConfigQuery[T])
BatchDelete stores an delete operation in the SetBatch.
func BatchReplace ¶
func BatchReplace[T any](sb *SetBatch, q ygnmi.ConfigQuery[T], val T)
BatchReplace stores an replace operation in the SetBatch.
func BatchUpdate ¶
func BatchUpdate[T any](sb *SetBatch, q ygnmi.ConfigQuery[T], val T)
BatchUpdate stores an update operation in the SetBatch.
func Delete ¶
func Delete[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T]) *ygnmi.Result
Delete deletes the configuration at the given query path.
func Get ¶
func Get[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T]) T
Get fetches the value of a SingletonQuery with a ONCE subscription, failing the test fatally if no value is present at the path. Use Lookup to also get metadata or tolerate no value present.
func GetAll ¶
func GetAll[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.WildcardQuery[T]) []T
GetAll fetches the value of a WildcardQuery with a ONCE subscription skipping any non-present paths. It fails the test fatally if no value is present at the path Use LookupAll to also get metadata or tolerate no values present.
func GetConfig ¶
func GetConfig[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T]) T
GetConfig fetches the value of a SingletonQuery with a ONCE subscription, failing the test fatally if no value is present at the path. Use Lookup to also get metadata or tolerate no value present. Note: This is a workaround for Go's type inference not working for this use case and may be removed in a subsequent release. Note: This is equivalent to calling Get with a ConfigQuery and providing a fully-qualified type parameter.
func Lookup ¶
func Lookup[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T]) *ygnmi.Value[T]
Lookup fetches the value of a ygnmi.SingletonQuery with a ONCE subscription.
func LookupAll ¶
func LookupAll[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.WildcardQuery[T]) []*ygnmi.Value[T]
LookupAll fetches the values of a ygnmi.WildcardQuery with a ONCE subscription. It returns an empty list if no values are present at the path.
func LookupConfig ¶
func LookupConfig[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T]) *ygnmi.Value[T]
LookupConfig fetches the value of a ygnmi.SingletonQuery with a ONCE subscription. Note: This is a workaround for Go's type inference not working for this use case and may be removed in a subsequent release. Note: This is equivalent to calling Lookup with a ConfigQuery and providing a fully-qualified type parameter.
func Replace ¶
func Replace[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T], val T) *ygnmi.Result
Replace replaces the configuration at the given query path with the val.
func Update ¶
func Update[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.ConfigQuery[T], val T) *ygnmi.Result
Update updates the configuration at the given query path with the val.
Types ¶
type Collector ¶
type Collector[T any] struct { // contains filtered or unexported fields }
Collector represents an ongoing collection of telemetry values.
func Collect ¶
func Collect[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T], timeout time.Duration) *Collector[T]
Collect starts an asynchronous collection of the values at the query with a STREAM subscription. Calling Await on the return Collection waits until the timeout is reached and returns the collected values.
func CollectAll ¶
func CollectAll[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.WildcardQuery[T], timeout time.Duration) *Collector[T]
CollectAll starts an asynchronous collection of the values at the query with a STREAM subscription. Calling Await on the return Collection waits until the timeout is reached and returns the collected values.
type DeviceOrOpts ¶
type DeviceOrOpts interface {
GNMIOpts() *Opts
}
DeviceOrOpts is an interface that is ondatra.Device or a gnmi.Opts
type Opts ¶
type Opts struct {
// contains filtered or unexported fields
}
Opts contains customs options for a gNMI request.
func NewOpts ¶
func NewOpts(id string, useGetForConfig bool, initClient func(context.Context) (gpb.GNMIClient, error)) *Opts
NewOpts creates a set of GNMI options. DO NOT USE: call dut.GNMIOpts() or ate.OTG().GNMIOpts() instead.
func (*Opts) WithClient ¶
func (o *Opts) WithClient(client gpb.GNMIClient) *Opts
WithClient sets a custom gNMI client to the client, overriding any set by previous calls.
func (*Opts) WithMetadata ¶
WithMetadata adds metadata to the outgoing context, overriding any set by previous calls.
type SetBatch ¶
type SetBatch struct {
// contains filtered or unexported fields
}
SetBatch allows multiple Set operations (Replace, Update, Delete) to be applied as part of a single Set transaction. Use BatchUpdate, BatchReplace, BatchDelete to add operations, and then call the Set method to send the SetRequest.
type Watcher ¶
type Watcher[T any] struct { // contains filtered or unexported fields }
Watcher represents an ongoing watch of telemetry values.
func Watch ¶
func Watch[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.SingletonQuery[T], timeout time.Duration, pred func(*ygnmi.Value[T]) bool) *Watcher[T]
Watch starts an asynchronous STREAM subscription, evaluating each observed value with the specified predicate. The subscription completes when either the predicate is true or the timeout is reached. Calling Await on the returned Watcher waits for the subscription to complete. It returns the last observed value and a boolean that indicates whether that value satisfies the predicate.
func WatchAll ¶
func WatchAll[T any](t testing.TB, dev DeviceOrOpts, q ygnmi.WildcardQuery[T], timeout time.Duration, pred func(*ygnmi.Value[T]) bool) *Watcher[T]
WatchAll starts an asynchronous STREAM subscription, evaluating each observed value with the specified predicate. The subscription completes when either the predicate is true or the timeout is reached. Calling Await on the returned Watcher waits for the subscription to complete. It returns the last observed value and a boolean that indicates whether that value satisfies the predicate.
Directories ¶
Path | Synopsis |
---|---|
The migrator command contains a runnable version of the analyzer.
|
The migrator command contains a runnable version of the analyzer. |
gnmifix
Package gnmifix fixes deprecated Ondatra Telemetry code.
|
Package gnmifix fixes deprecated Ondatra Telemetry code. |
Package oc is a generated package which contains definitions of structs which represent a YANG schema.
|
Package oc is a generated package which contains definitions of structs which represent a YANG schema. |
acl
Package acl is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package acl is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
ateflow
Package ateflow is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package ateflow is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
definedsets
Package definedsets is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package definedsets is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
gnmicollectormetadata
Package gnmicollectormetadata is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package gnmicollectormetadata is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
interfaces
Package interfaces is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package interfaces is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
keychain
Package keychain is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package keychain is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
lacp
Package lacp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package lacp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
lldp
Package lldp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package lldp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
networkinstance
Package networkinstance is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package networkinstance is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
ocpath
Package ocpath is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package ocpath is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
platform
Package platform is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package platform is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
qos
Package qos is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package qos is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
routingpolicy
Package routingpolicy is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package routingpolicy is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
sampling
Package sampling is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package sampling is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
system
Package system is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package system is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
terminaldevice
Package terminaldevice is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package terminaldevice is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
Package otg is a generated package which contains definitions of structs which represent a YANG schema.
|
Package otg is a generated package which contains definitions of structs which represent a YANG schema. |
bgp
Package bgp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package bgp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
discovery
Package discovery is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package discovery is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
flow
Package flow is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package flow is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
isis
Package isis is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package isis is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
lacp
Package lacp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package lacp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
lag
Package lag is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package lag is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
lldp
Package lldp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package lldp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
otgpath
Package otgpath is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package otgpath is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
port
Package port is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package port is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |
rsvp
Package rsvp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema.
|
Package rsvp is a generated package which contains definitions of structs which generate gNMI paths for a YANG schema. |