The diagram below shows the high level structure of a Test Vector:
On a high level, each test vector contains:
test_case_id
- Unique identifier for the test case in the Test Vector.- Multiple
Action Groups
- Each action group is set of actions that can be executed sequentially or in parallel or random order. - Multiple Expectations - These are executed after all the actions are executed to verify expected system state.
Types of action supported in Test Vectors:
Config operation contains gNMI
SetRequest and gNMI
SetResponse for performing port speed change, port admin state change, config state change etc and for verifying corresponding RPC response.
Control plane operation supports various P4Runtime
operations.
Write Operation
containsP4
WriteRequest for sending all the forwarding entries, andP4
Write_Response for verifying corresponding RPC response.Packet Out Operation
containsP4
PacketOut for sending packet to switching chip via its CPU port. It also contains other attributes such asnum_of_packets
to be sent out,min_speed_bps
,max_speed_bps
at which packets will be sent to the CPU port, andcos
- class of service for the packets.Pipeline Config Operation
containsP4
SetForwardingPipelineConfigRequest to push to the switch for setting the config via P4Runtime API, andP4
SetForwardingPipelineConfigResponse for verifying corresponding RPC response.
[TODO]
Data plane stimulus is an external operation to send traffic to data plane port. It contains TrafficStimulus
which has various attributes. device_id
defined in the pipeline config pushed beforehand, port
to send the packets to, Multiple Packets
to be sent one after the other to the port, num_of replicas
of the packet, min_speed_bps
, max_speed_bps
at which packets will be generated, and cos
- class of service for the packets.
[TODO]
[TODO]
Types of expectation supported in Test Vectors:
Config expectation has gNMI
GetRequest containing data elements and gNMI
GetResponse containing expected RPC response with data values requested in the GetRequest.
Control plane expectation supports various P4Runtime
get operations.
Read Expectation
containsP4
ReadRequest for fetching entries from switch and multipleP4
ReadResponses expected as result of the RPC.Packet In Expectation
containsP4
PacketIn for receiving packet from switching chip on its CPU port. It also contains other attributes such asnum_of_packets
to be received,min_speed_bps
,max_speed_bps
at which packets will be received at the CPU port, andcos
- class of service for the packets.Pipeline Config Expectation
containsP4
GetForwardingPipelineConfigRequest to fetch the pipeline config from the switch via P4Runtime API, andP4
GetForwardingPipelineConfigResponse for verifying corresponding RPC response.
Telemetry expectation is used to test gNMI subscription operation. As part of this, a subscription channel is opened with one subscribe request, optionally some actions are performed and all the subscription responses received on the channel are verified.
Telemetry expectation contains single gNMI
SubscribeRequest to send over the stream, an ActionGroup
with set of actions to be run after the subscription stream is created and request has been sent, multiple gNMI
SubscribeResponses to be verified as soon as the subscription stream is created. The order of responses should match the order of the messages read from channel. To enforce a specific time limit for receiving all the responses and closing the channel, Requirement
[TODO] attribute is defined.
Data plane expectation is an external expectation to receive traffic from one of the data plane ports. It contains TrafficExpectation
which has various attributes. device_id
defined in the pipeline config pushed beforehand, multiple ports
from which output packets may come out, Multiple Packets
to be received on the port(s), num_of replicas
of the packet, min_speed_bps
, max_speed_bps
at which packets will be received, cos
- class of service for the packets, and Distribution
(TODO) in case packets are sent to an ECMP group.