From 98d163fa76a3bf34f5f499c7024dc699c25795f3 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Sat, 3 Jan 2015 12:29:29 -0800 Subject: [PATCH] update code to use renamed network fields --- planetstack/core/admin.py | 6 +- planetstack/core/fixtures/initial_data.json | 120 ++++++++++---------- planetstack/core/models/network.py | 16 +-- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py index d027a2e..769d83b 100644 --- a/planetstack/core/admin.py +++ b/planetstack/core/admin.py @@ -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): diff --git a/planetstack/core/fixtures/initial_data.json b/planetstack/core/fixtures/initial_data.json index 6f0a976..516f216 100644 --- a/planetstack/core/fixtures/initial_data.json +++ b/planetstack/core/fixtures/initial_data.json @@ -2985,10 +2985,10 @@ "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", @@ -3008,10 +3008,10 @@ "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", @@ -3031,12 +3031,12 @@ "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", @@ -3056,12 +3056,12 @@ "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", @@ -3081,12 +3081,12 @@ "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", @@ -3106,12 +3106,12 @@ "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", @@ -3131,10 +3131,10 @@ "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", @@ -3154,10 +3154,10 @@ "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", @@ -3177,10 +3177,10 @@ "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", @@ -3200,10 +3200,10 @@ "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", @@ -3223,10 +3223,10 @@ "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", @@ -3246,10 +3246,10 @@ "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", @@ -3269,10 +3269,10 @@ "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", @@ -3292,10 +3292,10 @@ "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", @@ -3315,10 +3315,10 @@ "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", @@ -3338,10 +3338,10 @@ "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", @@ -3361,10 +3361,10 @@ "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", @@ -3384,10 +3384,10 @@ "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", @@ -3407,10 +3407,10 @@ "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", @@ -3430,10 +3430,10 @@ "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/models/network.py b/planetstack/core/models/network.py index eeacc1a..554bbf5 100644 --- a/planetstack/core/models/network.py +++ b/planetstack/core/models/network.py @@ -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 -- 2.43.0