CSIT-470 Add option to configure CFS scheduler priority for VPP
[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.SchedUtils
20 | Library | resources.libraries.python.TGSetup
21 | Library | resources/libraries/python/VppConfigGenerator.py
22 | Library | resources/libraries/python/VppCounters.py
23 | Library | Collections
24
25 *** Keywords ***
26 | Setup all DUTs before test
27 | | [Documentation] | Setup all DUTs in topology before test execution.
28 | | Setup All DUTs | ${nodes}
29
30 | Setup all TGs before traffic script
31 | | [Documentation] | Prepare all TGs before traffic scripts execution.
32 | | All TGs Set Interface Default Driver | ${nodes}
33
34 | Show Vpp Version On All DUTs
35 | | [Documentation] | Show VPP version verbose on all DUTs.
36 | | ${duts}= | Get Matches | ${nodes} | DUT*
37 | | :FOR | ${dut} | IN | @{duts}
38 | | | Vpp show version verbose | ${nodes['${dut}']}
39
40 | Show Vpp Errors On All DUTs
41 | | [Documentation] | Show VPP errors verbose on all DUTs.
42 | | ${duts}= | Get Matches | ${nodes} | DUT*
43 | | :FOR | ${dut} | IN | @{duts}
44 | | | Vpp Show Errors | ${nodes['${dut}']}
45
46 | Show Vpp Trace Dump On All DUTs
47 | | [Documentation] | Save API trace and dump output on all DUTs.
48 | | ${duts}= | Get Matches | ${nodes} | DUT*
49 | | :FOR | ${dut} | IN | @{duts}
50 | | | Vpp api trace save | ${nodes['${dut}']}
51 | | | Vpp api trace dump | ${nodes['${dut}']}
52
53 | Show Vpp Vhost On All DUTs
54 | | [Documentation] | Show Vhost User on all DUTs
55 | | ${duts}= | Get Matches | ${nodes} | DUT*
56 | | :FOR | ${dut} | IN | @{duts}
57 | | | Vpp Show Vhost | ${nodes['${dut}']}
58
59 | Setup Scheduler Policy for Vpp On All DUTs
60 | | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1
61 | | ...             | on all VPP worker threads on all DUTs.
62 | | ${duts}= | Get Matches | ${nodes} | DUT*
63 | | :FOR | ${dut} | IN | @{duts}
64 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
65
66 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
67 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup
68 | | ...             | configuration on all DUTs in 3-node single-link topology.
69 | | ${m_int}= | Convert To Integer | ${m}
70 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
71 | | ...           | ${dut1_if1} | ${dut1_if2}
72 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
73 | | ...           | ${dut2_if1} | ${dut2_if2}
74 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
75 | | ...               | cpu_cnt=${1}
76 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
77 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
78 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
79 | | ...               | cpu_cnt=${1}
80 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
81 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
82 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
83 | | ...          | corelist-workers | ${dut1_cpu_w}
84 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
85 | | ...          | corelist-workers | ${dut2_cpu_w}
86 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
87 | | Add CPU config | ${dut1} | ${dut1_cpu}
88 | | Add CPU config | ${dut2} | ${dut2_cpu}
89 | | Add rxqueues config | ${dut1} | ${rxqueues}
90 | | Add rxqueues config | ${dut2} | ${rxqueues}
91
92 | Add worker threads and rxqueues to all DUTs
93 | | [Documentation] | Setup worker threads and rxqueues in VPP startup
94 | | ...             | configuration to all DUTs
95 | | ...
96 | | ... | *Arguments:*
97 | | ... | - ${cpu} - CPU configuration. Type: string
98 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
99 | | ...
100 | | ... | *Example:*
101 | | ...
102 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
103 | | ... | \| rxqueues 2
104 | | [Arguments] | ${cpu} | ${rxqueues}
105 | | ${duts}= | Get Matches | ${nodes} | DUT*
106 | | :FOR | ${dut} | IN | @{duts}
107 | | | Add CPU config | ${nodes['${dut}']}
108 | | | ...            | ${cpu}
109 | | | Add rxqueues config | ${nodes['${dut}']}
110 | | | ...            | ${rxqueues}
111
112 | Add all PCI devices to all DUTs
113 | | [Documentation] | Add all available PCI devices from topology file to VPP
114 | | ...             | startup configuration to all DUTs
115 | | ${duts}= | Get Matches | ${nodes} | DUT*
116 | | :FOR | ${dut} | IN | @{duts}
117 | | | Add PCI all devices | ${nodes['${dut}']}
118
119 | Add PCI device to DUT
120 | | [Documentation] | Add PCI device to VPP startup configuration
121 | | ...             | to DUT specified as argument
122 | | ...
123 | | ... | *Arguments:*
124 | | ... | - ${node} - DUT node. Type: dictionary
125 | | ... | - ${pci_address} - PCI address. Type: string
126 | | ...
127 | | ... | *Example:*
128 | | ...
129 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \
130 | | ... | \| 0000:00:00.0
131 | | [Arguments] | ${node} | ${pci_address}
132 | | Add PCI device | ${node} | ${pci_address}
133
134 | Add Heapsize Config to all DUTs
135 | | [Documentation] | Add Add Heapsize Config to VPP startup configuration
136 | | ...             | to all DUTs
137 | | ... | *Arguments:*
138 | | ... | - ${heapsize} - Heapsize string (5G, 200M, ...)
139 | | [Arguments] | ${heapsize}
140 | | ${duts}= | Get Matches | ${nodes} | DUT*
141 | | :FOR | ${dut} | IN | @{duts}
142 | | | Add Heapsize Config | ${nodes['${dut}']} | ${heapsize}
143
144 | Add No Multi Seg to all DUTs
145 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all
146 | | ...             | DUTs
147 | | ${duts}= | Get Matches | ${nodes} | DUT*
148 | | :FOR | ${dut} | IN | @{duts}
149 | | | Add No Multi Seg Config | ${nodes['${dut}']}
150
151 | Add Enable Vhost User to all DUTs
152 | | [Documentation] | Add Enable Vhost User to VPP startup configuration to all
153 | | ...             | DUTs
154 | | ${duts}= | Get Matches | ${nodes} | DUT*
155 | | :FOR | ${dut} | IN | @{duts}
156 | | | Add Enable Vhost User Config | ${nodes['${dut}']}
157
158 | Remove startup configuration of VPP from all DUTs
159 | | [Documentation] | Remove VPP startup configuration from all DUTs
160 | | ${duts}= | Get Matches | ${nodes} | DUT*
161 | | :FOR | ${dut} | IN | @{duts}
162 | | | Remove All PCI Devices | ${nodes['${dut}']}
163 | | | Remove All CPU Config | ${nodes['${dut}']}
164 | | | Remove Socketmem Config | ${nodes['${dut}']}
165 | | | Remove Heapsize Config | ${nodes['${dut}']}
166 | | | Remove Rxqueues Config | ${nodes['${dut}']}
167 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
168 | | | Remove Enable Vhost User Config | ${nodes['${dut}']}
169
170 | Setup default startup configuration of VPP on all DUTs
171 | | [Documentation] | Setup default startup configuration of VPP to all DUTs
172 | | Remove startup configuration of VPP from all DUTs
173 | | Add '1' worker threads and rxqueues '1' in 3-node single-link topo
174 | | Add all PCI devices to all DUTs
175 | | Apply startup configuration on all VPP DUTs
176
177 | Apply startup configuration on all VPP DUTs
178 | | [Documentation] | Apply startup configuration of VPP and restart VPP on all
179 | | ...             | DUTs
180 | | ${duts}= | Get Matches | ${nodes} | DUT*
181 | | :FOR | ${dut} | IN | @{duts}
182 | | | Apply Config | ${nodes['${dut}']}
183 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}
184
185 | Save VPP PIDs
186 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and
187 | | ... | set it as a test variable. The PIDs are stored as dictionary items
188 | | ... | where the key is the host and the value is the PID.
189 | | ...
190 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
191 | | Set Test Variable | ${setup_vpp_pids}
192
193 | Check VPP PID in Teardown
194 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end
195 | | ... | of test as they were at the begining. If they are not, only a message
196 | | ... | is printed on console and to log. The test will not fail.
197 | | ...
198 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
199 | | ${err_msg}= | Catenate | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
200 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
201 | | ${rc} | ${msg}= | Run keyword and ignore error
202 | | ... | Dictionaries Should Be Equal
203 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
204 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
205 | | ... | console=yes | level=WARN
206
207 | Func Test Setup
208 | | [Documentation] | Common test setup for functional tests.
209 | | ...
210 | | Setup all DUTs before test
211 | | Save VPP PIDs
212 | | Setup all TGs before traffic script
213 | | Update All Interface Data On All Nodes | ${nodes}
214
215 | Func Test Teardown
216 | | [Documentation] | Common test teardown for functional tests.
217 | | ...
218 | | Show Packet Trace on All DUTs | ${nodes}
219 | | Show vpp trace dump on all DUTs
220 | | Vpp Show Errors On All DUTs | ${nodes}
221 | | Check VPP PID in Teardown