add controllerUrl to network object
[plstackapi.git] / planetstack / core / models / network.py
index ee239a7..0b3400a 100644 (file)
@@ -65,6 +65,8 @@ def ValidateNatList(ports):
 class NetworkTemplate(PlCoreBase):
     VISIBILITY_CHOICES = (('public', 'public'), ('private', 'private'))
     TRANSLATION_CHOICES = (('none', 'none'), ('NAT', 'NAT'))
+    TOPOLOGY_CHOICES = (('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))
+    CONTROLLER_CHOICES = ((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))
 
     name = models.CharField(max_length=32)
     description = models.CharField(max_length=1024, blank=True, null=True)
@@ -73,6 +75,8 @@ class NetworkTemplate(PlCoreBase):
     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")
+    topologyKind = models.CharField(null=False, blank=False, max_length=30, choices=TOPOLOGY_CHOICES, default="BigSwitch")
+    controllerKind = models.CharField(null=True, blank=True, max_length=30, choices=CONTROLLER_CHOICES, default=None)
 
     def __unicode__(self):  return u'%s' % (self.name)
 
@@ -90,6 +94,10 @@ class Network(PlCoreBase):
     slices = models.ManyToManyField(Slice, blank=True, related_name="networks", through="NetworkSlice")
     slivers = models.ManyToManyField(Sliver, blank=True, related_name="networks", through="NetworkSliver")
 
+    topologyParameters = models.TextField(null=True, blank=True)
+    controllerUrl = models.CharField(null=True, blank=True, max_length=1024)
+    controllerParameters = models.TextField(null=True, blank=True)
+
     # for observer/manager
     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")
@@ -125,8 +133,8 @@ class NetworkDeployments(PlCoreBase):
     deleted_objects = DeploymentLinkDeletionManager()
 
     # Stores the openstack ids at various deployments
-    network = models.ForeignKey(Network)
-    deployment = models.ForeignKey(Deployment)
+    network = models.ForeignKey(Network, related_name='networkdeployments')
+    deployment = models.ForeignKey(Deployment, related_name='networkdeployments')
     net_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")
@@ -149,8 +157,8 @@ class NetworkSlice(PlCoreBase):
     # This object exists solely so we can implement the permission check when
     # adding slices to networks. It adds no additional fields to the relation.
 
-    network = models.ForeignKey(Network)
-    slice = models.ForeignKey(Slice)
+    network = models.ForeignKey(Network,related_name='networkslices')
+    slice = models.ForeignKey(Slice,related_name='networkslices')
 
     def save(self, *args, **kwds):
         slice = self.slice
@@ -178,8 +186,8 @@ class NetworkSlice(PlCoreBase):
         return qs
 
 class NetworkSliver(PlCoreBase):
-    network = models.ForeignKey(Network)
-    sliver = models.ForeignKey(Sliver)
+    network = models.ForeignKey(Network,related_name='networkslivers')
+    sliver = models.ForeignKey(Sliver,related_name='networkslivers')
     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")
 
@@ -227,7 +235,7 @@ class NetworkParameterType(PlCoreBase):
     def __unicode__(self):  return u'%s' % (self.name)
 
 class NetworkParameter(PlCoreBase):
-    parameter = models.ForeignKey(NetworkParameterType, related_name="parameters", help_text="The type of the parameter")
+    parameter = models.ForeignKey(NetworkParameterType, related_name="networkparameters", help_text="The type of the parameter")
     value = models.CharField(help_text="The value of this parameter", max_length=1024)
 
     # The required fields to do a ObjectType lookup, and object_id assignment