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 container on all DUTs
21 | | [Documentation] | Construct 1 CNF of specific technology on all DUT nodes.
23 | | ... | *Arguments:*
24 | | ... | - chains: Total number of chains. Type: integer
25 | | ... | - nodeness: Total number of nodes per chain. Type: integer
26 | | ... | - chain_id: Chain ID. Type: integer
27 | | ... | - node_id: Node ID. Type: integer
31 | | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \|
33 | | [Arguments] | ${chains}=${1} | ${nodeness}=${1} | ${chain_id}=${1}
34 | | ... | ${node_id}=${1}
36 | | ${group}= | Set Variable | CNF
37 | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
38 | | ... | engine=${container_engine} | WITH NAME | ${group}
39 | | ${duts}= | Get Matches | ${nodes} | DUT*
40 | | :FOR | ${dut} | IN | @{duts}
41 | | | ${env}= | Create List | DEBIAN_FRONTEND=noninteractive
42 | | | ${mnt}= | Create List | /tmp:/mnt/host | /dev/vfio:/dev/vfio
43 | | | ${nf_cpus}= | Create network function CPU list | ${dut}
44 | | | ... | chains=${chains} | nodeness=${nodeness} | chain_id=${chain_id}
45 | | | ... | node_id=${node_id} | auto_scale=${True}
46 | | | Run Keyword | ${group}.Construct container
47 | | | ... | name=${dut}_${group}${chain_id}${node_id} | node=${nodes['${dut}']}
48 | | | ... | mnt=${mnt} | env=${env} | cpuset_cpus=${nf_cpus}
49 | | Append To List | ${container_groups} | ${group}
51 | Construct chain of containers on all DUTs
52 | | [Documentation] | Construct 1 chain of 1..N CNFs on all DUT nodes.
54 | | ... | *Arguments:*
55 | | ... | - chains: Total number of chains. Type: integer
56 | | ... | - nodeness: Total number of nodes per chain. Type: integer
57 | | ... | - chain_id: Chain ID. Type: integer
61 | | ... | \| Construct chain of containers on all DUTs \| 1 \| 1 \| 1 \|
63 | | [Arguments] | ${chains} | ${nodeness} | ${chain_id}
65 | | :FOR | ${node_id} | IN RANGE | 1 | ${nodeness}+1
66 | | | Construct container on all DUTs | chains=${chains} | nodeness=${nodeness}
67 | | | ... | chain_id=${chain_id} | node_id=${node_id}
69 | Construct chains of containers on all DUTs
70 | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes.
72 | | ... | *Arguments:*
73 | | ... | - chains: Total number of chains. Type: integer
74 | | ... | - nodeness: Total number of nodes per chain. Type: integer
78 | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \|
80 | | [Arguments] | ${chains}=${1} | ${nodeness}=${1}
82 | | :FOR | ${chain_id} | IN RANGE | 1 | ${chains}+1
83 | | | Construct chain of containers on all DUTs | chains=${chains}
84 | | | ... | nodeness=${nodeness} | chain_id=${chain_id}
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 | Restart VPP in all '${group}' containers
105 | | [Documentation] | Restart VPP on all container(s) in specific container
106 | | ... | group on all DUT nodes.
108 | | Run Keyword | ${group}.Restart VPP In All Containers
110 | Configure VPP in all '${group}' containers
111 | | [Documentation] | Configure VPP on all container(s) in specific container
112 | | ... | group on all DUT nodes.
114 | | ${dut2_if2} = | Get Variable Value | \${dut2_if2} | ${EMPTY}
115 | | Run Keyword | ${group}.Configure VPP In All Containers
116 | | ... | chain_topology=${container_chain_topology}
117 | | ... | dut1_if=${dut1_if2} | dut2_if=${dut2_if2}
119 | Stop all '${group}' containers
120 | | [Documentation] | Stop all container(s) in specific container group on all
123 | | Run Keyword | ${group}.Stop all containers
125 | Destroy all '${group}' containers
126 | | [Documentation] | Destroy all container(s) in specific container group on
127 | | ... | all DUT nodes.
129 | | Run Keyword | ${group}.Destroy all containers