attrs

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 5 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
	IPv6    string
	MAC     string
	Name    string // Interface name, only applied to ATE ports.
	Desc    string // Description, only applied to DUT interfaces.
	IPv4Len uint8  // Prefix length for IPv4.
	IPv6Len uint8  // Prefix length for IPv6.
	MTU     uint16
}

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) AddToOTG

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

AddToOTG adds basic elements to a gosnappi configuration

func (*Attributes) ConfigOCInterface

func (a *Attributes) ConfigOCInterface(intf *oc.Interface, _ *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