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