basic

package
v0.0.0-...-feb2584 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package basic is a suite of basic functionality tests for the fabric simulator

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPipelineConfig

func ApplyPipelineConfig(ctx context.Context, client p4api.P4RuntimeClient, deviceID uint64, role string, electionID *p4api.Uint128,
	cookie uint64, info *p4info.P4Info) error

ApplyPipelineConfig applies the forwarding pipeline configuration using the given device P4RT client

func ApplyPipelineConfigAndWriteEntries

func ApplyPipelineConfigAndWriteEntries(ctx context.Context, t *testing.T, wg *sync.WaitGroup,
	info *p4info.P4Info, device *simapi.Device, totalEntries int)

ApplyPipelineConfigAndWriteEntries negotiates mastership, applies pipeline config and writes a slew of table entries to all the device's tables

func CleanUp

func CleanUp(t *testing.T)

CleanUp cleans up the simulation

func GenerateAndWriteTableEntries

func GenerateAndWriteTableEntries(ctx context.Context, client p4api.P4RuntimeClient, request *p4api.WriteRequest, info *p4info.P4Info, count int) error

GenerateAndWriteTableEntries generates specified number of entries spread randomly between all the device tables and inserts them

func GetP4Client

func GetP4Client(t *testing.T, device *simapi.Device) (p4api.P4RuntimeClient, *grpc.ClientConn)

GetP4Client returns a new P4Runtime service client and its underlying connection for the given device

func InstallPuntRule

func InstallPuntRule(ctx context.Context, p4sw2a p4api.P4RuntimeClient, chassisID uint64, roleName string, electionID *p4api.Uint128, ethType uint16) error

InstallPuntRule installs rule matching on the specified eth type with action to punt to CPU

func LoadAndValidate

func LoadAndValidate(t *testing.T, path string, devices int, links int, hosts int,
	portsPerDevice DevicePortCount, nicsPerHost HostNICCount) ([]*simapi.Device, []*simapi.Link, []*simapi.Host)

LoadAndValidate loads the specified topology and validates the correct counts of devices, links and hosts

func ProbeAllDevices

func ProbeAllDevices(t *testing.T, devices []*simapi.Device)

ProbeAllDevices tests each device P4Runtime agent port by requesting capabilities

func ReadEntries

func ReadEntries(ctx context.Context, t *testing.T, wg *sync.WaitGroup, device *simapi.Device, totalEntries int)

ReadEntries reads all device's tables' entries and makes sure their total count is as expected

func StartStream

func StartStream(ctx context.Context, t *testing.T, client p4api.P4RuntimeClient, electionID *p4api.Uint128, electionCode int32) p4api.P4Runtime_StreamChannelClient

StartStream opens a new stream using the specified client and negotiates mastership using the supplied election ID Then it returns the new stream client.

func ValidateLLDPPacket

func ValidateLLDPPacket(t *testing.T, msg *p4api.StreamMessageResponse, chassisID string, ingressPortNumber uint32, sdnPortNumber uint32)

ValidateLLDPPacket makes sure that the specified message is a packet in with an LLDP packet with an expected port

func ValidateNoPendingMessage

func ValidateNoPendingMessage(t *testing.T, stream p4api.P4Runtime_StreamChannelClient)

ValidateNoPendingMessage makes sure that the specified stream has no pending messages; blocks until message or error

Types

type DevicePortCount

type DevicePortCount func(device *simapi.Device) int

DevicePortCount returns the expected number of ports for a devuce

type HostNICCount

type HostNICCount func(host *simapi.Host) int

HostNICCount returns the expected number of NICs for a host

type TestSuite

type TestSuite struct {
	// contains filtered or unexported fields
}

TestSuite is the basic test suite

func (*TestSuite) SetupTestSuite

func (s *TestSuite) SetupTestSuite(c *input.Context) error

SetupTestSuite sets up the fabric simulator basic test suite

func (*TestSuite) TestAccessFabricLoad

func (s *TestSuite) TestAccessFabricLoad(t *testing.T)

TestAccessFabricLoad loads simulator with the access.yaml topology and validates proper startup

func (*TestSuite) TestFixedFabricLoad

func (s *TestSuite) TestFixedFabricLoad(t *testing.T)

TestFixedFabricLoad loads simulator with the fixed_fabric.yaml topology and validates proper startup

func (*TestSuite) TestGNMI

func (s *TestSuite) TestGNMI(t *testing.T)

TestGNMI loads simulator with access fabric topology, and tests basic gNMI operations

func (*TestSuite) TestLLDPPacket

func (s *TestSuite) TestLLDPPacket(t *testing.T)

TestLLDPPacket tests the LLDP packet-out handling

func (*TestSuite) TestPlainFabricLoad

func (s *TestSuite) TestPlainFabricLoad(t *testing.T)

TestPlainFabricLoad loads simulator with the plain_mid.yaml topology and validates proper startup

func (*TestSuite) TestPodFabricLoad

func (s *TestSuite) TestPodFabricLoad(t *testing.T)

TestPodFabricLoad loads simulator with the pod.yaml topology and validates proper startup

func (*TestSuite) TestReadWrite

func (s *TestSuite) TestReadWrite(t *testing.T)

TestReadWrite loads simulator with access fabric topology, primes all switches forwarding pipeline config and then writes entries into all their tables and reads them back

func (*TestSuite) TestTopologyLoad

func (s *TestSuite) TestTopologyLoad(t *testing.T)

TestTopologyLoad loads simulator with custom.yaml topology and validates proper startup

Jump to

Keyboard shortcuts

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