move over configurations from xos repo

Change-Id: I66583bdaea582986d8f16a29066a79c6687b97fb
diff --git a/common/Dockerfile.common b/common/Dockerfile.common
new file mode 100644
index 0000000..aedd245
--- /dev/null
+++ b/common/Dockerfile.common
@@ -0,0 +1,144 @@
+FROM       ubuntu:14.04.2
+MAINTAINER Andy Bavier <acb@cs.princeton.edu>
+
+# XXX Workaround for docker bug:
+# https://github.com/docker/docker/issues/6345
+# Kernel 3.15 breaks docker, uss the line below as a workaround
+# until there is a fix
+RUN ln -s -f /bin/true /usr/bin/chfn
+# XXX End workaround
+
+# Install.
+RUN apt-get update && apt-get install -y \
+    git \
+    postgresql \
+    python-psycopg2 \
+    graphviz \
+    graphviz-dev \
+    libxslt1.1 \
+    libxslt1-dev \
+    python-pip \
+    tar \
+    gcc \
+    python-httplib2 \
+    geoip-database \
+    libgeoip1 \
+    wget \
+    curl \
+    python-dev \
+    libyaml-dev \
+    pkg-config \
+    python-pycurl
+
+RUN pip install django==1.7
+RUN pip install djangorestframework==2.4.4
+RUN pip install markdown  # Markdown support for the browseable API.
+RUN pip install pyyaml    # YAML content-type support.
+RUN pip install django-filter==0.11.0  # Filtering support
+RUN pip install lxml  # XML manipulation library
+RUN pip install netaddr # IP Addr library
+RUN pip install pytz
+RUN pip install django-timezones
+RUN pip install requests
+RUN pip install python-logstash
+RUN pip install django-crispy-forms
+RUN pip install django-geoposition
+RUN pip install django-extensions
+RUN pip install django-suit==0.3a1
+RUN pip install django-bitfield
+RUN pip install django-ipware
+RUN pip install django-encrypted-fields
+RUN pip install python-keyczar
+RUN pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
+RUN pip install dnslib
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-keystoneclient
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-novaclient
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-neutronclient
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-glanceclient
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-ceilometerclient
+
+RUN pip install django_rest_swagger
+
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-setuptools
+RUN easy_install python_gflags
+RUN easy_install --upgrade httplib2
+RUN easy_install google_api_python_client
+RUN easy_install httplib2.ca_certs_locater
+
+# Install custom Ansible
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-crypto
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-yaml
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-client
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-paramiko
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-jinja2
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-httplib2
+RUN git clone -b release1.8.2 git://github.com/ansible/ansible.git /opt/ansible
+RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/lib/ansible/modules/extras
+RUN git clone -b release1.8.2 git://github.com/ansible/ansible-modules-extras.git /opt/ansible/v2/ansible/modules/extras
+RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/lib/ansible/modules/core
+RUN git clone git://github.com/sb98052/ansible-modules-core.git /opt/ansible/v2/ansible/modules/core
+ADD ansible-hosts /etc/ansible/hosts
+
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+
+# For Observer
+RUN git clone git://git.planet-lab.org/fofum.git /tmp/fofum
+RUN cd /tmp/fofum; python setup.py install
+RUN rm -rf /tmp/fofum
+
+RUN mkdir -p /usr/local/share /bin
+ADD http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-x86_64.tar.bz2 /usr/local/share/
+RUN tar jxvf /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2 -C /usr/local/share/
+RUN rm -f /usr/local/share/phantomjs-1.7.0-linux-x86_64.tar.bz2
+RUN ln -s /usr/local/share/phantomjs-1.7.0-linux-x86_64 /usr/local/share/phantomjs
+RUN ln -s /usr/local/share/phantomjs/bin/phantomjs /bin/phantomjs
+
+# Supervisor
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor
+ADD observer.conf /etc/supervisor/conf.d/
+
+# Get XOS
+ADD xos /opt/xos
+
+# Initscript is broken in Ubuntu
+#ADD observer-initscript /etc/init.d/xosobserver
+
+RUN chmod +x /opt/xos/tools/xos-manage
+RUN /opt/xos/tools/xos-manage genkeys
+
+# Workaround for AUFS issue
+# https://github.com/docker/docker/issues/783#issuecomment-56013588
+RUN mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private
+
+# Set postgres password to match default value in settings.py
+RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
+
+# Turn DEBUG on so that devel server will serve static files
+#    (not necessary if --insecure is passed to 'manage.py runserver')
+# RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/xos/settings.py
+
+# Cruft to workaround problems with migrations, should go away...
+RUN /opt/xos/tools/xos-manage remigrate
+
+# git clone uses cached copy, doesn't pick up latest
+RUN git -C /opt/ansible pull
+RUN git -C /opt/ansible/lib/ansible/modules/core pull
+RUN git -C /opt/ansible/v2/ansible/modules/core pull
+
+# install Tosca engine
+RUN apt-get install -y m4
+RUN pip install python-dateutil
+RUN bash /opt/xos/tosca/install_tosca.sh
+
+EXPOSE 8000
+
+# Set environment variables.
+ENV HOME /root
+
+# Define working directory.
+WORKDIR /root
+
+# Define default command.
+#CMD ["/bin/bash"]
+#CMD /opt/xos/tools/docker_start_xos
diff --git a/common/Makedefs b/common/Makedefs
new file mode 100644
index 0000000..7111b42
--- /dev/null
+++ b/common/Makedefs
@@ -0,0 +1,2 @@
+SERVICE_DIR=../../xos_services
+XOS_DIR=../../xos
diff --git a/common/Makefile.cloudlab b/common/Makefile.cloudlab
new file mode 100644
index 0000000..7ab8a54
--- /dev/null
+++ b/common/Makefile.cloudlab
@@ -0,0 +1,41 @@
+MYFLATLANIF:=$(shell netstat -i |grep "flat"|awk '{print $$1}' )
+ifndef MYFLATLANIF
+$(error MYFLATLANIF is empty)
+endif
+MYFLATLANIP:=$(shell ifconfig $(MYFLATLANIF) | grep "inet addr" | awk -F: '{print $$2}' | awk '{print $$1}' )
+SETUPDIR:=../setup
+
+all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url other_keys
+
+prereqs:
+	make -f Makefile.prereqs
+	mkdir -p $(SETUPDIR)
+
+admin-openrc:
+	sudo cat /root/setup/admin-openrc.sh > $(SETUPDIR)/admin-openrc.sh
+	sudo cat /root/setup/settings > $(SETUPDIR)/controller_settings
+	echo 'CONTROLLER_FLAT_LAN_IP=$(MYFLATLANIP)' >> $(SETUPDIR)/controller_settings
+
+flat_name:
+	bash -c "source $(SETUPDIR)/admin-openrc.sh ; neutron net-list" |grep flat|awk '{printf "%s",$$4}' > $(SETUPDIR)/flat_net_name
+	[ -s $(SETUPDIR)/flat_net_name ] # throw error if flat_net_name is empty
+
+nodes_yaml:
+	export SETUPDIR=$(SETUPDIR); bash ./make-nodes-yaml.sh 
+
+ceilometer_url:
+	echo http://`hostname -i`/xosmetering/ > $(SETUPDIR)/ceilometer_url
+
+public_key: ~/.ssh/id_rsa.pub
+	cp ~/.ssh/id_rsa.pub $(SETUPDIR)
+
+private_key: ~/.ssh/id_rsa
+	cp ~/.ssh/id_rsa $(SETUPDIR)
+
+~/.ssh/id_rsa.pub:
+	cat /dev/zero | ssh-keygen -q -N ""
+
+other_keys: public_key private_key
+	sudo cat /root/setup/id_rsa > $(SETUPDIR)/node_key
+	sudo cat /root/setup/id_rsa.pub > $(SETUPDIR)/node_key.pub
+	sudo cp $(SETUPDIR)/id_rsa.pub $(SETUPDIR)/padmin_public_key
diff --git a/common/Makefile.containers b/common/Makefile.containers
new file mode 100644
index 0000000..0db49d6
--- /dev/null
+++ b/common/Makefile.containers
@@ -0,0 +1,26 @@
+include ../common/Makedefs
+
+local_containers: xos_devel synchronizer onboarding_synchronizer
+
+xos_devel:
+	cd $(XOS_DIR)/containers/xos; make devel
+
+xos_base:
+	cd $(XOS_DIR)/containers/xos; make base
+
+xos_test:
+	cd $(XOS_DIR)/containers/xos; make test
+
+synchronizer:
+	cd $(XOS_DIR)/containers/synchronizer; make
+
+onboarding_synchronizer:
+	cd $(XOS_DIR)/containers/onboarding_synchronizer; make
+
+update_certs:
+	echo "" > $(XOS_DIR)/containers/xos/local_certs.crt
+	for CRT in $$(ls /usr/local/share/ca-certificates/*) ; do \
+	        echo Adding Certificate: $$CRT ;\
+	        cat $$CRT >> $(XOS_DIR)/containers/xos/local_certs.crt ;\
+	        echo "" >> $(XOS_DIR)/containers/xos/local_certs.crt ;\
+	done
diff --git a/common/Makefile.devstack b/common/Makefile.devstack
new file mode 100644
index 0000000..0dff27c
--- /dev/null
+++ b/common/Makefile.devstack
@@ -0,0 +1,42 @@
+# This shouldn't be hardcoded
+DEVSTACK_ROOT:=~/devstack
+SETUPDIR:=../setup
+
+all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url other_keys net_fix
+
+prereqs:
+	make -f Makefile.prereqs
+	sudo pip install httpie --upgrade
+	mkdir -p $(SETUPDIR)
+
+admin-openrc:
+	bash ./devstack-creds.sh $(DEVSTACK_ROOT) > $(SETUPDIR)/admin-openrc.sh
+	touch $(SETUPDIR)/controller_settings
+
+flat_name:
+	echo private|tr -d '\n' > $(SETUPDIR)/flat_net_name
+	bash -c "source $(SETUPDIR)/admin-openrc.sh; neutron net-update private --shared"
+
+nodes_yaml:
+	export SETUPDIR=$(SETUPDIR); bash ./make-nodes-yaml.sh
+
+ceilometer_url:
+	echo http://`hostname -i`/xosmetering/ > $(SETUPDIR)/ceilometer_url
+
+public_key: ~/.ssh/id_rsa.pub
+	cp ~/.ssh/id_rsa.pub $(SETUPDIR)
+
+private_key: ~/.ssh/id_rsa
+	cp ~/.ssh/id_rsa $(SETUPDIR)
+
+~/.ssh/id_rsa.pub:
+	cat /dev/zero | ssh-keygen -q -N ""
+
+other_keys: public_key private_key
+	cp $(SETUPDIR)/id_rsa $(SETUPDIR)/node_key
+	cp $(SETUPDIR)/id_rsa.pub $(SETUPDIR)/node_key.pub
+	cp $(SETUPDIR)/id_rsa.pub $(SETUPDIR)/padmin_public_key
+
+net_fix:
+	sudo devstack/net-fix.sh
+	bash -c "source $(SETUPDIR)/admin-openrc.sh; neutron subnet-update private-subnet --dns-nameservers list=true 8.8.8.8 8.8.4.4"
diff --git a/common/Makefile.opencloud b/common/Makefile.opencloud
new file mode 100644
index 0000000..8cf9f29
--- /dev/null
+++ b/common/Makefile.opencloud
@@ -0,0 +1,40 @@
+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
+
+all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url node_key
+
+prereqs:
+	make -f Makefile.prereqs
+	mkdir -p $(SETUPDIR)
+
+admin-openrc:
+	sudo cat /root/setup/admin-openrc.sh > $(SETUPDIR)/admin-openrc.sh
+	sudo cat /root/setup/settings > $(SETUPDIR)/controller_settings
+	echo 'CONTROLLER_FLAT_LAN_IP=$(MYFLATLANIP)' >> $(SETUPDIR)/controller_settings
+
+flat_name:
+	sudo bash -c "source /root/setup/admin-openrc.sh ; neutron net-list" |grep flat|awk '{printf "%s",$$4}' > $(SETUPDIR)/flat_net_name
+	[ -s $(SETUPDIR)/flat_net_name ] # throw error if flat_net_name is empty
+
+nodes_yaml:
+	bash ./make-nodes-yaml.sh > $(SETUPDIR)/nodes.yaml
+
+ceilometer_url:
+	echo http://`hostname -i`/xosmetering/ > $(SETUPDIR)/ceilometer_url
+
+public_key: ~/.ssh/id_rsa.pub
+	cp ~/.ssh/id_rsa.pub $(SETUPDIR)
+
+private_key: ~/.ssh/id_rsa
+	cp ~/.ssh/id_rsa $(SETUPDIR)
+
+~/.ssh/id_rsa.pub:
+	cat /dev/zero | ssh-keygen -q -N ""
+
+node_key:
+	sudo cat /root/setup/id_rsa > $(SETUPDIR)/node_key
+	sudo cat /root/setup/id_rsa.pub > $(SETUPDIR)/node_key.pub
+
+images:
+	source admin-openrc.sh; glance image-show trusty-server-multi-nic || glance image-create --name trusty-server-multi-nic --disk-format qcow2 --file /proj/xos-PG0/acb/images/trusty-server-multi-nic.img --container-format bare
diff --git a/common/Makefile.prereqs b/common/Makefile.prereqs
new file mode 100644
index 0000000..fce51be
--- /dev/null
+++ b/common/Makefile.prereqs
@@ -0,0 +1,41 @@
+UBUNTU:=$(shell which apt > /dev/null 2>&1; echo $$?)
+
+ifeq ($(UBUNTU),0)
+
+# ******************* apt-based distros ***************************
+prereqs: /usr/bin/http docker /usr/bin/curl /usr/local/bin/docker-compose
+
+/usr/bin/http:
+	sudo apt-get -y install httpie
+
+/usr/bin/curl:
+	sudo apt-get -y install curl
+
+docker:
+	which docker > /dev/null || wget -qO- https://get.docker.com/ | sh
+	sudo usermod -aG docker $(shell whoami)
+
+else
+
+# ****************** RPM-based distros ******************
+
+# (untested / work-in-progress)
+
+prereqs: /usr/bin/pip /usr/bin/http docker /usr/local/bin/docker-compose
+
+/usr/bin/pip:
+	curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
+	sudo python ./get-pip.py
+
+docker:
+	which docker > /dev/null || wget -qO- https://get.docker.com/ | sh
+	sudo usermod -aG docker $(shell whoami)
+
+/usr/bin/http:
+	sudo pip install httpie
+
+endif
+
+/usr/local/bin/docker-compose:
+	sudo bash -c "curl -L https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
+	sudo chmod +x /usr/local/bin/docker-compose
diff --git a/common/Makefile.services b/common/Makefile.services
new file mode 100644
index 0000000..6b62a1d
--- /dev/null
+++ b/common/Makefile.services
@@ -0,0 +1,64 @@
+include ../common/Makedefs
+
+services: $(SERVICE_DIR) \
+          $(SERVICE_DIR)/exampleservice \
+          $(SERVICE_DIR)/olt \
+	  $(SERVICE_DIR)/vsg \
+          $(SERVICE_DIR)/vtn \
+	  $(SERVICE_DIR)/vrouter \
+	  $(SERVICE_DIR)/vtr \
+	  $(SERVICE_DIR)/onos-service \
+	  $(SERVICE_DIR)/fabric
+
+monitoring_services: $(SERVICE_DIR)/monitoring
+
+xos_core: $(XOS_DIR)
+
+$(SERVICE_DIR):
+	mkdir -p $(SERVICE_DIR)
+
+$(SERVICE_DIR)/exampleservice:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/exampleservice.git
+
+$(SERVICE_DIR)/olt:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/olt.git
+
+$(SERVICE_DIR)/vsg:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/vsg.git
+
+$(SERVICE_DIR)/vtn:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/vtn.git
+
+$(SERVICE_DIR)/vrouter:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/vrouter.git
+
+$(SERVICE_DIR)/vtr:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/vtr.git
+
+$(SERVICE_DIR)/onos-service:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/onos-service.git
+
+$(SERVICE_DIR)/fabric:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/fabric.git
+
+$(SERVICE_DIR)/monitoring:
+	git -C $(SERVICE_DIR) clone https://gerrit.opencord.org/p/monitoring.git
+
+cleanup:
+	rm -rf $(SERVICE_DIR)/*
+
+update:
+	git -C $(SERVICE_DIR)/exampleservice pull
+	git -C $(SERVICE_DIR)/olt pull
+	git -C $(SERVICE_DIR)/vsg pull
+	git -C $(SERVICE_DIR)/vtn pull
+	git -C $(SERVICE_DIR)/vrouter pull
+	git -C $(SERVICE_DIR)/vtr pull
+	git -C $(SERVICE_DIR)/onos-service pull
+	git -C $(SERVICE_DIR)/fabric pull
+
+$(XOS_DIR):
+	git -C ../.. clone https://gerrit.opencord.org/p/xos.git
+
+update_xos:
+	git -C $(XOS_DIR) pull
diff --git a/common/base.yaml b/common/base.yaml
new file mode 100644
index 0000000..3638dd9
--- /dev/null
+++ b/common/base.yaml
@@ -0,0 +1,89 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# Note:
+#   assumes the following have been created and filled with appropriate data:
+#       /root/setup/admin_openrc
+#       /root/setup/flat_net_name
+#       /root/setup/padmin_public_key
+
+description: >
+    * Adds OpenCloud Sites, Deployments, and Controllers.
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    trusty-server-multi-nic:
+      type: tosca.nodes.Image
+      properties:
+         disk_format: QCOW2
+         container_format: BARE
+
+    MyDeployment:
+      type: tosca.nodes.Deployment
+      properties:
+          flavors: m1.large, m1.medium, m1.small
+      requirements:
+          - image:
+              node: trusty-server-multi-nic
+              relationship: tosca.relationships.SupportsImage
+
+    CloudLab:
+      type: tosca.nodes.Controller
+      requirements:
+          - deployment:
+              node: MyDeployment
+              relationship: tosca.relationships.ControllerDeployment
+      properties:
+          backend_type: OpenStack
+          version: Kilo
+          auth_url: { get_script_env: [ SELF, adminrc, OS_AUTH_URL, LOCAL_FILE] }
+          admin_user: { get_script_env: [ SELF, adminrc, OS_USERNAME, LOCAL_FILE] }
+          admin_password: { get_script_env: [ SELF, adminrc, OS_PASSWORD, LOCAL_FILE] }
+          admin_tenant: { get_script_env: [ SELF, adminrc, OS_TENANT_NAME, LOCAL_FILE] }
+          rabbit_user: { get_script_env: [ SELF, controller_settings, RABBIT_USER, LOCAL_FILE] }
+          rabbit_password: { get_script_env: [ SELF, controller_settings, RABBIT_PASS, LOCAL_FILE] }
+          rabbit_host: { get_script_env: [ SELF, controller_settings, CONTROLLER_FLAT_LAN_IP, LOCAL_FILE] }
+          domain: Default
+      artifacts:
+          adminrc: /root/setup/admin-openrc.sh
+          controller_settings: /root/setup/controller_settings
+
+    mysite:
+      type: tosca.nodes.Site
+      properties:
+          display_name: MySite
+          site_url: http://opencloud.us/
+      requirements:
+          - deployment:
+               node: MyDeployment
+               relationship: tosca.relationships.SiteDeployment
+               requirements:
+                   - controller:
+                       node: CloudLab
+                       relationship: tosca.relationships.UsesController
+
+    Public shared IPv4:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          visibility: private
+          translation: NAT
+          shared_network_name: { get_artifact: [ SELF, flat_net_name, LOCAL_FILE] }
+      artifacts:
+          flat_net_name: /root/setup/flat_net_name
+
+    padmin@vicci.org:
+      type: tosca.nodes.User
+      requirements:
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+      properties:
+          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE ] }
+          is_admin: true
+          is_active: true
+          firstname: XOS
+          lastname: admin
+      artifacts:
+          pubkey: /root/setup/padmin_public_key
diff --git a/common/cloudlab-openstack.yaml b/common/cloudlab-openstack.yaml
new file mode 100644
index 0000000..969f84c
--- /dev/null
+++ b/common/cloudlab-openstack.yaml
@@ -0,0 +1,89 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# Note:
+#   assumes mydeployment.yaml has already been run, and the following exist:
+#       MyDeployment
+#       mysite
+#       padmin@vicci.org
+#       Public Shared IPv4
+#   assumes the following have been created and filled with appropriate data:
+#       /root/setup/admin_openrc
+#       /root/setup/flat_net_name
+#       /root/setup/padmin_public_key
+
+description: >
+    * Adds OpenCloud Sites, Deployments, and Controllers.
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    trusty-server-multi-nic:
+      type: tosca.nodes.Image
+      properties:
+         disk_format: QCOW2
+         container_format: BARE
+
+    MyDeployment:
+      type: tosca.nodes.Deployment
+      properties:
+          no-create: True
+          no-delete: True
+      requirements:
+          - image:
+              node: trusty-server-multi-nic
+              relationship: tosca.relationships.SupportsImage
+
+    CloudLab:
+      type: tosca.nodes.Controller
+      requirements:
+          - deployment:
+              node: MyDeployment
+              relationship: tosca.relationships.ControllerDeployment
+      properties:
+          backend_type: OpenStack
+          version: Kilo
+          auth_url: { get_script_env: [ SELF, adminrc, OS_AUTH_URL, LOCAL_FILE] }
+          admin_user: { get_script_env: [ SELF, adminrc, OS_USERNAME, LOCAL_FILE] }
+          admin_password: { get_script_env: [ SELF, adminrc, OS_PASSWORD, LOCAL_FILE] }
+          admin_tenant: { get_script_env: [ SELF, adminrc, OS_TENANT_NAME, LOCAL_FILE] }
+          rabbit_user: { get_script_env: [ SELF, controller_settings, RABBIT_USER, LOCAL_FILE] }
+          rabbit_password: { get_script_env: [ SELF, controller_settings, RABBIT_PASS, LOCAL_FILE] }
+          rabbit_host: { get_script_env: [ SELF, controller_settings, CONTROLLER_FLAT_LAN_IP, LOCAL_FILE] }
+          domain: Default
+      artifacts:
+          adminrc: /root/setup/admin-openrc.sh
+          controller_settings: /root/setup/controller_settings
+
+    mysite:
+      type: tosca.nodes.Site
+      properties:
+          no-create: True
+          no-delete: True
+      requirements:
+          - deployment:
+               node: MyDeployment
+               relationship: tosca.relationships.SiteDeployment
+               requirements:
+                   - controller:
+                       node: CloudLab
+                       relationship: tosca.relationships.UsesController
+
+    Public shared IPv4:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          no-create: True
+          no-delete: True
+          shared_network_name: { get_artifact: [ SELF, flat_net_name, LOCAL_FILE] }
+      artifacts:
+          flat_net_name: /root/setup/flat_net_name
+
+    padmin@vicci.org:
+      type: tosca.nodes.User
+      properties:
+          no-create: True
+          no-delete: True
+          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE ] }
+      artifacts:
+          pubkey: /root/setup/padmin_public_key
diff --git a/common/devstack-creds.sh b/common/devstack-creds.sh
new file mode 100644
index 0000000..b90e6ec
--- /dev/null
+++ b/common/devstack-creds.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+DEVSTACK_ROOT=$1
+
+source $DEVSTACK_ROOT/openrc admin admin
+echo export OS_TENANT_NAME=$OS_TENANT_NAME
+echo export OS_USERNAME=$OS_USERNAME
+echo export OS_PASSWORD=$OS_PASSWORD
+echo export OS_AUTH_URL=$OS_AUTH_URL
diff --git a/common/devstack/local.conf b/common/devstack/local.conf
new file mode 100644
index 0000000..15a95fb
--- /dev/null
+++ b/common/devstack/local.conf
@@ -0,0 +1,32 @@
+# A single node devstack configuration for use with XOS
+[[local|localrc]]
+
+DOWNLOAD_DEFAULT_IMAGES=false
+IMAGE_URLS="http://www.planet-lab.org/cord/trusty-server-multi-nic.img,"
+#IMAGE_URLS+="http://www.vicci.org/cord/ceilometer-trusty-server-multi-nic.compressed.qcow2"
+LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
+# Append the git branch name if you wish to download ceilometer from a specific branch
+#enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer 
+
+disable_service n-net
+enable_service q-svc
+enable_service q-agt
+enable_service q-dhcp
+enable_service q-l3
+enable_service q-meta
+# Optional, to enable tempest configuration as part of devstack
+enable_service tempest
+
+# Uncomment below lines if you are installing kilo version of ceilometer
+#enable_service ceilometer-acentral
+#enable_service ceilometer-anotification
+#enable_service ceilometer-collector
+#enable_service ceilometer-alarm-singleton
+#enable_service ceilometer-alarm-notifier
+#enable_service ceilometer-alarm-evaluator
+#enable_service ceilometer-api
+#enable_service ceilometer-acompute
+#CEILOMETER_BACKEND=mongodb
+
+## Neutron options
+Q_USE_SECGROUP=False
diff --git a/common/devstack/net-fix.sh b/common/devstack/net-fix.sh
new file mode 100755
index 0000000..5b486bd
--- /dev/null
+++ b/common/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
diff --git a/common/devstack/setup-devstack.sh b/common/devstack/setup-devstack.sh
new file mode 100644
index 0000000..bfbb8f8
--- /dev/null
+++ b/common/devstack/setup-devstack.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# If running on a CloudLab node, set up extra disk space
+if [ -e /usr/testbed/bin/mkextrafs ]
+then
+    sudo mkdir -p /opt/stack
+    sudo /usr/testbed/bin/mkextrafs -f /opt/stack
+fi
+
+cd ~
+git clone https://github.com/open-cloud/xos.git
+git clone https://git.openstack.org/openstack-dev/devstack
+cd ~/devstack
+git checkout stable/kilo
+cp ~/xos/xos/configurations/common/devstack/local.conf .
+./stack.sh
diff --git a/common/disable-onboarding.yaml b/common/disable-onboarding.yaml
new file mode 100644
index 0000000..acb75c8
--- /dev/null
+++ b/common/disable-onboarding.yaml
@@ -0,0 +1,16 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the exampleservice
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    xos:
+      type: tosca.nodes.XOS
+      properties:
+        no-create: true
+        no-delete: true
+        enable_build: false
+
diff --git a/common/enable-onboarding.yaml b/common/enable-onboarding.yaml
new file mode 100644
index 0000000..98e433c
--- /dev/null
+++ b/common/enable-onboarding.yaml
@@ -0,0 +1,16 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the exampleservice
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    xos:
+      type: tosca.nodes.XOS
+      properties:
+        no-create: true
+        no-delete: true
+        enable_build: true
+
diff --git a/common/fixtures.yaml b/common/fixtures.yaml
new file mode 100644
index 0000000..198f5d2
--- /dev/null
+++ b/common/fixtures.yaml
@@ -0,0 +1,135 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Some basic fixtures
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+
+    xos:
+      type: tosca.nodes.XOS
+
+
+# -----------------------------------------------------------------------------
+# Network Parameter Types
+# -----------------------------------------------------------------------------
+
+    s_tag:
+      type: tosca.nodes.NetworkParameterType
+
+    c_tag:
+      type: tosca.nodes.NetworkParameterType
+
+    next_hop:
+      type: tosca.nodes.NetworkParameterType
+
+    device:
+      type: tosca.nodes.NetworkParameterType
+
+    bridge:
+      type: tosca.nodes.NetworkParameterType
+
+    neutron_port_name:
+      type: tosca.nodes.NetworkParameterType
+
+# ----------------------------------------------------------------------------
+# Roles
+# ----------------------------------------------------------------------------
+
+    siterole#admin:
+      type: tosca.nodes.SiteRole
+
+    siterole#pi:
+      type: tosca.nodes.SiteRole
+
+    siterole#tech:
+      type: tosca.nodes.SiteRole
+
+    tenantrole#admin:
+      type: tosca.nodes.TenantRole
+
+    tenantrole#access:
+      type: tosca.nodes.TenantRole
+
+    deploymentrole#admin:
+      type: tosca.nodes.DeploymentRole
+
+    slicerole#admin:
+      type: tosca.nodes.SliceRole
+
+    slicerole#access:
+      type: tosca.nodes.SliceRole
+
+# -----------------------------------------------------------------------------
+# Flavors
+# -----------------------------------------------------------------------------
+
+    m1.small:
+      type: tosca.nodes.Flavor
+
+    m1.medium:
+      type: tosca.nodes.Flavor
+
+    m1.large:
+      type: tosca.nodes.Flavor
+
+# -----------------------------------------------------------------------------
+# Dashboard Views
+# -----------------------------------------------------------------------------
+
+# Temporary removed, waiting for a new Angular Base Implementation
+#    xsh:
+#      type: tosca.nodes.DashboardView
+#      properties:
+#          url: template:xsh
+
+    Customize:
+      type: tosca.nodes.DashboardView
+      properties:
+          url: template:customize
+
+    Tenant:
+      type: tosca.nodes.DashboardView
+      properties:
+          url: template:xosTenant
+
+    Developer:
+      type: tosca.nodes.DashboardView
+      properties:
+          url: template:xosDeveloper
+
+    Services Grid:
+      type: tosca.nodes.DashboardView
+      properties:
+          url: template:xosServiceGrid
+
+# -----------------------------------------------------------------------------
+# Network Templates
+# -----------------------------------------------------------------------------
+
+    Private:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          visibility: private
+          translation: none
+
+    Public shared IPv4:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          visibility: private
+          translation: NAT
+          shared_network_name: nat-net
+
+    Public dedicated IPv4:
+      type: tosca.nodes.NetworkTemplate
+      properties:
+          visibility: public
+          translation: none
+          shared_network_name: ext-net
+
+
+
+
+
diff --git a/common/make-images-yaml.sh b/common/make-images-yaml.sh
new file mode 100644
index 0000000..6321a9d
--- /dev/null
+++ b/common/make-images-yaml.sh
@@ -0,0 +1,48 @@
+FN=$SETUPDIR/images.yaml
+
+rm -f $FN
+
+cat >> $FN <<EOF
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: autogenerated nodes file
+
+topology_template:
+  node_templates:
+    mysite:
+        type: tosca.nodes.Site
+
+EOF
+
+IMAGES=$( bash -c "source $SETUPDIR/admin-openrc.sh ; glance image-list" |grep -v ID|grep -v +|awk '{print $4}' )
+I=0
+for IMAGE in $IMAGES; do
+    echo $IMAGE
+    cat >> $FN <<EOF
+    $IMAGE:
+      type: tosca.nodes.Image
+      properties:
+         disk_format: QCOW2
+         container_format: BARE
+
+EOF
+done
+
+cat >> $FN <<EOF
+    MyDeployment:
+      type: tosca.nodes.Deployment
+      properties:
+          flavors: m1.large, m1.medium, m1.small
+      requirements:
+EOF
+
+for IMAGE in $IMAGES; do
+    cat >> $FN <<EOF
+          - image:
+              node: $IMAGE
+              relationship: tosca.relationships.SupportsImage
+EOF
+done
diff --git a/common/make-nodes-yaml.sh b/common/make-nodes-yaml.sh
new file mode 100644
index 0000000..65e16bb
--- /dev/null
+++ b/common/make-nodes-yaml.sh
@@ -0,0 +1,36 @@
+FN=$SETUPDIR/nodes.yaml
+
+rm -f $FN
+
+cat >> $FN <<EOF
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+imports:
+   - custom_types/xos.yaml
+
+description: autogenerated nodes file
+
+topology_template:
+  node_templates:
+    MyDeployment:
+        type: tosca.nodes.Deployment
+    mysite:
+        type: tosca.nodes.Site
+EOF
+
+NODES=$( bash -c "source $SETUPDIR/admin-openrc.sh ; nova host-list" |grep compute|awk '{print $2}' )
+I=0
+for NODE in $NODES; do
+    echo $NODE
+    cat >> $FN <<EOF
+    $NODE:
+      type: tosca.nodes.Node
+      requirements:
+        - site:
+            node: mysite
+            relationship: tosca.relationships.MemberOfSite
+        - deployment:
+            node: MyDeployment
+            relationship: tosca.relationships.MemberOfDeployment
+EOF
+done
diff --git a/common/mydeployment.yaml b/common/mydeployment.yaml
new file mode 100644
index 0000000..c81fd93
--- /dev/null
+++ b/common/mydeployment.yaml
@@ -0,0 +1,75 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Some basic fixtures
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    m1.large:
+      type: tosca.nodes.Flavor
+
+    m1.medium:
+      type: tosca.nodes.Flavor
+
+    m1.small:
+      type: tosca.nodes.Flavor
+
+    m1.xlarge:
+      type: tosca.nodes.Flavor
+
+    MyDeployment:
+      type: tosca.nodes.Deployment
+      requirements:
+          - m1.xlarge:
+             node: m1.large
+             relationship: tosca.relationships.SupportsFlavor
+          - m1.large:
+             node: m1.large
+             relationship: tosca.relationships.SupportsFlavor
+          - m1.medium:
+             node: m1.medium
+             relationship: tosca.relationships.SupportsFlavor
+          - m1.small:
+             node: m1.small
+             relationship: tosca.relationships.SupportsFlavor
+
+    mysite:
+      type: tosca.nodes.Site
+      properties:
+          display_name: MySite
+      requirements:
+          - deployment:
+               node: MyDeployment
+               relationship: tosca.relationships.SiteDeployment
+
+    # Attach the Tenant view to the MyDeployment deployment
+    Tenant:
+      type: tosca.nodes.DashboardView
+      properties:
+          no-create: true
+          no-delete: true
+      requirements:
+          - deployment:
+              node: MyDeployment
+              relationship: tosca.relationships.SupportsDeployment
+
+    padmin@vicci.org:
+      type: tosca.nodes.User
+      properties:
+          password: letmein
+#          encrypted_password: pbkdf2_sha256$12000$Qufx9iqtaYma$xs0YurPOcj9qYQna/Qrb3K+im9Yr2XEVr0J4Kqek7AE=
+          firstname: XOS
+          lastname: admin
+          is_admin: true
+      requirements:
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+          - tenant_dashboard:
+              node: Tenant
+              relationship: tosca.relationships.UsesDashboard
+
+
+
diff --git a/common/run_tosca.py b/common/run_tosca.py
new file mode 100755
index 0000000..35a0fb7
--- /dev/null
+++ b/common/run_tosca.py
@@ -0,0 +1,44 @@
+#! /usr/bin/env python
+
+import json
+import os
+import requests
+import sys
+import traceback
+
+def main():
+    global opencloud_auth
+
+    if len(sys.argv)!=5:
+        print >> sys.stderr, "syntax: run_tosca.py <port> <username> <password> <fn>"
+        sys.exit(-1)
+
+    port = int(sys.argv[1])
+    username = sys.argv[2]
+    password = sys.argv[3]
+    tosca_fn = sys.argv[4]
+
+    xos_auth=(username, password)
+
+    hostname = "127.0.0.1"
+    url = "http://%s:%d/api/utility/tosca/run/" % (hostname, port)
+
+    recipe = open(tosca_fn).read()
+
+    r = requests.post(url, data={"recipe": recipe}, auth=xos_auth)
+    if (r.status_code != 200):
+        print >> sys.stderr, "ERR: recieved status %d" % r.status_code
+        try:
+            print >> sys.stderr, r.json()["error_text"]
+        except:
+            traceback.print_exc("error while printing the error!")
+            print r.text
+        sys.exit(-1)
+
+    result = r.json()
+    if "log_msgs" in result:
+        print "\n".join(result["log_msgs"])+"\n"
+
+if __name__ == "__main__":
+    main()
+
diff --git a/common/wait_for_onboarding_ready.sh b/common/wait_for_onboarding_ready.sh
new file mode 100755
index 0000000..dbfdde8
--- /dev/null
+++ b/common/wait_for_onboarding_ready.sh
@@ -0,0 +1,28 @@
+#! /bin/bash
+
+display_usage() { 
+    echo -e "\nUsage:\n$0 [xos-listen-port] [name] \n" 
+} 
+
+if [  $# -lt 2 ] 
+then 
+    display_usage
+    exit 1
+fi 
+
+echo "Waiting for $2 to be onboarded"
+while [[ 1 ]]; do
+    STATUS=`curl 0.0.0.0:$1/api/utility/onboarding/$2/ready/ 2> /dev/null`
+    if [[ "$STATUS" == "true" ]]; then
+        echo "$2 is onboarded"
+        exit 0
+    fi
+    echo -ne "."
+    sleep 1
+#    RUNNING_CONTAINER=`sudo docker ps|grep "xos"|awk '{print $$NF}'`
+#    if [[ $RUNNING_CONTAINER == "" ]]; then
+#        echo Container may have failed. check with \"make showlogs\'
+#        exit 1
+#    fi
+done
+
diff --git a/common/wait_for_xos.sh b/common/wait_for_xos.sh
new file mode 100644
index 0000000..afffb86
--- /dev/null
+++ b/common/wait_for_xos.sh
@@ -0,0 +1,13 @@
+#! /bin/bash
+echo "Waiting for XOS to come up"
+until http 0.0.0.0:9999 &> /dev/null
+do
+    sleep 1
+    echo -ne "."
+    RUNNING_CONTAINER=`sudo docker ps|grep "xos"|awk '{print $$NF}'`
+    if [[ $RUNNING_CONTAINER == "" ]]; then
+        echo Container may have failed. check with \"make showlogs\'
+        exit 1
+    fi
+done
+echo "XOS is ready"
diff --git a/common/wait_for_xos_file.sh b/common/wait_for_xos_file.sh
new file mode 100755
index 0000000..e137164
--- /dev/null
+++ b/common/wait_for_xos_file.sh
@@ -0,0 +1,25 @@
+#! /bin/bash
+
+display_usage() { 
+    echo -e "\nUsage:\n$0 [fn] \n" 
+} 
+
+if [  $# -lt 1 ] 
+then 
+    display_usage
+    exit 1
+fi 
+
+echo "Waiting for XOS to create file $1"
+
+until find $1 &> /dev/null
+do
+    sleep 1
+    echo -ne "."
+    RUNNING_CONTAINER=`sudo docker ps|grep "xos"|awk '{print $$NF}'`
+    if [[ $RUNNING_CONTAINER == "" ]]; then
+        echo Container may have failed. check with \"make showlogs\'
+        exit 1
+    fi
+done
+echo "XOS is ready"
diff --git a/common/wait_for_xos_port.sh b/common/wait_for_xos_port.sh
new file mode 100755
index 0000000..b16639e
--- /dev/null
+++ b/common/wait_for_xos_port.sh
@@ -0,0 +1,24 @@
+#! /bin/bash
+
+display_usage() { 
+    echo -e "\nUsage:\n$0 [xos-listen-port] \n" 
+} 
+
+if [  $# -lt 1 ] 
+then 
+    display_usage
+    exit 1
+fi 
+
+echo "Waiting for XOS to start listening on port $1"
+until curl 0.0.0.0:$1 &> /dev/null
+do
+    sleep 1
+    echo -ne "."
+    RUNNING_CONTAINER=`sudo docker ps|grep "xos"|awk '{print $$NF}'`
+    if [[ $RUNNING_CONTAINER == "" ]]; then
+        echo Container may have failed. check with \"make showlogs\'
+        exit 1
+    fi
+done
+echo "XOS is ready"
diff --git a/common/xos_common_config b/common/xos_common_config
new file mode 100644
index 0000000..76ba747
--- /dev/null
+++ b/common/xos_common_config
@@ -0,0 +1,47 @@
+[plc]
+name=plc
+deployment=plc
+
+[db]
+name=xos
+user=postgres
+password=password
+host=localhost
+port=5432
+
+[api]
+host=localhost
+port=8000
+ssl_key=None
+ssl_cert=None
+ca_ssl_cert=None
+ratelimit_enabled=0
+omf_enabled=0
+mail_support_address=support@localhost
+nova_enabled=True
+logfile=/var/log/xos.log
+
+[nova]
+admin_user=admin@domain.com
+admin_password=admin
+admin_tenant=admin
+url=http://localhost:5000/v2.0/
+default_image=None
+default_flavor=m1.small
+default_security_group=default
+ca_ssl_cert=/etc/ssl/certs/ca-certificates.crt
+
+[observer]
+pretend=False
+backoff_disabled=True
+images_directory=/opt/xos/images
+dependency_graph=/opt/xos/model-deps
+logfile=/var/log/xos_backend.log
+save_ansible_output=True
+
+[gui]
+disable_minidashboard=True
+branding_name=Open Cloud
+branding_icon=/static/logo.png
+branding_favicon=/static/favicon.png
+branding_bg=/static/bg.jpg