Abhilash Endurthi | d4caf28 | 2021-04-13 18:20:20 -0700 | [diff] [blame] | 1 | .. |
| 2 | SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org> |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | PDP Testing |
| 6 | ============== |
| 7 | |
| 8 | |
| 9 | Test Framework |
| 10 | -------------- |
| 11 | |
| 12 | We use `TestVectors`_ to connect to Stratum hardware switches using gRPC and execute gNMI and P4Runtime tests. |
| 13 | For Aether, we convert existing ptf unit tests written for fabric-tna to TestVectors and execute them on Stratum |
| 14 | hardware switches in loopback mode using `TestVectors-Runner`_. |
| 15 | |
| 16 | We use Jenkins to schedule and trigger our tests which run against a set of hardware switches. |
| 17 | |
| 18 | Test Scenarios |
| 19 | ------------------- |
| 20 | |
Zack Williams | 4c1eab9 | 2021-05-28 11:37:14 -0700 | [diff] [blame] | 21 | fabric-tna is a P4 program based on the Tofino Native Architecture(TNA). Currently 4 profiles are supported for |
Abhilash Endurthi | d4caf28 | 2021-04-13 18:20:20 -0700 | [diff] [blame] | 22 | compiling the fabric-tna P4 program. |
| 23 | |
| 24 | 1. fabric |
| 25 | 2. fabric-spgw |
| 26 | 3. fabric-int |
| 27 | 4. fabric-spgw-int |
| 28 | |
| 29 | Based on the ptf unit tests for fabric-tna, we generate TestVectors for each profile to run on Stratum hardware |
| 30 | switches. The names of generated tests can be found in `Test List`_. |
| 31 | |
| 32 | Prerequisites to Generate, Run Tests |
| 33 | -------------------------------------- |
| 34 | 1. Stratum running on a hardware switch with 4 ports running in loopback mode. |
| 35 | 2. 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 | |
| 39 | How to Generate TestVectors |
| 40 | -------------------------------------- |
| 41 | 1. 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 | |
| 48 | 2. Compile the P4 program for specific profile. |
| 49 | |
| 50 | .. code-block:: shell |
| 51 | |
| 52 | $make <profile> |
| 53 | |
| 54 | Supported profiles are: fabric, fabric-spgw, fabric-int, fabric-spgw-int. |
| 55 | |
| 56 | 3. 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 | |
| 63 | switch_ip and switch_port are IP and port where Stratum is running. |
| 64 | cpu_port is 192 for dual pipe switch and 320 for quad pipe switch. |
| 65 | Generated TestVectors are stored under 'fabric-tna/ptf/TestVectors'. |
| 66 | |
| 67 | How to Run TestVectors |
| 68 | -------------------------------------- |
| 69 | 1. 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 | |
| 76 | 2. Build tv-runner docker image. |
| 77 | |
| 78 | .. code-block:: shell |
| 79 | |
| 80 | $docker build -t tvrunner:fabric-tna-binary -f build/test/Dockerfile . |
| 81 | |
| 82 | 3. 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 | |
| 88 | 4. 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 | |
| 94 | 5. 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 | |
| 100 | 6. 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 | |
| 106 | tv_dir is the directory where TestVectors are stored. In this case, tv_dir is 'fabric-tna/ptf/TestVectors'. |
| 107 | tv_name is the name of the test case. It's also the directory name of the test under 'fabric-tna/ptf/TestVectors'. |
| 108 | |
| 109 | Results 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 |