c33ca5fea9b87e1e82abc3bd1c43756e7569bdeb
[csit.git] / resources / libraries / robot / shared / vm.robot
1 # Copyright (c) 2020 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 vm lifecycle management
16 ...
17 | Library | resources.libraries.python.InterfaceUtil
18
19 *** Keywords ***
20 | Configure chains of NFs connected via vhost-user
21 | | [Documentation]
22 | | ... | Start 1..N chains of 1..N QEMU guests (VNFs) with two vhost-user\
23 | | ... | interfaces and interconnecting NF.
24 | |
25 | | ... | *Arguments:*
26 | | ... | - nf_chains - Number of chains of NFs. Type: integer
27 | | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer
28 | | ... | - jumbo - Jumbo frames are used (True) or are not used (False)
29 | | ... | in the test. Type: boolean
30 | | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer
31 | | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP.
32 | | ... | Type: boolean
33 | | ... | - auto_scale - Whether to use same amount of RXQs for memif interface
34 | | ... | in containers as vswitch, otherwise use single RXQ. Type: boolean
35 | | ... | - vnf - Network function as a payload. Type: string
36 | | ... | - pinning - Whether to pin QEMU VMs to specific cores
37 | |
38 | | ... | *Example:*
39 | |
40 | | ... | \| Configure chains of VMs connected via vhost-user
41 | | ... | \| 1 \| 1 \| False \| 1024 \| False \| False \| vpp \| True \|
42 | |
43 | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${jumbo}=${False}
44 | | ... | ${perf_qemu_qsz}=${1024} | ${use_tuned_cfs}=${False}
45 | | ... | ${auto_scale}=${True} | ${vnf}=vpp | ${pinning}=${True}
46 | |
47 | | Import Library | resources.libraries.python.QemuManager | ${nodes}
48 | | ... | WITH NAME | vnf_manager
49 | | Run Keyword | vnf_manager.Construct VMs on all nodes
50 | | ... | nf_chains=${nf_chains} | nf_nodes=${nf_nodes} | jumbo=${jumbo}
51 | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs}
52 | | ... | auto_scale=${auto_scale} | vnf=${vnf}
53 | | ... | tg_pf1_mac=${TG_pf1_mac}[0] | tg_pf2_mac=${TG_pf2_mac}[0]
54 | | ... | vs_dtc=${cpu_count_int} | nf_dtc=${nf_dtc} | nf_dtcr=${nf_dtcr}
55 | | ... | rxq_count_int=${rxq_count_int} | enable_csum=${False}
56 | | ... | enable_gso=${False}
57 | | ${cpu_wt}= | Run Keyword | vnf_manager.Start All VMs | pinning=${pinning}
58 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_wt}
59 | | Set Test Variable | ${cpu_alloc_str}
60 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
61 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual
62
63 | Configure chains of NFs connected via vhost-user on single node
64 | | [Documentation]
65 | | ... | Start 1..N chains of 1..N QEMU guests (VNFs) with two vhost-user\
66 | | ... | interfaces and interconnecting NF on single DUT node.
67 | |
68 | | ... | *Arguments:*
69 | | ... | - node - DUT node. Type: dictionary
70 | | ... | - nf_chains - Number of chains of NFs. Type: integer
71 | | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer
72 | | ... | - jumbo - Jumbo frames are used (True) or are not used (False)
73 | | ... | in the test. Type: boolean
74 | | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer
75 | | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP.
76 | | ... | Type: boolean
77 | | ... | - auto_scale - Whether to use same amount of RXQs for memif interface
78 | | ... | in containers as vswitch, otherwise use single RXQ. Type: boolean
79 | | ... | - vnf - Network function as a payload. Type: string
80 | | ... | - pinning - Whether to pin QEMU VMs to specific cores
81 | |
82 | | ... | *Example:*
83 | |
84 | | ... | \| Configure chains of NFs connected via vhost-user on single node
85 | | ... | \| DUT1 \| 1 \| 1 \| False \| 1024 \| False \| False \| vpp \|
86 | | ... | True \|
87 | |
88 | | [Arguments] | ${node} | ${nf_chains}=${1} | ${nf_nodes}=${1}
89 | | ... | ${jumbo}=${False} | ${perf_qemu_qsz}=${1024}
90 | | ... | ${use_tuned_cfs}=${False} | ${auto_scale}=${True} | ${vnf}=vpp
91 | | ... | ${pinning}=${True}
92 | |
93 | | Import Library | resources.libraries.python.QemuManager | ${nodes}
94 | | ... | WITH NAME | vnf_manager
95 | | Run Keyword | vnf_manager.Initialize
96 | | Run Keyword | vnf_manager.Construct VMs on node
97 | | ... | node=${node}
98 | | ... | nf_chains=${nf_chains} | nf_nodes=${nf_nodes} | jumbo=${jumbo}
99 | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs}
100 | | ... | auto_scale=${auto_scale} | vnf=${vnf}
101 | | ... | tg_pf1_mac=${TG_pf1_mac}[0] | tg_pf2_mac=${TG_pf2_mac}[0]
102 | | ... | vs_dtc=${cpu_count_int} | nf_dtc=${nf_dtc} | nf_dtcr=${nf_dtcr}
103 | | ... | rxq_count_int=${rxq_count_int} | enable_csum=${False}
104 | | ... | enable_gso=${False}
105 | | ${cpu_wt}= | Run Keyword | vnf_manager.Start All VMs | pinning=${pinning}
106 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_wt}
107 | | Set Test Variable | ${cpu_alloc_str}
108 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
109 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=Virtual
110
111 | Configure chains of NFs connected via passtrough
112 | | [Documentation]
113 | | ... | Start 1..N chains of 1..N QEMU guests (VNFs) with two pci passtrough\
114 | | ... | interfaces and interconnecting NF.
115 | |
116 | | ... | *Arguments:*
117 | | ... | - nf_chains - Number of chains of NFs. Type: integer
118 | | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer
119 | | ... | - jumbo - Jumbo frames are used (True) or are not used (False)
120 | | ... | in the test. Type: boolean
121 | | ... | - perf_qemu_qsz - Virtio Queue Size. Type: integer
122 | | ... | - use_tuned_cfs - Set True if CFS RR should be used for Qemu SMP.
123 | | ... | Type: boolean
124 | | ... | - auto_scale - Whether to use same amount of RXQs for memif interface
125 | | ... | in containers as vswitch, otherwise use single RXQ. Type: boolean
126 | | ... | - vnf - Network function as a payload. Type: string
127 | | ... | - pinning - Whether to pin QEMU VMs to specific cores
128 | |
129 | | ... | *Example:*
130 | |
131 | | ... | \| Configure chains of VMs connected via passtrough
132 | | ... | \| 1 \| 1 \| False \| 1024 \| False \| False \| vpp \| True \|
133 | |
134 | | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${jumbo}=${False}
135 | | ... | ${perf_qemu_qsz}=${1024} | ${use_tuned_cfs}=${False}
136 | | ... | ${auto_scale}=${True} | ${vnf}=vpp | ${pinning}=${True}
137 | |
138 | | Import Library | resources.libraries.python.QemuManager | ${nodes}
139 | | ... | WITH NAME | vnf_manager
140 | | Run Keyword | vnf_manager.Construct VMs on all nodes
141 | | ... | nf_chains=${nf_chains} | nf_nodes=${nf_nodes} | jumbo=${jumbo}
142 | | ... | perf_qemu_qsz=${perf_qemu_qsz} | use_tuned_cfs=${use_tuned_cfs}
143 | | ... | auto_scale=${auto_scale} | vnf=${vnf}
144 | | ... | tg_pf1_mac=${TG_pf1_mac}[0] | tg_pf2_mac=${TG_pf2_mac}[0]
145 | | ... | vs_dtc=${cpu_count_int} | nf_dtc=${nf_dtc} | nf_dtcr=${nf_dtcr}
146 | | ... | rxq_count_int=${rxq_count_int} | enable_csum=${False}
147 | | ... | enable_gso=${False}
148 | | ... | if1=${DUT1_${int}1}[0] | if2=${DUT1_${int}2}[0]
149 | | ${cpu_wt}= | Run Keyword | vnf_manager.Start All VMs | pinning=${pinning}
150 | | ${cpu_alloc_str}= | Catenate | SEPARATOR=, | ${cpu_alloc_str} | ${cpu_wt}
151 | | Set Test Variable | ${cpu_alloc_str}