Merge branch 'acord_post_ons_fixes' of https://github.com/open-cloud/xos into acord_post_ons_fixes

Conflicts:
	xos/configurations/acord/acord-exampleservice.yaml
	xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
diff --git a/xos/configurations/acord/Makefile b/xos/configurations/acord/Makefile
index 2bcab00..2e64772 100644
--- a/xos/configurations/acord/Makefile
+++ b/xos/configurations/acord/Makefile
@@ -13,7 +13,7 @@
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/common/cloudlab-openstack.yaml
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /root/setup/nodes.yaml
 
-acord: cord
+acord: cord exampleservice
 	sudo MYIP=$(MYIP) docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/acord/ceilometer.yaml
 
 exampleservice:
diff --git a/xos/configurations/acord/acord-exampleservice.yaml b/xos/configurations/acord/acord-exampleservice.yaml
index 6441807..b6b23dd 100644
--- a/xos/configurations/acord/acord-exampleservice.yaml
+++ b/xos/configurations/acord/acord-exampleservice.yaml
@@ -4,75 +4,53 @@
 
 imports:
    - custom_types/xos.yaml
+   - custom_types/exampleservice.yaml
 
 topology_template:
   node_templates:
 
-    Private:
-      type: tosca.nodes.NetworkTemplate
-
-#    management:
-#      type: tosca.nodes.network.Network.XOS
-#      properties:
-#          no-create: true
-#          no-delete: true
-#          no-update: true
-
-#    service#vrouter:
-#      type: tosca.nodes.Service
-#      properties:
-#          no-create: true
-#          no-delete: true
-#          no-update: true
-
-#    exampleservice-public:
-#      type: tosca.nodes.network.Network
-#      properties:
-#          ip_version: 4
-#      requirements:
-#          - network_template:
-#              node: Private
-#              relationship: tosca.relationships.UsesNetworkTemplate
-#          - owner:
-#              node: mysite_exampleservice
-#              relationship: tosca.relationships.MemberOfSlice
-#          - connection:
-#              node: mysite_exampleservice
-#              relationship: tosca.relationships.ConnectsToSlice
-#          - vrouter_tenant:
-#              node: service#vrouter
-#              relationship: tosca.relationships.TenantOfService
-
     mysite:
       type: tosca.nodes.Site
 
+    trusty-server-multi-nic:
+      type: tosca.nodes.Image
+
+    m1.small:
+      type: tosca.nodes.Flavor
+
     mysite_exampleservice:
       description: This slice holds the ExampleService
       type: tosca.nodes.Slice
-      properties:
-          network: noauto
       requirements:
           - site:
               node: mysite
               relationship: tosca.relationships.MemberOfSite
-#          - management:
-#              node: management
-#              relationship: tosca.relationships.ConnectsToNetwork
-          - exmapleserver:
-              node: service#exampleservice
+          - exmapleservice:
+              node: service_example
               relationship: tosca.relationships.MemberOfService
+          - default_image:
+                node: trusty-server-multi-nic
+                relationship: tosca.relationships.DefaultImage
+          - m1.small:
+                node: m1.small
+                relationship: tosca.relationships.DefaultFlavor
 
-    service#exampleservice:
+    service_example:
       type: tosca.nodes.ExampleService
-#      requirements:
-#          - management:
-#              node: management
-#              relationship: tosca.relationships.UsesNetwork
       properties:
           view_url: /admin/exampleservice/exampleservice/$id$/
           kind: exampleservice
           public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
           private_key_fn: /opt/xos/synchronizers/exampleservice/exampleservice_private_key
+          service_message: hello
       artifacts:
           pubkey: /opt/xos/synchronizers/exampleservice/exampleservice_public_key
 
