add VOLTTenant to tosca, relationships to connect VOLT to Subscriber, and update cord sample
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index fbc8f13..0a68c9d 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -49,7 +49,14 @@
kind:
type: string
default: generic
- subscriber_specific_id:
+ service_specific_id:
+ type: string
+ required: false)
+define(xos_base_tenant_props,
+ kind:
+ type: string
+ default: generic
+ service_specific_id:
type: string
required: false)
@@ -128,6 +135,11 @@
type: string
required: true
+ tosca.nodes.VOLTTenant:
+ derived_from: tosca.nodes.Root
+ properties:
+ xos_base_tenant_props
+
tosca.nodes.User:
derived_from: tosca.nodes.Root
@@ -427,6 +439,9 @@
tosca.relationships.SubscriberDevice:
derived_from: tosca.relationships.Root
+ tosca.relationships.BelongsToSubscriber:
+ derived_from: tosca.relationships.Root
+
tosca.capabilities.xos.Service:
derived_from: tosca.capabilities.Root
description: An XOS Service
diff --git a/xos/tosca/resources/CORDSubscriber.py b/xos/tosca/resources/CORDSubscriber.py
index ebd842b..45f5ee3 100644
--- a/xos/tosca/resources/CORDSubscriber.py
+++ b/xos/tosca/resources/CORDSubscriber.py
@@ -14,7 +14,7 @@
class XOSCORDSubscriber(XOSResource):
provides = "tosca.nodes.CORDSubscriber"
xos_model = CordSubscriberRoot
- copyin_props = ["subscriber_specific_id", "firewall_enable", "url_filter_enable", "cdn_enable", "url_filter_level"]
+ copyin_props = ["service_specific_id", "firewall_enable", "url_filter_enable", "cdn_enable", "url_filter_level"]
def postprocess(self, obj):
pass
diff --git a/xos/tosca/resources/VOLTTenant.py b/xos/tosca/resources/VOLTTenant.py
new file mode 100644
index 0000000..611bf23
--- /dev/null
+++ b/xos/tosca/resources/VOLTTenant.py
@@ -0,0 +1,46 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+import pdb
+
+from core.models import User
+from cord.models import VOLTTenant, VOLTService, CordSubscriberRoot
+
+from xosresource import XOSResource
+
+class XOSVOLTTenant(XOSResource):
+ provides = "tosca.nodes.VOLTTenant"
+ xos_model = VOLTTenant
+ copyin_props = ["service_specific_id"]
+ name_field = None
+
+ def get_xos_args(self, throw_exception=True):
+ args = super(XOSVOLTTenant, self).get_xos_args()
+
+ provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
+ if provider_name:
+ args["provider_service"] = self.get_xos_object(VOLTService, throw_exception=throw_exception, name=provider_name)
+
+ subscriber_name = self.get_requirement("tosca.relationships.BelongsToSubscriber")
+ if subscriber_name:
+ args["subscriber_root"] = self.get_xos_object(CordSubscriberRoot, throw_exception=throw_exception, name=subscriber_name)
+
+ return args
+
+ def get_existing_objs(self):
+ args = self.get_xos_args(throw_exception=False)
+ provider_service = args.get("provider", None)
+ service_specific_id = args.get("service_specific_id", None)
+ if (provider_service) and (service_specific_id):
+ return [ self.get_xos_object(provider_service=provider_service, service_specific_id=service_specific_id) ]
+ return []
+
+ def postprocess(self, obj):
+ pass
+
+ def can_delete(self, obj):
+ return super(XOSVOLTTenant, self).can_delete(obj)
+
diff --git a/xos/tosca/resources/subscriber.py b/xos/tosca/resources/subscriber.py
index f247caa..5ec0462 100644
--- a/xos/tosca/resources/subscriber.py
+++ b/xos/tosca/resources/subscriber.py
@@ -13,7 +13,7 @@
class XOSSubscriber(XOSResource):
provides = "tosca.nodes.Subscriber"
xos_model = Subscriber
- copyin_props = ["subscriber_specific_id"]
+ copyin_props = ["service_specific_id"]
def postprocess(self, obj):
pass
diff --git a/xos/tosca/samples/cord.yaml b/xos/tosca/samples/cord.yaml
index d1a2af5..eaa536a 100644
--- a/xos/tosca/samples/cord.yaml
+++ b/xos/tosca/samples/cord.yaml
@@ -75,6 +75,7 @@
My House:
type: tosca.nodes.CORDSubscriber
properties:
+ service_specific_id: 1234
firewall_enable: true
cdn_enable: true
url_filter_enable: true
@@ -120,3 +121,17 @@
node: My House
relationship: tosca.relationships.SubscriberDevice
+ My Volt:
+ type: tosca.nodes.VOLTTenant
+ properties:
+ service_specific_id: 1234
+ requirements:
+ - provider_service:
+ node: service_volt
+ relationship: tosca.relationships.MemberOfService
+ - subscriber:
+ node: My House
+ relationship: tosca.relationships.BelongsToSubscriber
+
+
+