blob: 11eaa14bbabff17b16f4ddb294a6243c3d1bd6c7 [file] [log] [blame]
Andy Bavier050dc832015-08-05 15:41:39 -04001#!/bin/bash
2set -x
Andy Bavier4b8504a2015-08-04 17:25:17 -04003
Andy Bavier050dc832015-08-05 15:41:39 -04004# This script assumes that it is being run on the ctl node of the Tutorial-OpenStack
5# profile on CloudLab.
Andy Bavier4b8504a2015-08-04 17:25:17 -04006
Andy Bavier050dc832015-08-05 15:41:39 -04007XOS="http://ctl:9999/"
Andy Bavier4b8504a2015-08-04 17:25:17 -04008AUTH="padmin@vicci.org:letmein"
Andy Bavier050dc832015-08-05 15:41:39 -04009
10# Install Docker
11wget -qO- https://get.docker.com/ | sh
12sudo usermod -aG docker $(whoami)
13
14sudo apt-get install httpie
15
16docker build -t xos .
17
18# OpenStack is using port 8000...
19MYIP=$( hostname -i )
20docker run -d --add-host="ctl:$MYIP" -p 9999:8000 xos
21
22echo "Waiting for XOS to come up"
23until http $XOS &> /dev/null
24do
25 sleep 1
26done
27
28# Create public key if none present
29cat /dev/zero | ssh-keygen -q -N ""
30PUBKEY=$( cat ~/.ssh/id_rsa.pub )
Andy Bavier4b8504a2015-08-04 17:25:17 -040031
32# Copy public key
33# BUG: Shouldn't have to set the 'enacted' field...
34http --auth $AUTH PATCH $XOS/xos/users/1/ public_key="$PUBKEY" enacted=$( date "+%Y-%m-%dT%T")
35
Andy Bavier4b8504a2015-08-04 17:25:17 -040036# Set up controller
37http --auth $AUTH POST $XOS/xos/controllers/ name=CloudLab deployment=$XOS/xos/deployments/1/ backend_type=OpenStack version=Juno auth_url="http://ctl:5000/v2.0" admin_user=admin admin_tenant=admin admin_password="N!ceD3m0"
38
39# Add controller to site
40http --auth $AUTH PATCH $XOS/xos/sitedeployments/1/ controller=$XOS/xos/controllers/1/
41
42# Add image
43http --auth $AUTH POST $XOS/xos/images/ name=trusty-server-multi-nic disk_format=QCOW2 container_format=BARE
44
45# Activate image
46http --auth $AUTH POST $XOS/xos/imagedeploymentses/ deployment=$XOS/xos/deployments/1/ image=$XOS/xos/images/1/
47
48# Add node
Andy Bavier050dc832015-08-05 15:41:39 -040049NODE=$( sudo bash -c "source /root/setup/admin-openrc.sh ; nova hypervisor-list" |grep cloudlab|awk '{print $4}' )
Andy Bavier4b8504a2015-08-04 17:25:17 -040050http --auth $AUTH POST $XOS/xos/nodes/ name=$NODE site_deployment=$XOS/xos/sitedeployments/1/
51
52# Modify networktemplate/2
53# BUG: Shouldn't have to set the controller_kind field, it's invalid in the initial fixture
Andy Bavier68e22e92015-08-05 16:13:46 -040054http --auth $AUTH PATCH $XOS/xos/networktemplates/2/ shared_network_name=flat-data-net controller_kind=""