Clean: Various libraries
[csit.git] / resources / libraries / robot / dpdk / default.robot
1 # Copyright (c) 2019 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 | Library | resources.libraries.python.InterfaceUtil
16 | Library | resources.libraries.python.CpuUtils
17 | Library | resources.libraries.python.DPDK.L2fwdTest
18 | Library | resources.libraries.python.DPDK.L3fwdTest
19 | Library | Collections
20
21 *** Keywords ***
22 | Start L2FWD on all DUTs
23 | | [Documentation] | Start the l2fwd with M worker threads and rxqueues N and
24 | | ... | jumbo support frames on/off on all DUTs.
25 | | ...
26 | | ... | *Arguments:*
27 | | ... | - phy_cores - Number of physical cores to use. Type: integer
28 | | ... | - rx_queues - Number of RX queues. Type: integer
29 | | ... | - jumbo_frames - Jumbo frames on/off: boolean
30 | | ...
31 | | ... | *Example:*
32 | | ...
33 | | ... | \| Start L2FWD on all DUTs \| ${1} \| ${1} \| ${False} \|
34 | | ...
35 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${jumbo_frames}=${False}
36 | | ...
37 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
38 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
39 | | ${dp_cores}= | Evaluate | ${cpu_count_int}+1
40 | | ${duts}= | Get Matches | ${nodes} | DUT*
41 | | :FOR | ${dut} | IN | @{duts}
42 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']}
43 | | | ... | ${${dut}_if1} | ${${dut}_if2}
44 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
45 | | | ${cpus}= | Cpu Range Per Node Str | ${nodes['${dut}']} | ${numa}
46 | | | ... | skip_cnt=${1} | cpu_cnt=${dp_cores} | smt_used=${smt_used}
47 | | | ${thr_count_int}= | Run keyword if | ${smt_used} |
48 | | | ... | Evaluate | int(${cpu_count_int}*2) | ELSE | Set variable
49 | | | ... | ${thr_count_int}
50 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
51 | | | ... | Set variable | ${rx_queues}
52 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
53 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
54 | | | ... | Set variable | ${1}
55 | | | ... | ELSE | Set variable | ${rxq_count_int}
56 | | | Start the l2fwd test | ${nodes['${dut}']} | ${cpus} | ${thr_count_int}
57 | | | ... | ${rxq_count_int} | ${jumbo_frames}
58 | | | Run keyword if | ${thr_count_int} > 1
59 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
60 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
61
62 | Start L3FWD on all DUTs
63 | | [Documentation] | Start the l3fwd with M worker threads and rxqueues N and
64 | | ... | jumbo support frames on/off on all DUTs.
65 | | ...
66 | | ... | *Arguments:*
67 | | ... | - phy_cores - Number of physical cores to use. Type: integer
68 | | ... | - rx_queues - Number of RX queues. Type: integer
69 | | ... | - jumbo_frames - Jumbo frames on/off: boolean
70 | | ...
71 | | ... | *Example:*
72 | | ...
73 | | ... | \| Start L3FWD on all DUTs \| ${1} \| ${1} \| ${False} \|
74 | | ...
75 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${jumbo_frames}=${False}
76 | | ...
77 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
78 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
79 | | ${dp_cores}= | Evaluate | ${cpu_count_int}+1
80 | | ${duts}= | Get Matches | ${nodes} | DUT*
81 | | :FOR | ${dut} | IN | @{duts}
82 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']}
83 | | | ... | ${${dut}_if1} | ${${dut}_if2}
84 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
85 | | | ${cpus}= | Cpu List Per Node Str | ${nodes['${dut}']} | ${numa}
86 | | | ... | skip_cnt=${1} | cpu_cnt=${cpu_count_int} | smt_used=${smt_used}
87 | | | ${thr_count_int}= | Run keyword if | ${smt_used} |
88 | | | ... | Evaluate | int(${cpu_count_int}*2) | ELSE | Set variable
89 | | | ... | ${thr_count_int}
90 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
91 | | | ... | Set variable | ${rx_queues}
92 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
93 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
94 | | | ... | Set variable | ${1}
95 | | | ... | ELSE | Set variable | ${rxq_count_int}
96 | | | Start the l3fwd test | ${nodes} | ${nodes['${dut}']} | ${${dut}_if1}
97 | | | ... | ${${dut}_if2} | ${thr_count_int} | ${cpus} | ${rxq_count_int}
98 | | | ... | ${jumbo_frames}
99 | | | Run keyword if | ${thr_count_int} > 1
100 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
101 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C