Move setup directory, fix scripts to use it
diff --git a/xos/configurations/common/Makefile.cloudlab b/xos/configurations/common/Makefile.cloudlab
index 1f51b8f..7ab8a54 100644
--- a/xos/configurations/common/Makefile.cloudlab
+++ b/xos/configurations/common/Makefile.cloudlab
@@ -3,7 +3,7 @@
 $(error MYFLATLANIF is empty)
 endif
 MYFLATLANIP:=$(shell ifconfig $(MYFLATLANIF) | grep "inet addr" | awk -F: '{print $$2}' | awk '{print $$1}' )
-SETUPDIR:=./setup
+SETUPDIR:=../setup
 
 all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url other_keys
 
@@ -21,7 +21,7 @@
 	[ -s $(SETUPDIR)/flat_net_name ] # throw error if flat_net_name is empty
 
 nodes_yaml:
-	bash ./make-nodes-yaml.sh > $(SETUPDIR)/nodes.yaml
+	export SETUPDIR=$(SETUPDIR); bash ./make-nodes-yaml.sh 
 
 ceilometer_url:
 	echo http://`hostname -i`/xosmetering/ > $(SETUPDIR)/ceilometer_url
diff --git a/xos/configurations/common/Makefile.devstack b/xos/configurations/common/Makefile.devstack
index 3ba71ae..2764b28 100644
--- a/xos/configurations/common/Makefile.devstack
+++ b/xos/configurations/common/Makefile.devstack
@@ -1,6 +1,6 @@
 # This shouldn't be hardcoded
 DEVSTACK_ROOT:=~/devstack
-SETUPDIR:=./setup
+SETUPDIR:=../setup
 
 all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url node_key net_fix
 
diff --git a/xos/configurations/common/Makefile.opencloud b/xos/configurations/common/Makefile.opencloud
index f1ed944..8cf9f29 100644
--- a/xos/configurations/common/Makefile.opencloud
+++ b/xos/configurations/common/Makefile.opencloud
@@ -1,6 +1,6 @@
 MYFLATLANIF:=$(shell netstat -i |grep "flat"|awk '{print $$1}' )
 MYFLATLANIP:=$(shell ifconfig $(MYFLATLANIF) | grep "inet addr" | awk -F: '{print $$2}' | awk '{print $$1}' )
-SETUPDIR:=./setup
+SETUPDIR:=../setup
 
 all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url node_key
 
diff --git a/xos/configurations/common/make-nodes-yaml.sh b/xos/configurations/common/make-nodes-yaml.sh
index ef84c68..1c0003a 100644
--- a/xos/configurations/common/make-nodes-yaml.sh
+++ b/xos/configurations/common/make-nodes-yaml.sh
@@ -1,6 +1,8 @@
-#!/bin/sh
+FN=$SETUPDIR/nodes.yaml
 
-cat <<EOF
+rm -f $FN
+
+cat >> $FN <<EOF
 tosca_definitions_version: tosca_simple_yaml_1_0
 
 imports:
@@ -16,11 +18,11 @@
         type: tosca.nodes.Site
 EOF
 
