Update models.py after service name changes
Change-Id: Ic8a71a458469f28d49ef30e5a13b25f386593ae4
diff --git a/xos/models.py b/xos/models.py
index 8bd0c46..a67b509 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -12,7 +12,7 @@
from operator import itemgetter, attrgetter, methodcaller
from core.models import Tag
from core.models.service import LeastLoadedNodeScheduler
-from services.vsgw.models import VSGWService, VSGWTenant
+from services.vsgwc.models import VSGWCService, VSGWCTenant
from services.vpgwc.models import VPGWCService, VPGWCTenant
from services.vhss.models import VHSSService, VHSSTenant
import traceback
@@ -34,26 +34,26 @@
if vmmeservices:
self._meta.get_field("provider_service").default = vmmeservices[0].id
super(VMMETenant, self).__init__(*args, **kwargs)
- self.cached_vsgw = None
+ self.cached_vsgwc = None
self.cached_vpgwc = None
self.cached_vhss = None
@property
- def vsgw(self):
- vsgw = self.get_newest_subscribed_tenant(VSGWTenant)
- if not vsgw:
+ def vsgwc(self):
+ vsgwc = self.get_newest_subscribed_tenant(VSGWCTenant)
+ if not vsgwc:
return None
- if (self.cached_vsgw) and (self.cached_vsgw.id == vsgw.id):
- return self.cached_vsgw
+ if (self.cached_vsgwc) and (self.cached_vsgwc.id == vsgwc.id):
+ return self.cached_vsgwc
- vsgw.caller = self.creator
- self.cached_vsgw = vsgw
- return vsgw
+ vsgwc.caller = self.creator
+ self.cached_vsgwc = vsgwc
+ return vsgwc
- @vsgw.setter
- def vsgw(self, value):
- raise XOSConfigurationError("VMMETenant.vsgw setter is not implemeneted")
+ @vsgwc.setter
+ def vsgwc(self, value):
+ raise XOSConfigurationError("VMMETenant.vsgwc setter is not implemeneted")
@property
def vpgwc(self):
@@ -90,11 +90,11 @@
raise XOSConfigurationError("VMMETenant.vhss setter is not implemeneted")
# This model breaks down if there are multiple service objects
- def get_vsgw_service(self):
- vsgwservices = VSGWService.get_service_objects().all()
- if not vsgwservices:
- raise XOSConfigurationError("No VSGW Services available")
- return vsgwservices[0]
+ def get_vsgwc_service(self):
+ vsgwcservices = VSGWCService.get_service_objects().all()
+ if not vsgwcservices:
+ raise XOSConfigurationError("No VSGWC Services available")
+ return vsgwcservices[0]
def get_vpgwc_service(self):
vpgwcservices = VPGWCService.get_service_objects().all()
@@ -108,13 +108,13 @@
raise XOSConfigurationError("No VHSS Services available")
return vhssservices[0]
- def manage_vsgw(self):
- # Each vMME object owns exactly one VSGWTenant object
+ def manage_vsgwc(self):
+ # Each vMME object owns exactly one VSGWCTenant object
if self.deleted:
return
- if self.vsgw is None:
- vsgw = self.get_vsgw_service().create_tenant(subscriber_tenant=self, creator=self.creator)
+ if self.vsgwc is None:
+ vsgwc = self.get_vsgwc_service().create_tenant(subscriber_tenant=self, creator=self.creator)
def manage_vpgwc(self):
# Each vMME object owns exactly one VPGWCTenant object
@@ -132,9 +132,9 @@
if self.vhss is None:
vhss = self.get_vhss_service().create_tenant(subscriber_tenant=self, creator=self.creator)
- def cleanup_vsgw(self):
- if self.vsgw:
- self.vsgw.delete()
+ def cleanup_vsgwc(self):
+ if self.vsgwc:
+ self.vsgwc.delete()
def cleanup_vpgwc(self):
if self.vpgwc:
@@ -145,14 +145,14 @@
self.vhss.delete()
def cleanup_orphans(self):
- # ensure vMME only has one vSGW, vPGWC, and vHSS
- cur_vsgw = self.vsgw
+ # ensure vMME only has one vSGWC, vPGWC, and vHSS
+ cur_vsgwc = self.vsgwc
cur_vpgwc = self.vpgwc
cur_vhss = self.vhss
- for vsgw in list(self.get_subscribed_tenants(VSGWTenant)):
- if (not cur_vsgw) or (vsgw.id != cur_vsgw.id):
- vsgw.delete()
+ for vsgwc in list(self.get_subscribed_tenants(VSGWCTenant)):
+ if (not cur_vsgwc) or (vsgwc.id != cur_vsgwc.id):
+ vsgwc.delete()
for vpgwc in list(self.get_subscribed_tenants(VPGWCTenant)):
if (not cur_vpgwc) or (vpgwc.id != cur_vpgwc.id):
@@ -175,7 +175,7 @@
def delete(self, *args, **kwargs):
# Delete the instance that was created for this tenant
- self.cleanup_vsgw()
+ self.cleanup_vsgwc()
self.cleanup_vpgwc()
self.cleanup_vhss()
self.cleanup_container()
@@ -191,7 +191,7 @@
# Since this code is atomic it is safe to always use the first tenant
tenant = tenant[0]
tenant.manage_container()
- tenant.manage_vsgw()
+ tenant.manage_vsgwc()
tenant.manage_vpgwc()
tenant.manage_vhss()
tenant.cleanup_orphans()