Remove remains of WRK tests
[csit.git] / resources / libraries / robot / shared / suite_setup.robot
1 # Copyright (c) 2020 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 """Keywords used in suite setups."""
15
16 *** Settings ***
17 | Library | resources.libraries.python.DPDK.DPDKTools
18 | Library | resources.libraries.python.InterfaceUtil
19 | Library | resources.libraries.python.NodePath
20 | Library | resources.libraries.python.topology.Topology
21 | Library | resources.libraries.python.TrafficGenerator
22 | Variables | resources/libraries/python/Constants.py
23 |
24 | Documentation | Suite setup keywords.
25 *** Keywords ***
26 | Create suite topology variables
27 | | [Documentation]
28 | | ... | Create suite topology variables
29 | |
30 | | ... | _NOTE:_ This KW sets various suite variables based on filtered
31 | | ... | topology. All variables are set with also backward compatibility
32 | | ... | format dut{m}_if{n} (where the value type is string).
33 | | ... | List type allows to access physical interfaces in same way as
34 | | ... | virtual interface (e.g. SRIOV). This keeps abstracted compatibility
35 | | ... | between existing L1 and L2 KWs library and underlaying physical
36 | | ... | topology.
37 | |
38 | | ... | - duts - List of DUT nodes (name as seen in topology file).
39 | | ... | - duts_count - Number of DUT nodes.
40 | | ... | - int - Interfacy type (layer).
41 | | ... | Type: string
42 | | ... | - dut{n} - DUTx node.
43 | | ... | Type: dictionary
44 | | ... | - dut{m}_pf{n} - Nth interface of Mth DUT.
45 | | ... | Type: list
46 | | ... | - dut{m}_pf{n}_mac - Nth interface of Mth DUT - MAC address.
47 | | ... | Type: list
48 | | ... | - dut{m}_pf{n}_vlan - Nth interface of Mth DUT - VLAN id.
49 | | ... | Type: list
50 | | ... | - dut{m}_pf{n}_pci - Nth interface of Mth DUT - PCI address.
51 | | ... | Type: list
52 | | ... | - dut{m}_pf{n}_ip4_addr - Nth interface of Mth DUT - IPv4 address.
53 | | ... | Type: list
54 | | ... | - dut{m}_pf{n}_ip4_prefix - Nth interface of Mth DUT - IPv4 prefix.
55 | | ... | Type: list
56 | |
57 | | ... | *Arguments:*
58 | | ... | - @{actions} - Additional setup action. Type: list
59 | |
60 | | [Arguments] | @{actions}
61 | |
62 | | ${variables}= | Get Dictionary Keys | ${topology_info}
63 | | FOR | ${variable} | IN | @{variables}
64 | | | ${value}= | Get From Dictionary | ${topology_info} | ${variable}
65 | | | Set Suite Variable | ${${variable}} | ${value}
66 | | END
67 | | FOR | ${action} | IN | @{actions}
68 | | | Run Keyword | Additional Suite setup Action For ${action}
69 | | END
70
71 | Setup suite topology interfaces
72 | | [Documentation]
73 | | ... | Common suite setup for one to multiple link tests.
74 | | ... |
75 | | ... | Compute path for testing on given topology nodes in circular topology
76 | | ... | based on interface model provided as an argument and set
77 | | ... | corresponding suite variables.
78 | |
79 | | ... | *Arguments:*
80 | | ... | - ${actions} - Additional setup action. Type: list
81 | |
82 | | [Arguments] | @{actions}
83 | |
84 | | ${nic_model_list}= | Create list | ${nic_name}
85 | | &{info}= | Compute Circular Topology
86 | | ... | ${nodes} | filter_list=${nic_model_list} | nic_pfs=${nic_pfs}
87 | | ... | always_same_link=${False} | topo_has_tg=${True}
88 | | Set suite variable | &{topology_info} | &{info}
89 | | Create suite topology variables | @{actions}
90
91 | Setup suite topology interfaces with no TG
92 | | [Documentation]
93 | | ... | Common suite setup for single link tests with no traffic generator
94 | | ... | node.
95 | | ... |
96 | | ... | Compute path for testing on given topology nodes in circular topology
97 | | ... | based on interface model provided as an argument and set
98 | | ... | corresponding suite variables.
99 | |
100 | | ... | *Arguments:*
101 | | ... | - ${actions} - Additional setup action. Type: list
102 | |
103 | | [Arguments] | @{actions}
104 | |
105 | | ${nic_model_list}= | Create list | ${nic_name}
106 | | &{info}= | Compute Circular Topology
107 | | ... | ${nodes} | filter_list=${nic_model_list} | nic_pfs=${nic_pfs}
108 | | ... | always_same_link=${True} | topo_has_tg=${False}
109 | | Set suite variable | &{topology_info} | &{info}
110 | | Create suite topology variables | @{actions}
111
112 | Additional Suite Setup Action For scapy
113 | | [Documentation]
114 | | ... | Additional Setup for suites which uses scapy as Traffic generator.
115 | |
116 | | FOR | ${dut} | IN | @{duts}
117 | | | Set Suite Variable | ${${dut}_vf1} | ${${dut}_${int}1}
118 | | | Set Suite Variable | ${${dut}_vf2} | ${${dut}_${int}2}
119 | | END
120 | | Set Interface State | ${tg} | ${TG_pf1}[0] | up
121 | | Set Interface State | ${tg} | ${TG_pf2}[0] | up
122
123 | Additional Suite Setup Action For dpdk
124 | | [Documentation]
125 | | ... | Additional Setup for suites which uses dpdk.
126 | |
127 | | FOR | ${dut} | IN | @{duts}
128 | | | Initialize DPDK Framework | ${nodes['${dut}']}
129 | | | ... | ${${dut}_${int}1}[0] | ${${dut}_${int}2}[0] | ${nic_driver}
130 | | END
131
132 | Additional Suite Setup Action For performance vf
133 | | [Documentation]
134 | | ... | Additional Setup for suites which uses performance measurement for
135 | | ... | single DUT (inner loop).
136 | |
137 | | ... | *Arguments:*
138 | | ... | - dut - DUT node. Type: string
139 | |
140 | | ... | *Example:*
141 | |
142 | | ... | \| Additional Suite Setup Action For performance_dut \| DUT1 \|
143 | |
144 | | [Arguments] | ${dut}
145 | |
146 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
147 | | | ${_vf}=
148 | | | ... | Run Keyword | Init ${nic_driver} interface
149 | | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | numvfs=${nic_vfs}
150 | | | ... | osi_layer=${osi_layer}
151 | | | ${_mac}=
152 | | | ... | Create List | ${EMPTY}
153 | | | ${_ip4_addr}=
154 | | | ... | Create List | ${EMPTY}
155 | | | ${_ip4_prefix}=
156 | | | ... | Create List | ${EMPTY}
157 | | | ${_pci}=
158 | | | ... | Create List | ${EMPTY}
159 | | | ${_vlan}=
160 | | | ... | Create List | ${EMPTY}
161 | | | Set Suite Variable
162 | | | ... | ${${dut}_prevf${pf}} | ${_vf}
163 | | | Set Suite Variable
164 | | | ... | ${${dut}_prevf${pf}_ip4_addr} | ${_ip4_addr}
165 | | | Set Suite Variable
166 | | | ... | ${${dut}_prevf${pf}_ip4_prefix} | ${_ip4_prefix}
167 | | | Set Suite Variable
168 | | | ... | ${${dut}_prevf${pf}_mac} | ${_mac}
169 | | | Set Suite Variable
170 | | | ... | ${${dut}_prevf${pf}_pci} | ${_pci}
171 | | | Set Suite Variable
172 | | | ... | ${${dut}_prevf${pf}_vlan} | ${_vlan}
173 | | END
174 | | Set Suite Variable
175 | | ... | ${int} | prevf
176
177 | Additional Suite Setup Action For performance
178 | | [Documentation]
179 | | ... | Additional Setup for suites which uses performance measurement.
180 | |
181 | | FOR | ${dut} | IN | @{duts}
182 | | | Run Keyword If | ${nic_vfs} > 0
183 | | | ... | Additional Suite Setup Action For performance vf | ${dut}
184 | | END
185 | | Initialize traffic generator
186 | | ... | ${tg} | ${TG_pf1}[0] | ${TG_pf2}[0]
187 | | ... | ${dut1} | ${DUT1_${int}1}[0]
188 | | ... | ${dut${duts_count}} | ${DUT${duts_count}_${int}2}[0]
189 | | ... | ${osi_layer}
190
191 | Additional Suite Setup Action For ipsechw
192 | | [Documentation]
193 | | ... | Additional Setup for suites which uses QAT HW.
194 | |
195 | | ${numvfs}= | Set Variable If
196 | | ... | '${crypto_type}' == 'HW_DH895xcc' | ${32}
197 | | ... | '${crypto_type}' == 'HW_C3xxx' | ${16}
198 | | Configure crypto device on all DUTs | ${crypto_type} | numvfs=${numvfs}
199 | | ... | force_init=${True}
200 | | Configure kernel module on all DUTs | vfio_pci | force_load=${True}