refactor vSGW cord-3.0
Change-Id: I72a19da1803d8e9dd9d7c9e848011aa28ef4d619
diff --git a/xos/tosca/custom_types/vsgw.m4 b/xos/tosca/custom_types/vsgw.m4
index 1ff75dd..45c35e4 100644
--- a/xos/tosca/custom_types/vsgw.m4
+++ b/xos/tosca/custom_types/vsgw.m4
@@ -15,9 +15,6 @@
properties:
xos_base_props
xos_base_service_props
- service_message:
- type: string
- required: false
tosca.nodes.VSGWTenant:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/custom_types/vsgw.yaml b/xos/tosca/custom_types/vsgw.yaml
index 5d6cb16..c4da998 100644
--- a/xos/tosca/custom_types/vsgw.yaml
+++ b/xos/tosca/custom_types/vsgw.yaml
@@ -78,9 +78,6 @@
type: string
required: false
description: Version number of Service.
- service_message:
- type: string
- required: false
tosca.nodes.VSGWTenant:
derived_from: tosca.nodes.Root
diff --git a/xos/tosca/resources/vsgwservice.py b/xos/tosca/resources/vsgwservice.py
index c3a9414..3826425 100644
--- a/xos/tosca/resources/vsgwservice.py
+++ b/xos/tosca/resources/vsgwservice.py
@@ -1,30 +1,9 @@
# from services.vsgw.models import VSGWService
-from xosresource import XOSResource
-from synchronizers.new_base.modelaccessor import *
from service import XOSService
+from services.vsgw.models import VSGWService
-class XOSVSGWService(XOSResource):
+class XOSVSGWService(XOSService):
provides = "tosca.nodes.VSGWService"
xos_model = VSGWService
- 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"):
- provider_service = self.get_xos_object(VSGWService, name=provider_service_name)
-
- existing_tenancy = CoarseTenant.get_tenant_objects().filter(provider_service = provider_service, subscriber_service = obj)
- if existing_tenancy:
- self.info("Tenancy relationship from %s to %s already exists" % (str(obj), str(provider_service)))
- else:
- tenancy = CoarseTenant(provider_service = provider_service,
- subscriber_service = obj)
- tenancy.save()
-
- self.info("Created Tenancy relationship from %s to %s" % (str(obj), str(provider_service)))
-
- def can_delete(self, obj):
- if obj.slices.exists():
- self.info("Service %s has active slices; skipping delete" % obj.name)
- return False
- return super(XOSVSGWService, self).can_delete(obj)
+ copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "private_key_fn", "versionNumber"]
diff --git a/xos/tosca/resources/vsgwtenant.py b/xos/tosca/resources/vsgwtenant.py
index 48984fe..5f6c3bb 100644
--- a/xos/tosca/resources/vsgwtenant.py
+++ b/xos/tosca/resources/vsgwtenant.py
@@ -1,20 +1,20 @@
-# from services.vsgw.models import *
-from synchronizers.new_base.modelaccessor import *
from xosresource import XOSResource
+from core.models import Service, Tenant
+from services.vsgw.models import VSGWTenant
class XOSVSGWTenant(XOSResource):
provides = "tosca.nodes.VSGWTenant"
xos_model = VSGWTenant
name_field = "service_specific_id"
- copyin_props = ("tenant_message", "image_name")
+ copyin_props = ("tenant_message",)
def get_xos_args(self, throw_exception=True):
args = super(XOSVSGWTenant, self).get_xos_args()
# ExampleTenant must always have a provider_service
- provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
+ provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=throw_exception)
if provider_name:
- args["provider_service"] = self.get_xos_object(VSGWService, throw_exception=throw_exception, name=provider_name)
+ args["provider_service"] = self.get_xos_object(Service, throw_exception=throw_exception, name=provider_name)
return args