+    exampletenant1:
+        type: tosca.nodes.ExampleTenant
+        properties:
+            tenant_message: world
+        requirements:
+          - tenant:
+              node: service_example
+              relationship: tosca.relationships.TenantOfService
diff --git a/xos/configurations/cord-pod/README-Tutorial.md b/xos/configurations/cord-pod/README-Tutorial.md
index 4bd68c5..94f5170 100644
--- a/xos/configurations/cord-pod/README-Tutorial.md
+++ b/xos/configurations/cord-pod/README-Tutorial.md
@@ -84,11 +84,9 @@
 ubuntu@xos:~/xos/xos/configurations/cord-pod$ make exampleservice
 ```
 
-Next, in the XOS UI, create an ExampleTenant. Go to *http://xos/admin/exampleservice*
-([caveat](https://github.com/open-cloud/xos/blob/master/xos/configurations/cord-pod/README.md#logging-into-xos-on-cloudlab-or-any-remote-host))
-and add / save an Example Tenant.  When creating the tenant, fill in a message that
-this tenant should display.  This will cause an Instance to be created
-in the the *mysite_exampleservice* slice.
+This will add the ExampleService to XOS.  It will also create an ExampleTenant,
+which causes a VM to be created with Apache running inside.
+
 
 ## Set up a Subscriber Device
 
diff --git a/xos/configurations/cord-pod/pod-exampleservice.yaml b/xos/configurations/cord-pod/pod-exampleservice.yaml
index ec45bb8..23add83 100644
--- a/xos/configurations/cord-pod/pod-exampleservice.yaml
+++ b/xos/configurations/cord-pod/pod-exampleservice.yaml
@@ -4,6 +4,7 @@
 
 imports:
    - custom_types/xos.yaml
+   - custom_types/exampleservice.yaml
 
 topology_template:
   node_templates:
@@ -73,6 +74,15 @@
           kind: exampleservice
           public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
           private_key_fn: /opt/xos/synchronizers/exampleservice/exampleservice_private_key
+          service_message: hello
       artifacts:
           pubkey: /opt/xos/synchronizers/exampleservice/exampleservice_public_key
 
+    tenant#exampletenant1:
+        type: tosca.nodes.ExampleTenant
+        properties:
+            tenant_message: world
+        requirements:
+          - tenant:
+              node: service#exampleservice
+              relationship: tosca.relationships.TenantOfService
diff --git a/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
index 9c7c321..ca72c5f 100644
--- a/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
+++ b/xos/synchronizers/monitoring_channel/steps/sync_monitoringchannel.yaml
@@ -71,16 +71,16 @@
 # Due to some issue, ansible "changed" flag is set to false even though there is a change of 
 # ceilometer configuration file, because of which the configuration change is not reflecting in 
 # ceilometer containers 
-  - file: path=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config state=absent
+#  - file: path=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config state=absent
 
   - name: ceilometer proxy config
     template: src=/opt/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
     notify:
-#    - restart monitoring-channel
      - copy ceilo-config-file
-     - stop monitoring-channel
+     - restart monitoring-channel container
+#     - stop monitoring-channel
 #     - remove container
-     - start monitoring-channel
+#     - start monitoring-channel
 
   - name: Monitoring channel upstart
     template: src=/opt/xos/synchronizers/monitoring_channel/templates/monitoring-channel.conf.j2 dest=/etc/init/monitoring-channel-{{ unique_id }}.conf
@@ -129,6 +129,9 @@
   - name: copy ceilo-config-file
     shell: docker cp /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config monitoring-channel-{{ unique_id }}:/usr/local/share/ceilometer_proxy_config
 
+  - name: restart monitoring-channel container
+    shell: docker restart monitoring-channel-{{ unique_id }}
+
   - name: restart monitoring-channel
     shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service monitoring-channel-{{ unique_id }} start
 
diff --git a/xos/tools/xos-manage b/xos/tools/xos-manage
index 709882b..53b5bd8 100755
--- a/xos/tools/xos-manage
+++ b/xos/tools/xos-manage
@@ -144,6 +144,7 @@
     python ./manage.py makemigrations syndicate_storage
     python ./manage.py makemigrations cord
     python ./manage.py makemigrations ceilometer
+    python ./manage.py makemigrations exampleservice
     python ./manage.py makemigrations onos
     python ./manage.py makemigrations openvpn
     python ./manage.py makemigrations vtr
diff --git a/xos/tosca/custom_types/exampleservice.m4 b/xos/tosca/custom_types/exampleservice.m4
new file mode 100644
index 0000000..720913e
--- /dev/null
+++ b/xos/tosca/custom_types/exampleservice.m4
@@ -0,0 +1,31 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# compile this with "m4 exampleservice.m4 > exampleservice.yaml"
+
+# include macros
+include(macros.m4)
+
+node_types:
+    tosca.nodes.ExampleService:
+        derived_from: tosca.nodes.Root
+        description: >
+            Example Service
+        capabilities:
+            xos_base_service_caps
+        properties:
+            xos_base_props
+            xos_base_service_props
+            service_message:
+                type: string
+                required: false
+
+    tosca.nodes.ExampleTenant:
+        derived_from: tosca.nodes.Root
+        description: >
+            A Tenant of the example service
+        properties:
+            xos_base_tenant_props
+            tenant_message:
+                type: string
+                required: false
+
diff --git a/xos/tosca/custom_types/exampleservice.yaml b/xos/tosca/custom_types/exampleservice.yaml
new file mode 100644
index 0000000..2cd70dd
--- /dev/null
+++ b/xos/tosca/custom_types/exampleservice.yaml
@@ -0,0 +1,101 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+# compile this with "m4 exampleservice.m4 > exampleservice.yaml"
+
+# include macros
+# Note: Tosca derived_from isn't working the way I think it should, it's not
+#    inheriting from the parent template. Until we get that figured out, use
+#    m4 macros do our inheritance
+
+
+# Service
+
+
+# Subscriber
+
+
+
+
+# end m4 macros
+
+
+
+node_types:
+    tosca.nodes.ExampleService:
+        derived_from: tosca.nodes.Root
+        description: >
+            Example Service
+        capabilities:
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service
+        properties:
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object
+            kind:
+                type: string
+                default: generic
+                description: Type of service.
+            view_url:
+                type: string
+                required: false
+                description: URL to follow when icon is clicked in the Service Directory.
+            icon_url:
+                type: string
+                required: false
+                description: ICON to display in the Service Directory.
+            enabled:
+                type: boolean
+                default: true
+            published:
+                type: boolean
+                default: true
+                description: If True then display this Service in the Service Directory.
+            public_key:
+                type: string
+                required: false
+                description: Public key to install into Instances to allows Services to SSH into them.
+            private_key_fn:
+                type: string
+                required: false
+                description: Location of private key file
+            versionNumber:
+                type: string
+                required: false
+                description: Version number of Service.
+            service_message:
+                type: string
+                required: false
+
+    tosca.nodes.ExampleTenant:
+        derived_from: tosca.nodes.Root
+        description: >
+            A Tenant of the example service
+        properties:
+            kind:
+                type: string
+                default: generic
+                description: Kind of tenant
+            service_specific_id:
+                type: string
+                required: false
+                description: Service specific ID opaque to XOS but meaningful to service
+            tenant_message:
+                type: string
+                required: false
+
diff --git a/xos/tosca/custom_types/macros.m4 b/xos/tosca/custom_types/macros.m4
new file mode 100644
index 0000000..1f48f10
--- /dev/null
+++ b/xos/tosca/custom_types/macros.m4
@@ -0,0 +1,84 @@
+# Note: Tosca derived_from isn't working the way I think it should, it's not
+#    inheriting from the parent template. Until we get that figured out, use
+#    m4 macros do our inheritance
+
+define(xos_base_props,
+            no-delete:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to delete this object
+            no-create:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to create this object
+            no-update:
+                type: boolean
+                default: false
+                description: Do not allow Tosca to update this object
+            replaces:
+                type: string
+                required: false
+                descrption: Replaces/renames this object)
+# Service
+define(xos_base_service_caps,
+            scalable:
+                type: tosca.capabilities.Scalable
+            service:
+                type: tosca.capabilities.xos.Service)
+define(xos_base_service_props,
+            kind:
+                type: string
+                default: generic
+                description: Type of service.
+            view_url:
+                type: string
+                required: false
+                description: URL to follow when icon is clicked in the Service Directory.
+            icon_url:
+                type: string
+                required: false
+                description: ICON to display in the Service Directory.
+            enabled:
+                type: boolean
+                default: true
+            published:
+                type: boolean
+                default: true
+                description: If True then display this Service in the Service Directory.
+            public_key:
+                type: string
+                required: false
+                description: Public key to install into Instances to allows Services to SSH into them.
+            private_key_fn:
+                type: string
+                required: false
+                description: Location of private key file
+            versionNumber:
+                type: string
+                required: false
+                description: Version number of Service.)
+# Subscriber
+define(xos_base_subscriber_caps,
+            subscriber:
+                type: tosca.capabilities.xos.Subscriber)
+define(xos_base_subscriber_props,
+            kind:
+                type: string
+                default: generic
+                description: Kind of subscriber
+            service_specific_id:
+                type: string
+                required: false
+                description: Service specific ID opaque to XOS but meaningful to service)
+define(xos_base_tenant_props,
+            kind:
+                type: string
+                default: generic
+                description: Kind of tenant
+            service_specific_id:
+                type: string
+                required: false
+                description: Service specific ID opaque to XOS but meaningful to service)
+
+# end m4 macros
+
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index e83a22f..28a4205 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -1,90 +1,9 @@
 tosca_definitions_version: tosca_simple_yaml_1_0
 
-# Note: Tosca derived_from isn't working the way I think it should, it's not
-#    inheriting from the parent template. Until we get that figured out, use
-#    m4 macros do our inheritance
+# compile this with "m4 xos.m4 > xos.yaml"
 
-define(xos_base_props,
-            no-delete:
-                type: boolean
-                default: false
-                description: Do not allow Tosca to delete this object
-            no-create:
-                type: boolean
-                default: false
-                description: Do not allow Tosca to create this object
-            no-update:
-                type: boolean
-                default: false
-                description: Do not allow Tosca to update this object
-            replaces:
-                type: string
-                required: false
-                descrption: Replaces/renames this object)
-# Service
-define(xos_base_service_caps,
-            scalable:
-                type: tosca.capabilities.Scalable
-            service:
-                type: tosca.capabilities.xos.Service)
-define(xos_base_service_props,
-            kind:
-                type: string
-                default: generic
-                description: Type of service.
-            view_url:
-                type: string
-                required: false
-                description: URL to follow when icon is clicked in the Service Directory.
-            icon_url:
-                type: string
-                required: false
-                description: ICON to display in the Service Directory.
-            enabled:
-                type: boolean
-                default: true
-            published:
-                type: boolean
-                default: true
-                description: If True then display this Service in the Service Directory.
-            public_key:
-                type: string
-                required: false
-                description: Public key to install into Instances to allows Services to SSH into them.
-            private_key_fn:
-                type: string
-                required: false
-                description: Location of private key file
-            versionNumber:
-                type: string
-                required: false
-                description: Version number of Service.)
-# Subscriber
-define(xos_base_subscriber_caps,
-            subscriber:
-                type: tosca.capabilities.xos.Subscriber)
-define(xos_base_subscriber_props,
-            kind:
-                type: string
-                default: generic
-                description: Kind of subscriber
-            service_specific_id:
-                type: string
-                required: false
-                description: Service specific ID opaque to XOS but meaningful to service)
-define(xos_base_tenant_props,
-            kind:
-                type: string
-                default: generic
-                description: Kind of tenant
-            service_specific_id:
-                type: string
-                required: false
-                description: Service specific ID opaque to XOS but meaningful to service)
-
-# end m4 macros
-#
-# compile this with "m4 custom_types/xos.m4 > custom_types/xos.yaml"
+# include macros
+include(macros.m4)
 
 node_types:
     tosca.nodes.Service:
@@ -317,17 +236,6 @@
             xos_base_props
             xos_base_service_props
 
-    tosca.nodes.ExampleService:
-        derived_from: tosca.nodes.Root
-        description: >
-            Example Service
-        capabilities:
-            xos_base_service_caps
-        properties:
-            xos_base_props
-            xos_base_service_props
-
-
     tosca.nodes.Subscriber:
         derived_from: tosca.nodes.Root
         description: XOS subscriber base class.
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index b41a6c7..d83ca09 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -1,5 +1,8 @@
 tosca_definitions_version: tosca_simple_yaml_1_0
 
+# compile this with "m4 xos.m4 > xos.yaml"
+
+# include macros
 # Note: Tosca derived_from isn't working the way I think it should, it's not
 #    inheriting from the parent template. Until we get that figured out, use
 #    m4 macros do our inheritance
@@ -14,8 +17,8 @@
 
 
 # end m4 macros
-#
-# compile this with "m4 custom_types/xos.m4 > custom_types/xos.yaml"
+
+
 
 node_types:
     tosca.nodes.Service:
@@ -667,65 +670,6 @@
                 required: false
                 description: Version number of Service.
 
-    tosca.nodes.ExampleService:
-        derived_from: tosca.nodes.Root
-        description: >
-            Example Service
-        capabilities:
-            scalable:
-                type: tosca.capabilities.Scalable
-            service:
-                type: tosca.capabilities.xos.Service
-        properties:
-            no-delete:
-                type: boolean
-                default: false
-                description: Do not allow Tosca to delete this object
-            no-create:
-                type: boolean
-                default: false
-                description: Do not allow Tosca to create this object
-            no-update:
-                type: boolean
-                default: false
-                description: Do not allow Tosca to update this object
-            replaces:
-                type: string
-                required: false
-                descrption: Replaces/renames this object
-            kind:
-                type: string
-                default: generic
-                description: Type of service.
-            view_url:
-                type: string
-                required: false
-                description: URL to follow when icon is clicked in the Service Directory.
-            icon_url:
-                type: string
-                required: false
-                description: ICON to display in the Service Directory.
-            enabled:
-                type: boolean
-                default: true
-            published:
-                type: boolean
-                default: true
-                description: If True then display this Service in the Service Directory.
-            public_key:
-                type: string
-                required: false
-                description: Public key to install into Instances to allows Services to SSH into them.
-            private_key_fn:
-                type: string
-                required: false
-                description: Location of private key file
-            versionNumber:
-                type: string
-                required: false
-                description: Version number of Service.
-
-
     tosca.nodes.Subscriber:
         derived_from: tosca.nodes.Root
         description: XOS subscriber base class.
diff --git a/xos/tosca/destroy.py b/xos/tosca/destroy.py
index d7f8300..6fa9101 100644
--- a/xos/tosca/destroy.py
+++ b/xos/tosca/destroy.py
@@ -7,9 +7,6 @@
 parentdir = os.path.dirname(currentdir)
 sys.path.append(parentdir)
 
-# a bit of a hack for developing -- run m4 to generate xos.yaml from xos.m4
-os.system("m4 %s/custom_types/xos.m4 > %s/custom_types/xos.yaml" % (currentdir, currentdir))
-
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
 import django
 django.setup()
diff --git a/xos/tosca/makedocs.py b/xos/tosca/makedocs.py
index 6a9e959..2db6db8 100644
--- a/xos/tosca/makedocs.py
+++ b/xos/tosca/makedocs.py
@@ -10,9 +10,6 @@
 parentdir = os.path.dirname(currentdir)
 sys.path.append(parentdir)
 
-# a bit of a hack for developing -- run m4 to generate xos.yaml from xos.m4
-os.system("m4 %s/custom_types/xos.m4 > %s/custom_types/xos.yaml" % (currentdir, currentdir))
-
 """
 {'derived_from': 'tosca.nodes.Root', 'capabilities': {'scalable': {'type': 'tosca.capabilities.Scalable'},
 'service': {'type': 'tosca.capabilities.xos.Service'}}, 'properties': {'icon_url': {'required': False,
diff --git a/xos/tosca/resources/exampleservice.py b/xos/tosca/resources/exampleservice.py
index 9d41807..f26b8b7 100644
--- a/xos/tosca/resources/exampleservice.py
+++ b/xos/tosca/resources/exampleservice.py
@@ -14,7 +14,7 @@
 class XOSExampleService(XOSResource):
     provides = "tosca.nodes.ExampleService"
     xos_model = ExampleService
-    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "private_key_fn", "versionNumber"]
+    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "private_key_fn", "versionNumber", "service_message"]
 
     def postprocess(self, obj):
         for provider_service_name in self.get_requirements("tosca.relationships.TenantOfService"):
diff --git a/xos/tosca/resources/exampletenant.py b/xos/tosca/resources/exampletenant.py
new file mode 100644
index 0000000..d9239f9
--- /dev/null
+++ b/xos/tosca/resources/exampletenant.py
@@ -0,0 +1,36 @@
+import importlib
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+from core.models import Tenant, Service
+from services.exampleservice.models import ExampleTenant, SERVICE_NAME as EXAMPLETENANT_KIND
+
+from xosresource import XOSResource
+
+class XOSExampleTenant(XOSResource):
+    provides = "tosca.nodes.ExampleTenant"
+    xos_model = ExampleTenant
+    name_field = "service_specific_id"
+    copyin_props = ("tenant_message",)
+
+    def get_xos_args(self, throw_exception=True):
+        args = super(XOSExampleTenant, self).get_xos_args()
+
+        # ExampleTenant must always have a provider_service
+        provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=True)
+        if provider_name:
+            args["provider_service"] = self.get_xos_object(Service, throw_exception=True, name=provider_name)
+
+        return args
+
+    def get_existing_objs(self):
+        args = self.get_xos_args(throw_exception=False)
+        return ExampleTenant.get_tenant_objects().filter(provider_service=args["provider_service"], service_specific_id=args["service_specific_id"])
+        return []
+
+    def can_delete(self, obj):
+        return super(XOSExampleTenant, self).can_delete(obj)
+
diff --git a/xos/tosca/run.py b/xos/tosca/run.py
index 58dc22b..0ba2df9 100644
--- a/xos/tosca/run.py
+++ b/xos/tosca/run.py
@@ -7,9 +7,6 @@
 parentdir = os.path.dirname(currentdir)
 sys.path.append(parentdir)
 
-# a bit of a hack for developing -- run m4 to generate xos.yaml from xos.m4
-os.system("m4 %s/custom_types/xos.m4 > %s/custom_types/xos.yaml" % (currentdir, currentdir))
-
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
 import django
 django.setup()
diff --git a/xos/tosca/samples/exampleservice.yaml b/xos/tosca/samples/exampleservice.yaml
new file mode 100644
index 0000000..5b90ce2
--- /dev/null
+++ b/xos/tosca/samples/exampleservice.yaml
@@ -0,0 +1,47 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Setup the ExampleService
+
+imports:
+   - custom_types/xos.yaml
+   - custom_types/exampleservice.yaml
+
+topology_template:
+  node_templates:
+
+    mysite:
+      type: tosca.nodes.Site
+
+    mysite_exampleservice:
+      description: This slice holds the ExampleService
+      type: tosca.nodes.Slice
+
+      requirements:
+          - site:
+              node: mysite
+              relationship: tosca.relationships.MemberOfSite
+          - exmapleserver:
+              node: service#exampleservice
+              relationship: tosca.relationships.MemberOfService
+
+    service#exampleservice:
+      type: tosca.nodes.ExampleService
+      properties:
+          view_url: /admin/exampleservice/exampleservice/$id$/
+          kind: exampleservice
+          public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
+          private_key_fn: /opt/xos/synchronizers/exampleservice/exampleservice_private_key
+          service_message: hello
+      artifacts:
+          pubkey: /opt/xos/synchronizers/exampleservice/exampleservice_public_key
+
+
+    tenant#exampletenant1:
+        type: tosca.nodes.ExampleTenant
+        properties:
+            tenant_message: world
+        requirements:
+          - tenant:
+              node: service#exampleservice
+              relationship: tosca.relationships.TenantOfService
+
diff --git a/xos/xos/settings.py b/xos/xos/settings.py
index 417be81..bcb0f72 100644
--- a/xos/xos/settings.py
+++ b/xos/xos/settings.py
@@ -184,6 +184,7 @@
     'services.cord',
     'services.onos',
     'services.ceilometer',
+    'services.exampleservice',
     'services.requestrouter',
     'services.syndicate_storage',
     'services.openvpn',