Merge branch 'master' into xos_auto_scaling_app_changes
diff --git a/README.md b/README.md
index 7d279c5..7a72658 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,12 @@
 For a general introduction to XOS and how it is used in CORD, see
 http://guide.xosproject.org. The "Developer Guide" at that URL is
 especially helpful, although it is sync'ed with the previous
-release (currently Burwell), which likely lags what's in master.
+release (Burwell), which lags what's in master.
 Additional design notes, presentations, and other collateral are 
-also available at http://xosproject.org.
+also available at http://xosproject.org and http://cord.onosproject.org.
 
 The quickest way to get started is to look at the collection of
-"stock" configurations in *xos/configurations*. The *cord* 
+canned configurations in *xos/configurations*. The *cord* 
 configuration in that directory corresponds to our current 
 CORD development environment, and the README you'll find there
 will help you get started.
diff --git a/xos/configurations/cord/Dockerfile.cord b/xos/configurations/cord/Dockerfile.cord
index 8734eef..a436871 100644
--- a/xos/configurations/cord/Dockerfile.cord
+++ b/xos/configurations/cord/Dockerfile.cord
@@ -20,6 +20,7 @@
 RUN sed -i 's/proxy_ssh=True/proxy_ssh=False/' /opt/xos/observers/vcpe/vcpe_observer_config
 RUN sed -i 's/proxy_ssh=True/proxy_ssh=False/' /opt/xos/observers/monitoring_channel/monitoring_channel_observer_config
 ADD xos/configurations/cord/virtualbng.json /root/setup/
+ADD xos/configurations/cord/vtn-network-cfg.json /root/setup/
 
 CMD /usr/bin/make -C /opt/xos/configurations/cord -f Makefile.inside; /bin/bash
 
diff --git a/xos/configurations/cord/README-VTN.md b/xos/configurations/cord/README-VTN.md
new file mode 100644
index 0000000..d585d5c
--- /dev/null
+++ b/xos/configurations/cord/README-VTN.md
@@ -0,0 +1,45 @@
+vtn notes:
+
+inside the xos container:
+
+    python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/tosca/samples/vtn.yaml
+
+ctl node:
+
+    # set ONOS_VTN_HOSTNAME to the host where the VTN container was installed
+    ONOS_VTN_HOSTNAME="cp-2.smbaker-xos5.xos-pg0.clemson.cloudlab.us"
+    apt-get -y install python-pip
+    pip install -U setuptools pip
+    git clone https://github.com/openstack/networking-onos.git
+    cd networking-onos
+    python setup.py install
+    # the above fails the first time with an error about pbr.json
+    # I ran it again and it succeeded, but I am skeptical there's
+    # not still an issue lurking...
+    cat > /usr/local/etc/neutron/plugins/ml2/conf_onos.ini <<EOF
+    [ml2_onos]
+    url_path = http://$ONOS_VTN_HOSTNAME:8181/onos/vtn
+    username = karaf
+    password = karaf
+    EOF
+    emacs /etc/neutron/plugins/ml2/ml2_conf.ini
+        update settings as per vtn docs ([ml2] and [ml2_type_vxlan] sections)
+    systemctl restart neutron-server
+
+Compute node that has the ONOS Container
+
+    # we need NAT rule so the neutron vtn plugin can talk to onos
+    # change 172.17.0.2 to the IP address for the ONOS container (use "docker inspect")
+    iptables -t nat -A PREROUTING -i br-ex -p tcp --dport 8101 -j DNAT --to-destination 172.17.0.2
+
+Compute nodes (all of them):
+
+    systemctl stop neutron-plugin-openvswitch-agent
+    /usr/share/openvswitch/scripts/ovs-ctl
+        update settings as per vtn docs to make port 6640 visible
+    service openvswitch-switch restart
+
+VTN doesn't seem to like cloudlab's networks (flat-net-1, ext-net, etc). You might have to delete them all.
+
+For development, I suggest using the bash configuration (remember to start the ONOS observer manually) so that 
+there aren't a bunch of preexisting Neutron networks and nova instances to get in the way. 
diff --git a/xos/configurations/cord/make-vtn-networkconfig-json.sh b/xos/configurations/cord/make-vtn-networkconfig-json.sh
old mode 100644
new mode 100755
index df94597..918674a
--- a/xos/configurations/cord/make-vtn-networkconfig-json.sh
+++ b/xos/configurations/cord/make-vtn-networkconfig-json.sh
@@ -37,8 +37,12 @@
     fi
 done
 
