add healthcheck support to tosca
diff --git a/xos/configurations/opencloud/cdn-content.yaml b/xos/configurations/opencloud/cdn-content.yaml
index bdb309c..ebf6b82 100644
--- a/xos/configurations/opencloud/cdn-content.yaml
+++ b/xos/configurations/opencloud/cdn-content.yaml
@@ -168,3 +168,56 @@
- default_origin_server:
node: http_www.cs.arizona.edu
relationship: tosca.relationships.DefaultOriginServer
+
+ # Health Checks
+
+ healthcheck_dns_onlab.vicci.org:
+ type: tosca.nodes.HpcHealthCheck
+ requirements:
+ - hpc_service:
+ node: HyperCache
+ relationship: tosca.relationships.MemberOfService
+ properties:
+ kind: dns
+ resource_name: onlab.vicci.org
+
+ healthcheck_dns_test-cdn.opencloud.us:
+ type: tosca.nodes.HpcHealthCheck
+ requirements:
+ - hpc_service:
+ node: HyperCache
+ relationship: tosca.relationships.MemberOfService
+ properties:
+ kind: dns
+ resource_name: test-cdn.opencloud.us
+
+ healthcheck_http_test-cdn-index:
+ type: tosca.nodes.HpcHealthCheck
+ requirements:
+ - hpc_service:
+ node: HyperCache
+ relationship: tosca.relationships.MemberOfService
+ properties:
+ kind: http
+ resource_name: test-cdn.opencloud.us:/
+ result_contains: Lowenthal
+
+ healthcheck_http_onlab_onos_image:
+ type: tosca.nodes.HpcHealthCheck
+ requirements:
+ - hpc_service:
+ node: HyperCache
+ relationship: tosca.relationships.MemberOfService
+ properties:
+ kind: http
+ resource_name: onlab.vicci.org:/onos/vm/onos-tutorial-1.1.0r220-ovf.zip
+
+ healthcheck_http_onlab_mininet_image:
+ type: tosca.nodes.HpcHealthCheck
+ requirements:
+ - hpc_service:
+ node: HyperCache
+ relationship: tosca.relationships.MemberOfService
+ properties:
+ kind: http
+ resource_name: onlab.vicci.org:/mininet-vm/mininet-2.1.0-130919-ubuntu-13.04-server-amd64-ovf.zip
diff --git a/xos/tosca/custom_types/cdn.m4 b/xos/tosca/custom_types/cdn.m4
index 59d4ee6..0d33715 100644
--- a/xos/tosca/custom_types/cdn.m4
+++ b/xos/tosca/custom_types/cdn.m4
@@ -33,6 +33,26 @@
user:
type: tosca.capabilities.xos.CDNPrefix
+ tosca.nodes.HpcHealthCheck:
+ derived_from: tosca.nodes.Root
+
+ properties:
+ kind:
+ type: string
+ required: true
+ description: dns | http | nameserver
+ resource_name:
+ type: string
+ required: true
+ description: name of resource to query
+ result_contains:
+ type: string
+ required: false
+ description: soemthing to look for inside the result
+ capabilities:
+ healthcheck:
+ type: tosca.capabilities.xos.HpcHealthCheck
+
tosca.relationships.MemberOfServiceProvider:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.ServiceProvider ]
@@ -57,4 +77,7 @@
tosca.capabilities.xos.OriginServer:
derived_from: tosca.capabilities.Root
+ tosca.capabilities.xos.HpcHealthCheck:
+ derived_from: tosca.capabilities.Root
+
diff --git a/xos/tosca/custom_types/cdn.yaml b/xos/tosca/custom_types/cdn.yaml
index 59d4ee6..0d33715 100644
--- a/xos/tosca/custom_types/cdn.yaml
+++ b/xos/tosca/custom_types/cdn.yaml
@@ -33,6 +33,26 @@
user:
type: tosca.capabilities.xos.CDNPrefix
+ tosca.nodes.HpcHealthCheck:
+ derived_from: tosca.nodes.Root
+
+ properties:
+ kind:
+ type: string
+ required: true
+ description: dns | http | nameserver
+ resource_name:
+ type: string
+ required: true
+ description: name of resource to query
+ result_contains:
+ type: string
+ required: false
+ description: soemthing to look for inside the result
+ capabilities:
+ healthcheck:
+ type: tosca.capabilities.xos.HpcHealthCheck
+
tosca.relationships.MemberOfServiceProvider:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.ServiceProvider ]
@@ -57,4 +77,7 @@
tosca.capabilities.xos.OriginServer:
derived_from: tosca.capabilities.Root
+ tosca.capabilities.xos.HpcHealthCheck:
+ derived_from: tosca.capabilities.Root
+
diff --git a/xos/tosca/resources/hpchealthcheck.py b/xos/tosca/resources/hpchealthcheck.py
new file mode 100644
index 0000000..93a0912
--- /dev/null
+++ b/xos/tosca/resources/hpchealthcheck.py
@@ -0,0 +1,39 @@
+import importlib
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+import pdb
+
+from services.hpc.models import HpcHealthCheck, HpcService
+
+from xosresource import XOSResource
+
+class XOSHpcHealthCheck(XOSResource):
+ provides = "tosca.nodes.HpcHealthCheck"
+ xos_model = HpcHealthCheck
+ name_field = None
+ copyin_props = ("kind", "resource_name", "result_contains")
+
+ def get_xos_args(self, throw_exception=True):
+ args = super(XOSHpcHealthCheck, self).get_xos_args()
+
+ service_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
+ if service_name:
+ args["hpcService"] = self.get_xos_object(HpcService, throw_exception=throw_exception, name=service_name)
+
+ return args
+
+ def get_existing_objs(self):
+ args = self.get_xos_args(throw_exception=True)
+
+ return list( HpcHealthCheck.objects.filter(hpcService=args["hpcService"], kind=args["kind"], resource_name=args["resource_name"]) )
+
+ def postprocess(self, obj):
+ pass
+
+ def can_delete(self, obj):
+ return super(XOSTenant, self).can_delete(obj)
+