Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 6.53 KB

testvectors_overview.md

File metadata and controls

50 lines (41 loc) · 6.53 KB

Overview of Test Vectors

Contents of Test Vector

The diagram below shows the high level structure of a Test Vector: Test Vector structure

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.

Contents of Action

Action structure Types of action supported in Test Vectors:

Config Operation

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

Control plane operation supports various P4Runtime operations.

  • Write Operation contains P4 WriteRequest for sending all the forwarding entries, and P4 Write_Response for verifying corresponding RPC response.
  • Packet Out Operation contains P4 PacketOut for sending packet to switching chip via its CPU port. It also contains other attributes such as num_of_packets to be sent out, min_speed_bps, max_speed_bps at which packets will be sent to the CPU port, and cos- class of service for the packets.
  • Pipeline Config Operation contains P4 SetForwardingPipelineConfigRequest to push to the switch for setting the config via P4Runtime API, and P4 SetForwardingPipelineConfigResponse for verifying corresponding RPC response.

Management Operation

[TODO]

Data Plane Stimulus

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.

Port Stimulus

[TODO]

Alarm Stimulus

[TODO]

Contents of Expectation

Expectation structure Types of expectation supported in Test Vectors:

Config Expectation

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

Control plane expectation supports various P4Runtime get operations.

  • Read Expectation contains P4 ReadRequest for fetching entries from switch and multiple P4 ReadResponses expected as result of the RPC.
  • Packet In Expectation contains P4 PacketIn for receiving packet from switching chip on its CPU port. It also contains other attributes such as num_of_packets to be received, min_speed_bps, max_speed_bps at which packets will be received at the CPU port, and cos- class of service for the packets.
  • Pipeline Config Expectation contains P4 GetForwardingPipelineConfigRequest to fetch the pipeline config from the switch via P4Runtime API, and P4 GetForwardingPipelineConfigResponse for verifying corresponding RPC response.

Telemetry Expectation

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

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.