CORD-2964 add TOSCA example for creating VM

Change-Id: I41711f32f84dbeaf659b535a853993295d1a136f
diff --git a/xos/examples/make_instance.yaml b/xos/examples/make_instance.yaml
new file mode 100644
index 0000000..4d3cdf5
--- /dev/null
+++ b/xos/examples/make_instance.yaml
@@ -0,0 +1,137 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: >
+  Creates a TrustDomain, Principal, Slice, Image, and then brings up an openstack
+  VM attached to the management network.
+
+imports:
+  - custom_types/trustdomain.yaml
+  - custom_types/principal.yaml
+  - custom_types/image.yaml
+  - custom_types/flavor.yaml
+  - custom_types/network.yaml
+  - custom_types/networkslice.yaml
+  - custom_types/node.yaml
+  - custom_types/site.yaml
+  - custom_types/slice.yaml
+  - custom_types/openstackservice.yaml
+  - custom_types/openstackserviceinstance.yaml
+
+topology_template:
+  node_templates:
+    service#openstack:
+          type: tosca.nodes.OpenStackService
+          properties:
+            name: OpenStack
+            must-exist: true
+
+    mysite:
+      type: tosca.nodes.Site
+      properties:
+        name: mysite
+        must-exist: true
+
+    management_network:
+      type: tosca.nodes.Network
+      properties:
+        name: management
+        must-exist: true
+
+    compute_node:
+      type: tosca.nodes.Node
+      properties:
+        name: <insert node hostname here>
+        must-exist: true
+
+    m1.small:
+      type: tosca.nodes.Flavor
+      properties:
+        name: m1.small
+        must-exist: true
+
+    demo_trustdomain:
+      type: tosca.nodes.TrustDomain
+      properties:
+        name: "demo-trust"
+      requirements:
+        - owner:
+            node: service#openstack
+            relationship: tosca.relationships.BelongsToOne
+
+    demo_principal:
+      type: tosca.nodes.Principal
+      properties:
+        name: "demo-account"
+      requirements:
+        - trust_domain:
+            node: demo_trustdomain
+            relationship: tosca.relationships.BelongsToOne
+
+    image_cirros:
+      type: tosca.nodes.Image
+      properties:
+        name: "cirros-0.3.5"
+        container_format: "BARE"
+        disk_format: "QCOW2"
+        path: "http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img"
+
+    demo_slice:
+      type: tosca.nodes.Slice
+      properties:
+        name: "demo-slice"
+      requirements:
+        - site:
+            node: mysite
+            relationship: tosca.relationships.BelongsToOne
+        - trust_domain:
+            node: demo_trustdomain
+            relationship: tosca.relationships.BelongsToOne
+        - principal:
+            node: demo_principal
+            relationship: tosca.relationships.BelongsToOne
+
+    demo_slice_management_network:
+      type: tosca.nodes.NetworkSlice
+      requirements:
+        - network:
+            node: management_network
+            relationship: tosca.relationships.BelongsToOne
+        - slice:
+            node: demo_slice
+            relationship: tosca.relationships.BelongsToOne
+
+    demo_instance:
+      type: tosca.nodes.OpenStackServiceInstance
+      properties:
+        name: "demo-instance"
+      requirements:
+        - slice:
+            node: demo_slice
+            relationship: tosca.relationships.BelongsToOne
+        - owner:
+            node: service#openstack
+            relationship: tosca.relationships.BelongsToOne
+        - image:
+            node: image_cirros
+            relationship: tosca.relationships.BelongsToOne
+        - node:
+            node: compute_node
+            relationship: tosca.relationships.BelongsToOne
+        - flavor:
+            node: m1.small
+            relationship: tosca.relationships.BelongsToOne
diff --git a/xos/synchronizer/steps/sync_openstackserviceinstance.py b/xos/synchronizer/steps/sync_openstackserviceinstance.py
index 6ae91a1..9db35de 100644
--- a/xos/synchronizer/steps/sync_openstackserviceinstance.py
+++ b/xos/synchronizer/steps/sync_openstackserviceinstance.py
@@ -88,6 +88,9 @@
 
             # TODO(smbaker): No ssh keys specified
 
+            if not instance.node:
+                raise Exception("No node specified for instance")
+
             availability_zone="nova:%s" % instance.node.name
 
             log.info("Creating Instance", instance=instance, image_id=image_id, flavor_id=flavor_id,