attrs

package
v0.0.0-...-e8efe0d Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package attrs bundles some common interface attributes and provides helpers to generate the appropriate OpenConfig and ATETopology.

The use of this package in new tests is discouraged. Legacy tests using this package will be migrated to use testbed topology helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	IPv4         string
	IPv4Sec      string // Secondary IPv4 address
	IPv6         string
	MAC          string
	Name         string // Interface name, only applied to ATE ports.
	Desc         string // Description, only applied to DUT interfaces.
	Subinterface uint32 //Subinterface
	IPv4Len      uint8  // Prefix length for IPv4.
	IPv4LenSec   uint8  // Prefix length for Secondary IPv4 address.
	IPv6Len      uint8  // Prefix length for IPv6.
	MTU          uint16
	ID           uint32 // /interfaces/interface/state/id p4rt interface id
}

Attributes bundles some common attributes for devices and/or interfaces. It provides helpers to generate appropriate configuration for OpenConfig and for an ATETopology. All fields are optional; only those that are non-empty will be set when configuring an interface.

func (*Attributes) AddToATE

func (a *Attributes) AddToATE(top *ondatra.ATETopology, ap *ondatra.Port, peer *Attributes) *ondatra.Interface

AddToATE adds a new interface to an ATETopology with these attributes.

func (*Attributes) AddToOTG

func (a *Attributes) AddToOTG(top gosnappi.Config, ap *ondatra.Port, peer *Attributes) gosnappi.Device

AddToOTG adds basic elements to a gosnappi configuration

func (*Attributes) ConfigOCInterface

func (a *Attributes) ConfigOCInterface(intf *oc.Interface, dut *ondatra.DUTDevice) *oc.Interface

ConfigOCInterface configures an OpenConfig interface with these attributes.

func (*Attributes) IPv4CIDR

func (a *Attributes) IPv4CIDR() string

IPv4CIDR constructs the IPv4 CIDR notation with the given prefix length, e.g. "192.0.2.1/30".

func (*Attributes) IPv6CIDR

func (a *Attributes) IPv6CIDR() string

IPv6CIDR constructs the IPv6 CIDR notation with the given prefix length, e.g. "2001:db8::1/126".

func (*Attributes) NewOCInterface

func (a *Attributes) NewOCInterface(name string, dut *ondatra.DUTDevice) *oc.Interface

NewOCInterface returns a new *oc.Interface configured with these attributes.

Jump to

Keyboard shortcuts

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