1 # Copyright (c) 2017 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.
15 | Documentation | Keywords related to linux container (LXC)
16 | Library | resources.libraries.python.LXCUtils
17 | Library | resources.libraries.python.CpuUtils
18 | Library | resources.libraries.python.topology.Topology
21 | Create LXC container on DUT node
22 | | [Documentation] | Setup lxc container on DUT node.
24 | | ... | *Arguments:*
26 | | ... | - dut_node - DUT node. Type: dictionary
27 | | ... | - lxc_name - Name of LXC container. Type: dictionary
31 | | ... | \| Create LXC container on DUT node \| ${nodes['DUT1']} \
32 | | ... | \| DUT1_slave_1 \|
34 | | [Arguments] | ${dut_node} | ${lxc_name}
36 | | Import Library | resources.libraries.python.LXCUtils
37 | | ... | container_name=${lxc_name} | WITH NAME | ${lxc_name}
38 | | Run keyword | ${lxc_name}.Set node | ${dut_node}
39 | | Run keyword | ${lxc_name}.Container create | force_create=${TRUE}
40 | | Run keyword | ${lxc_name}.Mount host dir in container
42 | Create LXC container on DUT node with cpuset
43 | | [Documentation] | Create LXC container on DUT node with cpuset.
45 | | ... | *Arguments:*
47 | | ... | - dut_node - DUT node. Type: dictionary
48 | | ... | - lxc_name - Name of LXC container. Type: dictionary
49 | | ... | - skip - number of cpus which will be skipped. Type: integer
50 | | ... | - count - number of cpus which will be allocated for lxc. Type:
55 | | ... | \| Create LXC container on DUT node with cpuset \
56 | | ... | \| ${nodes['DUT1']} \| DUT1_slave_1 \| 6 \| 1 \|
58 | | [Arguments] | ${dut_node} | ${lxc_name} | ${skip}=${6} | ${count}=${1}
60 | | Import Library | resources.libraries.python.LXCUtils
61 | | ... | container_name=${lxc_name} | WITH NAME | ${lxc_name}
62 | | ${dut_numa}= | Get interfaces numa node | ${dut_node}
63 | | ... | ${dut1_if1} | ${dut1_if2}
64 | | ${lxc_cpus}= | CPU list per node str | ${dut_node} | ${dut_numa}
65 | | ... | skip_cnt=${skip} | cpu_cnt=${count} | smt_used=${False}
66 | | Run keyword | ${lxc_name}.Set node | ${dut_node}
67 | | Run keyword | ${lxc_name}.Container create | force_create=${TRUE}
68 | | Run keyword | ${lxc_name}.Mount host dir in container
69 | | Run keyword | ${lxc_name}.Container cpuset cpus | ${lxc_cpus}
71 | Create '${nr}' LXC containers on '${dut}' node
72 | | [Documentation] | Create and start multiple lxc containers on DUT node.
76 | | ... | \| Create 5 LXC containers on DUT1 node \|
78 | | :FOR | ${number} | IN RANGE | 1 | ${nr}+1
79 | | | Create LXC container on DUT node | ${nodes['${dut}']}
80 | | | ... | ${dut}_${lxc_base_name}_${number}
82 | Create '${nr}' LXC containers on all DUT nodes
83 | | [Documentation] | Create and start multiple LXC containers on all DUT nodes.
87 | | ... | \| Create 5 LXC containers on all DUT nodes \|
89 | | ${duts}= | Get Matches | ${nodes} | DUT*
90 | | :FOR | ${dut} | IN | @{duts}
91 | | | Create '${nr}' LXC containers on '${dut}' node
93 | Create '${nr}' LXC containers on '${dut}' node with '${count}' cpus
94 | | [Documentation] | Create and start multiple LXC containers on DUT node.
95 | | ... | Set the cpuset.cpus cgroup profile for pin of cpus.
99 | | ... | \| Create 5 LXC containers on DUT1 node with 2 cpus \|
101 | | ${skip_cpus}= | Evaluate | ${vpp_cpus}+${system_cpus}
102 | | ${count_int}= | Convert To Integer | ${count}
103 | | ${duts}= | Get Matches | ${nodes} | DUT*
104 | | :FOR | ${number} | IN RANGE | 1 | ${nr}+1
105 | | | ${skip}= | Evaluate | ${skip_cpus} + (${nr} - 1) * ${count}
106 | | | Create LXC container on DUT node with cpuset | ${nodes['${dut}']}
107 | | | ... | ${dut}_${lxc_base_name}_${number} | ${skip} | ${count_int}
109 | Create '${nr}' LXC containers on all DUT nodes with '${count}' cpus
110 | | [Documentation] | Create and start multiple LXC containers on all DUT nodes.
111 | | ... | Set the cpuset.cpus cgroup profile for pin of cpus.
115 | | ... | \| Create 5 LXC containers on all DUT nodes with 2 cpus \|
117 | | ${duts}= | Get Matches | ${nodes} | DUT*
118 | | :FOR | ${dut} | IN | @{duts}
119 | | | Create '${nr}' LXC containers on '${dut}' node with '${count}' cpus
121 | Destroy LXC container on DUT node
122 | | [Documentation] | Stop and destroy LXC container on DUT node.
124 | | ... | *Arguments:*
126 | | ... | - dut_node - DUT node. Type: dictionary
127 | | ... | - lxc_name - Name of LXC container. Type: dictionary
131 | | ... | \| Destroy LXC container on DUT node \| ${nodes['DUT1']} \
132 | | ... | \| DUT1_slave_1 \|
134 | | [Arguments] | ${dut_node} | ${lxc_name}
136 | | Import Library | resources.libraries.python.LXCUtils
137 | | ... | container_name=${lxc_name} | WITH NAME | ${lxc_name}
138 | | Run keyword | ${lxc_name}.Set node | ${dut_node}
139 | | Run keyword | ${lxc_name}.Container destroy
141 | Destroy '${nr}' LXC containers on '${dut}' node
142 | | [Documentation] | Stop and destroy multiple LXC containers on DUT node.
146 | | ... | \| Destroy 5 LXC containers on DUT1 node \|
148 | | :FOR | ${number} | IN RANGE | 1 | ${nr}+1
149 | | | Destroy LXC container on DUT node | ${nodes['${dut}']}
150 | | | ... | ${dut}_${lxc_base_name}_${number}
152 | Destroy '${nr}' LXC containers on all DUT nodes
153 | | [Documentation] | Stop and destroy multiple LXC containers on all DUT nodes.
157 | | ... | \| Destroy 5 LXC containers on all DUT nodes \|
159 | | ${duts}= | Get Matches | ${nodes} | DUT*
160 | | :FOR | ${dut} | IN | @{duts}
161 | | | Destroy '${nr}' LXC containers on '${dut}' node
163 | Install VPP on LXC container on DUT node
164 | | [Documentation] | Install vpp on LXC container on DUT node.
166 | | ... | *Arguments:*
168 | | ... | - dut_node - DUT node. Type: dictionary
169 | | ... | - lxc_name - Name of LXC container. Type: dictionary
173 | | ... | \| Install VPP on LXC container on DUT node \| ${nodes['DUT1']} \
174 | | ... | \| DUT1_slave_1 \|
176 | | [Arguments] | ${dut_node} | ${lxc_name}
178 | | Import Library | resources.libraries.python.LXCUtils
179 | | ... | container_name=${lxc_name} | WITH NAME | ${lxc_name}
180 | | Run keyword | ${lxc_name}.Set node | ${dut_node}
181 | | Run keyword | ${lxc_name}.Install VPP in container
183 | Install VPP on '${nr}' LXC containers on '${dut}' node
184 | | [Documentation] | Install VPP on multiple LXC containers on DUT node.
188 | | ... | \| Install VPP on 5 LXC containers on DUT1 node \|
190 | | :FOR | ${number} | IN RANGE | 1 | ${nr}+1
191 | | | Install VPP on LXC container on DUT node | ${nodes['${dut}']}
192 | | | ... | ${dut}_${lxc_base_name}_${number}
194 | Install VPP on '${nr}' LXC containers on all DUT nodes
195 | | [Documentation] | Install VPP on multiple LXC containers on all DUT nodes.
199 | | ... | \| Install VPP on 5 LXC containers on all DUT nodes \|
201 | | ${duts}= | Get Matches | ${nodes} | DUT*
202 | | :FOR | ${dut} | IN | @{duts}
203 | | | Install VPP on '${nr}' LXC containers on '${dut}' node
205 | Create startup configuration of VPP on LXC container on DUT node
206 | | [Documentation] | Create base startup configuration of VPP on LXC container
207 | | ... | on DUT node.
209 | | ... | *Arguments:*
211 | | ... | - dut_node - DUT node. Type: dictionary
212 | | ... | - lxc_name - Name of LXC container. Type: dictionary
216 | | ... | \| Create startup configuration of VPP on LXC container on DUT node \
217 | | ... | \| ${nodes['DUT1']} \| DUT1_slave_1 \|
219 | | [Arguments] | ${dut_node} | ${lxc_name}
221 | | Import Library | resources.libraries.python.VppConfigGenerator
222 | | ... | WITH NAME | ${lxc_name}_conf
223 | | Run keyword | ${lxc_name}_conf.Set node | ${dut_node}
224 | | Run keyword | ${lxc_name}_conf.Add unix CLI listen
225 | | Run keyword | ${lxc_name}_conf.Add unix nodaemon
226 | | Run keyword | ${lxc_name}_conf.Add plugin disable | "dpdk_plugin.so"
227 | | Run Keyword | ${lxc_name}_conf.Apply config LXC | ${lxc_name}
229 | Create startup configuration of VPP on '${nr}' LXC containers on '${dut}' node
230 | | [Documentation] | Create base startup configuration of VPP on multiple LXC
231 | | ... | container on DUT node.
235 | | ... | \| Create startup configuration of VPP on 1 LXC containers on DUT1 \
238 | | :FOR | ${number} | IN RANGE | 1 | ${nr}+1
239 | | | Create startup configuration of VPP on LXC container on DUT node
240 | | | ... | ${nodes['${dut}']} | ${dut}_${lxc_base_name}_${number}
242 | Create startup configuration of VPP on '${nr}' LXC containers on all DUT nodes
243 | | [Documentation] | Create base startup configuration of VPP on multiple LXC
244 | | ... | container on all DUT nodes.
248 | | ... | \| Create startup configuration of VPP on 1 LXC containers on all \
249 | | ... | DUT nodes \|
251 | | ${duts}= | Get Matches | ${nodes} | DUT*
252 | | :FOR | ${dut} | IN | @{duts}
253 | | | Create startup configuration of VPP on '${nr}' LXC containers on '${dut}' node