Merge branch 'master' of github.com:open-cloud/xos
diff --git a/containers/xos/Dockerfile b/containers/xos/Dockerfile
index 46e88b3..9e69cac 100644
--- a/containers/xos/Dockerfile
+++ b/containers/xos/Dockerfile
@@ -70,7 +70,7 @@
     google_api_python_client \
     httplib2.ca_certs_locater
 
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/site-packages/suit/static/suit/js/
 
 # Install XOS
 RUN git clone git://github.com/open-cloud/xos.git /tmp/xos && \
diff --git a/containers/xos/Dockerfile.templ b/containers/xos/Dockerfile.templ
index 5071f68..f29305b 100644
--- a/containers/xos/Dockerfile.templ
+++ b/containers/xos/Dockerfile.templ
@@ -29,7 +29,7 @@
     python-setuptools \
     tar \
     wget \
-##### observer dependencies  
+##### observer dependencies
     python-keystoneclient \
     python-novaclient \
     python-neutronclient \
@@ -54,7 +54,7 @@
     google_api_python_client \
     httplib2 \
     httplib2.ca_certs_locater \
-    lxml \  
+    lxml \
     markdown \
     netaddr \
     python-dateutil \
@@ -65,7 +65,7 @@
     pyyaml \
     requests
 
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/site-packages/suit/static/suit/js/
 
 # Install XOS
 RUN git clone XOS_GIT_REPO -b XOS_GIT_BRANCH /tmp/xos && \
diff --git a/xos/configurations/common/Makefile.cloudlab b/xos/configurations/common/Makefile.cloudlab
index af2ec58..4646fd6 100644
--- a/xos/configurations/common/Makefile.cloudlab
+++ b/xos/configurations/common/Makefile.cloudlab
@@ -1,4 +1,7 @@
 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}' )
 
 all: prereqs admin-openrc flat_name nodes_yaml public_key private_key ceilometer_url node_key
diff --git a/xos/configurations/cord/README-VTN.md b/xos/configurations/cord/README-VTN.md
index 2b7d5e1..d196205 100644
--- a/xos/configurations/cord/README-VTN.md
+++ b/xos/configurations/cord/README-VTN.md
@@ -1,5 +1,7 @@
 vtn notes:
 
+see also: https://github.com/hyunsun/documentations/wiki/Neutron-ONOS-Integration-for-CORD-VTN#onos-setup
+
 inside the xos container:
 
     python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/tosca/samples/vtn.yaml
@@ -10,6 +12,7 @@
     ONOS_VTN_HOSTNAME="cp-2.smbaker-xos5.xos-pg0.clemson.cloudlab.us"
     apt-get -y install python-pip
     pip install -U setuptools pip
+    pip install testrepository
     git clone https://github.com/openstack/networking-onos.git
     cd networking-onos
     python setup.py install
@@ -29,6 +32,12 @@
     # files. Maybe it can be restarted using systemctl instead...
     /usr/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-file /usr/local/etc/neutron/plugins/ml2/conf_onos.ini
 
+Neutron driver arg-parsing issue
+
+    # For some reason, the VTN Neutron plugin isn't getting its arguments from neutron
+    emacs /usr/local/lib/python2.7/dist-packages/networking_onos/plugins/ml2/driver.py
+        hard-code self.onos_path and self.onos_auth
+    
 Compute node that has the ONOS Container
 
     # we need NAT rule so the neutron vtn plugin can talk to onos
@@ -44,6 +53,11 @@
     service openvswitch-switch restart
     ovs-vsctl del-br br-int
 
+nm node:
+
+    # neutron-dhcp-agent causes VTN app to throw port errors, because XOS uses --no-gateway
+    systemctl stop neutron-dhcp-agent.service 
+
 VTN doesn't seem to like cloudlab's networks (flat-net-1, ext-net, etc). You might have to delete them all. I've placed a script in xos/scripts/ called destroy-all-networks.sh that will automate tearing down all of cloudlab's neutron networks.
 
 For development, I suggest using the bash configuration (remember to start the ONOS observer manually) so that 
@@ -51,3 +65,4 @@
 
 Problems:
 * If you have more than one compute node, then the node that isn't running ONOS VTN will report as incomplete in VTN. This is because the openvswitch is trying to contact VTN on 172.17.0.2:6653. 
+* VTN doesn't like the nat-net network that XOS creates by default. Go into model_policies/model_policy_Slice.py and disable automatic creation of nat-net.
diff --git a/xos/core/static/donw_arrow.png b/xos/core/static/down_arrow.png
similarity index 100%
rename from xos/core/static/donw_arrow.png
rename to xos/core/static/down_arrow.png
Binary files differ
diff --git a/xos/observers/base/SyncInstanceUsingAnsible.py b/xos/observers/base/SyncInstanceUsingAnsible.py
index 5bb8250..373178c 100644
--- a/xos/observers/base/SyncInstanceUsingAnsible.py
+++ b/xos/observers/base/SyncInstanceUsingAnsible.py
@@ -179,6 +179,44 @@
 
         o.save()
 