-NODES=$( bash -c "source ./setup/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
+NODES=$( bash -c "source $SETUPDIR/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
 I=0
 for NODE in $NODES; do
-    # echo $NODE
-    cat <<EOF
+    echo $NODE
+    cat >> $FN <<EOF
     $NODE:
       type: tosca.nodes.Node
       requirements:
diff --git a/xos/configurations/cord/Makefile b/xos/configurations/cord/Makefile
index 755f704..af5f584 100644
--- a/xos/configurations/cord/Makefile
+++ b/xos/configurations/cord/Makefile
@@ -1,20 +1,25 @@
+SETUPDIR:=../setup
 MYIP:=$(shell hostname -i)
-RUNNING_CONTAINER:=$(shell sudo docker ps|grep "xos"|awk '{print $$NF}')
-LAST_CONTAINER=$(shell sudo docker ps -l -q)
 
-cord: common_cloudlab ceilometer_dashboard virtualbng_json vtn_network_cfg_json
-	rm ../../xos_configuration/*
-	echo "# Autogenerated -- do not edit" > Dockerfile
-	cat ../common/Dockerfile.common Dockerfile.cord >> Dockerfile
-	cp ../common/xos_common_config ../../xos_configuration/
-	cp ./xos_cord_config ../../xos_configuration/
-	cd ../../..; sudo docker build -t xos -f xos/configurations/cord/Dockerfile .
-	sudo docker run -d --add-host="ctl:$(MYIP)" -p 9999:8000 xos
+cloudlab: common_cloudlab cord
+
+devstack: upgrade_pkgs common_devstack devstack_net_fix cord
+
+cord: ceilometer_dashboard virtualbng_json vtn_network_cfg_json
+	sudo MYIP=$(MYIP) docker-compose up -d
 	bash ../common/wait_for_xos.sh
+	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/fixtures.yaml
+	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/base.yaml
+	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
+	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/cord/cord.yaml
+	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/cord/ceilometer.yaml
 
 common_cloudlab:
 	make -C ../common -f Makefile.cloudlab
 
+common_devstack:
+	make -C ../common -f Makefile.devstack
+
 ceilometer_dashboard:
 	#NOTE: The below dashboard install scripts assume
 	#clouldlab openstack environment created using "OpenStack" profile
@@ -22,19 +27,16 @@
 	bash install_ceilometer_patch.sh
 
 virtualbng_json:
-	bash make-virtualbng-json.sh
+	export SETUPDIR=$(SETUPDIR); bash make-virtualbng-json.sh
 
 vtn_network_cfg_json:
-	bash make-vtn-networkconfig-json.sh
+	export SETUPDIR=$(SETUPDIR); bash make-vtn-networkconfig-json.sh
 
 stop:
-	sudo docker stop $(RUNNING_CONTAINER)
+	sudo MYIP=$(MYIP) docker-compose stop
 
 showlogs:
-	sudo docker logs $(LAST_CONTAINER)
-
-enter:
-	sudo docker exec -t -i $(RUNNING_CONTAINER) bash
+	sudo MYIP=$(MYIP) docker-compose logs
 
 dataplane: etc_hosts
 	cd dataplane; ./gen-inventory.sh > hosts
@@ -57,5 +59,12 @@
 
 cleanup:
 	cd dataplane; ./cleanup.sh
-	bash -c "source ../common/admin-openrc.sh; nova list --all-tenants; neutron net-list"
+	bash -c "source ../setup/admin-openrc.sh; nova list --all-tenants; neutron net-list"
 	echo "Don't forget to clean up containers"
+
+devstack_net_fix:
+	sudo ../common/devstack/net-fix.sh
+	sudo bash -c "source ../setup/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/cord/dataplane/cleanup.sh b/xos/configurations/cord/dataplane/cleanup.sh
index 721f054..9860de7 100755
--- a/xos/configurations/cord/dataplane/cleanup.sh
+++ b/xos/configurations/cord/dataplane/cleanup.sh
@@ -13,7 +13,7 @@
   neutron net-delete $NETWORK
 }
 
-source ../../common/admin-openrc.sh
+source ../../setup/admin-openrc.sh
 
 echo "Deleting VMs"
 # Delete all VMs
diff --git a/xos/configurations/cord/make-virtualbng-json.sh b/xos/configurations/cord/make-virtualbng-json.sh
index 2d6501d..8eb971b 100644
--- a/xos/configurations/cord/make-virtualbng-json.sh
+++ b/xos/configurations/cord/make-virtualbng-json.sh
@@ -1,4 +1,4 @@
-FN=virtualbng.json
+FN=$SETUPDIR/virtualbng.json
 
 rm -f $FN
 
@@ -14,7 +14,7 @@
     "hosts" : {
 EOF
 
-NODES=$( sudo bash -c "source /root/setup/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
+NODES=$( sudo bash -c "source $SETUPDIR/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
 
 NODECOUNT=0
 for NODE in $NODES; do
diff --git a/xos/configurations/cord/make-vtn-networkconfig-json.sh b/xos/configurations/cord/make-vtn-networkconfig-json.sh
index 918674a..b35c440 100755
--- a/xos/configurations/cord/make-vtn-networkconfig-json.sh
+++ b/xos/configurations/cord/make-vtn-networkconfig-json.sh
@@ -1,4 +1,4 @@
-FN=vtn-network-cfg.json
+FN=$SETUPDIR/vtn-network-cfg.json
 
 rm -f $FN
 
@@ -10,7 +10,7 @@
                 "nodes" : [
 EOF
 
-NODES=$( sudo bash -c "source /root/setup/admin-openrc.sh ; nova hypervisor-list" |grep cloudlab|awk '{print $4}' )
+NODES=$( sudo bash -c "source $SETUPDIR/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}' )
 
 NODECOUNT=0
 for NODE in $NODES; do
@@ -38,7 +38,7 @@
 done
 
 # get the openstack admin password and username
-source /root/setup/admin-openrc.sh
+source $SETUPDIR/admin-openrc.sh
 
 HOSTNAME=`hostname`
 NEUTRONIP=`getent hosts $HOSTNAME | awk '{ print $1 }'`
diff --git a/xos/configurations/devel/Makefile b/xos/configurations/devel/Makefile
index db78402..1ae97be 100644
--- a/xos/configurations/devel/Makefile
+++ b/xos/configurations/devel/Makefile
@@ -23,8 +23,8 @@
 	sudo MYIP=$(MYIP) docker-compose logs
 
 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"
+	sudo ../common/devstack/net-fix.sh
+	sudo bash -c "source ../setup/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/docker-compose.yml b/xos/configurations/devel/docker-compose.yml
index 03f7aaf..6ff2e78 100644
--- a/xos/configurations/devel/docker-compose.yml
+++ b/xos/configurations/devel/docker-compose.yml
@@ -11,7 +11,7 @@
     links:
         - xos_db
     extra_hosts:
-      - ctl:${MYIP}
+        - ctl:${MYIP}
 
 # FUTURE
 #xos_swarm_synchronizer:
@@ -28,5 +28,5 @@
     links:
         - xos_db
     volumes:
-      - ../common/setup:/root/setup:ro
+      - ../setup:/root/setup:ro
       - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro