Merge branch 'master' into roles
diff --git a/README.md b/README.md
index 63c3914..bf84b8b 100644
--- a/README.md
+++ b/README.md
@@ -31,26 +31,67 @@
  2. resolves VM names to IP addresses
  3. is configured as a resolver on the head and compute nodes
 
-If you need to set up `dnsmasq` to do this, 
-take a look at [this example](files/etc/dnsmasq.d/cord).
+If you need to set up `dnsmasq` to do this,
+take a look at [this example configuration](files/etc/dnsmasq.d/cord).
 Then follow these steps:
 
-* Edit *cord-hosts* with the DNS names of your compute nodes, and update the *ansible_ssh_user* variable appropriately.
-  Before proceeding, this needs to work on the head node: `ansible -i cord-hosts all -m ping`
-* Run: `ansible-playbook -i cord-hosts cord-setup.yml`
+* Run the `bootstrap.sh` script to install Ansible and set up keys for login via `localhost`
+* Edit *cord-hosts* with the DNS names of your compute nodes, and update the *ansible_ssh_user*
+variable appropriately.  Before proceeding, these commands needs to work on the head node:
+```
+$ ansible -i cord-hosts head -m ping
+$ ansible -i cord-hosts compute -m ping
+```
+* Run:
+```
+ansible-playbook -i cord-hosts cord-setup.yml
+```
 * After the playbook finishes, wait for the OpenStack services to come up.  You can check on their progress
   using `juju status --format=tabular`
-* Once the services are up, you can use the `admin-openrc.sh` credentials in the home directory to 
+* Once the services are up, you can use the `admin-openrc.sh` credentials in the home directory to
   interact with OpenStack.  You can SSH to any VM using `ssh ubuntu@<vm-name>`
 
 This will bring up various OpenStack services, including Neutron with the VTN plugin.  It will also create
 two VMs called *xos* and *onos-cord* and prep them. Configuring and running XOS and ONOS in these VMs is beyond
 the scope of this README.
 
