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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 """Keywords used in suite setups."""
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
24 | Documentation | Suite setup keywords.
26 | Create suite topology variables
28 | | ... | Create suite topology variables
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
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.
46 | | ... | - dut{m}_pf{n}_mac - Nth interface of Mth DUT - MAC address.
48 | | ... | - dut{m}_pf{n}_vlan - Nth interface of Mth DUT - VLAN id.
50 | | ... | - dut{m}_pf{n}_pci - Nth interface of Mth DUT - PCI address.
52 | | ... | - dut{m}_pf{n}_ip4_addr - Nth interface of Mth DUT - IPv4 address.
54 | | ... | - dut{m}_pf{n}_ip4_prefix - Nth interface of Mth DUT - IPv4 prefix.
57 | | ... | *Arguments:*
58 | | ... | - @{actions} - Additional setup action. Type: list
60 | | [Arguments] | @{actions}
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}
67 | | FOR | ${action} | IN | @{actions}
68 | | | Run Keyword | Additional Suite setup Action For ${action}
71 | Setup suite topology interfaces
73 | | ... | Common suite setup for one to multiple link tests.
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.
79 | | ... | *Arguments:*
80 | | ... | - ${actions} - Additional setup action. Type: list
82 | | [Arguments] | @{actions}
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}
91 | Setup suite topology interfaces with no TG
93 | | ... | Common suite setup for single link tests with no traffic generator
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.
100 | | ... | *Arguments:*
101 | | ... | - ${actions} - Additional setup action. Type: list
103 | | [Arguments] | @{actions}
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}
112 | Additional Suite Setup Action For scapy
114 | | ... | Additional Setup for suites which uses scapy as Traffic generator.
116 | | FOR | ${dut} | IN | @{duts}
117 | | | Set Suite Variable | ${${dut}_vf1} | ${${dut}_${int}1}
118 | | | Set Suite Variable | ${${dut}_vf2} | ${${dut}_${int}2}
120 | | Set Interface State | ${tg} | ${TG_pf1}[0] | up
121 | | Set Interface State | ${tg} | ${TG_pf2}[0] | up
123 | Additional Suite Setup Action For dpdk
125 | | ... | Additional Setup for suites which uses dpdk.
127 | | FOR | ${dut} | IN | @{duts}
128 | | | Initialize DPDK Framework | ${nodes['${dut}']}
129 | | | ... | ${${dut}_${int}1}[0] | ${${dut}_${int}2}[0] | ${nic_driver}
132 | Additional Suite Setup Action For performance vf
134 | | ... | Additional Setup for suites which uses performance measurement for
135 | | ... | single DUT (inner loop).
137 | | ... | *Arguments:*
138 | | ... | - dut - DUT node. Type: string
142 | | ... | \| Additional Suite Setup Action For performance_dut \| DUT1 \|
144 | | [Arguments] | ${dut}
146 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
148 | | | ... | Run Keyword | Init ${nic_driver} interface
149 | | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | numvfs=${nic_vfs}
150 | | | ... | osi_layer=${osi_layer}
152 | | | ... | Create List | ${EMPTY}
154 | | | ... | Create List | ${EMPTY}
155 | | | ${_ip4_prefix}=
156 | | | ... | Create List | ${EMPTY}
158 | | | ... | Create List | ${EMPTY}
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}
174 | | Set Suite Variable
175 | | ... | ${int} | prevf
177 | Additional Suite Setup Action For performance
179 | | ... | Additional Setup for suites which uses performance measurement.
181 | | FOR | ${dut} | IN | @{duts}
182 | | | Run Keyword If | ${nic_vfs} > 0
183 | | | ... | Additional Suite Setup Action For performance vf | ${dut}
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}
191 | Additional Suite Setup Action For ipsechw
193 | | ... | Additional Setup for suites which uses QAT HW.
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}