netutil

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package netutil provides network-related helper functions for testing.

Among the various utilities in this package are several helpers that wrap functions in the entity naming library to make tests less verbose. For example, production might generate the name of a loopback interface for a device with the following code:

dev := &entname.DeviceParams{
	Vendor: devVendor,
	HardwareModel: devHardwareModel,
}
lbIntf, err := entname.LoopbackInterface(deviceParams, 0)
if err != nil {
	return err
}

Using LoopbackInterface, an Ondatra test can do the equivalent in a single line, reusing an existing Ondatra DUT:

lbIntf := netutil.LoopbackInterface(t, dut, 0)

Index

Constants

View Source
const DefaultNetworkInstance = "DEFAULT"

DefaultNetworkInstance is the constant name for referring to the default network instance on the device. It has been standardized in OpenConfig.

Variables

This section is empty.

Functions

func AggregateInterface added in v0.1.22

func AggregateInterface(t *testing.T, dut *ondatra.DUTDevice, index int) string

AggregateInterface returns the vendor-specific name of the aggregate interface with the specified zero-based index.

func CommonQoSQueues added in v0.2.8

func CommonQoSQueues(t *testing.T, dut *ondatra.DUTDevice, qos *entname.QoSParams) *entname.CommonQoSQueueNames

CommonQoSQueues returns the vendors-specific names of common QoS queues. See the common QoS queue definitions here: https://github.com/openconfig/entity-naming#common-qos-queues

func CommonTrafficQueues added in v0.1.22

func CommonTrafficQueues(t *testing.T, dut *ondatra.DUTDevice) *entname.CommonTrafficQueueNames

CommonTrafficQueues returns the vendors-specific names of common traffic class queues. See the definition of common queues here: Deprecated: Use CommonQosQueues instead.

func GenCIDRs added in v0.4.2

func GenCIDRs(t testing.TB, cidr string, count int) <-chan string

GenCIDRs returns a channel of the specified number of CIDR strings starting from the given CIDR.

func GenSystemIDs added in v0.4.2

func GenSystemIDs(t testing.TB, startID string, count int) <-chan string

GenSystemIDs returns a channel of the specified number of hex-formatted system IDs.

func LoopbackInterface

func LoopbackInterface(t *testing.T, dut *ondatra.DUTDevice, index int) string

LoopbackInterface returns the vendor-specific name of the loopback interface with the specified zero-based index.

func MeanRate

func MeanRate[T constraints.Integer | constraints.Float](t testing.TB, vals []*ygnmi.Value[T]) float64

MeanRate calculates the average rate across the supplied interval from the values supplied in the vals slice. It sorts the values by timestamp and uses the earliest and latest to calculate the rate. Errors are reported using the supplied testing.TB.

func NextAggregateInterface added in v0.1.19

func NextAggregateInterface(t *testing.T, dut *ondatra.DUTDevice) string

NextAggregateInterface returns the aggregate interface with the lowest non-zero index that according to the dut's telemetry is not yet configured.

Types

This section is empty.

Jump to

Keyboard shortcuts

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