otgconfighelpers

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: 3 Imported by: 0

Documentation

Overview

Package otgconfighelpers provides helper functions to setup Protocol configurations on traffic generators.

Index

Constants

View Source
const (
	IanaMPLSEthertype = 34887
	IanaIPv4Ethertype = 2048
	IanaIPv6Ethertype = 34525
)

Iana Ethertype is the IANA Ethertype for MPLS, IPv4 and IPv6.

Variables

This section is empty.

Functions

func ConfigureOtgInterface

func ConfigureOtgInterface(t *testing.T, top gosnappi.Config, intf *InterfaceProperties, a *Port)

ConfigureOtgInterface configures the Ethernet for the LAG or subinterface.

func ConfigureOtgLag

func ConfigureOtgLag(t *testing.T, top gosnappi.Config, ate *ondatra.ATEDevice, a *Port)

ConfigureOtgLag configures the aggregate port.

func ConfigureOtgLagMemberPort

func ConfigureOtgLagMemberPort(agg gosnappi.Lag, portID string, a *Port, index int)

ConfigureOtgLagMemberPort configures the member port in the LAG.

func ConfigureOtgNetworkInterface

func ConfigureOtgNetworkInterface(t *testing.T, top gosnappi.Config, ate *ondatra.ATEDevice, a *Port)

ConfigureOtgNetworkInterface configures the network interface.

Types

type EthFlowParams

type EthFlowParams struct {
	SrcMAC      string
	DstMAC      string
	SrcMACCount uint32
}

EthFlowParams is a struct to hold Ethernet traffic parameters.

type Flow

type Flow struct {
	TxNames   []string
	RxNames   []string
	FrameSize uint32
	FlowName  string
	VLANFlow  *VLANFlowParams
	GREFlow   *GREFlowParams
	EthFlow   *EthFlowParams
	IPv4Flow  *IPv4FlowParams
	IPv6Flow  *IPv6FlowParams
	TCPFlow   *TCPFlowParams
	UDPFlow   *UDPFlowParams
	MPLSFlow  *MPLSFlowParams
	// contains filtered or unexported fields
}

Flow is a struct to hold Flow parameters. TxNames and RxNames should be set to a valid OTG endpoint name. Creating basic IPv4 Flow.

top = gosnappi.NewConfig()

FlowIPv4 = &Flow{
  TxNames:   []string{"interface1"},
  RxNames:   []string{"interface2"},
  FrameSize: 1500,
  FlowName:  "IPv4Flow",
  EthFlow:   &EthFlowParams{SrcMAC: "00:11:22:33:44:55", DstMAC: "00:11:22:33:44:66"},
  IPv4Flow:  &IPv4FlowParams{IPv4Src: "192.0.2.1", IPv4Dst: "192.0.2.129", IPv4DstCount: 10},
}

FlowIPv4.CreateFlow(top) FlowIPv4.AddEthHeader() FlowIPv4.AddIPv4Header()

func (*Flow) AddEthHeader

func (f *Flow) AddEthHeader()

AddEthHeader adds an Ethernet header to the flow.

func (*Flow) AddGREHeader

func (f *Flow) AddGREHeader()

AddGREHeader adds a GRE header to the flow.

func (*Flow) AddIPv4Header

func (f *Flow) AddIPv4Header()

AddIPv4Header adds an IPv4 header to the flow.

func (*Flow) AddIPv6Header

func (f *Flow) AddIPv6Header()

AddIPv6Header adds an IPv6 header to the flow.

func (*Flow) AddMPLSHeader

func (f *Flow) AddMPLSHeader()

AddMPLSHeader adds an MPLS header to the flow.

func (*Flow) AddTCPHeader

func (f *Flow) AddTCPHeader()

AddTCPHeader adds a TCP header to the flow.

func (*Flow) AddUDPHeader

func (f *Flow) AddUDPHeader()

AddUDPHeader adds a UDP header to the flow.

func (*Flow) AddVlanHeader

func (f *Flow) AddVlanHeader()

AddVlanHeader adds a VLAN header to the flow.

func (*Flow) CreateFlow

func (f *Flow) CreateFlow(top gosnappi.Config)

CreateFlow defines Tx and Rx end points for traffic flow.

type GREFlowParams

type GREFlowParams struct {
	Protocol uint32
}

GREFlowParams is a struct to hold Ethernet traffic parameters.

type IPv4FlowParams

type IPv4FlowParams struct {
	IPv4Src      string
	IPv4Dst      string
	IPv4SrcCount uint32
	IPv4DstCount uint32
	TTL          uint32
}

IPv4FlowParams is a struct to hold IPv4 traffic parameters.

type IPv6FlowParams

type IPv6FlowParams struct {
	IPv6Src      string
	IPv6Dst      string
	IPv6SrcCount uint32
	IPv6DstCount uint32
	HopLimit     uint32
}

IPv6FlowParams is a struct to hold IPv6 traffic parameters.

type InterfaceProperties

type InterfaceProperties struct {
	IPv4        string
	IPv4Gateway string
	IPv6        string
	IPv6Gateway string
	Name        string
	Vlan        uint32
	IPv4Len     uint32
	IPv6Len     uint32
	Mac         string
}

InterfaceProperties is a struct to hold interface data.

type MPLSFlowParams

type MPLSFlowParams struct {
	MPLSLabel uint32
	MPLSExp   uint32
}

MPLSFlowParams is a struct to hold MPLS traffic parameters.

type Port

type Port struct {
	Name        string
	AggMAC      string
	Interfaces  []*InterfaceProperties
	MemberPorts []string
	LagID       uint32
	Islag       bool
}

Port is a struct to hold aggregate/physical port data.

Usage for Aggregate port:

  agg1 = &otgconfighelpers.Port{
	Name:        "Port-Channel1",
	AggMAC:      "02:00:01:01:01:07",
	Interfaces:  []*otgconfighelpers.InterfaceProperties{interface1, interface2, interface3, interface4, interface5, interface6},
	MemberPorts: []string{"port1", "port2"},
	LagID:       1,
	Islag:       true,
}

Usage for Physical port:

phy1 = &otgconfighelpers.Port{
	Name:        "port1",
	Interfaces:  []*otgconfighelpers.InterfaceProperties{interface1, interface2, interface3, interface4, interface5, interface6},
}

Interface properties has attributes required for creating interfaces/subinterfaces on the port..

interface1 = &otgconfighelpers.InterfaceProperties{
	IPv4:        "169.254.0.12",
	IPv4Gateway: "169.254.0.11",
	Name:        "Port-Channel1.20",
	Vlan:        20,
	IPv4Len:     29,
	Mac:         "02:00:01:01:01:08",
}

type TCPFlowParams

type TCPFlowParams struct {
	TCPSrcPort  uint32
	TCPDstPort  uint32
	TCPSrcCount uint32
	TCPDstCount uint32
}

TCPFlowParams is a struct to hold TCP traffic parameters.

type UDPFlowParams

type UDPFlowParams struct {
	UDPSrcPort  uint32
	UDPDstPort  uint32
	UDPSrcCount uint32
	UDPDstCount uint32
}

UDPFlowParams is a struct to hold UDP traffic parameters.

type VLANFlowParams

type VLANFlowParams struct {
	VLANId uint32
}

VLANFlowParams is a struct to hold VLAN traffic parameters.

Jump to

Keyboard shortcuts

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