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 "Press enter to continue"
40 imagePath
=/mnt
/powervault
/virtualization
/vnfs
/os
/US1404.qcow2
41 #image to load as an extra disk, can be any
42 imagePath_extra
=/mnt
/powervault
/virtualization
/vnfs
/os
/US1404user.qcow2
43 #default network to use
49 function del_rubbish
(){
50 echo "Press enter to delete the deployed things"
52 [ -n "$DEL_server" ] && ${DIRNAME}/test_openvim.py
-f del server
$DEL_server
53 [ -n "$DEL_network" ] && ${DIRNAME}/test_openvim.py
-f del network
$DEL_network
54 [ -n "$DEL_flavor" ] && ${DIRNAME}/test_openvim.py
-f del flavor
$DEL_flavor
55 [ -n "$DEL_image" ] && ${DIRNAME}/test_openvim.py
-f del image
$DEL_image
59 function proccess_out
(){ # action_text field to retrieve
60 if egrep -q "\"error\"" kk.out
67 if [ -z "$2" ] ; then pattern
='"id"' ; else pattern
="$2" ; fi
68 value
=`egrep "$pattern" kk.out `
73 echo "not found the field" $2
80 #proccess_out "insert server tidgen1" '^ "id"'
86 echo -n "get ${imagePath##*/} image: "
87 ${DIRNAME}/test_openvim.py
-F"path=$imagePath" images
> kk.out
88 proccess_out
"get ${imagePath##*/}"
93 echo -n "get ${imagePath_extra##*/} image: "
94 ${DIRNAME}/test_openvim.py
-F"path=$imagePath_extra" images
> kk.out
95 proccess_out
"get ${imagePath_extra##*/}"
100 echo -n "get ${network_eth0} network: "
101 ${DIRNAME}/test_openvim.py
-F"name=$network_eth0" network
> kk.out
102 proccess_out
"get ${network_eth0} network"
107 echo -n "insert flavor: "
108 ${DIRNAME}/test_openvim.py new flavor
'
112 description: flavor to test openvim
114 processor_ranking: 205
123 #mac_address: "10:10:10:10:10:10"
128 mac_address: "10:10:10:10:10:11"
130 proccess_out
"insert flavor"
133 DEL_flavor
="$DEL_flavor $flavor1"
136 echo -n "insert ptp net1: "
137 ${DIRNAME}/test_openvim.py new network
'
143 proccess_out
"insert network 0"
146 DEL_network
="$DEL_network $value"
149 echo -n "insert ptp net2: "
150 ${DIRNAME}/test_openvim.py new network
'
156 proccess_out
"insert network 1"
159 DEL_network
="$DEL_network $value"
163 echo -n "insert bridge network net2: "
164 ${DIRNAME}/test_openvim.py new network
'
170 proccess_out
"insert network 2"
173 DEL_network
="$DEL_network $value"
175 echo -n "insert test VM 1: "
176 ${DIRNAME}/test_openvim.py new server
"
180 descrition: US or tidgen with 1 SRIOV 1 PASSTHROUGH
182 flavorRef: '$flavor1'
186 uuid: ${network_eth0}
187 mac_address: '10:10:10:10:10:12'
191 mac_address: '10:10:10:10:10:13'
193 proccess_out
"insert test VM 2" '^ "id"'
196 DEL_server
="$DEL_server $value"
200 echo -n "insert test VM 2: "
201 ${DIRNAME}/test_openvim.py new server
"
205 descrition: US or tidgen with direct network attach
207 flavorRef: '$flavor1'
211 uuid: ${network_eth0}
212 mac_address: '10:10:10:10:aa:12'
216 mac_address: '10:10:10:10:aa:13'
218 processor_ranking: 205
227 #mac_address: '10:10:10:10:aa:10'
233 mac_address: '10:10:10:10:aa:11'
239 proccess_out
"insert test VM 2" '^ "id"'
242 DEL_server
="$DEL_server $value"
244 echo -n "get xe0 iface uuid from tidgen1: "
245 ${DIRNAME}/test_openvim.py
-F "device_id=${server1}&name=xe0" ports
> kk.out
246 proccess_out
"get xe0 uuid port from tidgen1"
251 echo -n "get xe1 iface uuid from tidgen1: "
252 ${DIRNAME}/test_openvim.py
-F "device_id=${server1}&name=xe1" ports
> kk.out
253 proccess_out
"get xe1 uuid port from tidgen1"
258 echo -n "attach xe0 from tidgen1 to network "
259 ${DIRNAME}/test_openvim.py
-f edit ports
$iface_xe0 "network_id: $network0" > kk.out
260 proccess_out
"attach xe0 from tidgen1 to network"
264 echo -n "attach xe1 from tidgen1 to network "
265 ${DIRNAME}/test_openvim.py
-f edit ports
$iface_xe1 "network_id: $network1" > kk.out
266 proccess_out
"attach xe1 from tidgen1 to network"
271 echo finsish. Check connections
!!