Andy Bavier | d54e0f5 | 2015-08-04 17:25:17 -0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # This script assumes that XOS is running in a Docker container on the local machine, |
| 4 | # using an image called 'xos'. |
| 5 | |
| 6 | # CHANGE THE FOLLOWING FOR YOUR CLOUDLAB INSTALLATION |
| 7 | # URL for your XOS installation |
| 8 | XOS="http://192.168.59.103:8000/" |
| 9 | # The IP address of the OpenStack head node on CloudLab |
| 10 | CTL_IP="128.104.222.18" |
| 11 | # The DNS name of the OpenStack compute node, as shown by 'nova hypervisor-list' |
| 12 | NODE="cp1.acb-qv7993.planetcloud-pg0.wisc.cloudlab.us" |
| 13 | # The public key that you want to use to login to instances |
| 14 | PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArlgZWcRP75W2/e5bKG1FEeec1OJQuw9dGVyo3TdUgVu4F0/JgBsgR2BrTuQ+mzm+N47ZkSrYwLdAJGuvL7ECxc6aouQ6AtQ/biU1gsrfuPnnUBjfAGqlP/L77lYxpLAPglx/HCCBu53gLKVt8lRDyyGZaWnB7fGlnwrn5AMjcfXsz5Ia8W6oBmxy2fxDSR9SpTs5yAzfcj37mCBtOZBwdjb54B36WpFq9BwFrEXxbvxH4aU0WSneJagicZuCUXnTg2YSURBD0jBmTrYOVRfTZzNPyagOvuIhnnakOSGkGa8s4SrC5zymZsVPdQbp6icRsu6OjKZ83Y0oiTQ4rTaeUw== acb@cadenza.cs.princeton.edu" |
| 15 | # END CHANGES |
| 16 | |
| 17 | AUTH="padmin@vicci.org:letmein" |
| 18 | CONTAINER=$( docker ps|grep xos|awk '{print $(NF)}' ) |
| 19 | |
| 20 | # Copy public key |
| 21 | # BUG: Shouldn't have to set the 'enacted' field... |
| 22 | http --auth $AUTH PATCH $XOS/xos/users/1/ public_key="$PUBKEY" enacted=$( date "+%Y-%m-%dT%T") |
| 23 | |
| 24 | # Fix /etc/hosts, necessary for OpenStack endpoints |
| 25 | docker exec $CONTAINER bash -c "echo $CTL_IP ctl >> /etc/hosts" |
| 26 | |
| 27 | # Set up controller |
| 28 | http --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" |
| 29 | |
| 30 | # Add controller to site |
| 31 | http --auth $AUTH PATCH $XOS/xos/sitedeployments/1/ controller=$XOS/xos/controllers/1/ |
| 32 | |
| 33 | # Add image |
| 34 | http --auth $AUTH POST $XOS/xos/images/ name=trusty-server-multi-nic disk_format=QCOW2 container_format=BARE |
| 35 | |
| 36 | # Activate image |
| 37 | http --auth $AUTH POST $XOS/xos/imagedeploymentses/ deployment=$XOS/xos/deployments/1/ image=$XOS/xos/images/1/ |
| 38 | |
| 39 | # Add node |
| 40 | http --auth $AUTH POST $XOS/xos/nodes/ name=$NODE site_deployment=$XOS/xos/sitedeployments/1/ |
| 41 | |
| 42 | # Modify networktemplate/2 |
| 43 | # BUG: Shouldn't have to set the controller_kind field, it's invalid in the initial fixture |
| 44 | http --auth $AUTH PATCH $XOS/xos/networktemplates/2/ shared_network_name=tun-data-net controller_kind="" |