created separate 'image_name' field to allow user to specify desired VM through TOSCA;
if 'default' used for 'image_name', will use slice's default image

Change-Id: I2cc286c91915fdb8ca24c949ad25255841b8c15f
diff --git a/xos/admin.py b/xos/admin.py
index 5877ec6..df0f636 100644
--- a/xos/admin.py
+++ b/xos/admin.py
@@ -73,6 +73,7 @@
         if self.instance:
             self.fields['creator'].initial = self.instance.creator
             self.fields['tenant_message'].initial = self.instance.tenant_message
+            self.fields['image_name'].initial = self.instance.image_name
 
         if (not self.instance) or (not self.instance.pk):
             self.fields['creator'].initial = get_request().user
@@ -82,6 +83,7 @@
     def save(self, commit=True):
         self.instance.creator = self.cleaned_data.get('creator')
         self.instance.tenant_message = self.cleaned_data.get('tenant_message')
+        self.instance.image_name = self.cleaned_data.get('image_name')
         return super(VMMETenantForm, self).save(commit=commit)
 
 
@@ -90,11 +92,11 @@
     verbose_name = "VMME Service Tenant"
     verbose_name_plural = "VMME Service Tenants"
 
-    list_display = ('id', 'backend_status_icon', 'instance', 'tenant_message')
-    list_display_links = ('backend_status_icon', 'instance', 'tenant_message', 'id')
+    list_display = ('id', 'backend_status_icon', 'instance', 'tenant_message', 'image_name')
+    list_display_links = ('backend_status_icon', 'instance', 'tenant_message', 'id', 'image_name')
 
     fieldsets = [(None, {
-        'fields': ['backend_status_text', 'kind', 'provider_service', 'instance', 'creator', 'tenant_message'],
+        'fields': ['backend_status_text', 'kind', 'provider_service', 'instance', 'creator', 'tenant_message', 'image_name'],
         'classes': ['suit-tab suit-tab-general'],
         })]
 
diff --git a/xos/models.py b/xos/models.py
index 0c185e6..e49a93f 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -1,6 +1,6 @@
 # models.py -  ExampleService Models
 
-from core.models import Service, TenantWithContainer
+from core.models import Service, TenantWithContainer, Image
 from django.db import models, transaction
 
 
@@ -29,8 +29,8 @@
         verbose_name = "VMME Service Tenant"
 
     tenant_message = models.CharField(max_length=254, help_text="vMME message")
+    image_name = models.CharField(max_length=254, help_text="Name of VM image")
 
-    #default_attributes = {"tenant_message": "New vMME Component"}  will this work? 
     def __init__(self, *args, **kwargs):
         vmme_services = VMMEService.get_service_objects().all()
         if vmme_services:
@@ -45,6 +45,15 @@
         self.cleanup_container()
         super(VMMETenant, self).delete(*args, **kwargs)
 
+    @property
+    def image(self):
+        img = self.image_name.strip()
+        if img.lower() != "default":
+            return Image.objects.get(name=img)
+        else: 
+            return super(VMMETenant, self).image
+
+        
 
 def model_policy_vmmetenant(pk):
     with transaction.atomic():
diff --git a/xos/synchronizer/steps/sync_vmmetenant.py b/xos/synchronizer/steps/sync_vmmetenant.py
index 19a2782..f494e1e 100644
--- a/xos/synchronizer/steps/sync_vmmetenant.py
+++ b/xos/synchronizer/steps/sync_vmmetenant.py
@@ -49,6 +49,6 @@
     def get_extra_attributes(self, o):
         fields = {}
         fields['tenant_message'] = o.tenant_message
-        #vmmeservice = self.get_vmmeservice(o)   #not needed cause there's no service message 
+        fields['image_name'] = o.image_name
         return fields
 
diff --git a/xos/tosca/resources/vmmetenant.py b/xos/tosca/resources/vmmetenant.py
index 848d2c8..2a6e6d4 100644
--- a/xos/tosca/resources/vmmetenant.py
+++ b/xos/tosca/resources/vmmetenant.py
@@ -4,8 +4,8 @@
 class XOSVMMETenant(XOSResource):
     provides = "tosca.nodes.VMMETenant"
     xos_model = VMMETenant
-    copyin_props = ["tenant_message"]  #should this be a list or a tuple (as in exampleservice) ? 
-    name_field = None  #should this be "service_specific id" (as in exampleservice) ? 
+    copyin_props = ["tenant_message", "image_name"]  
+    name_field = None  
 
     def get_xos_args(self, throw_exception=True):
         args = super(XOSVMMETenant, self).get_xos_args()