Add Image to TOSCA
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index d4c242c..a708d2e 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -322,6 +322,25 @@
             accessControl:
                 type: string
                 default: allow all
+            flavors:
+                type: string
+                required: false
+
+    tosca.nodes.Image:
+        derived_from: tosca.nodes.Root
+        capabilities:
+            image:
+                type: tosca.capabilities.xos.Image
+        properties:
+            disk_format:
+                type: string
+                required: false
+            container_format:
+                type: string
+                required: false
+            path:
+                type: string
+                required: false
 
     tosca.nodes.Controller:
         derived_from: tosca.nodes.Root
@@ -439,6 +458,10 @@
         derived_from: tosca.relationships.Root
         valid_target_types: [ tosca.capabilities.xos.Network ]
 
+    tosca.relationships.SupportsImage:
+        derived_from: tosca.relationships.Root
+        valid_target_types: [ tosca.capabilities.xos.Image ]
+
     tosca.relationships.ConnectsToSlice:
         derived_from: tosca.relationships.Root
 
@@ -512,3 +535,7 @@
         derived_from: tosca.capabilities.Root
         description: An XOS Node
 
+    tosca.capabilities.xos.Image:
+        derived_from: tosca.capabilities.Root
+        description: An XOS Image
+
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index ea43e12..0a0451e 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -384,6 +384,25 @@
             accessControl:
                 type: string
                 default: allow all
+            flavors:
+                type: string
+                required: false
+
+    tosca.nodes.Image:
+        derived_from: tosca.nodes.Root
+        capabilities:
+            image:
+                type: tosca.capabilities.xos.Image
+        properties:
+            disk_format:
+                type: string
+                required: false
+            container_format:
+                type: string
+                required: false
+            path:
+                type: string
+                required: false
 
     tosca.nodes.Controller:
         derived_from: tosca.nodes.Root
@@ -501,6 +520,10 @@
         derived_from: tosca.relationships.Root
         valid_target_types: [ tosca.capabilities.xos.Network ]
 
+    tosca.relationships.SupportsImage:
+        derived_from: tosca.relationships.Root
+        valid_target_types: [ tosca.capabilities.xos.Image ]
+
     tosca.relationships.ConnectsToSlice:
         derived_from: tosca.relationships.Root
 
@@ -574,3 +597,7 @@
         derived_from: tosca.capabilities.Root
         description: An XOS Node
 
+    tosca.capabilities.xos.Image:
+        derived_from: tosca.capabilities.Root
+        description: An XOS Image
+
diff --git a/xos/tosca/resources/image.py b/xos/tosca/resources/image.py
new file mode 100644
index 0000000..bdc66b6
--- /dev/null
+++ b/xos/tosca/resources/image.py
@@ -0,0 +1,41 @@
+# note: this module named xossite.py instead of site.py due to conflict with
+#    /usr/lib/python2.7/site.py
+
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from core.models import User, Deployment, Image
+
+from xosresource import XOSResource
+
+class XOSImage(XOSResource):
+    provides = "tosca.nodes.Image"
+    xos_model = Image
+    copyin_props = ["disk_format", "container_format", "path"]
+
+    def get_xos_args(self):
+        args = super(XOSImage, self).get_xos_args()
+
+        return args
+
+    def create(self):
+        xos_args = self.get_xos_args()
+
+        image = Image(**xos_args)
+        image.caller = self.user
+        image.save()
+
+        self.info("Created Image '%s'" % (str(image), ))
+
+    def delete(self, obj):
+        if obj.instances.exists():
+            self.info("Instance %s has active instances; skipping delete" % obj.name)
+            return
+        super(XOSImage, self).delete(obj)
+
+
+