for stratum enabled switches test vector framework · abhilash endurthi, you wang open networking...

30
Test Vector Framework for Stratum Enabled Switches Abhilash Endurthi, You Wang Open Networking Foundation

Upload: others

Post on 16-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Test Vector Frameworkfor Stratum Enabled Switches

Abhilash Endurthi, You WangOpen Networking Foundation

Page 2: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Introduction● Test Vector Details● Test Vector Runner Details● Next Steps

2

Outline

Page 3: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● What are we trying to achieve?○ Develop set of vendor agnostic tests to certify a switch as Stratum compliant○ Develop a framework (runner) to execute the tests

● How?○ Using black box methodology○ Data driven tests

● What is our device under test?○ Switches running Stratum○ Switches that comply with Stratum open APIs (gNMI, gNOI, P4Runtime)

3

Introduction

Source: Black Box Testing of Stratum Enabled Switches, ONF Connect 2018

Page 4: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Separate test definitions from test infra○ Vendors use different infra/frameworks/programming

languages for testing○ A way to define tests so that they could be easily

supported by various test infra● A compact way of defining test input/output

○ TV = {TCi } where TCi = (Actionsi , Expectationsi )○ Actions and Expectations: Open APIs accesses and

external stimuli (port events, dataplane packet IO, etc.)

Test Vectors Overview

Test Vectors

Test Framework

Switch Under Test

Source: Black Box Testing of Stratum Enabled Switches, ONF Connect 2018

Page 5: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Black Box Testing with Test Vectors

Test Vectors Runner Traffic

generator

Switch Under Test

Test Vectors Generators

Humans

Vendors

TV repo

P4RT gNMI gNOI ports

Source: Black Box Testing of Stratum Enabled Switches, ONF Connect 2018

Test Vector

Test CaseTest CaseTest Case

Action 1Action 2...

Expectation 1Expectation 2...

P4 specs & P4Info

SDN Controller Trace

Topology Info

Page 6: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Introduction● Test Vector Details● Test Vector Runner Details● Next Steps

6

Outline

Page 7: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

• Coded using protobufs• TV protobuf definition is open sourced with Stratum• gNMI, gNOI and P4Runtime also use protobufs• Language specific source code can be generated for classes

using protoc compiler

Test Vector

Page 8: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

8

Test Vector DefinitionTest Vector

Target Test Case

test_case_id Action Group Expectation

action_group_id

Parallel Action Group

Sequential Action Group

Randomized Action Group

Optional attribute

Oneof attribute

Repeated attribute

Page 9: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Action

Action Definition

RequirementConfig

OperationControl Plane

OperationManagement

OperationData Plane

StimulusPort Stimulus Alarm Stimulus

gnmi.SetRequest

gnmi.SetResponse

Write Operation

Packet Out Operation

Pipeline Config Operation

Security Operation

Diag Operation

System Operation

File Operation

Traffic Stimulus gnmi.Path

State

gnmi.Path

Optional attribute

Oneof attribute

Repeated attribute

Page 10: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Expectation DefinitionExpectation

expectation_idControl Plane Expectation

Telemetry Expectation

Data Plane Expectation

gnmi.GetRequest

gnmi.GetResponse

Read Expectation

Packet In Expectation

Pipeline Config Expectation

Requirement

gnmi.SubscribeRequest

Action Group

gnmi.SubscribeResponse

Traffic Expectation

Optional attribute

Oneof attribute

Repeated attribute

Page 11: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Test Vector Examplesequential_action_group: <

>

test_cases: < test_case_id: “tc2”>

test_cases: <

test_case_id: “tc1”>

action_groups: < action_group_id: “ag1”>

action_groups: < action_group_id: “ag2”>

expectations: < expectation_id: “e1”>

expectations: < expectation_id: “e2”>

...

...

...

...

actions: < control_plane_operation: < write_operation: < p4_write_request: < > > >>

actions: < data_plane_operation:< traffic_stimulus:< packets: < payload: “” > ports: 2 > >>

...

control_plane_expectaion: < read_expectation: < p4_read_request: <

> p4_read_response: < > >>

data_plane_expectation: < traffic_expectation: < packets: < payload:”” > ports:2 >>

...

...

Page 12: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

test_cases: < action_groups: < …

action_group_id: “ag1” > action_groups: < …

action_group_id: “ag2” > expectations: < …

expectation_id: “e1” > expectations: < …

expectation_id: “e2” > test_case_id: “tc1”>test_cases: < …

test_case_id: “tc2”>

sequential_action_group: < actions: < control_plane_operation: < write_operation: < p4_write_request: <

...

> > > > actions: < data_plane_operation:< traffic_stimulus:< ...

> > >>

Page 13: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

control_plane_expectation: < read_expectation: < p4_read_request: <

… > p4_read_response: <

… > >>

test_cases: < action_groups: < …

action_group_id: “ag1” > action_groups: < …

action_group_id: “ag2” > expectations: < …

expectation_id: “e1” > expectations: < …

expectation_id: “e2” > test_case_id: “tc1”>test_cases: < …

test_case_id: “tc2”>

data_plane_expectation: < traffic_expectation: < packets: < payload: “” > ports: 2 >>

