blob: 446852f81d40e184790459aa45fa06dafb413197 [file] [log] [blame]
Andy Bavier628710c2015-08-05 15:41:39 -04001#!/bin/bash
2set -x
Andy Bavierd54e0f52015-08-04 17:25:17 -04003
Andy Bavier628710c2015-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 Bavierd54e0f52015-08-04 17:25:17 -04006
Andy Bavier628710c2015-08-05 15:41:39 -04007XOS="http://ctl:9999/"
Andy Bavierd54e0f52015-08-04 17:25:17 -04008AUTH="padmin@vicci.org:letmein"
Andy Bavier628710c2015-08-05 15:41:39 -04009
Andy Bavier8954c2e2015-09-01 14:19:11 -040010# Create public key if none present
11cat /dev/zero | ssh-keygen -q -N ""
12PUBKEY=$( cat ~/.ssh/id_rsa.pub )
13
14# Make sure the public key is available inside the container
15cp ~/.ssh/id_rsa.pub xos/observers/vcpe/vcpe_public_key
16
Andy Bavier628710c2015-08-05 15:41:39 -040017# Install Docker
18wget -qO- https://get.docker.com/ | sh
19sudo usermod -aG docker $(whoami)
20
21sudo apt-get install httpie
22
Andy Bavier1b8fd472015-08-06 10:33:14 -040023sudo docker build -t xos .
Andy Bavier628710c2015-08-05 15:41:39 -040024
25# OpenStack is using port 8000...
26MYIP=$( hostname -i )
Andy Bavier1b8fd472015-08-06 10:33:14 -040027sudo docker run -d --add-host="ctl:$MYIP" -p 9999:8000 xos
Andy Bavier628710c2015-08-05 15:41:39 -040028
29echo "Waiting for XOS to come up"
30until http $XOS &> /dev/null
31do
32 sleep 1
33done
34
Andy Bavierd54e0f52015-08-04 17:25:17 -040035# Copy public key
36# BUG: Shouldn't have to set the 'enacted' field...
37http --auth $AUTH PATCH $XOS/xos/users/1/ public_key="$PUBKEY" enacted=$( date "+%Y-%m-%dT%T")
38
Andy Bavierd54e0f52015-08-04 17:25:17 -040039# Set up controller
40http --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"
41
42# Add controller to site
43http --auth $AUTH PATCH $XOS/xos/sitedeployments/1/ controller=$XOS/xos/controllers/1/
44
45# Add image
46http --auth $AUTH POST $XOS/xos/images/ name=trusty-server-multi-nic disk_format=QCOW2 container_format=BARE
47
48# Activate image
49http --auth $AUTH POST $XOS/xos/imagedeploymentses/ deployment=$XOS/xos/deployments/1/ image=$XOS/xos/images/1/
50
51# Add node
Andy Bavieradff3dc2015-08-07 12:28:49 -040052NODES=$( sudo bash -c "source /root/setup/admin-openrc.sh ; nova hypervisor-list" |grep cloudlab|awk '{print $4}' )
53for NODE in $NODES
54do
55 http --auth $AUTH POST $XOS/xos/nodes/ name=$NODE site_deployment=$XOS/xos/sitedeployments/1/
56done
Andy Bavierd54e0f52015-08-04 17:25:17 -040057
58# Modify networktemplate/2
59# BUG: Shouldn't have to set the controller_kind field, it's invalid in the initial fixture
Andy Bavier753f4822015-08-06 10:34:12 -040060FLATNET=$( sudo bash -c "source /root/setup/admin-openrc.sh ; neutron net-list" |grep flat|awk '{print $4}' )
Andy Bavier1b8fd472015-08-06 10:33:14 -040061http --auth $AUTH PATCH $XOS/xos/networktemplates/2/ shared_network_name=$FLATNET controller_kind=""