4 # Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
5 # This file is part of openvim
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
20 # For those usages not covered by the Apache License, Version 2.0 please
21 # contact with: nfvlabs@tid.es
25 #author Alfonso Tierno
27 #script to test openvim with the creation of flavors and interfaces
28 #using images already inserted
31 echo " Creates 1 flavor, 3 nets, 2 VMs (US)
32 Interfaces: 2 sriov, 1 passthrough, 1 sriov dedicated
33 Test mac address allocation, 1 VM with direct network attach,
34 another VM with network attach after creation"
36 echo -n "type network model to test network model (empty to skip)? "
38 echo "Press enter to continue"
42 model
="model: '${model}'"
47 imagePath
=/mnt
/powervault
/virtualization
/vnfs
/os
/US1404.qcow2
48 #image to load as an extra disk, can be any
49 imagePath_extra
=/mnt
/powervault
/virtualization
/vnfs
/os
/US1404user.qcow2
50 #default network to use
56 function del_rubbish
(){
57 echo "Press enter to delete the deployed things"
59 [ -n "$DEL_server" ] && ${DIRNAME}/test_openvim.py
-f del server
$DEL_server
60 [ -n "$DEL_network" ] && ${DIRNAME}/test_openvim.py
-f del network
$DEL_network
61 [ -n "$DEL_flavor" ] && ${DIRNAME}/test_openvim.py
-f del flavor
$DEL_flavor
62 [ -n "$DEL_image" ] && ${DIRNAME}/test_openvim.py
-f del image
$DEL_image
66 function proccess_out
(){ # action_text field to retrieve
67 if egrep -q "\"error\"" kk.out
74 if [ -z "$2" ] ; then pattern
='"id"' ; else pattern
="$2" ; fi
75 value
=`egrep "$pattern" kk.out `
80 echo "not found the field" $2
87 #proccess_out "insert server tidgen1" '^ "id"'
93 echo -n "get ${imagePath##*/} image: "
94 ${DIRNAME}/test_openvim.py
-F"path=$imagePath" images
> kk.out
95 proccess_out
"get ${imagePath##*/}"
100 echo -n "get ${imagePath_extra##*/} image: "
101 ${DIRNAME}/test_openvim.py
-F"path=$imagePath_extra" images
> kk.out
102 proccess_out
"get ${imagePath_extra##*/}"
107 echo -n "get ${network_eth0} network: "
108 ${DIRNAME}/test_openvim.py
-F"name=$network_eth0" network
> kk.out
109 proccess_out
"get ${network_eth0} network"
114 echo -n "insert flavor: "
115 ${DIRNAME}/test_openvim.py new flavor
'
119 description: flavor to test openvim
121 processor_ranking: 205
130 #mac_address: "10:10:10:10:10:10"
132 dedicated: "yes:sriov"
135 mac_address: "10:10:10:10:10:11"
137 proccess_out
"insert flavor"
140 DEL_flavor
="$DEL_flavor $flavor1"
143 echo -n "insert ptp net1: "
144 ${DIRNAME}/test_openvim.py new network
'
150 proccess_out
"insert network 0"
153 DEL_network
="$DEL_network $value"
156 echo -n "insert ptp net2: "
157 ${DIRNAME}/test_openvim.py new network
'
163 proccess_out
"insert network 1"
166 DEL_network
="$DEL_network $value"
170 echo -n "insert bridge network net2: "
171 ${DIRNAME}/test_openvim.py new network
'
177 proccess_out
"insert network 2"
180 DEL_network
="$DEL_network $value"
182 echo -n "insert test VM 1: "
183 ${DIRNAME}/test_openvim.py new server
"
187 descrition: US or tidgen with 1 SRIOV 1 PASSTHROUGH
189 flavorRef: '$flavor1'
193 uuid: ${network_eth0}
194 mac_address: '10:10:10:10:10:12'
198 mac_address: '10:10:10:10:10:13'
201 proccess_out
"insert test VM 2" '^ "id"'
204 DEL_server
="$DEL_server $value"
208 echo -n "insert test VM 2: "
209 ${DIRNAME}/test_openvim.py new server
"
213 descrition: US or tidgen with direct network attach
215 flavorRef: '$flavor1'
217 processor_ranking: 205
226 #mac_address: '10:10:10:10:aa:10'
232 mac_address: '10:10:10:10:aa:11'
240 uuid: ${network_eth0}
241 mac_address: '10:10:10:10:aa:12'
245 mac_address: '10:10:10:10:aa:13'
248 proccess_out
"insert test VM 2" '^ "id"'
251 DEL_server
="$DEL_server $value"
253 echo -n "get xe0 iface uuid from tidgen1: "
254 ${DIRNAME}/test_openvim.py
-F "device_id=${server1}&name=xe0" ports
> kk.out
255 proccess_out
"get xe0 uuid port from tidgen1"
260 echo -n "get xe1 iface uuid from tidgen1: "
261 ${DIRNAME}/test_openvim.py
-F "device_id=${server1}&name=xe1" ports
> kk.out
262 proccess_out
"get xe1 uuid port from tidgen1"
267 echo -n "attach xe0 from tidgen1 to network "
268 ${DIRNAME}/test_openvim.py
-f edit ports
$iface_xe0 "network_id: $network0" > kk.out
269 proccess_out
"attach xe0 from tidgen1 to network"
273 echo -n "attach xe1 from tidgen1 to network "
274 ${DIRNAME}/test_openvim.py
-f edit ports
$iface_xe1 "network_id: $network1" > kk.out
275 proccess_out
"attach xe1 from tidgen1 to network"
280 echo finish. Check connections
!!
281 echo click
return to delete all deployed things