blob: 09b29fd750ae6d5e9444ea389ff7303672e89b51 [file] [log] [blame]
Andy Bavier99c11d32016-09-14 17:21:20 -04001#!/usr/bin/env bash
Zack Williamsa1f55082017-02-28 22:41:36 -07002# cord-in-a-box.sh
Andy Bavier99c11d32016-09-14 17:21:20 -04003
Sapan Bhatia01ddea62017-02-10 11:28:48 -08004set -e -x
Andy Bavier99c11d32016-09-14 17:21:20 -04005
Zack Williamsa1f55082017-02-28 22:41:36 -07006# start time, used to name logfiles
7START_T=$(date -u "+%Y%m%d_%H%M%SZ")
8
9# Paths
Zack Williams0620c932017-01-25 14:36:31 -070010CORDDIR=~/cord
Andy Bavier99c11d32016-09-14 17:21:20 -040011VMDIR=/cord/build/
12CONFIG=config/cord_in_a_box.yml
Andy Baviera69ee722016-11-17 07:26:01 -080013SSHCONFIG=~/.ssh/config
Zack Williamsa1f55082017-02-28 22:41:36 -070014VAGRANT_CWD=${CORDDIR}/build/targets/cord-in-a-box
Andy Bavier99c11d32016-09-14 17:21:20 -040015
Zack Williamsa1f55082017-02-28 22:41:36 -070016# CORD versioning
Andy Bavierd1165102017-01-13 16:38:57 -050017REPO_BRANCH="master"
Zack Williamsa1f55082017-02-28 22:41:36 -070018VERSION_STRING="CiaB Devel"
Andy Bavierd1165102017-01-13 16:38:57 -050019
Sapan Bhatiaa94c2db2017-02-27 20:18:24 +010020function finish {
Sapan Bhatia95692092017-03-01 06:48:19 +010021 EXIT=$?
Sapan Bhatiaeb7819c2017-03-01 15:26:17 +010022 python $CORDDIR/build/elk-logger/mixpanel --event FINISH --corddir $CORDDIR --finish --status $EXIT
Sapan Bhatiaa94c2db2017-02-27 20:18:24 +010023}
24
Andy Bavier0f07bb32017-01-17 10:20:26 -050025function add_box() {
26 vagrant box list | grep $1 | grep virtualbox || vagrant box add $1
27 vagrant box list | grep $1 | grep libvirt || vagrant mutate $1 libvirt --input-provider virtualbox
28}
29
Sapan Bhatia01ddea62017-02-10 11:28:48 -080030function run_stage {
Sapan Bhatiaa94c2db2017-02-27 20:18:24 +010031 cd $CORDDIR
Sapan Bhatiaeb7819c2017-03-01 15:26:17 +010032 python build/elk-logger/mixpanel --event $1-start --corddir $CORDDIR
Sapan Bhatiaa94c2db2017-02-27 20:18:24 +010033
Sapan Bhatia01ddea62017-02-10 11:28:48 -080034 echo "==> "$1": Starting"
35 $1
36 echo "==> "$1": Complete"
Sapan Bhatiaa94c2db2017-02-27 20:18:24 +010037
38 cd $CORDDIR
Sapan Bhatiaeb7819c2017-03-01 15:26:17 +010039 python build/elk-logger/mixpanel --event $1-end --corddir $CORDDIR
Sapan Bhatia01ddea62017-02-10 11:28:48 -080040}
41
Andy Bavier99c11d32016-09-14 17:21:20 -040042function cleanup_from_previous_test() {
Andy Bavier99c11d32016-09-14 17:21:20 -040043 echo "## Cleanup ##"
44
Andy Baviera4883ba2016-12-21 15:46:58 -050045 if [ -d $CORDDIR/build ]
46 then
47 echo "Destroying all Vagrant VMs"
48 cd $CORDDIR/build
Zack Williamsa1f55082017-02-28 22:41:36 -070049 for i in `seq 12`; do
50 sudo VAGRANT_CWD=$VAGRANT_CWD vagrant destroy && break
51 done
Andy Baviera4883ba2016-12-21 15:46:58 -050052 fi
Andy Bavier99c11d32016-09-14 17:21:20 -040053
Andy Bavier2505f592016-11-11 15:58:55 -050054 echo "Removing $CORDDIR"
55 cd ~
Andy Bavier99c11d32016-09-14 17:21:20 -040056 rm -rf $CORDDIR
Andy Bavier99c11d32016-09-14 17:21:20 -040057}
58
59function bootstrap() {
Zack Williamsa1f55082017-02-28 22:41:36 -070060
Sapan Bhatia95692092017-03-01 06:48:19 +010061 echo "Generating build id"
Sapan Bhatia77f26672017-03-13 18:30:25 +010062 rm -f /tmp/cord-build-version
Sapan Bhatia95692092017-03-01 06:48:19 +010063 dd bs=18 count=1 if=/dev/urandom | base64 | tr +/ _. > /tmp/cord-build
Andy Bavier99c11d32016-09-14 17:21:20 -040064
Zack Williamsa1f55082017-02-28 22:41:36 -070065 if [ ! -x "/usr/local/bin/repo" ]
66 then
67 echo "Installing repo..."
68 REPO_SHA256SUM="e147f0392686c40cfd7d5e6f332c6ee74c4eab4d24e2694b3b0a0c037bf51dc5" # not versioned...
69 curl -o /tmp/repo https://storage.googleapis.com/git-repo-downloads/repo
70 echo "$REPO_SHA256SUM /tmp/repo" | sha256sum -c -
71 sudo mv /tmp/repo /usr/local/bin/repo
72 sudo chmod a+x /usr/local/bin/repo
73 fi
74
75 if [ ! -x "/usr/bin/vagrant" ]
76 then
77 echo "Installing vagrant and associated tools..."
78 VAGRANT_SHA256SUM="faff6befacc7eed3978b4b71f0dbb9c135c01d8a4d13236bda2f9ed53482d2c4" # version 1.9.3
79 curl -o /tmp/vagrant.deb https://releases.hashicorp.com/vagrant/1.9.3/vagrant_1.9.3_x86_64.deb
80 echo "$VAGRANT_SHA256SUM /tmp/vagrant.deb" | sha256sum -c -
81 sudo apt-get update
82 sudo dpkg -i /tmp/vagrant.deb
83 sudo apt-get -y install qemu-kvm libvirt-bin libvirt-dev curl nfs-kernel-server git build-essential python-pip
84 sudo adduser $USER libvirtd
85 sudo pip install pyparsing python-logstash mixpanel
86 fi
87
88 echo "Installing vagrant plugins..."
89 vagrant plugin list | grep vagrant-libvirt || vagrant plugin install vagrant-libvirt --plugin-version 0.0.35
90 vagrant plugin list | grep vagrant-mutate || vagrant plugin install vagrant-mutate
91
92 add_box ubuntu/trusty64
93
94 echo "Creating SSH key..."
Andy Bavier99c11d32016-09-14 17:21:20 -040095 [ -e ~/.ssh/id_rsa ] || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
Andy Bavier99c11d32016-09-14 17:21:20 -040096
Andy Bavier99c11d32016-09-14 17:21:20 -040097 if [ ! -d "$CORDDIR" ]
98 then
Zack Williamsa1f55082017-02-28 22:41:36 -070099 echo "Downloading CORD/XOS..."
100
101 if [ ! -e "~/.gitconfig" ]
102 then
103 echo "No ~/.gitconfig, setting testing defaults"
104 git config --global user.name 'Test User'
105 git config --global user.email 'test@null.com'
106 git config --global color.ui false
107 fi
108
109 # make sure we can find gerrit.opencord.org as DNS failures will fail the build
110 dig +short gerrit.opencord.org || (echo "ERROR: gerrit.opencord.org can't be looked up in DNS" && exit 1)
111
Andy Bavier99c11d32016-09-14 17:21:20 -0400112 mkdir $CORDDIR && cd $CORDDIR
Zack Williamsa1f55082017-02-28 22:41:36 -0700113 repo init -u https://gerrit.opencord.org/manifest -b master -g build,onos,orchestration,voltha
Andy Bavier99c11d32016-09-14 17:21:20 -0400114 repo sync
115
Zack Williamsdae7ff62016-11-14 15:20:06 -0700116 # check out gerrit branches using repo
117 for gerrit_branch in ${GERRIT_BRANCHES[@]}; do
Zack Williamsa1f55082017-02-28 22:41:36 -0700118 echo "Checking out opencord gerrit branch: $gerrit_branch"
Zack Williamsdae7ff62016-11-14 15:20:06 -0700119 repo download ${gerrit_branch/:/ }
120 done
Andy Bavier99c11d32016-09-14 17:21:20 -0400121 fi
122
Sapan Bhatia868e0012017-02-15 22:14:11 -0800123 exec > >(tee -i $CORDDIR/install.out)
124 exec 2>&1
125
Sapan Bhatia95692092017-03-01 06:48:19 +0100126 # Start tracking failures from this point
127 trap finish EXIT
128
Andy Bavier99c11d32016-09-14 17:21:20 -0400129}
130
131function cloudlab_setup() {
Andy Bavier8b4ed1f2017-02-13 17:06:58 -0800132
Andy Bavier46dfda62017-03-02 05:40:08 -0500133 # Don't do anything if not a CloudLab node
134 [ ! -d /usr/local/etc/emulab ] && return
135
Andy Bavier8b4ed1f2017-02-13 17:06:58 -0800136 # The watchdog will sometimes reset groups, turn it off
137 if [ -e /usr/local/etc/emulab/watchdog ]
138 then
139 sudo /usr/bin/perl -w /usr/local/etc/emulab/watchdog stop
140 sudo mv /usr/local/etc/emulab/watchdog /usr/local/etc/emulab/watchdog-disabled
141 fi
142
Zack Williamsf4e65222017-03-01 14:22:37 -0700143 # Mount extra space, if haven't already
144 if [ ! -d /mnt/extra ]
Andy Bavier99c11d32016-09-14 17:21:20 -0400145 then
Zack Williamsf4e65222017-03-01 14:22:37 -0700146 # for NVME SSD on Utah Cloudlab, not supported by mkextrafs
147 if $(df | grep -q nvme0n1p1) && [ -e /usr/testbed/bin/mkextrafs ]
Andy Bavier2505f592016-11-11 15:58:55 -0500148 then
Zack Williamsf4e65222017-03-01 14:22:37 -0700149 sudo mkdir -p /mnt/extra
150
151 # set partition type of 4th partition to Linux, ignore errors
152 echo -e "t\n4\n82\np\nw\nq" | sudo fdisk /dev/nvme0n1 || true
153
154 sudo mkfs.ext4 /dev/nvme0n1p4
155 echo "/dev/nvme0n1p4 /mnt/extra/ ext4 defaults 0 0" | sudo tee -a /etc/fstab
156 sudo mount /mnt/extra
157 mount | grep nvme0n1p4 || (echo "ERROR: NVME mkfs/mount failed, exiting!" && exit 1)
158
159 elif [ -e /usr/testbed/bin/mkextrafs ] # if on Clemson/Wisconsin Cloudlab
160 then
161 sudo mkdir -p /mnt/extra
162
163 # Sometimes this command fails on the first try
164 sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/mnt/extra/" || sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/mnt/extra/"
165
166 # Check that the mount succeeded (sometimes mkextrafs succeeds but device not mounted)
167 mount | grep sdb || (echo "ERROR: mkextrafs failed, exiting!" && exit 1)
Andy Bavier2505f592016-11-11 15:58:55 -0500168 fi
Andy Bavier99c11d32016-09-14 17:21:20 -0400169 fi
Zack Williamsf4e65222017-03-01 14:22:37 -0700170
171 # replace /var/lib/libvirt/images with a symlink
172 [ -d /var/lib/libvirt/images/ ] && [ ! -h /var/lib/libvirt/images ] && sudo rmdir /var/lib/libvirt/images
173 sudo mkdir -p /mnt/extra/libvirt_images
174
175 if [ ! -e /var/lib/libvirt/images ]
176 then
177 sudo ln -s /mnt/extra/libvirt_images /var/lib/libvirt/images
178 fi
Andy Bavier99c11d32016-09-14 17:21:20 -0400179}
180
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800181function elk_up() {
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800182
183 cd $CORDDIR
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800184 sudo chmod +x build/elk-logger/logstash_tail
Zack Williams49af5e62017-03-24 18:02:56 -0700185
186 build/elk-logger/logstash_tail --file install.out --hostport 10.100.198.201:5617 &
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800187}
188
Andy Bavier2505f592016-11-11 15:58:55 -0500189function vagrant_vms_up() {
Zack Williamsa1f55082017-02-28 22:41:36 -0700190
191 echo "Bringing up CORD-in-a-Box Vagrant VM's..."
Andy Bavier99c11d32016-09-14 17:21:20 -0400192 cd $CORDDIR/build
193
Zack Williamsa1f55082017-02-28 22:41:36 -0700194 sudo VAGRANT_CWD=$VAGRANT_CWD vagrant up corddev prod --provider libvirt
Andy Baviera69ee722016-11-17 07:26:01 -0800195
196 # This is a workaround for a weird issue with ARP cache timeout breaking 'vagrant ssh'
197 # It allows SSH'ing to the machine via 'ssh corddev'
Zack Williamsa1f55082017-02-28 22:41:36 -0700198 sudo VAGRANT_CWD=$VAGRANT_CWD vagrant ssh-config corddev prod > $SSHCONFIG
199
200 sudo chown -R ${USER} ${VAGRANT_CWD}/.vagrant
Andy Bavier2505f592016-11-11 15:58:55 -0500201
202 scp ~/.ssh/id_rsa* corddev:.ssh
203 ssh corddev "chmod go-r ~/.ssh/id_rsa"
Andy Bavier99c11d32016-09-14 17:21:20 -0400204}
205
206function install_head_node() {
207 cd $CORDDIR/build
208
Andy Baviera69ee722016-11-17 07:26:01 -0800209 # SSH config saved earlier allows us to connect to VM without running 'vagrant'
Zack Williams0620c932017-01-25 14:36:31 -0700210 ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG fetch"
211 ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG buildImages"
Andy Bavier2505f592016-11-11 15:58:55 -0500212 ssh corddev "cd /cord/build; ping -c 3 prod; ./gradlew -PdeployConfig=$VMDIR/$CONFIG -PtargetReg=10.100.198.201:5000 publish"
Andy Baviera69ee722016-11-17 07:26:01 -0800213 ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG deploy"
Andy Bavier99c11d32016-09-14 17:21:20 -0400214}
215
216function set_up_maas_user() {
Andy Bavier2505f592016-11-11 15:58:55 -0500217 # Set up MAAS user on server to restart nodes via libvirt
218 grep maas /etc/passwd || sudo useradd -m maas
Andy Bavier99c11d32016-09-14 17:21:20 -0400219 sudo adduser maas libvirtd
220
Andy Bavier2505f592016-11-11 15:58:55 -0500221 # Copy generated public key to maas user's authorized_keys
222 sudo su maas -c "mkdir -p ~/.ssh"
223 sudo cp $HOME/.ssh/id_rsa.pub ~maas/.ssh/authorized_keys
224 sudo chown maas:maas ~maas/.ssh/authorized_keys
Andy Bavier99c11d32016-09-14 17:21:20 -0400225
Andy Bavier2505f592016-11-11 15:58:55 -0500226 # Copy generated private key to maas user's home dir in prod VM
227 scp $HOME/.ssh/id_rsa prod:/tmp
228 ssh prod "sudo mkdir -p ~maas/.ssh"
229 ssh prod "sudo cp /tmp/id_rsa ~maas/.ssh/id_rsa"
230 ssh prod "sudo chown -R maas:maas ~maas/.ssh"
231}
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600232
Andy Bavier0f07bb32017-01-17 10:20:26 -0500233function turn_off_learning () {
234 NET=$1
235 BRIDGE=`sudo virsh net-info $NET|grep "Bridge:"|awk '{print $2}'`
236 sudo brctl setageing $BRIDGE 0
237 sudo brctl stp $BRIDGE off
238}
239
240function leaf_spine_up() {
241 cd $CORDDIR/build
242
243 if [[ $FABRIC -ne 0 ]]
244 then
Zack Williamsa1f55082017-02-28 22:41:36 -0700245 sudo VAGRANT_CWD=$VAGRANT_CWD FABRIC=$FABRIC vagrant up leaf-1 leaf-2 spine-1 spine-2 --provider libvirt
Andy Bavier0f07bb32017-01-17 10:20:26 -0500246 else
247 # Linux bridging seems to be having issues with two spine switches
Zack Williamsa1f55082017-02-28 22:41:36 -0700248 sudo VAGRANT_CWD=$VAGRANT_CWD FABRIC=$FABRIC vagrant up leaf-1 leaf-2 spine-1 --provider libvirt
Andy Bavier0f07bb32017-01-17 10:20:26 -0500249 fi
250
251 # Turn off MAC learning on "links" -- i.e., bridges created by libvirt.
252 # Without this, sometimes packets are dropped because the bridges
253 # think they are not local -- this needs further investigation.
254 # A better solution might be to replace the bridges with UDP tunnels, but this
255 # is not supported with the version of libvirt available on Ubuntu 14.04.
256 turn_off_learning head-node-leaf-1
257 turn_off_learning compute-node-1-leaf-1
258 turn_off_learning compute-node-2-leaf-2
259 turn_off_learning compute-node-3-leaf-2
260 turn_off_learning leaf-1-spine-1
261 turn_off_learning leaf-1-spine-2
262 turn_off_learning leaf-2-spine-1
263 turn_off_learning leaf-2-spine-2
264}
265
Andy Bavier99c11d32016-09-14 17:21:20 -0400266function add_compute_node() {
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600267 echo add_compute_node: $1 $2
Andy Bavier2505f592016-11-11 15:58:55 -0500268
Andy Bavier99c11d32016-09-14 17:21:20 -0400269 cd $CORDDIR/build
Zack Williamsa1f55082017-02-28 22:41:36 -0700270 sudo VAGRANT_CWD=$VAGRANT_CWD vagrant up $1 --provider libvirt
Andy Bavier99c11d32016-09-14 17:21:20 -0400271
Andy Bavier2505f592016-11-11 15:58:55 -0500272 # Set up power cycling for the compute node and wait for it to be provisioned
273 ssh prod "cd /cord/build/ansible; ansible-playbook maas-provision.yml --extra-vars \"maas_user=maas vagrant_name=$2\""
Andy Bavier99c11d32016-09-14 17:21:20 -0400274
275 echo ""
Andy Bavier0f07bb32017-01-17 10:20:26 -0500276 echo "$1 is fully provisioned!"
277}
278
279function initialize_fabric() {
280 echo "Initializing fabric"
281 ssh prod "cd /cord/build/platform-install; ansible-playbook -i /etc/maas/ansible/pod-inventory cord-refresh-fabric.yml"
282
283 echo "Fabric ping test"
284 ssh prod "cd /cord/build/platform-install; ansible-playbook -i /etc/maas/ansible/pod-inventory cord-fabric-pingtest.yml"
Andy Bavier99c11d32016-09-14 17:21:20 -0400285}
286
287function run_e2e_test () {
288 cd $CORDDIR/build
289
Andy Bavier2505f592016-11-11 15:58:55 -0500290 # User has been added to the lbvirtd group, but su $USER to be safe
Andy Baviera69ee722016-11-17 07:26:01 -0800291 ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG postDeployTests"
Andy Bavier99c11d32016-09-14 17:21:20 -0400292}
293
294function run_diagnostics() {
Zack Williams4fd3dcc2017-02-08 20:46:14 -0700295 ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG PIrunDiag"
Andy Bavier99c11d32016-09-14 17:21:20 -0400296}
297
298# Parse options
Zack Williamsdae7ff62016-11-14 15:20:06 -0700299GERRIT_BRANCHES=
Andy Bavier99c11d32016-09-14 17:21:20 -0400300RUN_TEST=0
Andy Bavier5c2e4fa2016-10-31 13:50:52 -0400301SETUP_ONLY=0
Andy Bavier99c11d32016-09-14 17:21:20 -0400302DIAGNOSTICS=0
303CLEANUP=0
Andy Bavier0f07bb32017-01-17 10:20:26 -0500304FABRIC=0
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600305#By default, cord-in-a-box creates 1 compute node. If more than one compute is
306#needed, use -n option
307NUM_COMPUTE_NODES=1
Andy Bavier99c11d32016-09-14 17:21:20 -0400308
Andy Bavier0f07bb32017-01-17 10:20:26 -0500309while getopts "b:cdfhn:stv" opt; do
Andy Bavier99c11d32016-09-14 17:21:20 -0400310 case ${opt} in
Zack Williamsdae7ff62016-11-14 15:20:06 -0700311 b ) GERRIT_BRANCHES+=("$OPTARG")
Andy Bavier99c11d32016-09-14 17:21:20 -0400312 ;;
313 c ) CLEANUP=1
314 ;;
315 d ) DIAGNOSTICS=1
316 ;;
Andy Bavier0f07bb32017-01-17 10:20:26 -0500317 f ) FABRIC=1
318 ;;
Andy Bavier99c11d32016-09-14 17:21:20 -0400319 h ) echo "Usage:"
320 echo " $0 install OpenStack and prep XOS and ONOS VMs [default]"
Zack Williamsdae7ff62016-11-14 15:20:06 -0700321 echo " $0 -b <project:changeset/revision> checkout a changesets from gerrit. Can"
322 echo " be used multiple times."
Andy Bavier99c11d32016-09-14 17:21:20 -0400323 echo " $0 -c cleanup from previous test"
324 echo " $0 -d run diagnostic collector"
Andy Bavier0f07bb32017-01-17 10:20:26 -0500325 echo " $0 -f use ONOS fabric (EXPERIMENTAL)"
Andy Bavier99c11d32016-09-14 17:21:20 -0400326 echo " $0 -h display this help message"
Zack Williamsa9e76ec2017-01-20 16:17:35 -0700327 echo " $0 -n # number of compute nodes to setup. Currently max 2 nodes can be supported"
Andy Bavier5c2e4fa2016-10-31 13:50:52 -0400328 echo " $0 -s run initial setup phase only (don't start building CORD)"
Andy Bavier99c11d32016-09-14 17:21:20 -0400329 echo " $0 -t do install, bring up cord-pod configuration, run E2E test"
Andy Bavierd1165102017-01-13 16:38:57 -0500330 echo " $0 -v print CiaB version and exit"
Andy Bavier99c11d32016-09-14 17:21:20 -0400331 exit 0
332 ;;
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600333 n ) NUM_COMPUTE_NODES=$OPTARG
334 ;;
Andy Bavier5c2e4fa2016-10-31 13:50:52 -0400335 s ) SETUP_ONLY=1
336 ;;
Andy Bavier99c11d32016-09-14 17:21:20 -0400337 t ) RUN_TEST=1
338 ;;
Andy Bavierd1165102017-01-13 16:38:57 -0500339 v ) echo "$VERSION_STRING ($REPO_BRANCH branch)"
340 exit 0
341 ;;
Andy Bavier99c11d32016-09-14 17:21:20 -0400342 \? ) echo "Invalid option: -$OPTARG"
343 exit 1
344 ;;
345 esac
346done
347
348# What to do
349if [[ $CLEANUP -eq 1 ]]
350then
Sapan Bhatia3f454b32017-03-01 05:24:19 +0100351 cleanup_from_previous_test
Andy Bavier99c11d32016-09-14 17:21:20 -0400352fi
353
Andy Bavierd1165102017-01-13 16:38:57 -0500354echo ""
355echo "Preparing to install $VERSION_STRING ($REPO_BRANCH branch)"
356echo ""
357
Sapan Bhatiaa94c2db2017-02-27 20:18:24 +0100358bootstrap
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800359run_stage cloudlab_setup
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800360run_stage vagrant_vms_up
Zack Williams49af5e62017-03-24 18:02:56 -0700361run_stage elk_up
Andy Bavier5c2e4fa2016-10-31 13:50:52 -0400362
363if [[ $SETUP_ONLY -ne 0 ]]
364then
365 echo "Finished build environment setup, exiting..."
366 exit 0
367fi
368
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800369run_stage install_head_node
370run_stage set_up_maas_user
371run_stage leaf_spine_up
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600372
Andy Bavier0f07bb32017-01-17 10:20:26 -0500373if [[ $NUM_COMPUTE_NODES -gt 3 ]]
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600374then
Andy Bavier0f07bb32017-01-17 10:20:26 -0500375 echo "currently max only three compute nodes can be supported..."
376 NUM_COMPUTE_NODES=3
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600377fi
378
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800379echo "==> Adding compute nodes: Starting"
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600380for i in `seq 1 $NUM_COMPUTE_NODES`;
381do
382 echo adding the compute node: compute-node-$i
Zack Williamsa1f55082017-02-28 22:41:36 -0700383 add_compute_node compute-node-$i cord-in-a-box_compute-node-$i
Srikanth Vavilapallib1c4da02016-11-17 15:24:28 -0600384done
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800385echo "==> Adding compute nodes: Complete"
Andy Bavier99c11d32016-09-14 17:21:20 -0400386
Zack Williams4fd3dcc2017-02-08 20:46:14 -0700387# run diagnostics both before/after the fabric/e2e tests
388if [[ $DIAGNOSTICS -eq 1 ]]
389then
390 run_diagnostics
391fi
392
393
Andy Bavier0f07bb32017-01-17 10:20:26 -0500394if [[ $FABRIC -ne 0 ]]
395then
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800396 run_stage initialize_fabric
Andy Bavier0f07bb32017-01-17 10:20:26 -0500397fi
398
Andy Bavier99c11d32016-09-14 17:21:20 -0400399if [[ $RUN_TEST -eq 1 ]]
400then
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800401 run_stage run_e2e_test
Andy Bavier99c11d32016-09-14 17:21:20 -0400402fi
403
404if [[ $DIAGNOSTICS -eq 1 ]]
405then
Sapan Bhatia01ddea62017-02-10 11:28:48 -0800406 run_stage run_diagnostics
Andy Bavier99c11d32016-09-14 17:21:20 -0400407fi
408
409exit 0