add dashboardview support to tosca
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index e125150..a661af7 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -574,6 +574,23 @@
             node:
                 type: tosca.capabilities.xos.Node
 
+    tosca.nodes.DashboardView:
+        derived_from: tosca.nodes.Root
+        description: >
+            An XOS Dashboard View
+        capabilities:
+            dashboardview:
+                type: tosca.capabilities.xos.DashboardView
+        properties:
+            xos_base_props
+            enabled:
+                type: boolean
+                default: true
+            url:
+                type: string
+                required: false
+                description: URL to the dashboard
+
     tosca.relationships.MemberOfSlice:
         derived_from: tosca.relationships.Root
         valid_target_types: [ tosca.capabilities.xos.Slice ]
@@ -654,6 +671,10 @@
         derived_from: tosca.relationships.Root
         valid_target_types: [ tosca.capabilities.xos.Subscriber ]
 
+    tosca.relationships.UsesDashboard:
+        derived_from: tosca.relationships.Root
+        valid_target_types: [ tosca.capabilities.xos.DashboardView ]
+
     tosca.capabilities.xos.Service:
         derived_from: tosca.capabilities.Root
         description: An XOS Service
@@ -701,3 +722,7 @@
     tosca.capabilities.xos.Image:
         derived_from: tosca.capabilities.Root
         description: An XOS Image
+
+    tosca.capabilities.xos.DashboardView:
+        derived_from: tosca.capabilities.Root
+        description: An XOS DashboardView
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 24be6af..9170ecf 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -757,6 +757,34 @@
             node:
                 type: tosca.capabilities.xos.Node
 
+    tosca.nodes.DashboardView:
+        derived_from: tosca.nodes.Root
+        description: >
+            An XOS Dashboard View
+        capabilities:
+            dashboardview:
+                type: tosca.capabilities.xos.DashboardView
+        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
+            enabled:
+                type: boolean
+                default: true
+            url:
+                type: string
+                required: false
+                description: URL to the dashboard
+
     tosca.relationships.MemberOfSlice:
         derived_from: tosca.relationships.Root
         valid_target_types: [ tosca.capabilities.xos.Slice ]
@@ -837,6 +865,10 @@
         derived_from: tosca.relationships.Root
         valid_target_types: [ tosca.capabilities.xos.Subscriber ]
 
+    tosca.relationships.UsesDashboard:
+        derived_from: tosca.relationships.Root
+        valid_target_types: [ tosca.capabilities.xos.DashboardView ]
+
     tosca.capabilities.xos.Service:
         derived_from: tosca.capabilities.Root
         description: An XOS Service
@@ -884,3 +916,7 @@
     tosca.capabilities.xos.Image:
         derived_from: tosca.capabilities.Root
         description: An XOS Image
+
+    tosca.capabilities.xos.DashboardView:
+        derived_from: tosca.capabilities.Root
+        description: An XOS DashboardView
diff --git a/xos/tosca/resources/dashboardview.py b/xos/tosca/resources/dashboardview.py
new file mode 100644
index 0000000..9f7687c
--- /dev/null
+++ b/xos/tosca/resources/dashboardview.py
@@ -0,0 +1,23 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from core.models import DashboardView, Site, Deployment, SiteDeployment
+
+from xosresource import XOSResource
+
+class XOSDashboardView(XOSResource):
+    provides = "tosca.nodes.DashboardView"
+    xos_model = DashboardView
+    copyin_props = ["url","enabled"]
+
+    def get_xos_args(self):
+        return super(XOSDashboardView, self).get_xos_args()
+
+    def can_delete(self, obj):
+        return super(XOSDashboardView, self).can_delete(obj)
+
+
diff --git a/xos/tosca/resources/user.py b/xos/tosca/resources/user.py
index 53323c5..2b2a787 100644
--- a/xos/tosca/resources/user.py
+++ b/xos/tosca/resources/user.py
@@ -5,7 +5,7 @@
 sys.path.append("/opt/tosca")
 from translator.toscalib.tosca_template import ToscaTemplate
 
-from core.models import User, Site, SiteRole, SliceRole, SlicePrivilege, SitePrivilege
+from core.models import User, Site, SiteRole, SliceRole, SlicePrivilege, SitePrivilege, DashboardView, UserDashboardView
 
 from xosresource import XOSResource
 
@@ -46,6 +46,19 @@
                         sp.save()
                         self.info("Added site privilege on %s role %s for %s" % (str(dest), str(role), str(obj)))
 
+        for reqs in self.nodetemplate.requirements:
+            for (k,v) in reqs.items():
+                if (v["relationship"] == "tosca.relationships.UsesDashboard"):
+                    dashboard_name = v["node"]
+                    dashboard = self.get_xos_object(DashboardView, name=dashboard_name)
+
+                    udvs = UserDashboardView.objects.filter(user=obj, dashboardView=dashboard)
+                    if not udvs:
+                        self.info("Adding UserDashboardView from %s to %s" % (obj, dashboard))
+
+                        udv = UserDashboardView(user=obj, dashboardView=dashboard)
+                        udv.save()
+
     def create(self):
         nodetemplate = self.nodetemplate
 
diff --git a/xos/tosca/samples/dashboardview.yaml b/xos/tosca/samples/dashboardview.yaml
new file mode 100644
index 0000000..2a358f2
--- /dev/null
+++ b/xos/tosca/samples/dashboardview.yaml
@@ -0,0 +1,34 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Dashboard View
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    Ceilometer:
+      type: tosca.nodes.DashboardView
+      properties:
+          url: http:/xosmetering/
+
+    Tenant:
+      type: tosca.nodes.DashboardView
+      properties:
+          no-create: true
+          no-update: true
+          no-delete: true
+
+    padmin@vicci.org:
+      type: tosca.nodes.User
+      properties:
+          firstname: XOS
+          lastname: admin
+          is_admin: true
+      requirements:
+          - tenant_dashboard:
+              node: Tenant
+              relationship: tosca.relationships.UsesDashboard
+          - ceilometer_dashboard:
+              node: Ceilometer
+              relationship: tosca.relationships.UsesDashboard