introduce Controller model
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index 6e1d163..8854a75 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -5,13 +5,13 @@
from core.models.site import SitePrivilege
from core.models import User
from core.models import Role
-from core.models import Deployment,DeploymentLinkManager,DeploymentLinkDeletionManager
+from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
from core.models import ServiceClass
from core.models.serviceclass import get_default_serviceclass
from core.models import Tag
from django.contrib.contenttypes import generic
from core.models import Service
-from core.models import Deployment
+from core.models import Controller
from django.core.exceptions import ValidationError
# Create your models here.
@@ -92,9 +92,9 @@
from core.models.network import Network
nets = Network.objects.filter(slices=self)
nets.delete()
- # delete slice deployments
- slice_deployments = SliceDeployments.objects.filter(slice=self)
- slice_deployments.delete()
+ # delete slice controllers
+ slice_controllers = ControllerSlices.objects.filter(slice=self)
+ slice_controllers.delete()
# delete slice privilege
slice_privileges = SlicePrivilege.objects.filter(slice=self)
slice_privileges.delete()
@@ -128,26 +128,23 @@
qs = SlicePrivilege.objects.filter(id__in=sp_ids)
return qs
-class SliceDeployments(PlCoreBase):
- objects = DeploymentLinkManager()
- deleted_objects = DeploymentLinkDeletionManager()
+class ControllerSlices(PlCoreBase):
+ objects = ControllerLinkManager()
+ deleted_objects = ControllerLinkDeletionManager()
- slice = models.ForeignKey(Slice, related_name='slicedeployments')
- deployment = models.ForeignKey(Deployment, related_name='slicedeployments')
+ controller = models.ForeignKey(Controller, related_name='controllerslices')
+ slice = models.ForeignKey(Slice, related_name='controllerslices')
tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")
- network_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
- router_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum router id")
- subnet_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum subnet id")
- def __unicode__(self): return u'%s %s' % (self.slice, self.deployment)
+ def __unicode__(self): return u'%s %s' % (self.slice, self.controller)
@staticmethod
def select_by_user(user):
if user.is_admin:
- qs = SliceDeployments.objects.all()
+ qs = ControllerSlices.objects.all()
else:
slices = Slice.select_by_user(user)
- qs = SliceDeployments.objects.filter(slice__in=slices)
+ qs = ControllerSlices.objects.filter(slice__in=slices)
return qs
def get_cpu_stats(self):