-    def delete_record(self, m):
-        pass
+    def delete_record(self, o):
+        try:
+            controller = o.get_controller()
+            controller_register = json.loads(o.node.site_deployment.controller.backend_register)
+
+            if (controller_register.get('disabled',False)):
+                raise InnocuousException('Controller %s is disabled'%o.node.site_deployment.controller.name)
+        except AttributeError:
+            pass
+
+        instance = self.get_instance(o)
+        if isinstance(instance, basestring):
+            # sync to some external host
+
+            # XXX - this probably needs more work...
+
+            fields = { "hostname": instance,
+                       "instance_id": "ubuntu",     # this is the username to log into
+                       "private_key": service.key,
+                     }
+        else:
+            # sync to an XOS instance
+            fields = self.get_ansible_fields(instance)
+
+            fields["ansible_tag"] =  o.__class__.__name__ + "_" + str(o.id)
+
+        # If 'o' defines a 'sync_attributes' list, then we'll copy those
+        # attributes into the Ansible recipe's field list automatically.
+        if hasattr(o, "sync_attributes"):
+            for attribute_name in o.sync_attributes:
+                fields[attribute_name] = getattr(o, attribute_name)
+
+        fields.update(self.map_delete_inputs(o))
+
+        fields['delete']=True
+        res = self.run_playbook(o,fields)
+        try:
+                self.map_delete_outputs(o,res)
+        except AttributeError:
+                pass
 
diff --git a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.py b/xos/observers/monitoring_channel/steps/sync_monitoringchannel.py
index ad6564e..78ad45e 100644
--- a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.py
+++ b/xos/observers/monitoring_channel/steps/sync_monitoringchannel.py
@@ -70,5 +70,7 @@
 
         #o.last_ansible_hash = ansible_hash
 
-    def delete_record(self, m):
-        pass
+    def map_delete_inputs(self, o):
+        fields = {"unique_id": o.id,
+                  "delete": True}
+        return fields
diff --git a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.yaml b/xos/observers/monitoring_channel/steps/sync_monitoringchannel.yaml
index 3fbd569..c2705ba 100644
--- a/xos/observers/monitoring_channel/steps/sync_monitoringchannel.yaml
+++ b/xos/observers/monitoring_channel/steps/sync_monitoringchannel.yaml
@@ -22,6 +22,14 @@
         {% endfor %}
 
   tasks:
+{% if delete %}
+  - name: Remove tenant
+# FIXME: Adding dummy template action to avoid "action attribute missing in task" error
+    template: src=/opt/xos/observers/monitoring_channel/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
+    notify:
+     - stop monitoring-channel
+     - remove container
+{% else %}
 {% if full_setup %}
   - name: Docker repository
     copy: src=/opt/xos/observers/monitoring_channel/files/docker.list
@@ -75,16 +83,17 @@
 
   - name: Make sure Monitoring channel service is running
     service: name=monitoring-channel-{{ unique_id }} state=started
+{% endif %}
 
   handlers:
   - name: restart monitoring-channel
-    shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service vcpe-{{ unique_id }} start
+    shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service monitoring-channel-{{ unique_id }} start
 
   - name: stop monitoring-channel
     service: name=monitoring-channel-{{ unique_id }} state=stopped
 
   - name: remove container
-    docker: name=monitoring-channel-{{ unique_id }} state=absent image=docker-vcpe
+    docker: name=monitoring-channel-{{ unique_id }} state=absent image=monitoring-channel
 
   - name: start monitoring-channel
     service: name=monitoring-channel-{{ unique_id }} state=started
diff --git a/xos/observers/vcpe/files/etc/ufw/applications.d/openssh-server b/xos/observers/vcpe/files/etc/ufw/applications.d/openssh-server
new file mode 100644
index 0000000..9bbe906
--- /dev/null
+++ b/xos/observers/vcpe/files/etc/ufw/applications.d/openssh-server
@@ -0,0 +1,4 @@
+[OpenSSH]
+title=Secure shell server, an rshd replacement
+description=OpenSSH is a free implementation of the Secure Shell protocol.
+ports=22/tcp
diff --git a/xos/xos_configuration/xos_common_config b/xos/xos_configuration/xos_common_config
index b86d618..df30b54 100755
--- a/xos/xos_configuration/xos_common_config
+++ b/xos/xos_configuration/xos_common_config
@@ -40,6 +40,5 @@
 
 [gui]
 disable_minidashboard=True
-#branding_name=CORD
-#branding_css=/static/cord.css
-#branding_icon=/static/onos-logo.png
+branding_name=Open Cloud
+branding_icon=/static/logo.png