Documentation
¶
Overview ¶
Package samplestream provides utilities for creating gNMI Subscriptions in SAMPLE mode.
Index ¶
- type SampleStream
- func (s *SampleStream[T]) All() []*ygnmi.Value[T]
- func (s *SampleStream[T]) AwaitNext(timeout time.Duration, pred func(*ygnmi.Value[T]) bool) (*ygnmi.Value[T], bool)
- func (s *SampleStream[T]) Close()
- func (s *SampleStream[T]) Next() *ygnmi.Value[T]
- func (s *SampleStream[T]) Nexts(count int) []*ygnmi.Value[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SampleStream ¶
type SampleStream[T any] struct { // contains filtered or unexported fields }
SampleStream represents a gNMI Subscription with SAMPLE mode.
func New ¶
func New[T any](t *testing.T, dut *ondatra.DUTDevice, q ygnmi.SingletonQuery[T], interval time.Duration) *SampleStream[T]
New creates a new SampleStream.
func (*SampleStream[T]) All ¶
func (s *SampleStream[T]) All() []*ygnmi.Value[T]
All returns the list of values that has been received thus far.
func (*SampleStream[T]) AwaitNext ¶
func (s *SampleStream[T]) AwaitNext(timeout time.Duration, pred func(*ygnmi.Value[T]) bool) (*ygnmi.Value[T], bool)
AwaitNext returns the next sample that satisfies the predicate within the timeout. If no sample is received or does not satisfy the predicate within the timeout, false is returned.
func (*SampleStream[T]) Close ¶
func (s *SampleStream[T]) Close()
Close closes the gnmi subscription.
func (*SampleStream[T]) Next ¶
func (s *SampleStream[T]) Next() *ygnmi.Value[T]
Next returns the next sample received within the sample interval. If no sample is received within the interval, nil is returned.
Click to show internal directories.
Click to hide internal directories.