Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | set -e |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 4 | |
Zack Williams | 0620c93 | 2017-01-25 14:36:31 -0700 | [diff] [blame] | 5 | CORDDIR=~/cord |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 6 | VMDIR=/cord/build/ |
| 7 | CONFIG=config/cord_in_a_box.yml |
Andy Bavier | a69ee72 | 2016-11-17 07:26:01 -0800 | [diff] [blame] | 8 | SSHCONFIG=~/.ssh/config |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 9 | |
Andy Bavier | d116510 | 2017-01-13 16:38:57 -0500 | [diff] [blame] | 10 | # For CORD version |
| 11 | REPO_BRANCH="master" |
| 12 | VERSION_STRING="CiaB development version" |
| 13 | |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 14 | function add_box() { |
| 15 | vagrant box list | grep $1 | grep virtualbox || vagrant box add $1 |
| 16 | vagrant box list | grep $1 | grep libvirt || vagrant mutate $1 libvirt --input-provider virtualbox |
| 17 | } |
| 18 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 19 | function cleanup_from_previous_test() { |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 20 | echo "## Cleanup ##" |
| 21 | |
Andy Bavier | a4883ba | 2016-12-21 15:46:58 -0500 | [diff] [blame] | 22 | if [ -d $CORDDIR/build ] |
| 23 | then |
| 24 | echo "Destroying all Vagrant VMs" |
| 25 | cd $CORDDIR/build |
| 26 | sudo su $USER -c 'vagrant destroy' |
| 27 | fi |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 28 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 29 | echo "Removing $CORDDIR" |
| 30 | cd ~ |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 31 | rm -rf $CORDDIR |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | function bootstrap() { |
| 35 | cd ~ |
| 36 | sudo apt-get update |
| 37 | [ -e vagrant_1.8.5_x86_64.deb ] || wget https://releases.hashicorp.com/vagrant/1.8.5/vagrant_1.8.5_x86_64.deb |
Andy Bavier | ad3ea84 | 2016-12-21 16:19:07 -0500 | [diff] [blame] | 38 | dpkg -l vagrant || sudo dpkg -i vagrant_1.8.5_x86_64.deb |
Andy Bavier | 1a35ae6 | 2016-11-15 19:58:13 -0800 | [diff] [blame] | 39 | sudo apt-get -y install qemu-kvm libvirt-bin libvirt-dev curl nfs-kernel-server git build-essential |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 40 | |
| 41 | [ -e ~/.ssh/id_rsa ] || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 42 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 43 | sudo adduser $USER libvirtd |
| 44 | |
| 45 | sudo curl -o /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo |
| 46 | sudo chmod a+x /usr/local/bin/repo |
| 47 | |
| 48 | if [ ! -d "$CORDDIR" ] |
| 49 | then |
| 50 | mkdir $CORDDIR && cd $CORDDIR |
| 51 | git config --global user.name 'Test User' |
| 52 | git config --global user.email 'test@null.com' |
| 53 | git config --global color.ui false |
| 54 | |
Scott Baker | 0ab8682 | 2017-02-01 14:33:40 -0800 | [diff] [blame] | 55 | repo init -u https://gerrit.opencord.org/manifest -b $REPO_BRANCH -g build,onos,orchestration,voltha |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 56 | repo sync |
| 57 | |
Zack Williams | dae7ff6 | 2016-11-14 15:20:06 -0700 | [diff] [blame] | 58 | # check out gerrit branches using repo |
| 59 | for gerrit_branch in ${GERRIT_BRANCHES[@]}; do |
| 60 | echo "checking out opencord gerrit branch: $gerrit_branch" |
| 61 | repo download ${gerrit_branch/:/ } |
| 62 | done |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 63 | fi |
| 64 | |
| 65 | cd $CORDDIR/build |
Andy Bavier | ad3ea84 | 2016-12-21 16:19:07 -0500 | [diff] [blame] | 66 | vagrant plugin list | grep vagrant-libvirt || vagrant plugin install vagrant-libvirt --plugin-version 0.0.35 |
| 67 | vagrant plugin list | grep vagrant-mutate || vagrant plugin install vagrant-mutate |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 68 | add_box ubuntu/trusty64 |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | function cloudlab_setup() { |
| 72 | if [ -e /usr/testbed/bin/mkextrafs ] |
| 73 | then |
Andy Bavier | 9c0835e | 2016-11-11 15:56:47 -0500 | [diff] [blame] | 74 | sudo mkdir -p /mnt/extra |
Scott Baker | 8b9182d | 2016-10-27 17:53:52 -0700 | [diff] [blame] | 75 | |
Andy Bavier | 8ce395f | 2016-10-14 12:51:30 -0400 | [diff] [blame] | 76 | # Sometimes this command fails on the first try |
Andy Bavier | 9c0835e | 2016-11-11 15:56:47 -0500 | [diff] [blame] | 77 | sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/mnt/extra/" || sudo /usr/testbed/bin/mkextrafs -r /dev/sdb -qf "/mnt/extra/" |
| 78 | |
| 79 | # Check that the mount succeeded (sometimes mkextrafs succeeds but device not mounted) |
Andy Bavier | a69ee72 | 2016-11-17 07:26:01 -0800 | [diff] [blame] | 80 | mount | grep sdb || (echo "ERROR: mkextrafs failed, exiting!" && exit 1) |
Scott Baker | 8b9182d | 2016-10-27 17:53:52 -0700 | [diff] [blame] | 81 | |
| 82 | # we'll replace /var/lib/libvirt/images with a symlink below |
| 83 | [ -d /var/lib/libvirt/images/ ] && [ ! -h /var/lib/libvirt/images ] && sudo rmdir /var/lib/libvirt/images |
| 84 | |
Andy Bavier | 9c0835e | 2016-11-11 15:56:47 -0500 | [diff] [blame] | 85 | sudo mkdir -p /mnt/extra/libvirt_images |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 86 | if [ ! -e /var/lib/libvirt/images ] |
| 87 | then |
| 88 | sudo ln -s /mnt/extra/libvirt_images /var/lib/libvirt/images |
| 89 | fi |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 90 | fi |
| 91 | } |
| 92 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 93 | function vagrant_vms_up() { |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 94 | cd $CORDDIR/build |
| 95 | |
Andy Bavier | 65c8e15 | 2016-12-22 16:01:27 -0500 | [diff] [blame] | 96 | sudo su $USER -c 'vagrant up corddev prod --provider libvirt' |
Andy Bavier | a69ee72 | 2016-11-17 07:26:01 -0800 | [diff] [blame] | 97 | |
| 98 | # This is a workaround for a weird issue with ARP cache timeout breaking 'vagrant ssh' |
| 99 | # It allows SSH'ing to the machine via 'ssh corddev' |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 100 | sudo su $USER -c "vagrant ssh-config corddev prod > $SSHCONFIG" |
| 101 | |
| 102 | scp ~/.ssh/id_rsa* corddev:.ssh |
| 103 | ssh corddev "chmod go-r ~/.ssh/id_rsa" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | function install_head_node() { |
| 107 | cd $CORDDIR/build |
| 108 | |
Andy Bavier | a69ee72 | 2016-11-17 07:26:01 -0800 | [diff] [blame] | 109 | # SSH config saved earlier allows us to connect to VM without running 'vagrant' |
Zack Williams | 0620c93 | 2017-01-25 14:36:31 -0700 | [diff] [blame] | 110 | ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG fetch" |
| 111 | ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG buildImages" |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 112 | ssh corddev "cd /cord/build; ping -c 3 prod; ./gradlew -PdeployConfig=$VMDIR/$CONFIG -PtargetReg=10.100.198.201:5000 publish" |
Andy Bavier | a69ee72 | 2016-11-17 07:26:01 -0800 | [diff] [blame] | 113 | ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG deploy" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | function set_up_maas_user() { |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 117 | # Set up MAAS user on server to restart nodes via libvirt |
| 118 | grep maas /etc/passwd || sudo useradd -m maas |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 119 | sudo adduser maas libvirtd |
| 120 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 121 | # Copy generated public key to maas user's authorized_keys |
| 122 | sudo su maas -c "mkdir -p ~/.ssh" |
| 123 | sudo cp $HOME/.ssh/id_rsa.pub ~maas/.ssh/authorized_keys |
| 124 | sudo chown maas:maas ~maas/.ssh/authorized_keys |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 125 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 126 | # Copy generated private key to maas user's home dir in prod VM |
| 127 | scp $HOME/.ssh/id_rsa prod:/tmp |
| 128 | ssh prod "sudo mkdir -p ~maas/.ssh" |
| 129 | ssh prod "sudo cp /tmp/id_rsa ~maas/.ssh/id_rsa" |
| 130 | ssh prod "sudo chown -R maas:maas ~maas/.ssh" |
| 131 | } |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 132 | |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 133 | function turn_off_learning () { |
| 134 | NET=$1 |
| 135 | BRIDGE=`sudo virsh net-info $NET|grep "Bridge:"|awk '{print $2}'` |
| 136 | sudo brctl setageing $BRIDGE 0 |
| 137 | sudo brctl stp $BRIDGE off |
| 138 | } |
| 139 | |
| 140 | function leaf_spine_up() { |
| 141 | cd $CORDDIR/build |
| 142 | |
| 143 | if [[ $FABRIC -ne 0 ]] |
| 144 | then |
| 145 | sudo su $USER -c "FABRIC=$FABRIC vagrant up leaf-1 leaf-2 spine-1 spine-2 --provider libvirt" |
| 146 | else |
| 147 | # Linux bridging seems to be having issues with two spine switches |
| 148 | sudo su $USER -c "FABRIC=$FABRIC vagrant up leaf-1 leaf-2 spine-1 --provider libvirt" |
| 149 | fi |
| 150 | |
| 151 | # Turn off MAC learning on "links" -- i.e., bridges created by libvirt. |
| 152 | # Without this, sometimes packets are dropped because the bridges |
| 153 | # think they are not local -- this needs further investigation. |
| 154 | # A better solution might be to replace the bridges with UDP tunnels, but this |
| 155 | # is not supported with the version of libvirt available on Ubuntu 14.04. |
| 156 | turn_off_learning head-node-leaf-1 |
| 157 | turn_off_learning compute-node-1-leaf-1 |
| 158 | turn_off_learning compute-node-2-leaf-2 |
| 159 | turn_off_learning compute-node-3-leaf-2 |
| 160 | turn_off_learning leaf-1-spine-1 |
| 161 | turn_off_learning leaf-1-spine-2 |
| 162 | turn_off_learning leaf-2-spine-1 |
| 163 | turn_off_learning leaf-2-spine-2 |
| 164 | } |
| 165 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 166 | function add_compute_node() { |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 167 | echo add_compute_node: $1 $2 |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 168 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 169 | cd $CORDDIR/build |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 170 | sudo su $USER -c "vagrant up $1 --provider libvirt" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 171 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 172 | # Set up power cycling for the compute node and wait for it to be provisioned |
| 173 | ssh prod "cd /cord/build/ansible; ansible-playbook maas-provision.yml --extra-vars \"maas_user=maas vagrant_name=$2\"" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 174 | |
| 175 | echo "" |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 176 | echo "$1 is fully provisioned!" |
| 177 | } |
| 178 | |
| 179 | function initialize_fabric() { |
| 180 | echo "Initializing fabric" |
| 181 | ssh prod "cd /cord/build/platform-install; ansible-playbook -i /etc/maas/ansible/pod-inventory cord-refresh-fabric.yml" |
| 182 | |
| 183 | echo "Fabric ping test" |
| 184 | ssh prod "cd /cord/build/platform-install; ansible-playbook -i /etc/maas/ansible/pod-inventory cord-fabric-pingtest.yml" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | function run_e2e_test () { |
| 188 | cd $CORDDIR/build |
| 189 | |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 190 | # User has been added to the lbvirtd group, but su $USER to be safe |
Andy Bavier | a69ee72 | 2016-11-17 07:26:01 -0800 | [diff] [blame] | 191 | ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG postDeployTests" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | function run_diagnostics() { |
Zack Williams | 4fd3dcc | 2017-02-08 20:46:14 -0700 | [diff] [blame] | 195 | ssh corddev "cd /cord/build; ./gradlew -PdeployConfig=$VMDIR/$CONFIG PIrunDiag" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | # Parse options |
Zack Williams | dae7ff6 | 2016-11-14 15:20:06 -0700 | [diff] [blame] | 199 | GERRIT_BRANCHES= |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 200 | RUN_TEST=0 |
Andy Bavier | 5c2e4fa | 2016-10-31 13:50:52 -0400 | [diff] [blame] | 201 | SETUP_ONLY=0 |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 202 | DIAGNOSTICS=0 |
| 203 | CLEANUP=0 |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 204 | FABRIC=0 |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 205 | #By default, cord-in-a-box creates 1 compute node. If more than one compute is |
| 206 | #needed, use -n option |
| 207 | NUM_COMPUTE_NODES=1 |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 208 | |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 209 | while getopts "b:cdfhn:stv" opt; do |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 210 | case ${opt} in |
Zack Williams | dae7ff6 | 2016-11-14 15:20:06 -0700 | [diff] [blame] | 211 | b ) GERRIT_BRANCHES+=("$OPTARG") |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 212 | ;; |
| 213 | c ) CLEANUP=1 |
| 214 | ;; |
| 215 | d ) DIAGNOSTICS=1 |
| 216 | ;; |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 217 | f ) FABRIC=1 |
| 218 | ;; |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 219 | h ) echo "Usage:" |
| 220 | echo " $0 install OpenStack and prep XOS and ONOS VMs [default]" |
Zack Williams | dae7ff6 | 2016-11-14 15:20:06 -0700 | [diff] [blame] | 221 | echo " $0 -b <project:changeset/revision> checkout a changesets from gerrit. Can" |
| 222 | echo " be used multiple times." |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 223 | echo " $0 -c cleanup from previous test" |
| 224 | echo " $0 -d run diagnostic collector" |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 225 | echo " $0 -f use ONOS fabric (EXPERIMENTAL)" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 226 | echo " $0 -h display this help message" |
Zack Williams | a9e76ec | 2017-01-20 16:17:35 -0700 | [diff] [blame] | 227 | echo " $0 -n # number of compute nodes to setup. Currently max 2 nodes can be supported" |
Andy Bavier | 5c2e4fa | 2016-10-31 13:50:52 -0400 | [diff] [blame] | 228 | echo " $0 -s run initial setup phase only (don't start building CORD)" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 229 | echo " $0 -t do install, bring up cord-pod configuration, run E2E test" |
Andy Bavier | d116510 | 2017-01-13 16:38:57 -0500 | [diff] [blame] | 230 | echo " $0 -v print CiaB version and exit" |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 231 | exit 0 |
| 232 | ;; |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 233 | n ) NUM_COMPUTE_NODES=$OPTARG |
| 234 | ;; |
Andy Bavier | 5c2e4fa | 2016-10-31 13:50:52 -0400 | [diff] [blame] | 235 | s ) SETUP_ONLY=1 |
| 236 | ;; |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 237 | t ) RUN_TEST=1 |
| 238 | ;; |
Andy Bavier | d116510 | 2017-01-13 16:38:57 -0500 | [diff] [blame] | 239 | v ) echo "$VERSION_STRING ($REPO_BRANCH branch)" |
| 240 | exit 0 |
| 241 | ;; |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 242 | \? ) echo "Invalid option: -$OPTARG" |
| 243 | exit 1 |
| 244 | ;; |
| 245 | esac |
| 246 | done |
| 247 | |
| 248 | # What to do |
| 249 | if [[ $CLEANUP -eq 1 ]] |
| 250 | then |
| 251 | cleanup_from_previous_test |
| 252 | fi |
| 253 | |
Andy Bavier | d116510 | 2017-01-13 16:38:57 -0500 | [diff] [blame] | 254 | echo "" |
| 255 | echo "Preparing to install $VERSION_STRING ($REPO_BRANCH branch)" |
| 256 | echo "" |
| 257 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 258 | bootstrap |
| 259 | cloudlab_setup |
Andy Bavier | 2505f59 | 2016-11-11 15:58:55 -0500 | [diff] [blame] | 260 | vagrant_vms_up |
Andy Bavier | 5c2e4fa | 2016-10-31 13:50:52 -0400 | [diff] [blame] | 261 | |
| 262 | if [[ $SETUP_ONLY -ne 0 ]] |
| 263 | then |
| 264 | echo "Finished build environment setup, exiting..." |
| 265 | exit 0 |
| 266 | fi |
| 267 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 268 | install_head_node |
| 269 | set_up_maas_user |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 270 | leaf_spine_up |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 271 | |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 272 | if [[ $NUM_COMPUTE_NODES -gt 3 ]] |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 273 | then |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 274 | echo "currently max only three compute nodes can be supported..." |
| 275 | NUM_COMPUTE_NODES=3 |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 276 | fi |
| 277 | |
| 278 | for i in `seq 1 $NUM_COMPUTE_NODES`; |
| 279 | do |
| 280 | echo adding the compute node: compute-node-$i |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 281 | add_compute_node compute-node-$i build_compute-node-$i |
Srikanth Vavilapalli | b1c4da0 | 2016-11-17 15:24:28 -0600 | [diff] [blame] | 282 | done |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 283 | |
Zack Williams | 4fd3dcc | 2017-02-08 20:46:14 -0700 | [diff] [blame] | 284 | # run diagnostics both before/after the fabric/e2e tests |
| 285 | if [[ $DIAGNOSTICS -eq 1 ]] |
| 286 | then |
| 287 | run_diagnostics |
| 288 | fi |
| 289 | |
| 290 | |
Andy Bavier | 0f07bb3 | 2017-01-17 10:20:26 -0500 | [diff] [blame] | 291 | if [[ $FABRIC -ne 0 ]] |
| 292 | then |
| 293 | initialize_fabric |
| 294 | fi |
| 295 | |
Andy Bavier | 99c11d3 | 2016-09-14 17:21:20 -0400 | [diff] [blame] | 296 | if [[ $RUN_TEST -eq 1 ]] |
| 297 | then |
| 298 | run_e2e_test |
| 299 | fi |
| 300 | |
| 301 | if [[ $DIAGNOSTICS -eq 1 ]] |
| 302 | then |
| 303 | run_diagnostics |
| 304 | fi |
| 305 | |
| 306 | exit 0 |