Documentation ¶
Overview ¶
Package basic is a suite of basic functionality tests for the fabric simulator
Index ¶
- func ApplyPipelineConfig(ctx context.Context, client p4api.P4RuntimeClient, deviceID uint64, ...) error
- func ApplyPipelineConfigAndWriteEntries(ctx context.Context, t *testing.T, wg *sync.WaitGroup, info *p4info.P4Info, ...)
- func CleanUp(t *testing.T)
- func GenerateAndWriteTableEntries(ctx context.Context, client p4api.P4RuntimeClient, request *p4api.WriteRequest, ...) error
- func GetP4Client(t *testing.T, device *simapi.Device) (p4api.P4RuntimeClient, *grpc.ClientConn)
- func InstallPuntRule(ctx context.Context, p4sw2a p4api.P4RuntimeClient, chassisID uint64, ...) error
- func LoadAndValidate(t *testing.T, path string, devices int, links int, hosts int, ...) ([]*simapi.Device, []*simapi.Link, []*simapi.Host)
- func ProbeAllDevices(t *testing.T, devices []*simapi.Device)
- func ReadEntries(ctx context.Context, t *testing.T, wg *sync.WaitGroup, device *simapi.Device, ...)
- func StartStream(ctx context.Context, t *testing.T, client p4api.P4RuntimeClient, ...) p4api.P4Runtime_StreamChannelClient
- func ValidateLLDPPacket(t *testing.T, msg *p4api.StreamMessageResponse, chassisID string, ...)
- func ValidateNoPendingMessage(t *testing.T, stream p4api.P4Runtime_StreamChannelClient)
- type DevicePortCount
- type HostNICCount
- type TestSuite
- func (s *TestSuite) SetupTestSuite(c *input.Context) error
- func (s *TestSuite) TestAccessFabricLoad(t *testing.T)
- func (s *TestSuite) TestFixedFabricLoad(t *testing.T)
- func (s *TestSuite) TestGNMI(t *testing.T)
- func (s *TestSuite) TestLLDPPacket(t *testing.T)
- func (s *TestSuite) TestPlainFabricLoad(t *testing.T)
- func (s *TestSuite) TestPodFabricLoad(t *testing.T)
- func (s *TestSuite) TestReadWrite(t *testing.T)
- func (s *TestSuite) TestTopologyLoad(t *testing.T)
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 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 ¶
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 ¶
DevicePortCount returns the expected number of ports for a devuce
type HostNICCount ¶
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 ¶
SetupTestSuite sets up the fabric simulator basic test suite
func (*TestSuite) TestAccessFabricLoad ¶
TestAccessFabricLoad loads simulator with the access.yaml topology and validates proper startup
func (*TestSuite) TestFixedFabricLoad ¶
TestFixedFabricLoad loads simulator with the fixed_fabric.yaml topology and validates proper startup
func (*TestSuite) TestGNMI ¶
TestGNMI loads simulator with access fabric topology, and tests basic gNMI operations
func (*TestSuite) TestLLDPPacket ¶
TestLLDPPacket tests the LLDP packet-out handling
func (*TestSuite) TestPlainFabricLoad ¶
TestPlainFabricLoad loads simulator with the plain_mid.yaml topology and validates proper startup
func (*TestSuite) TestPodFabricLoad ¶
TestPodFabricLoad loads simulator with the pod.yaml topology and validates proper startup
func (*TestSuite) TestReadWrite ¶
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 ¶
TestTopologyLoad loads simulator with custom.yaml topology and validates proper startup