Merge branch 'master' of github.com:open-cloud/xos
diff --git a/xos/configurations/cord/make-vtn-networkconfig-json.sh b/xos/configurations/cord/make-vtn-networkconfig-json.sh
index c60a939..9406d27 100755
--- a/xos/configurations/cord/make-vtn-networkconfig-json.sh
+++ b/xos/configurations/cord/make-vtn-networkconfig-json.sh
@@ -10,14 +10,20 @@
         "org.onosproject.cordvtn" : {
             "cordvtn" : {
                 "gatewayMac" : "00:00:00:00:00:01",
+                "localManagementIp": "172.27.0.1/24",
+                "ovsdbPort": "6641",
+                "sshPort": "22",
+                "sshUser": "root",
+                "sshKeyFile": "/root/node_key",
                 "nodes" : [
 EOF
 
 NODES=$( sudo bash -c "source $SETUPDIR/admin-openrc.sh ; nova hypervisor-list" |grep -v ID|grep -v +|awk '{print $4}' )
 
+# XXX disabled - we don't need or want the nm node at this time
 # also configure ONOS to manage the nm node
-NM=`grep "^nm" /root/setup/fqdn.map | awk '{ print $2 }'`
-NODES="$NODES $NM"
+# NM=`grep "^nm" /root/setup/fqdn.map | awk '{ print $2 }'`
+# NODES="$NODES $NM"
 
 NODECOUNT=0
 for NODE in $NODES; do
@@ -39,11 +45,10 @@
     cat >> $FN <<EOF
                     {
                       "hostname": "$NODE",
-                      "ovsdbIp": "$NODEIP",
-                      "ovsdbPort": "6641",
+                      "hostManagementIp": "$NODEIP/24",
                       "bridgeId": "of:000000000000000$I",
-                      "phyPortName": "$PHYPORT",
-                      "localIp": "$LOCALIP"
+                      "dataplaneIntf": "$PHYPORT",
+                      "dataplaneIp": "$LOCALIP"
 EOF
     if [[ "$I" -lt "$NODECOUNT" ]]; then
         echo "                    }," >> $FN
diff --git a/xos/services/onos/models.py b/xos/services/onos/models.py
index 4be2c1b..20fa73f 100644
--- a/xos/services/onos/models.py
+++ b/xos/services/onos/models.py
@@ -23,7 +23,8 @@
 
     default_attributes = {"rest_hostname": "",
                           "rest_port": "8181",
-                          "no_container": False}
+                          "no_container": False,
+                          "node_key": ""}
 
     @property
     def rest_hostname(self):
@@ -49,6 +50,14 @@
     def no_container(self, value):
         self.set_attribute("no_container", value)
 
+    @property
+    def node_key(self):
+        return self.get_attribute("node_key", self.default_attributes["node_key"])
+
+    @node_key.setter
+    def node_key(self, value):
+        self.set_attribute("node_key", value)
+
 
 class ONOSApp(Tenant):   # aka 'ONOSTenant'
     class Meta:
diff --git a/xos/synchronizers/onos/steps/sync_onosapp.py b/xos/synchronizers/onos/steps/sync_onosapp.py
index 663e115..2dfdfbd 100644
--- a/xos/synchronizers/onos/steps/sync_onosapp.py
+++ b/xos/synchronizers/onos/steps/sync_onosapp.py
@@ -133,6 +133,13 @@
 
         ordered_attrs = attrs.keys()
 
+        onos = self.get_onos_service(o)
+        if onos.node_key:
+            file(os.path.join(o.files_dir, "node_key"),"w").write(onos.node_key)
+            o.node_key_fn="node_key"
+        else:
+            o.node_key_fn=None
+
         o.early_rest_configs=[]
         if ("cordvtn" in o.dependencies) and (not self.is_no_container(o)):
             # For VTN, since it's running in a docker host container, we need
@@ -209,6 +216,7 @@
         fields["config_fns"] = o.config_fns
         fields["early_rest_configs"] = o.early_rest_configs
         fields["component_configs"] = o.component_configs
+        fields["node_key_fn"] = o.node_key_fn
 
         if o.install_dependencies:
             fields["install_dependencies"] = [x.strip() for x in o.install_dependencies.split(",")]
diff --git a/xos/synchronizers/onos/steps/sync_onosapp.yaml b/xos/synchronizers/onos/steps/sync_onosapp.yaml
index f0af0d6..8235286 100644
--- a/xos/synchronizers/onos/steps/sync_onosapp.yaml
+++ b/xos/synchronizers/onos/steps/sync_onosapp.yaml
@@ -50,6 +50,16 @@
       path=/home/ubuntu/{{ appname }}/
       state=directory
 
+{% if node_key_fn %}
+  - name: Copy over key
+    copy:
+      src={{ files_dir }}/{{ node_key_fn }}
+      dest=/home/ubuntu/node_key
+
+  - name: Copy node key into container
+    shell: docker cp /home/ubuntu/node_key {{ ONOS_container }}:/root/node_key
+{% endif %}
+
 {% if config_fns %}
   - name: Copy over configuration files
     copy:
diff --git a/xos/synchronizers/openstack/steps/sync_container.yaml b/xos/synchronizers/openstack/steps/sync_container.yaml
index 82588dc..4ae4eb2 100644
--- a/xos/synchronizers/openstack/steps/sync_container.yaml
+++ b/xos/synchronizers/openstack/steps/sync_container.yaml
@@ -52,10 +52,18 @@
       state=latest
       update_cache=yes
     with_items:
-    - docker-engine
+# XXX docker 1.10 is not working on cloudlab
+#    - docker-engine
     - python-pip
     - python-httplib2
 
+  - name: Install Docker 1.9.1
+    apt:
+      name={{ '{{' }} item {{ '}}' }}
+      update_cache=yes
+    with_items:
+    - docker-engine=1.9.1-0~trusty
+
   # Something is installing a requests library that is incompative with pip, and
   # will cause this recipe to fail next time it tries to run pip. Only the one
   # in /usr/local/lib is bad. There's still a good one in /usr/lib
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 9df9de9..92f8cc1 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -130,6 +130,9 @@
             no_container:
                 type: boolean
                 default: false
+            node_key:
+                type: string
+                required: false
 
 
     tosca.nodes.ONOSApp:
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 8535ada..dfb9481 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -160,6 +160,9 @@
             no_container:
                 type: boolean
                 default: false
+            key_fn:
+                type: string
+                required: false
 
 
     tosca.nodes.ONOSApp:
diff --git a/xos/tosca/resources/onosservice.py b/xos/tosca/resources/onosservice.py
index c836a6c..3540dd0 100644
--- a/xos/tosca/resources/onosservice.py
+++ b/xos/tosca/resources/onosservice.py
@@ -13,7 +13,7 @@
 class XOSONOSService(XOSService):
     provides = "tosca.nodes.ONOSService"
     xos_model = ONOSService
-    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber", "rest_hostname", "rest_port", "no_container"]
+    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber", "rest_hostname", "rest_port", "no_container", "node_key"]
 
     def set_service_attr(self, obj, prop_name, value):
         value = self.try_intrinsic_function(value)