epc-as-a-service functionality added
Change-Id: I5666e03a92b309a16309f4cb832211cdd9e632b2
diff --git a/xos/models.py b/xos/models.py
index a119fce..215d71a 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 VMMService(VMMService_decl):
class Meta:
proxy = True
+ def create_tenant(self, **kwargs):
+ t = VMMTenant(kind="vEPC", provider_service=self, connect_method="na", **kwargs)
+ t.save()
+ return t
+
class VMMTenant(VMMTenant_decl):
class Meta:
proxy = True
@@ -34,6 +37,13 @@
super(VMMTenant, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
+ if not self.creator:
+ if not getattr(self, "caller", None):
+ raise XOSProgrammingError("VMMTenant's self.caller was not set")
+ self.creator = self.caller
+ if not self.creator:
+ raise XOSProgrammingError("VMMTenant's self.creator was not set")
+
super(VMMTenant, 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.