714bf3a2510e317e4c8cbb066633333bcbfb892f
[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 | | Setup All DUTs | ${nodes}
28
29 | Setup all TGs before traffic script
30 | | [Documentation] | Prepare all TGs before traffic scripts execution
31 | | All TGs Set Interface Default Driver | ${nodes}
32
33 | Show vpp version on all DUTs
34 | | [Documentation] | Show VPP version verbose on all DUTs
35 | | ${duts}= | Get Matches | ${nodes} | DUT*
36 | | :FOR | ${dut} | IN | @{duts}
37 | | | Vpp show version verbose | ${nodes['${dut}']}
38
39 | Show Vpp Errors on All DUTs
40 | | [Documentation] | Show VPP errors verbose on all DUTs
41 | | ${duts}= | Get Matches | ${nodes} | DUT*
42 | | :FOR | ${dut} | IN | @{duts}
43 | | | Vpp Show Errors | ${nodes['${dut}']}
44
45 | Show vpp trace dump on all DUTs
46 | | [Documentation] | Save API trace and dump output on all DUTs
47 | | ${duts}= | Get Matches | ${nodes} | DUT*
48 | | :FOR | ${dut} | IN | @{duts}
49 | | | Vpp api trace save | ${nodes['${dut}']}
50 | | | Vpp api trace dump | ${nodes['${dut}']}
51
52 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
53 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup
54 | | ...             | configuration on all DUTs in 3-node single-link topology.
55 | | ${m_int}= | Convert To Integer | ${m}
56 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
57 | | ...           | ${dut1_if1} | ${dut1_if2}
58 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
59 | | ...           | ${dut2_if1} | ${dut2_if2}
60 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
61 | | ...               | cpu_cnt=${1}
62 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
63 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
64 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
65 | | ...               | cpu_cnt=${1}
66 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
67 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
68 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
69 | | ...          | corelist-workers | ${dut1_cpu_w}
70 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
71 | | ...          | corelist-workers | ${dut2_cpu_w}
72 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
73 | | Add CPU config | ${dut1} | ${dut1_cpu}
74 | | Add CPU config | ${dut2} | ${dut2_cpu}
75 | | Add rxqueues config | ${dut1} | ${rxqueues}
76 | | Add rxqueues config | ${dut2} | ${rxqueues}
77
78 | Add '${m}' worker threads and rxqueues '${n}' without HTT to all DUTs
79 | | [Documentation] |  Setup M worker threads without HTT and rxqueues N in
80 | | ...             |  startup configuration of VPP to all DUTs
81 | | ${cpu}= | Catenate | main-core | 0 | corelist-workers
82 | | ${cpu}= | Run Keyword If | '${m}' == '1' | Catenate | ${cpu} | 1
83 | | ...     | ELSE IF        | '${m}' == '2' | Catenate | ${cpu} | 1-2
84 | | ...     | ELSE IF        | '${m}' == '4' | Catenate | ${cpu} | 1-4
85 | | ...     | ELSE IF        | '${m}' == '6' | Catenate | ${cpu} | 1-6
86 | | ...     | ELSE           | Fail | Not supported combination
87 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
88 | | Add worker threads and rxqueues to all DUTs | ${cpu} | ${rxqueues}
89
90 | Add '${m}' worker threads and rxqueues '${n}' with HTT to all DUTs
91 | | [Documentation] |  Setup M worker threads with HTT and rxqueues N in
92 | | ...             |  startup configuration of VPP to all DUTs
93 | | ${cpu}= | Catenate | main-core | 0 | corelist-workers
94 | | ${cpu}= | Run Keyword If | '${m}' == '2' | Catenate | ${cpu} | 1,10
95 | | ...     | ELSE IF        | '${m}' == '4' | Catenate | ${cpu} | 1-2,10-11
96 | | ...     | ELSE IF        | '${m}' == '6' | Catenate | ${cpu} | 1-3,10-12
97 | | ...     | ELSE IF        | '${m}' == '8' | Catenate | ${cpu} | 1-4,10-13
98 | | ...     | ELSE           | Fail | Not supported combination
99 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
100 | | Add worker threads and rxqueues to all DUTs | ${cpu} | ${rxqueues}
101
102 | Add worker threads and rxqueues to all DUTs
103 | | [Documentation] | Setup worker threads and rxqueues in VPP startup
104 | | ...             | configuration to all DUTs
105 | | ...
106 | | ... | *Arguments:*
107 | | ... | - ${cpu} - CPU configuration. Type: string
108 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
109 | | ...
110 | | ... | *Example:*
111 | | ...
112 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
113 | | ... | \| rxqueues 2
114 | | [Arguments] | ${cpu} | ${rxqueues}
115 | | ${duts}= | Get Matches | ${nodes} | DUT*
116 | | :FOR | ${dut} | IN | @{duts}
117 | | | Add CPU config | ${nodes['${dut}']}
118 | | | ...            | ${cpu}
119 | | | Add rxqueues config | ${nodes['${dut}']}
120 | | | ...            | ${rxqueues}
121
122 | Add all PCI devices to all DUTs
123 | | [Documentation] | Add all available PCI devices from topology file to VPP
124 | | ...             | startup configuration to all DUTs
125 | | ${duts}= | Get Matches | ${nodes} | DUT*
126 | | :FOR | ${dut} | IN | @{duts}
127 | | | Add PCI all devices | ${nodes['${dut}']}
128
129 | Add PCI device to DUT
130 | | [Documentation] | Add PCI device to VPP startup configuration
131 | | ...             | to DUT specified as argument
132 | | ...
133 | | ... | *Arguments:*
134 | | ... | - ${node} - DUT node. Type: dictionary
135 | | ... | - ${pci_address} - PCI address. Type: string
136 | | ...
137 | | ... | *Example:*
138 | | ...
139 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \
140 | | ... | \| 0000:00:00.0
141 | | [Arguments] | ${node} | ${pci_address}
142 | | Add PCI device | ${node} | ${pci_address}
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' without HTT to all DUTs
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}