add vPGWU services
Change-Id: Ide9597e59f124dc4b43f653c6cc301ff19464450
diff --git a/xos/tosca/resources/vpgwutenant.py b/xos/tosca/resources/vpgwutenant.py
new file mode 100644
index 0000000..06cbd42
--- /dev/null
+++ b/xos/tosca/resources/vpgwutenant.py
@@ -0,0 +1,31 @@
+from xosresource import XOSResource
+from core.models import Tenant, Service
+from services.vpgwu.models import VPGWUTenant
+
+class XOSVPGWUTenant(XOSResource):
+ provides = "tosca.nodes.VPGWUTenant"
+ xos_model = VPGWUTenant
+ name_field = None
+ copyin_props = ["s5s8_pgw_tag", "display_message", "image_name"]
+
+ def get_xos_args(self, throw_exception=True):
+ args = super(XOSVPGWUTenant, self).get_xos_args()
+
+ provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=True)
+ if provider_name:
+ args["provider_service"] = self.get_xos_object(Service, throw_exception=True, name=provider_name)
+
+ return args
+
+ def get_existing_objs(self):
+ args = self.get_xos_args(throw_exception=False)
+ provider_service = args.get("provider", None)
+ if provider_service:
+ return [self.get_xos_object(provider_service=provider_service)]
+ return []
+
+ def postprocess(self, obj):
+ pass
+
+ def can_delete(self, obj):
+ return super(XOSVPGWUTenant, self).can_delete(obj)