Use 3 tries to prepare DUT for testing
[csit.git] / resources / libraries / robot / default.robot
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Variables | resources/libraries/python/topology.py
16 | Library | resources.libraries.python.topology.Topology
17 | Library | resources.libraries.python.CpuUtils
18 | Library | resources.libraries.python.DUTSetup
19 | Library | resources.libraries.python.TGSetup
20 | Library | resources/libraries/python/VppConfigGenerator.py
21 | Library | resources/libraries/python/VppCounters.py
22 | Library | Collections
23
24 *** Keywords ***
25 | Setup all DUTs before test
26 | | [Documentation] | Setup all DUTs in topology before test execution
27 | | ${duts}= | Get Matches | ${nodes} | DUT*
28 | | :FOR | ${dut} | IN | @{duts}
29 | | | Wait Until Keyword Succeeds | 3x | 1 min | Setup Dut | ${nodes['${dut}']}
30
31 | Setup all TGs before traffic script
32 | | [Documentation] | Prepare all TGs before traffic scripts execution
33 | | All TGs Set Interface Default Driver | ${nodes}
34
35 | Show vpp version on all DUTs
36 | | [Documentation] | Show VPP version verbose on all DUTs
37 | | ${duts}= | Get Matches | ${nodes} | DUT*
38 | | :FOR | ${dut} | IN | @{duts}
39 | | | Vpp show version verbose | ${nodes['${dut}']}
40
41 | Show Vpp Errors on All DUTs
42 | | [Documentation] | Show VPP errors verbose on all DUTs
43 | | ${duts}= | Get Matches | ${nodes} | DUT*
44 | | :FOR | ${dut} | IN | @{duts}
45 | | | Vpp Show Errors | ${nodes['${dut}']}
46
47 | Show vpp trace dump on all DUTs
48 | | [Documentation] | Save API trace and dump output on all DUTs
49 | | ${duts}= | Get Matches | ${nodes} | DUT*
50 | | :FOR | ${dut} | IN | @{duts}
51 | | | Vpp api trace save | ${nodes['${dut}']}
52 | | | Vpp api trace dump | ${nodes['${dut}']}
53
54 | Show Vpp Vhost On All DUTs
55 | | [Documentation] | Show Vhost User on all DUTs
56 | | ${duts}= | Get Matches | ${nodes} | DUT*
57 | | :FOR | ${dut} | IN | @{duts}
58 | | | Vpp Show Vhost | ${nodes['${dut}']}
59
60 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
61 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup
62 | | ...             | configuration on all DUTs in 3-node single-link topology.
63 | | ${m_int}= | Convert To Integer | ${m}
64 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
65 | | ...           | ${dut1_if1} | ${dut1_if2}
66 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
67 | | ...           | ${dut2_if1} | ${dut2_if2}
68 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
69 | | ...               | cpu_cnt=${1}
70 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
71 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
72 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
73 | | ...               | cpu_cnt=${1}
74 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
75 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
76 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
77 | | ...          | corelist-workers | ${dut1_cpu_w}
78 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
79 | | ...          | corelist-workers | ${dut2_cpu_w}
80 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
81 | | Add CPU config | ${dut1} | ${dut1_cpu}
82 | | Add CPU config | ${dut2} | ${dut2_cpu}
83 | | Add rxqueues config | ${dut1} | ${rxqueues}
84 | | Add rxqueues config | ${dut2} | ${rxqueues}
85
86 | Add '${m}' worker threads and rxqueues '${n}' without HTT to all DUTs
87 | | [Documentation] |  Setup M worker threads without HTT and rxqueues N in
88 | | ...             |  startup configuration of VPP to all DUTs
89 | | ${cpu}= | Catenate | main-core | 0 | corelist-workers
90 | | ${cpu}= | Run Keyword If | '${m}' == '1' | Catenate | ${cpu} | 1
91 | | ...     | ELSE IF        | '${m}' == '2' | Catenate | ${cpu} | 1-2
92 | | ...     | ELSE IF        | '${m}' == '4' | Catenate | ${cpu} | 1-4
93 | | ...     | ELSE IF        | '${m}' == '6' | Catenate | ${cpu} | 1-6
94 | | ...     | ELSE           | Fail | Not supported combination
95 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
96 | | Add worker threads and rxqueues to all DUTs | ${cpu} | ${rxqueues}
97
98 | Add '${m}' worker threads and rxqueues '${n}' with HTT to all DUTs
99 | | [Documentation] |  Setup M worker threads with HTT and rxqueues N in
100 | | ...             |  startup configuration of VPP to all DUTs
101 | | ${cpu}= | Catenate | main-core | 0 | corelist-workers
102 | | ${cpu}= | Run Keyword If | '${m}' == '2' | Catenate | ${cpu} | 1,10
103 | | ...     | ELSE IF        | '${m}' == '4' | Catenate | ${cpu} | 1-2,10-11
104 | | ...     | ELSE IF        | '${m}' == '6' | Catenate | ${cpu} | 1-3,10-12
105 | | ...     | ELSE IF        | '${m}' == '8' | Catenate | ${cpu} | 1-4,10-13
106 | | ...     | ELSE           | Fail | Not supported combination
107 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
108 | | Add worker threads and rxqueues to all DUTs | ${cpu} | ${rxqueues}
109
110 | Add worker threads and rxqueues to all DUTs
111 | | [Documentation] | Setup worker threads and rxqueues in VPP startup
112 | | ...             | configuration to all DUTs
113 | | ...
114 | | ... | *Arguments:*
115 | | ... | - ${cpu} - CPU configuration. Type: string
116 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
117 | | ...
118 | | ... | *Example:*
119 | | ...
120 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
121 | | ... | \| rxqueues 2
122 | | [Arguments] | ${cpu} | ${rxqueues}
123 | | ${duts}= | Get Matches | ${nodes} | DUT*
124 | | :FOR | ${dut} | IN | @{duts}
125 | | | Add CPU config | ${nodes['${dut}']}
126 | | | ...            | ${cpu}
127 | | | Add rxqueues config | ${nodes['${dut}']}
128 | | | ...            | ${rxqueues}
129
130 | Add all PCI devices to all DUTs
131 | | [Documentation] | Add all available PCI devices from topology file to VPP
132 | | ...             | startup configuration to all DUTs
133 | | ${duts}= | Get Matches | ${nodes} | DUT*
134 | | :FOR | ${dut} | IN | @{duts}
135 | | | Add PCI all devices | ${nodes['${dut}']}
136
137 | Add PCI device to DUT
138 | | [Documentation] | Add PCI device to VPP startup configuration
139 | | ...             | to DUT specified as argument
140 | | ...
141 | | ... | *Arguments:*
142 | | ... | - ${node} - DUT node. Type: dictionary
143 | | ... | - ${pci_address} - PCI address. Type: string
144 | | ...
145 | | ... | *Example:*
146 | | ...
147 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \
148 | | ... | \| 0000:00:00.0
149 | | [Arguments] | ${node} | ${pci_address}
150 | | Add PCI device | ${node} | ${pci_address}
151
152 | Add Heapsize Config to all DUTs
153 | | [Documentation] | Add Add Heapsize Config to VPP startup configuration
154 | | ...             | to all DUTs
155 | | ... | *Arguments:*
156 | | ... | - ${heapsize} - Heapsize string (5G, 200M, ...)
157 | | [Arguments] | ${heapsize}
158 | | ${duts}= | Get Matches | ${nodes} | DUT*
159 | | :FOR | ${dut} | IN | @{duts}
160 | | | Add Heapsize Config | ${nodes['${dut}']} | ${heapsize}
161
162 | Add No Multi Seg to all DUTs
163 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all
164 | | ...             | DUTs
165 | | ${duts}= | Get Matches | ${nodes} | DUT*
166 | | :FOR | ${dut} | IN | @{duts}
167 | | | Add No Multi Seg Config | ${nodes['${dut}']}
168
169 | Add Enable Vhost User to all DUTs
170 | | [Documentation] | Add Enable Vhost User to VPP startup configuration to all
171 | | ...             | DUTs
172 | | ${duts}= | Get Matches | ${nodes} | DUT*
173 | | :FOR | ${dut} | IN | @{duts}
174 | | | Add Enable Vhost User Config | ${nodes['${dut}']}
175
176 | Remove startup configuration of VPP from all DUTs
177 | | [Documentation] | Remove VPP startup configuration from all DUTs
178 | | ${duts}= | Get Matches | ${nodes} | DUT*
179 | | :FOR | ${dut} | IN | @{duts}
180 | | | Remove All PCI Devices | ${nodes['${dut}']}
181 | | | Remove All CPU Config | ${nodes['${dut}']}
182 | | | Remove Socketmem Config | ${nodes['${dut}']}
183 | | | Remove Heapsize Config | ${nodes['${dut}']}
184 | | | Remove Rxqueues Config | ${nodes['${dut}']}
185 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
186 | | | Remove Enable Vhost User Config | ${nodes['${dut}']}
187
188 | Setup default startup configuration of VPP on all DUTs
189 | | [Documentation] | Setup default startup configuration of VPP to all DUTs
190 | | Remove startup configuration of VPP from all DUTs
191 | | Add '1' worker threads and rxqueues '1' without HTT to all DUTs
192 | | Add all PCI devices to all DUTs
193 | | Apply startup configuration on all VPP DUTs
194
195 | Apply startup configuration on all VPP DUTs
196 | | [Documentation] | Apply startup configuration of VPP and restart VPP on all
197 | | ...             | DUTs
198 | | ${duts}= | Get Matches | ${nodes} | DUT*
199 | | :FOR | ${dut} | IN | @{duts}
200 | | | Apply Config | ${nodes['${dut}']}
201 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}