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