-NEUTRONIP="127.0.0.1"
-KEYSTONEIP="127.0.0.1"
+# get the openstack admin password and username
+source /root/setup/admin-openrc.sh
+
+HOSTNAME=`hostname`
+NEUTRONIP=`getent hosts $HOSTNAME | awk '{ print $1 }'`
+KEYSTONEIP=`getent hosts $HOSTNAME | awk '{ print $1 }'`
 
 cat >> $FN <<EOF
                 ]
@@ -49,8 +53,8 @@
                  "do_not_push_flows" : "true",
                  "neutron_server" : "http://$NEUTRONIP:9696/v2.0/",
                  "keystone_server" : "http://$KEYSTONEIP:5000/v2.0/",
-                 "user_name" : "admin",
-                 "password" : "passwd"
+                 "user_name" : "$OS_USERNAME",
+                 "password" : "$OS_PASSWORD"
              }
         }
     }
diff --git a/xos/configurations/devel/Makefile b/xos/configurations/devel/Makefile
index 216673d..eb5802a 100644
--- a/xos/configurations/devel/Makefile
+++ b/xos/configurations/devel/Makefile
@@ -4,7 +4,7 @@
 
 cloudlab: common_cloudlab xos
 
-devstack: common_devstack xos
+devstack: upgrade_pkgs common_devstack devstack_net_fix xos
 
 xos:
 	rm ../../xos_configuration/*
@@ -29,3 +29,10 @@
 
 enter:
 	sudo docker exec -t -i $(RUNNING_CONTAINER) bash
+
+devstack_net_fix:
+	sudo ../devstack/net-fix.sh
+	sudo bash -c "source ../common/admin-openrc.sh; neutron subnet-update private-subnet --dns-nameservers list=true 8.8.8.8 8.8.4.4"
+
+upgrade_pkgs:
+	sudo pip install httpie --upgrade
diff --git a/xos/configurations/devel/README.md b/xos/configurations/devel/README.md
index 47cc6e7..54a51a8 100644
--- a/xos/configurations/devel/README.md
+++ b/xos/configurations/devel/README.md
@@ -48,11 +48,11 @@
 ~/xos/xos/configurations/devel$ make devstack
 ```
 
-Note that there are some issues with the networking setup in this configuration;
-you will be able to create VMs but they are not accessible on the network.  However it is
-possible to log into a VM by first entering the appropriate network namespace.
-
 ## What you get
 
 XOS will be set up with a single Deployment and Site.  It should be in a state where
 you can create slices and associate instances with them.
+
+Note that there are some issues with the networking setup in this configuration:
+VMs do not have a working DNS configuration in `/etc/resolv.conf`.  If you fix this
+manually then everything should work.
diff --git a/xos/configurations/devstack/local.conf b/xos/configurations/devstack/local.conf
index 946d16e..dfcf07b 100644
--- a/xos/configurations/devstack/local.conf
+++ b/xos/configurations/devstack/local.conf
@@ -3,6 +3,7 @@
 
 DOWNLOAD_DEFAULT_IMAGES=false
 IMAGE_URLS="http://www.planet-lab.org/cord/trusty-server-multi-nic.img"
+LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
 
 disable_service n-net
 enable_service q-svc
diff --git a/xos/configurations/devstack/net-fix.sh b/xos/configurations/devstack/net-fix.sh
new file mode 100755
index 0000000..5b486bd
--- /dev/null
+++ b/xos/configurations/devstack/net-fix.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+PRIMARY=$( route | grep default | awk '{print $NF}' )
+RULE="POSTROUTING -t nat -o $PRIMARY -s 172.24.4.0/24 -j MASQUERADE"
+
+iptables -C $RULE || iptables -A $RULE