CSIT-1389 Refactor current keywords for multichaining - CNF (II)
[csit.git] / resources / libraries / robot / shared / container.robot
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:
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 | Documentation | Keywords related to linux containers
16 | Library | resources.libraries.python.CpuUtils
17 | Library | resources.libraries.python.topology.Topology
18
19 *** Keywords ***
20 | Construct container on all DUTs
21 | | [Documentation] | Construct 1 CNF of specific technology on all DUT nodes.
22 | | ...
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
28 | | ...
29 | | ... | *Example:*
30 | | ...
31 | | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \|
32 | | ...
33 | | [Arguments] | ${chains}=${1} | ${nodeness}=${1} | ${chain_id}=${1}
34 | | ... | ${node_id}=${1}
35 | | ...
36 | | ${duts}= | Get Matches | ${nodes} | DUT*
37 | | :FOR | ${dut} | IN | @{duts}
38 | | | ${env}= | Create List | DEBIAN_FRONTEND=noninteractive
39 | | | ${mnt}= | Create List | /tmp:/mnt/host | /dev/vfio:/dev/vfio
40 | | | ${nf_cpus}= | Create network function CPU list | ${dut}
41 | | | ... | chains=${chains} | nodeness=${nodeness} | chain_id=${chain_id}
42 | | | ... | node_id=${node_id} | auto_scale=${True}
43 | | | Run Keyword | ${container_group}.Construct container
44 | | | ... | name=${dut}_${container_group}${chain_id}${node_id}
45 | | | ... | node=${nodes['${dut}']} | mnt=${mnt} | env=${env}
46 | | | ... | cpuset_cpus=${nf_cpus}
47
48 | Construct chain of containers on all DUTs
49 | | [Documentation] | Construct 1 chain of 1..N CNFs on all DUT nodes.
50 | | ...
51 | | ... | *Arguments:*
52 | | ... | - chains: Total number of chains. Type: integer
53 | | ... | - nodeness: Total number of nodes per chain. Type: integer
54 | | ... | - chain_id: Chain ID. Type: integer
55 | | ...
56 | | ... | *Example:*
57 | | ...
58 | | ... | \| Construct chain of containers on all DUTs \| 1 \| 1 \| 1 \|
59 | | ...
60 | | [Arguments] | ${chains} | ${nodeness} | ${chain_id}
61 | | ...
62 | | :FOR | ${node_id} | IN RANGE | 1 | ${nodeness}+1
63 | | | Construct container on all DUTs | chains=${chains} | nodeness=${nodeness}
64 | | | ... | chain_id=${chain_id} | node_id=${node_id}
65
66 | Construct chains of containers on all DUTs
67 | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes.
68 | | ...
69 | | ... | *Arguments:*
70 | | ... | - chains: Total number of chains. Type: integer
71 | | ... | - nodeness: Total number of nodes per chain. Type: integer
72 | | ...
73 | | ... | *Example:*
74 | | ...
75 | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \|
76 | | ...
77 | | [Arguments] | ${chains}=${1} | ${nodeness}=${1}
78 | | ...
79 | | :FOR | ${chain_id} | IN RANGE | 1 | ${chains}+1
80 | | | Construct chain of containers on all DUTs | chains=${chains}
81 | | | ... | nodeness=${nodeness} | chain_id=${chain_id}
82
83 | Acquire all '${group}' containers
84 | | [Documentation] | Acquire all container(s) in specific container group on
85 | | ... | all DUT nodes.
86 | | ...
87 | | Run Keyword | ${group}.Acquire all containers
88
89 | Create all '${group}' containers
90 | | [Documentation] | Create/deploy all container(s) in specific container group
91 | | ... | on all DUT nodes.
92 | | ...
93 | | Run Keyword | ${group}.Create all containers
94
95 | Install VPP in all '${group}' containers
96 | | [Documentation] | Install VPP on all container(s) in specific container
97 | | ... | group on all DUT nodes.
98 | | ...
99 | | Run Keyword | ${group}.Install VPP In All Containers
100
101 | Restart VPP in all '${group}' containers
102 | | [Documentation] | Restart VPP on all container(s) in specific container
103 | | ... | group on all DUT nodes.
104 | | ...
105 | | Run Keyword | ${group}.Restart VPP In All Containers
106
107 | Configure VPP in all '${group}' containers
108 | | [Documentation] | Configure VPP on all container(s) in specific container
109 | | ... | group on all DUT nodes.
110 | | ...
111 | | ${dut2_if2} = | Get Variable Value | \${dut2_if2} | ${EMPTY}
112 | | Run Keyword | ${group}.Configure VPP In All Containers
113 | | ... | chain_topology=${container_chain_topology}
114 | | ... | dut1_if=${dut1_if2} | dut2_if=${dut2_if2}
115
116 | Stop all '${group}' containers
117 | | [Documentation] | Stop all container(s) in specific container group on all
118 | | ... | DUT nodes.
119 | | ...
120 | | Run Keyword | ${group}.Stop all containers
121
122 | Destroy all '${group}' containers
123 | | [Documentation] | Destroy all container(s) in specific container group on
124 | | ... | all DUT nodes.
125 | | ...
126 | | Run Keyword | ${group}.Destroy all containers