Page 14: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps
Page 15: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● p4runtime○ PktIoOutDirectToDataPlaneTest○ PktIoOutToIngressPipelineAclPuntToCpuTest○ PktIoOutToIngressPipelineAclRedirectToPortTest○ PktIoOutToIngressPipelineL3ForwardingTest○ PacketIoOutDirectLoopbackPortAclTest○ PacketIoOutDirectLoopbackL3ForwardingTest○ RedirectDataplaneToCpuACLTest○ RedirectDataplaneToCpuNextHopTest○ RedirectDataplaneToDataplaneTest○ L3ForwardTest

15

Test Vectors Implemented

● gnmi○ Subscribe_Health_Indicator○ Config_expectation_1○ Config_expectation_2○ …○ Config_expectation_36

● e2e○ SubRedirectDataplaneToDataplane

● Targets supported: bmv2, Barefoot Tofino, Broadcom Tomahawk

Page 16: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Introduction● Test Vector Details● Test Vector Runner Details● Next Steps

16

Outline

Page 17: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Reference implementation written in Golang○ Uses Go testing framework

● Target independent○ Runs with bmv2/hardware switches○ By reading different input files: target/port-map/test vectors

● Easy to deploy○ Provides tools to deploy and run as container/binary

17

Test Vector Runner

Page 18: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

gRPC

orchestrator

18

Test Vector Runner Architecture

main

Action Processor

Switch Under Test

Expectation Processor

Framework

P4RT gNMI Dataplane

Logger

Packet

Connect

...

Data planeinterfaces

Test Vector

Test CaseTest Case

...

Test Case

Action 1Action 2...

Expectation 1Expectation 2...

Test Vector

Test Vector

Page 19: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Test Suite testing.main( []testing.InternalTest{

} )

Test Vector A

Test Vectors and Go Testing

Action 1: p4_writeAction 2: packet_out...Expectation 1: gnmi_getExpectation 2: packet_exp...

Test Vector B

Test Case 2

testing.InternalTest{ Name: “Test_Vector_A” F: func(t *testing.T) {

}}

testing.InternalTest{ Name: “Test_Vector_B” F: func(t *testing.T) {}}

t.Run(“Test_Case_1”, func(t *testing.T) {

}

...

...

ProcessP4WriteRequest(request) ProcessPacketOutOperation(request) ... ProcessGnmiGetRequest(request) ProcessTrafficExpectation(packet, port) ...

t.Run(“Test_Case_2”, func(t *testing.T) {}

Page 20: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Action

20

TV Runner - Actions

RequirementConfig

OperationControl Plane

OperationManagement

OperationData Plane

StimulusPort Stimulus Alarm Stimulus

gnmi.SetRequest

gnmi.SetResponse

Write Operation

Packet Out Operation

Pipeline Config Operation

Security Operation

Diag Operation

System Operation

File Operation

Traffic Stimulus gnmi.Path

State

gnmi.Path

Optional attribute

Oneof attribute

Repeated attribute

Implemented

Not implemented

Page 21: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

21

TV Runner - ExpectationsExpectation

expectation_idConfig

ExpectationControl Plane Expectation

Telemetry Expectation

Data Plane Expectation

gnmi.GetRequest

gnmi.GetResponse

Read Expectation

Packet In Expectation

Pipeline Config Expectation

Requirement

gnmi.SubscribeRequest

Action Group

gnmi.SubscribeResponse

Traffic Expectation

Optional attribute

Oneof attribute

Repeated attribute

Implemented

Not implemented

Page 22: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Test Execution

Page 23: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Test Execution

Page 24: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Container

Data plane interfaces

gRPC

24

Deployment Scenarios

Hardware Switch

Server

bmv2Software Switch

TV Runner

TV Repo

TV Runner

vethgRPC

TV Runner Repo

deploy

deploy

Scenario 1 Scenario 2

Page 25: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Introduction● Test Vector Details● Test Vector Runner Details● Next Steps

25

Outline

Page 26: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Hand written test vectors ○ Tedious○ Time consuming○ Error prone○ Hard to debug

● Semi automatically generated○ P4RT write requests from stratum log○ Pipeline config from P4RT generated

binaries and json files○ gNMI get operations using list of

paths26

Test Vector Generation - Current Approach

Page 27: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Automatic generation of test vectors based on input from○ Chassis config○ SDN controller trace○ ATPG (Automatic Test Packet Generation)

27

Test Vector Generation - Next Steps

Page 28: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Container Hardware Switch

HardwareSwitch

28

More Testing Scenarios

Server

TV Runner

TV RepoTV Runner Repodeploy

Scenario 1 Scenario 2 Scenario 3

ASICgRPC

Port 1 Port 2

PktOut PktIn

Server

TV Runner

Scenario 4

Traffic Generator

gRPC

deploy

Page 29: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

● Test Vectors○ Adding more test vectors to the repo○ Adding test vector generators, utility functions for automated

test vector generation● Test Vector Runner

○ Support missing operations○ Support more deployment scenarios

29

Call for Community Help

Page 30: for Stratum Enabled Switches Test Vector Framework · Abhilash Endurthi, You Wang Open Networking Foundation Introduction Test Vector Details Test Vector Runner Details Next Steps

Thank You

Follow Up Links:https://stratumproject.slack.com/

[email protected] [email protected]