blob: 10108a6c4fc7f849c1bdea855f49893d1ee5ba03 [file] [log] [blame]
Abhilash Endurthid4caf282021-04-13 18:20:20 -07001..
2 SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org>
3 SPDX-License-Identifier: Apache-2.0
4
5PDP Testing
6==============
7
8
9Test Framework
10--------------
11
12We use `TestVectors`_ to connect to Stratum hardware switches using gRPC and execute gNMI and P4Runtime tests.
13For Aether, we convert existing ptf unit tests written for fabric-tna to TestVectors and execute them on Stratum
14hardware switches in loopback mode using `TestVectors-Runner`_.
15
16We use Jenkins to schedule and trigger our tests which run against a set of hardware switches.
17
18Test Scenarios
19-------------------
20
Zack Williams4c1eab92021-05-28 11:37:14 -070021fabric-tna is a P4 program based on the Tofino Native Architecture(TNA). Currently 4 profiles are supported for
Abhilash Endurthid4caf282021-04-13 18:20:20 -070022compiling the fabric-tna P4 program.
23
241. fabric
252. fabric-spgw
263. fabric-int
274. fabric-spgw-int
28
29Based on the ptf unit tests for fabric-tna, we generate TestVectors for each profile to run on Stratum hardware
30switches. The names of generated tests can be found in `Test List`_.
31
32Prerequisites to Generate, Run Tests
33--------------------------------------
341. Stratum running on a hardware switch with 4 ports running in loopback mode.
352. Create a port-map similar to `port-map`_. The three fields are ptf_port, p4_port and iface_name.
36 ptf_port is the port id used in the test, p4_port is a valid port id from Stratum hardware.
37 iface_name is ignored in TestVector generation, this can be any value.
38
39How to Generate TestVectors
40--------------------------------------
411. Checkout fabric-tna repo.
42
43.. code-block:: shell
44
45 $git clone https://github.com/stratum/fabric-tna.git
46 $cd fabric-tna
47
482. Compile the P4 program for specific profile.
49
50.. code-block:: shell
51
52 $make <profile>
53
54Supported profiles are: fabric, fabric-spgw, fabric-int, fabric-spgw-int.
55
563. Generate TestVectors.
57
58.. code-block:: shell
59
60 $cd ptf
61 $run/tv/run <profile> PORTMAP=port_map.json GRPCADDR=<switch_ip>:<switch_port> CPUPORT=<cpu_port>
62
63switch_ip and switch_port are IP and port where Stratum is running.
64cpu_port is 192 for dual pipe switch and 320 for quad pipe switch.
65Generated TestVectors are stored under 'fabric-tna/ptf/TestVectors'.
66
67How to Run TestVectors
68--------------------------------------
691. Checkout `TestVectors-Runner`_ repo.
70
71.. code-block:: shell
72
73 $git clone https://github.com/stratum/testvectors-runner -b support-fabric-tna
74 $cd testvectors-runner
75
762. Build tv-runner docker image.
77
78.. code-block:: shell
79
80 $docker build -t tvrunner:fabric-tna-binary -f build/test/Dockerfile .
81
823. Push PipelineConfig.
83
84.. code-block:: shell
85
86 $IMAGE_NAME=tvrunner:fabric-tna-binary ./tvrunner.sh --target ${tv_dir}/target.pb.txt --portmap ${tv_dir}/portmap.pb.txt --tv-dir ${tv_dir} --dp-mode loopback --tv-name PipelineConfig
87
884. Run Setup.
89
90.. code-block:: shell
91
92 $IMAGE_NAME=tvrunner:fabric-tna-binary ./tvrunner.sh --dp-mode loopback --match-type in --target ${tv_dir}/target.pb.txt --portmap ${tv_dir}/portmap.pb.txt --tv-dir ${tv_dir}/${test_name}/setup
93
945. Run TestVector.
95
96.. code-block:: shell
97
98 $IMAGE_NAME=tvrunner:fabric-tna-binary ./tvrunner.sh --dp-mode loopback --match-type in --target ${tv_dir}/target.pb.txt --portmap ${tv_dir}/portmap.pb.txt --tv-dir ${tv_dir}/${test_name} --tv-name ${test_name}.* --result-dir ./results --result-file ${test_name}
99
1006. Run Teardown.
101
102.. code-block:: shell
103
104 $IMAGE_NAME=tvrunner:fabric-tna-binary ./tvrunner.sh --dp-mode loopback --match-type in --target ${tv_dir}/target.pb.txt --portmap ${tv_dir}/portmap.pb.txt --tv-dir ${tv_dir}/${test_name}/teardown
105
106tv_dir is the directory where TestVectors are stored. In this case, tv_dir is 'fabric-tna/ptf/TestVectors'.
107tv_name is the name of the test case. It's also the directory name of the test under 'fabric-tna/ptf/TestVectors'.
108
109Results for each test are generated under 'testvectors-runner/results' directory in csv format.
110
111.. _TestVectors: https://github.com/stratum/testvectors
112.. _TestVectors-Runner: https://github.com/stratum/testvectors-runner/tree/support-fabric-tna
113.. _Test List: https://github.com/stratum/stratum-ci/blob/master/ptf_tv_resources/converted-tests.yaml
114.. _port-map: https://github.com/stratum/stratum-ci/blob/master/ptf_configs/x86-64-stordis-bf2556x-1t-r0/port_map.json