Adjusted modeling of Service, Slice and Tags. Added RequestRouter starter App. Modified Admin.py of core apps for new relationships. Modified the initial_data for new roles, and deprecated ForeignKey relationships.
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index b4c7cf6..ac12370 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -1,6 +1,9 @@
from .plcorebase import PlCoreBase
from .planetstack import PlanetStack
from .project import Project
+from .singletonmodel import SingletonModel
+from .service import Service
+from .service import ServiceAttribute
from .tag import Tag
from .role import Role
from .deployment import Deployment
diff --git a/planetstack/core/models/network.py b/planetstack/core/models/network.py
index 55711a4..72e7a5f 100644
--- a/planetstack/core/models/network.py
+++ b/planetstack/core/models/network.py
@@ -29,7 +29,7 @@
subnet = models.CharField(max_length=32, blank=True)
ports = models.CharField(max_length=1024, blank=True, null=True)
labels = models.CharField(max_length=1024, blank=True, null=True)
- owner = models.ForeignKey(Slice, related_name="ownedNetworks")
+ owner = models.ForeignKey(Slice, related_name="ownedNetworks", help_text="Slice that owns control of this Network")
guaranteedBandwidth = models.IntegerField(default=0)
permitAllSlices = models.BooleanField(default=False)
diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py
index 62bcb75..4a64ce5 100644
--- a/planetstack/core/models/plcorebase.py
+++ b/planetstack/core/models/plcorebase.py
@@ -38,13 +38,13 @@
def delete(self, *args, **kwds):
super(PlCoreBase, self).delete(*args, **kwds)
- EventSender().fire({'delete_flag':True,'model':self.__name__})
+# EventSender().fire({'delete_flag':True,'model':self.__name__})
def save(self, *args, **kwargs):
super(PlCoreBase, self).save(*args, **kwargs)
# Tell the observer that the source database has been updated
- EventSender().fire()
+ #EventSender().fire()
self.__initial = self._dict
diff --git a/planetstack/core/models/plservice.py b/planetstack/core/models/plservice.py
new file mode 100644
index 0000000..eb27d0f
--- /dev/null
+++ b/planetstack/core/models/plservice.py
@@ -0,0 +1,9 @@
+from core.models import PlCoreBase,SingletonModel
+from django.db import models
+
+class PlanetStackService(PlCoreBase):
+ description = models.TextField(max_length=254,null=True, blank=True,help_text="Description of Service")
+ enabled = models.BooleanField(default=True)
+ serviceName = models.CharField(max_length=30, help_text="Service Name")
+
+ def __unicode__(self): return u'%s' % (self.serviceName)
diff --git a/planetstack/core/models/singletonmodel.py b/planetstack/core/models/singletonmodel.py
new file mode 100644
index 0000000..4ab6f6e
--- /dev/null
+++ b/planetstack/core/models/singletonmodel.py
@@ -0,0 +1,16 @@
+from django.db import models
+
+class SingletonModel(models.Model):
+ class Meta:
+ abstract = True
+
+ def save(self, *args, **kwargs):
+ self.__class__.objects.exclude(id=self.id).delete()
+ super(SingletonModel, self).save(*args, **kwargs)
+
+ @classmethod
+ def load(cls):
+ try:
+ return cls.objects.get()
+ except cls.DoesNotExist:
+ return cls()
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index e584c07..51e05f5 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -8,6 +8,7 @@
from core.models import ServiceClass
from core.models import Tag
from django.contrib.contenttypes import generic
+from core.models import Service
# Create your models here.
@@ -22,6 +23,7 @@
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")
+ service = models.ForeignKey(Service, related_name='service', null=True, blank=True)
tags = generic.GenericRelation(Tag)
diff --git a/planetstack/core/models/tag.py b/planetstack/core/models/tag.py
index 7c957a1..cbe63a5 100644
--- a/planetstack/core/models/tag.py
+++ b/planetstack/core/models/tag.py
@@ -1,7 +1,7 @@
import os
from django.db import models
from core.models import PlCoreBase
-from core.models import Project
+from core.models import Service
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
@@ -9,7 +9,7 @@
class Tag(PlCoreBase):
- project = models.ForeignKey(Project, related_name='tags', help_text="The Project this Tag is associated with")
+ service = models.ForeignKey(Service, related_name='tags', help_text="The Service this Tag is associated with")
name = models.SlugField(help_text="The name of this tag", max_length=128)
value = models.CharField(help_text="The value of this tag", max_length=1024)