+*NOTE:* The install process only brings up a single nova-compute node.  To bring up more nodes
+as compute nodes, perform these steps on the head node:
+```
+$ juju add-machine ssh:<user>@<compute-host>
+$ juju add-unit nova-compute --to <juju-machine-id>
+```
+Refer to the [Juju documentation](https://jujucharms.com/docs/stable/config-manual)
+for more information.
+
 ### Caveats
 
 * The goal is to configure HA for the OpenStack services, but this is not yet implemented.
 
+## How to install a single-node CORD test environment on CloudLab
+
+The process for setting up a CORD test environment on CloudLab is similar (but
+not identical) to the one for setting up a CORD POD above.
+
+* Start a CloudLab experiment using profile *OnePC-Ubuntu14.04.3*
+* Run the `bootstrap.sh` script to install Ansible and set up keys for login via `localhost`
+* Run:
+```
+ansible-playbook -i cord-test-hosts cord-setup.yml
+```
+
+This will bring up various OpenStack services, including Neutron with the VTN plugin.  It will also create
+two VMs called *xos* and *onos-cord* and prep them.  It creates a single nova-compute
+node running inside a VM.  
+
+It should be possible to use this method on any server running Ubuntu 14.04, as long as it has
+sufficient CPU cores and disk space.
+
+*NOTE:* Currently VMs can be created using this configuration and logged into over the
+VTN-supplied management network.  However without the CORD fabric they don't have external
+connectivity, and as a result a vSG cannot be spun up.  A workaround for this issue
+should be in place shortly.
+
 ## How to install an OpenCloud cluster
 
 Once the prerequisites are satisfied, here are the basic steps for installing a new OpenCloud cluster named 'foo':
diff --git a/bootstrap.sh b/bootstrap.sh
index 3bfebe3..b8e7f4f 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,9 +1,9 @@
 #!/bin/bash
 
 sudo apt-get update
-sudo apt-get install -y software-properties-common git mosh
+sudo apt-get install -y software-properties-common git mosh dnsutils
 sudo add-apt-repository -y ppa:ansible/ansible
 sudo apt-get update
 sudo apt-get install -y ansible
-ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
+[ -e ~/.ssh/id_rsa ] || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
diff --git a/cord-setup.yml b/cord-setup.yml
index 6182ce1..6d83063 100644
--- a/cord-setup.yml
+++ b/cord-setup.yml
@@ -93,6 +93,16 @@
       line="nameserver 192.168.122.1"
     when: test_setup is defined
 
+  - name: Touch .ssh/config
+    sudo: no
+    file: path={{ ansible_env['PWD'] }}/.ssh/config
+      state=touch
+
+  - name: Disable host key checking in SSH
+    sudo: no
+    lineinfile: dest={{ ansible_env['PWD'] }}/.ssh/config
+      line="StrictHostKeyChecking no"
+
   - name: Create VMs to host OpenCloud services on mgmtbr
     sudo: no
     script: scripts/create-vms-cord.sh
@@ -116,12 +126,7 @@
     sudo: no
     file: path={{ ansible_env['PWD'] }}/.ssh/config state=touch
 
-  - name: Disable host key checking in SSH
-    sudo: no
-    lineinfile: dest={{ ansible_env['PWD'] }}/.ssh/config
-      line="StrictHostKeyChecking no"
-
-  - name: Test that we can log into every VM
+  - name: Test that we can log into every VM using Ansible
     sudo: no
     shell: ansible services -m ping -u ubuntu
 
diff --git a/scripts/compute-ext-net.sh b/scripts/compute-ext-net.sh
new file mode 100755
index 0000000..5c59a85
--- /dev/null
+++ b/scripts/compute-ext-net.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+apt-get update
+apt-get install bridge-utils
+brctl addbr databr
+ifconfig databr 192.168.0.254/24 up
+ip link add address 02:42:c0:a8:00:01 type veth
+ifconfig veth0 up
+ifconfig veth1 up
+brctl addif databr veth0
+iptables -t nat -A POSTROUTING -s 192.168.0.0/24 \! -d 192.168.0.0/24 -j MASQUERADE
diff --git a/scripts/create-vms-cord.sh b/scripts/create-vms-cord.sh
index d456525..dc19da7 100755
--- a/scripts/create-vms-cord.sh
+++ b/scripts/create-vms-cord.sh
@@ -36,8 +36,11 @@
 }
 
 function wait-for-vm {
-	NAME=$1
-	uvt-kvm wait --insecure $NAME
+  NAME=$1
+  until dig $NAME && ssh ubuntu@$NAME "ls"
+  do
+    sleep 1
+  done
 }
 
 create-vm juju 1 2048 20
@@ -53,6 +56,7 @@
 
 create-vm xos 2 4096 40
 create-vm onos-cord 2 4096 40
+create-vm onos-fabric 2 4096 40
 if $TESTING
 then
 	create-vm nova-compute 2 4096 100
@@ -72,6 +76,7 @@
 
 wait-for-vm xos
 wait-for-vm onos-cord
+wait-for-vm onos-fabric
 if $TESTING
 then
 	wait-for-vm nova-compute
diff --git a/setup-mgmtbr.sh b/setup-mgmtbr.sh
new file mode 100755
index 0000000..62f05c6
--- /dev/null
+++ b/setup-mgmtbr.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+IFACE=$1
+
+# Assumes that mgmtbr is set up on 10.10.1.1 interface
+apt-get install bridge-utils dnsmasq
+brctl addbr mgmtbr
+ifconfig $IFACE 0.0.0.0
+brctl addif mgmtbr $IFACE
+ifconfig mgmtbr 10.10.1.1/24 up
+
+cat <<EOF > /etc/dnsmasq.d/cord
+dhcp-range=10.10.1.3,10.10.1.253
+interface=mgmtbr
+dhcp-option=option:router,10.10.1.1
+EOF
+
+service dnsmasq restart
+
+# Assumes eth0 is the public interface
+iptables -t nat -I POSTROUTING -s 10.10.1.0/24 \! -d 10.10.1.0/24 -j MASQUERADE
diff --git a/templates/cord.yaml b/templates/cord.yaml
index 0e1cb70..c608671 100644
--- a/templates/cord.yaml
+++ b/templates/cord.yaml
@@ -177,7 +177,7 @@
     annotations:
       gui-x: '250'
       gui-y: '250'
-    charm: cs:trusty/nova-compute-33
+    charm: cs:~cordteam/trusty/nova-compute-2
     num_units: 1
     options:
       config-flags: firewall_driver=nova.virt.firewall.NoopFirewallDriver