epc-as-a-service functionality added
Change-Id: I4cb79a3305ead02391f9c31faa0225d549618b78
diff --git a/xos/models.py b/xos/models.py
index 3c8ef23..d6fcdcd 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -15,13 +15,16 @@
import traceback
from xos.exceptions import *
from xos.config import Config
-from django.contrib.contenttypes.models import ContentType
-from django.contrib.contenttypes.fields import GenericForeignKey
class VSGWUService(VSGWUService_decl):
class Meta:
proxy = True
+ def create_tenant(self, **kwargs):
+ t = VSGWUTenant(kind="vEPC", provider_service=self, connect_method="na", **kwargs)
+ t.save()
+ return t
+
class VSGWUTenant(VSGWUTenant_decl):
class Meta:
proxy = True
@@ -34,6 +37,13 @@
super(VSGWUTenant, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
+ if not self.creator:
+ if not getattr(self, "caller", None):
+ raise XOSProgrammingError("VSGWUTenant's self.caller was not set")
+ self.creator = self.caller
+ if not self.creator:
+ raise XOSProgrammingError("VSGWUTenant's self.creator was not set")
+
super(VSGWUTenant, self).save(*args, **kwargs)
# This call needs to happen so that an instance is created for this
# tenant is created in the slice. One instance is created per tenant.