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 containers
16 | Library | resources.libraries.python.CpuUtils
17 | Library | resources.libraries.python.topology.Topology
20 | Construct VNF containers on all DUTs
21 | | [Documentation] | Construct 1..N VNF container(s) of specific technology on
22 | | ... | all DUT nodes.
24 | | ${group}= | Set Variable | VNF
25 | | ${guest_dir}= | Set Variable | /mnt/host
26 | | ${host_dir}= | Set Variable | /tmp
27 | | ${skip_cpus}= | Evaluate | ${vpp_cpus}+${system_cpus}
28 | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
29 | | ... | engine=${container_engine} | WITH NAME | ${group}
30 | | ${duts}= | Get Matches | ${nodes} | DUT*
31 | | :FOR | ${dut} | IN | @{duts}
32 | | | ${env}= | Create List | LC_ALL="en_US.UTF-8"
33 | | | ... | DEBIAN_FRONTEND=noninteractive | ETCDV3_ENDPOINTS=172.17.0.1:2379
34 | | | ${cpu_node}= | Get interfaces numa node | ${nodes['${dut}']}
35 | | | ... | ${dut1_if1} | ${dut1_if2}
36 | | | Run Keyword | ${group}.Construct containers
37 | | | ... | name=${dut}_${group} | node=${nodes['${dut}']}
38 | | | ... | host_dir=${host_dir} | guest_dir=${guest_dir}
39 | | | ... | image=${container_image} | cpu_count=${container_cpus}
40 | | | ... | cpu_skip=${skip_cpus} | smt_used=${False} | cpuset_mems=${cpu_node}
41 | | | ... | cpu_shared=${False} | env=${env} | count=${container_count}
42 | | Append To List | ${container_groups} | ${group}
44 | Construct ETCD containers on all DUTs
45 | | [Documentation] | Construct Docker ETCD container on all DUTs.
47 | | ${group}= | Set Variable | ETCD
48 | | ${command}= | Set Variable
49 | | ... | /usr/local/bin/etcd -advertise-client-urls http://0.0.0.0:2379 -listen-client-urls http://0.0.0.0:2379
50 | | ${host_dir}= | Set Variable | /tmp
51 | | ${image}= | Set Variable | quay.io/coreos/etcd:v3.2.5
52 | | ${publish}= | Create List | 2379:2379
53 | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
54 | | ... | engine=Docker | WITH NAME | ${group}
55 | | ${duts}= | Get Matches | ${nodes} | DUT*
56 | | :FOR | ${dut} | IN | @{duts}
57 | | | ${cpu_node}= | Get interfaces numa node | ${nodes['${dut}']}
58 | | | ... | ${dut1_if1} | ${dut1_if2}
59 | | | Run Keyword | ${group}.Construct container
60 | | | ... | name=${dut}_${group} | node=${nodes['${dut}']}
61 | | | ... | image=${container_image} | cpu_count=${1} | cpu_skip=${0}
62 | | | ... | smt_used=${False} | cpuset_mems=${cpu_node} | cpu_shared=${True}
63 | | | ... | publish=${publish} | command=${command}
64 | | Append To List | ${container_groups} | ${group}
66 | Construct Kafka containers on all DUTs
67 | | [Documentation] | Construct Docker Kafka container on all DUTs.
69 | | ${group}= | Set Variable | Kafka
70 | | ${image}= | Set Variable | spotify/kafka
71 | | ${publish}= | Create List | 2181:2181 | 9092:9092
72 | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
73 | | ... | engine=Docker | WITH NAME | ${group}
74 | | ${duts}= | Get Matches | ${nodes} | DUT*
75 | | :FOR | ${dut} | IN | @{duts}
76 | | | ${env}= | Create List | ADVERTISED_HOST=172.17.0.1 | ADVERTISED_PORT=9092
77 | | | ${cpu_node}= | Get interfaces numa node | ${nodes['${dut}']}
78 | | | ... | ${dut1_if1} | ${dut1_if2}
79 | | | Run Keyword | ${group}.Construct container
80 | | | ... | name=${dut}_${group} | node=${nodes['${dut}']} | image=${image}
81 | | | ... | cpu_count=${1} | cpu_skip=${0} | cpuset_mems=${cpu_node}
82 | | | ... | smt_used=${False} | cpu_shared=${True} | publish=${publish}
83 | | | ... | env=${env}
84 | | Append To List | ${container_groups} | ${group}
86 | Acquire all '${group}' containers
87 | | [Documentation] | Acquire all container(s) in specific container group on
88 | | ... | all DUT nodes.
90 | | Run Keyword | ${group}.Acquire all containers
92 | Create all '${group}' containers
93 | | [Documentation] | Create/deploy all container(s) in specific container group
94 | | ... | on all DUT nodes.
96 | | Run Keyword | ${group}.Create all containers
98 | Install VPP in all '${group}' containers
99 | | [Documentation] | Install VPP on all container(s) in specific container
100 | | ... | group on all DUT nodes.
102 | | Run Keyword | ${group}.Install VPP In All Containers
104 | Configure VPP in all '${group}' containers
105 | | [Documentation] | Configure VPP on all container(s) in specific container
106 | | ... | group on all DUT nodes.
108 | | Run Keyword | ${group}.Configure VPP In All Containers
109 | | ... | memif_create_lxc.vat
111 | Stop all '${group}' containers
112 | | [Documentation] | Stop all container(s) in specific container group on all
115 | | Run Keyword | ${group}.Stop all containers
117 | Destroy all '${group}' containers
118 | | [Documentation] | Destroy all container(s) in specific container group on
119 | | ... | all DUT nodes.
121 | | Run Keyword | ${group}.Destroy all containers