import os
import socket
from django.db import models
-from core.models import PlCoreBase, Site, Slice, Sliver
+from core.models import PlCoreBase, Site, Slice, Sliver, Deployment
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class NetworkTemplate(PlCoreBase):
VISIBILITY_CHOICES = (('public', 'public'), ('private', 'private'))
+ TRANSLATION_CHOICES = (('none', 'none'), ('NAT', 'NAT'))
name = models.CharField(max_length=32)
description = models.CharField(max_length=1024, blank=True, null=True)
guaranteedBandwidth = models.IntegerField(default=0)
visibility = models.CharField(max_length=30, choices=VISIBILITY_CHOICES, default="private")
+ translation = models.CharField(max_length=30, choices=TRANSLATION_CHOICES, default="none")
+ sharedNetworkName = models.CharField(max_length=30, blank=True, null=True)
+ sharedNetworkId = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
def __unicode__(self): return u'%s' % (self.name)
class Network(PlCoreBase):
name = models.CharField(max_length=32)
template = models.ForeignKey(NetworkTemplate)
+ deployment = models.ForeignKey(Deployment, related_name="networks", help_text="Deployment this Network belongs to")
+ site = models.ForeignKey(Site, blank=True, null=True, default=None, related_name="networks", help_text="Is this an infrastructure Network at a single Site?")
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)
network = models.ForeignKey(Network)
sliver = models.ForeignKey(Sliver)
ip = models.GenericIPAddressField(help_text="Sliver ip address", blank=True, null=True)
+ port_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum port id")
def save(self, *args, **kwds):
slice = self.sliver.slice