CSIT-321 L2 Cross-connect - baseline - NIC-to-NIC(XL710)
[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 | Collections
22
23 *** Keywords ***
24 | Setup all DUTs before test
25 | | [Documentation] | Setup all DUTs in topology before test execution
26 | | Setup All DUTs | ${nodes}
27
28 | Setup all TGs before traffic script
29 | | [Documentation] | Prepare all TGs before traffic scripts execution
30 | | All TGs Set Interface Default Driver | ${nodes}
31
32 | Show vpp version on all DUTs
33 | | [Documentation] | Show VPP version verbose on all DUTs
34 | | ${duts}= | Get Matches | ${nodes} | DUT*
35 | | :FOR | ${dut} | IN | @{duts}
36 | | | Vpp show version verbose | ${nodes['${dut}']}
37
38 | Show vpp trace dump on all DUTs
39 | | [Documentation] | Save API trace and dump output on all DUTs
40 | | ${duts}= | Get Matches | ${nodes} | DUT*
41 | | :FOR | ${dut} | IN | @{duts}
42 | | | Vpp api trace save | ${nodes['${dut}']}
43 | | | Vpp api trace dump | ${nodes['${dut}']}
44
45 | Add '${m}' worker threads and rxqueues '${n}' in 3-node single-link topo
46 | | [Documentation] | Setup M worker threads and N rxqueues in vpp startup
47 | | ...             | configuration on all DUTs in 3-node single-link topology.
48 | | ${m_int}= | Convert To Integer | ${m}
49 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
50 | | ...           | ${dut1_if1} | ${dut1_if2}
51 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
52 | | ...           | ${dut2_if1} | ${dut2_if2}
53 | | ${dut1_cpu_main}= | Cpu list per node str | ${dut1} | ${dut1_numa}
54 | | ...               | cpu_cnt=${1}
55 | | ${dut1_cpu_w}= | Cpu list per node str | ${dut1} | ${dut1_numa}
56 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
57 | | ${dut2_cpu_main}= | Cpu list per node str | ${dut2} | ${dut2_numa}
58 | | ...               | cpu_cnt=${1}
59 | | ${dut2_cpu_w}= | Cpu list per node str | ${dut2} | ${dut2_numa}
60 | | ...            | skip_cnt=${1} | cpu_cnt=${m_int}
61 | | ${dut1_cpu}= | Catenate | main-core | ${dut1_cpu_main}
62 | | ...          | corelist-workers | ${dut1_cpu_w}
63 | | ${dut2_cpu}= | Catenate | main-core | ${dut2_cpu_main}
64 | | ...          | corelist-workers | ${dut2_cpu_w}
65 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
66 | | Add CPU config | ${dut1} | ${dut1_cpu}
67 | | Add CPU config | ${dut2} | ${dut2_cpu}
68 | | Add rxqueues config | ${dut1} | ${rxqueues}
69 | | Add rxqueues config | ${dut2} | ${rxqueues}
70
71 | Add '${m}' worker threads and rxqueues '${n}' without HTT to all DUTs
72 | | [Documentation] |  Setup M worker threads without HTT and rxqueues N in
73 | | ...             |  startup configuration of VPP to all DUTs
74 | | ${cpu}= | Catenate | main-core | 0 | corelist-workers
75 | | ${cpu}= | Run Keyword If | '${m}' == '1' | Catenate | ${cpu} | 1
76 | | ...     | ELSE IF        | '${m}' == '2' | Catenate | ${cpu} | 1-2
77 | | ...     | ELSE IF        | '${m}' == '4' | Catenate | ${cpu} | 1-4
78 | | ...     | ELSE IF        | '${m}' == '6' | Catenate | ${cpu} | 1-6
79 | | ...     | ELSE           | Fail | Not supported combination
80 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
81 | | Add worker threads and rxqueues to all DUTs | ${cpu} | ${rxqueues}
82
83 | Add '${m}' worker threads and rxqueues '${n}' with HTT to all DUTs
84 | | [Documentation] |  Setup M worker threads with HTT and rxqueues N in
85 | | ...             |  startup configuration of VPP to all DUTs
86 | | ${cpu}= | Catenate | main-core | 0 | corelist-workers
87 | | ${cpu}= | Run Keyword If | '${m}' == '2' | Catenate | ${cpu} | 1,10
88 | | ...     | ELSE IF        | '${m}' == '4' | Catenate | ${cpu} | 1-2,10-11
89 | | ...     | ELSE IF        | '${m}' == '6' | Catenate | ${cpu} | 1-3,10-12
90 | | ...     | ELSE IF        | '${m}' == '8' | Catenate | ${cpu} | 1-4,10-13
91 | | ...     | ELSE           | Fail | Not supported combination
92 | | ${rxqueues}= | Catenate | num-rx-queues | ${n}
93 | | Add worker threads and rxqueues to all DUTs | ${cpu} | ${rxqueues}
94
95 | Add worker threads and rxqueues to all DUTs
96 | | [Documentation] | Setup worker threads and rxqueues in VPP startup
97 | | ...             | configuration to all DUTs
98 | | ...
99 | | ... | *Arguments:*
100 | | ... | - ${cpu} - CPU configuration. Type: string
101 | | ... | - ${rxqueues} - rxqueues configuration. Type: string
102 | | ...
103 | | ... | *Example:*
104 | | ...
105 | | ... | \| Add worker threads and rxqueues to all DUTs \| main-core 0 \
106 | | ... | \| rxqueues 2
107 | | [Arguments] | ${cpu} | ${rxqueues}
108 | | ${duts}= | Get Matches | ${nodes} | DUT*
109 | | :FOR | ${dut} | IN | @{duts}
110 | | | Add CPU config | ${nodes['${dut}']}
111 | | | ...            | ${cpu}
112 | | | Add rxqueues config | ${nodes['${dut}']}
113 | | | ...            | ${rxqueues}
114
115 | Add all PCI devices to all DUTs
116 | | [Documentation] | Add all available PCI devices from topology file to VPP
117 | | ...             | startup configuration to all DUTs
118 | | ${duts}= | Get Matches | ${nodes} | DUT*
119 | | :FOR | ${dut} | IN | @{duts}
120 | | | Add PCI all devices | ${nodes['${dut}']}
121
122 | Add PCI device to DUT
123 | | [Documentation] | Add PCI device to VPP startup configuration
124 | | ...             | to DUT specified as argument
125 | | ...
126 | | ... | *Arguments:*
127 | | ... | - ${node} - DUT node. Type: dictionary
128 | | ... | - ${pci_address} - PCI address. Type: string
129 | | ...
130 | | ... | *Example:*
131 | | ...
132 | | ... | \| Add PCI device to DUT \| ${nodes['DUT1']} \
133 | | ... | \| 0000:00:00.0
134 | | [Arguments] | ${node} | ${pci_address}
135 | | Add PCI device | ${node} | ${pci_address}
136
137 | Add No Multi Seg to all DUTs
138 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all
139 | | ...             | DUTs
140 | | ${duts}= | Get Matches | ${nodes} | DUT*
141 | | :FOR | ${dut} | IN | @{duts}
142 | | | Add No Multi Seg Config | ${nodes['${dut}']}
143
144 | Add Enable Vhost User to all DUTs
145 | | [Documentation] | Add Enable Vhost User to VPP startup configuration to all
146 | | ...             | DUTs
147 | | ${duts}= | Get Matches | ${nodes} | DUT*
148 | | :FOR | ${dut} | IN | @{duts}
149 | | | Add Enable Vhost User Config | ${nodes['${dut}']}
150
151 | Remove startup configuration of VPP from all DUTs
152 | | [Documentation] | Remove VPP startup configuration from all DUTs
153 | | ${duts}= | Get Matches | ${nodes} | DUT*
154 | | :FOR | ${dut} | IN | @{duts}
155 | | | Remove All PCI Devices | ${nodes['${dut}']}
156 | | | Remove All CPU Config | ${nodes['${dut}']}
157 | | | Remove Socketmem Config | ${nodes['${dut}']}
158 | | | Remove Heapsize Config | ${nodes['${dut}']}
159 | | | Remove Rxqueues Config | ${nodes['${dut}']}
160 | | | Remove No Multi Seg Config | ${nodes['${dut}']}
161 | | | Remove Enable Vhost User Config | ${nodes['${dut}']}
162
163 | Setup default startup configuration of VPP on all DUTs
164 | | [Documentation] | Setup default startup configuration of VPP to all DUTs
165 | | Remove startup configuration of VPP from all DUTs
166 | | Add '1' worker threads and rxqueues '1' without HTT to all DUTs
167 | | Add all PCI devices to all DUTs
168 | | Apply startup configuration on all VPP DUTs
169
170 | Apply startup configuration on all VPP DUTs
171 | | [Documentation] | Apply startup configuration of VPP and restart VPP on all
172 | | ...             | DUTs
173 | | ${duts}= | Get Matches | ${nodes} | DUT*
174 | | :FOR | ${dut} | IN | @{duts}
175 | | | Apply Config | ${nodes['${dut}']}
176 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${TRUE}