resources for the new services
diff --git a/xos/tosca/resources/cdnservice.py b/xos/tosca/resources/cdnservice.py
new file mode 100644
index 0000000..4dbc561
--- /dev/null
+++ b/xos/tosca/resources/cdnservice.py
@@ -0,0 +1,16 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from hpc.models import HpcService
+
+from service import XOSService
+
+class XOSCdnService(XOSService):
+ provides = "tosca.nodes.CDNService"
+ xos_model = HpcService
+ copyin_props = ["view_url", "icon_url"]
+
diff --git a/xos/tosca/resources/service.py b/xos/tosca/resources/service.py
index 12b0464..c331789 100644
--- a/xos/tosca/resources/service.py
+++ b/xos/tosca/resources/service.py
@@ -12,9 +12,7 @@
class XOSService(XOSResource):
provides = "tosca.nodes.Service"
xos_model = Service
-
- def get_xos_args(self):
- return {"name": self.nodetemplate.name}
+ copyin_props = ["view_url"]
def postprocess(self, obj):
for provider_service_name in self.get_requirements("tosca.relationships.TenantOfService"):
@@ -30,21 +28,8 @@
self.info("Created Tenancy relationship from %s to %s" % (str(obj), str(provider_service)))
- def create(self):
- nodetemplate = self.nodetemplate
-
- xos_args = self.get_xos_args()
- service = Service(**xos_args)
- service.caller = self.user
- service.save()
-
- self.postprocess(service)
-
- self.info("Created Service '%s'" % (str(service), ))
-
- def delete(self, obj):
+ def pre_delete(self, obj):
if obj.slices.exists():
self.info("Service %s has active slices; skipping delete" % obj.name)
return
- obj.delete()
diff --git a/xos/tosca/resources/vbngservice.py b/xos/tosca/resources/vbngservice.py
new file mode 100644
index 0000000..70f47aa
--- /dev/null
+++ b/xos/tosca/resources/vbngservice.py
@@ -0,0 +1,16 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from cord.models import VBNGService
+
+from service import XOSService
+
+class XOSVBGNService(XOSService):
+ provides = "tosca.nodes.VBNGService"
+ xos_model = VBNGService
+ copyin_props = ["view_url", "icon_url", "vnbg_url"]
+
diff --git a/xos/tosca/resources/vcpeservice.py b/xos/tosca/resources/vcpeservice.py
new file mode 100644
index 0000000..a2247c6
--- /dev/null
+++ b/xos/tosca/resources/vcpeservice.py
@@ -0,0 +1,16 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from cord.models import VCPEService
+
+from service import XOSService
+
+class XOSVcpeService(XOSService):
+ provides = "tosca.nodes.VCPEService"
+ xos_model = VCPEService
+ copyin_props = ["view_url", "icon_url", "backend_network_label"]
+