Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
authorScott Baker <smbaker@gmail.com>
Sat, 3 Jan 2015 20:29:43 +0000 (12:29 -0800)
committerScott Baker <smbaker@gmail.com>
Sat, 3 Jan 2015 20:29:43 +0000 (12:29 -0800)
planetstack/core/admin.py
planetstack/core/fixtures/initial_data.json
planetstack/core/migrations/0003_network_field_case.py [new file with mode: 0644]
planetstack/core/models/network.py

index d027a2e..769d83b 100644 (file)
@@ -1505,14 +1505,14 @@ class NetworkAdmin(PlanetStackBaseAdmin):
     form=NetworkForm
 
     fieldsets = [
-        (None, {'fields': ['backend_status_text', 'name','template','ports','labels','owner','guaranteedBandwidth', 'permitAllSlices','permittedSlices','network_id','router_id','subnet_id','subnet'],
+        (None, {'fields': ['backend_status_text', 'name','template','ports','labels','owner','guaranteed_bandwidth', 'permit_all_slices','permitted_slices','network_id','router_id','subnet_id','subnet'],
                 'classes':['suit-tab suit-tab-general']}),
-        (None, {'fields': ['topologyParameters', 'controllerUrl', 'controllerParameters'],
+        (None, {'fields': ['topology_parameters', 'controller_url', 'controller_parameters'],
                 'classes':['suit-tab suit-tab-sdn']}),
                 ]
 
     readonly_fields = ('backend_status_text', )
-    user_readonly_fields = ['name','template','ports','labels','owner','guaranteedBandwidth', 'permitAllSlices','permittedSlices','network_id','router_id','subnet_id','subnet']
+    user_readonly_fields = ['name','template','ports','labels','owner','guaranteed_bandwidth', 'permit_all_slices','permitted_slices','network_id','router_id','subnet_id','subnet']
 
     @property
     def suit_form_tabs(self):
index a6cef77..516f216 100644 (file)
         "created": "2013-12-09T14:15:16.899Z",
         "deleted": false,
         "description": "Connect a sliver to the public network using dedicated public IPv4 address",
-        "sharedNetworkName": "ext-net",
-        "guaranteedBandwidth": 0,
+        "shared_network_name": "ext-net",
+        "guaranteed_bandwidth": 0,
         "visibility": "public",
-        "sharedNetworkId": "",
+        "shared_network_id": "",
         "translation": "none",
         "backend_status": "Provisioning in progress",
         "enacted": "2014-05-21T15:36:30Z"
         "created": "2013-12-09T14:17:29.551Z",
         "deleted": false,
         "description": "Connect a sliver to the public network via NAT",
-        "sharedNetworkName": "nat-net",
-        "guaranteedBandwidth": 0,
+        "shared_network_name": "nat-net",
+        "guaranteed_bandwidth": 0,
         "visibility": "private",
-        "sharedNetworkId": "",
+        "shared_network_id": "",
         "translation": "NAT",
         "backend_status": "Provisioning in progress",
         "enacted": "2014-05-21T15:36:03Z"
         "created": "2013-12-09T14:18:02.336Z",
         "deleted": false,
         "description": "A private virtual network",
-        "sharedNetworkName": "",
-        "guaranteedBandwidth": 0,
+        "shared_network_name": "",
+        "guaranteed_bandwidth": 0,
         "visibility": "private",
-        "sharedNetworkId": "",
+        "shared_network_id": "",
         "translation": "none",
         "backend_status": "Provisioning in progress",
         "enacted": "2014-05-21T15:35:54Z"
         "created": "2014-06-03T07:15:01.403Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 3,
         "owner": 32,
         "backend_status": "Provisioning in progress",
         "created": "2014-06-03T07:15:33.377Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 32,
         "backend_status": "Provisioning in progress",
         "created": "2014-07-25T03:48:20.878Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [
+        "permitted_slices": [
             40
         ],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 40,
         "backend_status": "Provisioning in progress",
         "created": "2014-07-25T03:50:31.250Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [
+        "permitted_slices": [
             40
         ],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 3,
         "owner": 40,
         "backend_status": "Provisioning in progress",
         "created": "2014-07-25T03:51:22.976Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [
+        "permitted_slices": [
             40
         ],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 40,
         "backend_status": "Provisioning in progress",
         "created": "2014-07-25T03:51:25.979Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [
+        "permitted_slices": [
             40
         ],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 40,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-01T23:37:00.625Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 1,
         "owner": 31,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-01T23:37:47.334Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 31,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-02T16:43:45.571Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 3,
         "owner": 31,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-02T17:29:06.716Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 3,
         "owner": 45,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-02T17:29:38.618Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 45,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-04T17:24:54.199Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 1,
         "owner": 31,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-19T21:40:48.549Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 53,
         "backend_status": "Provisioning in progress",
         "created": "2014-08-19T21:41:26.950Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 3,
         "owner": 53,
         "backend_status": "Provisioning in progress",
         "created": "2014-09-30T19:56:42.970Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 76,
         "backend_status": "Provisioning in progress",
         "created": "2014-09-30T19:57:30.963Z",
         "deleted": false,
         "network_id": "",
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": "",
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 3,
         "owner": 76,
         "backend_status": "Provisioning in progress",
         "created": "2014-10-08T14:41:03.309Z",
         "deleted": false,
         "network_id": null,
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": null,
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 1,
         "owner": 40,
         "backend_status": "Provisioning in progress",
         "created": "2014-10-08T14:41:17.387Z",
         "deleted": false,
         "network_id": null,
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": null,
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 40,
         "backend_status": "Provisioning in progress",
         "created": "2014-10-09T16:41:54.752Z",
         "deleted": false,
         "network_id": null,
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": null,
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 1,
         "owner": 97,
         "backend_status": "Provisioning in progress",
         "created": "2014-10-09T16:42:09.773Z",
         "deleted": false,
         "network_id": null,
-        "permittedSlices": [],
+        "permitted_slices": [],
         "labels": null,
-        "guaranteedBandwidth": 0,
-        "permitAllSlices": false,
+        "guaranteed_bandwidth": 0,
+        "permit_all_slices": false,
         "template": 4,
         "owner": 97,
         "backend_status": "Provisioning in progress",
diff --git a/planetstack/core/migrations/0003_network_field_case.py b/planetstack/core/migrations/0003_network_field_case.py
new file mode 100644 (file)
index 0000000..d063363
--- /dev/null
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import timezones.fields
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('core', '0002_network_field_case'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='network',
+            old_name='controllerParameters',
+            new_name='controller_parameters',
+        ),
+        migrations.RenameField(
+            model_name='network',
+            old_name='controllerUrl',
+            new_name='controller_url',
+        ),
+        migrations.RenameField(
+            model_name='network',
+            old_name='guaranteedBandwidth',
+            new_name='guaranteed_bandwidth',
+        ),
+        migrations.RenameField(
+            model_name='network',
+            old_name='permitAllSlices',
+            new_name='permit_all_slices',
+        ),
+        migrations.RenameField(
+            model_name='network',
+            old_name='permittedSlices',
+            new_name='permitted_slices',
+        ),
+        migrations.RenameField(
+            model_name='network',
+            old_name='topologyParameters',
+            new_name='topology_parameters',
+        ),
+    ]
index eeacc1a..554bbf5 100644 (file)
@@ -103,15 +103,15 @@ class Network(PlCoreBase):
     labels = models.CharField(max_length=1024, blank=True, null=True)
     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)
-    permittedSlices = models.ManyToManyField(Slice, blank=True, related_name="availableNetworks")
+    guaranteed_bandwidth = models.IntegerField(default=0)
+    permit_all_slices = models.BooleanField(default=False)
+    permitted_slices = models.ManyToManyField(Slice, blank=True, related_name="availableNetworks")
     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)
+    topology_parameters = models.TextField(null=True, blank=True)
+    controller_url = models.CharField(null=True, blank=True, max_length=1024)
+    controller_parameters = models.TextField(null=True, blank=True)
 
     # for observer/manager
     network_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
@@ -177,7 +177,7 @@ class NetworkSlice(PlCoreBase):
 
     def save(self, *args, **kwds):
         slice = self.slice
-        if (slice not in self.network.permittedSlices.all()) and (slice != self.network.owner) and (not self.network.permitAllSlices):
+        if (slice not in self.network.permitted_slices.all()) and (slice != self.network.owner) and (not self.network.permitAllSlices):
             # to add a sliver to the network, then one of the following must be true:
             #   1) sliver's slice is in network's permittedSlices list,
             #   2) sliver's slice is network's owner, or
@@ -208,7 +208,7 @@ class NetworkSliver(PlCoreBase):
 
     def save(self, *args, **kwds):
         slice = self.sliver.slice
-        if (slice not in self.network.permittedSlices.all()) and (slice != self.network.owner) and (not self.network.permitAllSlices):
+        if (slice not in self.network.permitted_slices.all()) and (slice != self.network.owner) and (not self.network.permitAllSlices):
             # to add a sliver to the network, then one of the following must be true:
             #   1) sliver's slice is in network's permittedSlices list,
             #   2) sliver's slice is network's owner, or