2 from django.db import models
3 from core.models import PlCoreBase, Site, Slice
4 from django.contrib.contenttypes.models import ContentType
5 from django.contrib.contenttypes import generic
7 # Create your models here.
9 class Network(PlCoreBase):
10 name = models.CharField(max_length=32)
11 subnet = models.CharField(max_length=32)
12 ports = models.CharField(max_length=1024)
13 labels = models.CharField(max_length=1024)
14 slice = models.ForeignKey(Slice, related_name="networks")
15 guaranteedBandwidth = models.IntegerField()
16 permittedSlices = models.ManyToManyField(Slice, blank=True, related_name="permittedNetworks")
17 boundSlices = models.ManyToManyField(Slice, blank=True, related_name="boundNetworks")
19 def __unicode__(self): return u'%s' % (self.name)
21 class Router(PlCoreBase):
22 name = models.CharField(max_length=32)
23 networks = models.ManyToManyField(Network, blank=True, related_name="routers")
25 def __unicode__(self): return u'%s' % (self.name)
27 class NetworkParameterType(PlCoreBase):
28 name = models.SlugField(help_text="The name of this tag", max_length=128)
30 def __unicode__(self): return u'%s' % (self.name)
32 class NetworkParameter(PlCoreBase):
33 networkParameterType = models.ForeignKey(NetworkParameterType, related_name="parameters", help_text="The name of the parameter")
34 value = models.CharField(help_text="The value of this parameter", max_length=1024)
36 # The required fields to do a ObjectType lookup, and object_id assignment
37 content_type = models.ForeignKey(ContentType)
38 object_id = models.PositiveIntegerField()
39 content_object = generic.GenericForeignKey('content_type', 'object_id')
41 def __unicode__(self):
42 return self.tagType.name