update to make use of renamed NetworkTemplate fields
authorScott Baker <smbaker@gmail.com>
Sat, 3 Jan 2015 20:03:38 +0000 (12:03 -0800)
committerScott Baker <smbaker@gmail.com>
Sat, 3 Jan 2015 20:03:38 +0000 (12:03 -0800)
planetstack/core/admin.py
planetstack/core/models/network.py
planetstack/core/xoslib/static/js/xoslib/xos-backbone.js
planetstack/core/xoslib/static/js/xoslib/xos-defaults.js
planetstack/core/xoslib/static/js/xoslib/xos-validators.js
planetstack/openstack/manager.py
planetstack/openstack_observer/steps/sync_network_slivers.py
planetstack/openstack_observer/steps/sync_slivers.py

index 8580177..d027a2e 100644 (file)
@@ -1532,12 +1532,12 @@ class NetworkAdmin(PlanetStackBaseAdmin):
 
 
 class NetworkTemplateAdmin(PlanetStackBaseAdmin):
-    list_display = ("backend_status_icon", "name", "guaranteedBandwidth", "visibility")
+    list_display = ("backend_status_icon", "name", "guaranteed_bandwidth", "visibility")
     list_display_links = ('backend_status_icon', 'name', )
-    user_readonly_fields = ["name", "guaranteedBandwidth", "visibility"]
+    user_readonly_fields = ["name", "guaranteed_bandwidth", "visibility"]
     user_readonly_inlines = []
     fieldsets = [
-        (None, {'fields': ['name', 'description', 'guaranteedBandwidth', 'visibility', 'translation', 'sharedNetworkName', 'sharedNetworkId', 'topologyKind', 'controllerKind'],
+        (None, {'fields': ['name', 'description', 'guaranteed_bandwidth', 'visibility', 'translation', 'shared_network_name', 'shared_network_id', 'topology_kind', 'controller_kind'],
                 'classes':['suit-tab suit-tab-general']}),]
     suit_form_tabs = (('general','Network Template Details'), )
 
index e09cb9d..eeacc1a 100644 (file)
@@ -70,28 +70,28 @@ class NetworkTemplate(PlCoreBase):
 
     name = models.CharField(max_length=32)
     description = models.CharField(max_length=1024, blank=True, null=True)
-    guaranteedBandwidth = models.IntegerField(default=0)
+    guaranteed_bandwidth = 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")
-    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)
+    shared_network_name = models.CharField(max_length=30, blank=True, null=True)
+    shared_network_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum network")
+    topology_kind = models.CharField(null=False, blank=False, max_length=30, choices=TOPOLOGY_CHOICES, default="BigSwitch")
+    controller_kind = models.CharField(null=True, blank=True, max_length=30, choices=CONTROLLER_CHOICES, default=None)
 
     def __init__(self, *args, **kwargs):
         super(NetworkTemplate, self).__init__(*args, **kwargs)
 
         # somehow these got set wrong inside of the live database. Remove this
         # code after all is well...
-        if (self.topologyKind=="BigSwitch"):
-            print "XXX warning: topologyKind invalid case"
-            self.topologyKind="bigswitch"
-        elif (self.topologyKind=="Physical"):
-            print "XXX warning: topologyKind invalid case"
-            self.topologyKind="physical"
-        elif (self.topologyKind=="Custom"):
-            print "XXX warning: topologyKind invalid case"
-            self.toplogyKind="custom"
+        if (self.topology_kind=="BigSwitch"):
+            print "XXX warning: topology_kind invalid case"
+            self.topology_kind="bigswitch"
+        elif (self.topology_kind=="Physical"):
+            print "XXX warning: topology_kind invalid case"
+            self.topology_kind="physical"
+        elif (self.topology_kind=="Custom"):
+            print "XXX warning: topology_kind invalid case"
+            self.toplogy_kind="custom"
 
     def __unicode__(self):  return u'%s' % (self.name)
 
index d59d538..952dfb4 100644 (file)
@@ -500,6 +500,7 @@ if (! window.XOSLIB_LOADED ) {
                             });
 
         define_model(this, {urlRoot: SITEDEPLOYMENT_API,
+                            relatedCollections: {"controllerSiteDeployments": "site_deployment"},
                             foreignCollections: ["sites", "deployments", "controllers"],
                             foreignFields: {"site": "sites", "deployment": "deployments", "controller": "controllers"},
                             modelName: "siteDeployment",
@@ -535,8 +536,8 @@ if (! window.XOSLIB_LOADED ) {
 
         define_model(this, {urlRoot: NETWORKTEMPLATE_API,
                             modelName: "networkTemplate",
-                            listFields: ["backend_status", "id", "name", "visibility", "translation", "sharedNetworkName", "sharedNetworkId"],
-                            detailFields: ["backend_status", "name", "description", "visibility", "translation", "sharedNetworkName", "sharedNetworkId"],
+                            listFields: ["backend_status", "id", "name", "visibility", "translation", "shared_network_name", "shared_network_id"],
+                            detailFields: ["backend_status", "name", "description", "visibility", "translation", "shared_network_name", "shared_network_id"],
                             });
 
         define_model(this, {urlRoot: NETWORK_API,
index 314d3be..b536eaf 100644 (file)
@@ -15,7 +15,7 @@ function xos_get_defaults() {
   this.networkParameterType = {"updated": null, "description": "", "created": null, "deleted": false, "enacted": null, "backend_status": "Provisioning in progress", "name": ""};
   this.networkSlice = {"updated": null, "slice": null, "network": null, "created": null, "deleted": false, "backend_status": "Provisioning in progress", "enacted": null};
   this.networkSliver = {"updated": null, "network": null, "created": null, "deleted": false, "ip": null, "enacted": null, "backend_status": "Provisioning in progress", "port_id": null, "sliver": null};
-  this.networkTemplate = {"enacted": null, "updated": null, "backend_status": "Provisioning in progress", "description": null, "created": null, "deleted": false, "sharedNetworkName": null, "guaranteedBandwidth": 0, "visibility": "private", "translation": "none", "sharedNetworkId": null, "name": ""};
+  this.networkTemplate = {"enacted": null, "updated": null, "backend_status": "Provisioning in progress", "description": null, "created": null, "deleted": false, "shared_network_name": null, "guaranteed_bandwidth": 0, "visibility": "private", "translation": "none", "shared_network_id": null, "name": ""};
   this.node = {"updated": null, "name": "", "created": null, "deleted": false, "site": null, "deployment": null, "backend_status": "Provisioning in progress", "enacted": null};
   this.payment = {"updated": null, "created": null, "deleted": false, "account": null, "amount": 0.0, "date": "2014-11-12T01:19:50.077Z", "backend_status": "Provisioning in progress", "enacted": null};
   this.planetStack = {"updated": null, "description": "PlanetStack", "created": null, "deleted": false, "backend_status": "Provisioning in progress", "enacted": null};
index 8865ce6..9af6ba7 100644 (file)
@@ -15,7 +15,7 @@ function xos_get_validators() {
   this.networkParameterType = {"updated": [], "name": ["notBlank"], "created": [], "deleted": [], "description": ["notBlank"], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
   this.networkSlice = {"updated": [], "slice": ["notBlank"], "network": ["notBlank"], "created": [], "deleted": [], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
   this.networkSliver = {"updated": [], "network": ["notBlank"], "created": [], "deleted": [], "ip": [], "sliver": ["notBlank"], "backend_status": ["notBlank"], "port_id": [], "id": [], "enacted": ["notBlank"]};
-  this.networkTemplate = {"controllerKind": [], "updated": [], "name": ["notBlank"], "created": [], "deleted": [], "description": [], "sharedNetworkName": [], "guaranteedBandwidth": ["notBlank"], "visibility": ["notBlank"], "topologyKind": ["notBlank"], "sharedNetworkId": [], "translation": ["notBlank"], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
+  this.networkTemplate = {"controller_kind": [], "updated": [], "name": ["notBlank"], "created": [], "deleted": [], "description": [], "shared_network_name": [], "guaranteed_bandwidth": ["notBlank"], "visibility": ["notBlank"], "topology_kind": ["notBlank"], "shared_network_id": [], "translation": ["notBlank"], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
   this.node = {"updated": [], "name": ["notBlank"], "created": [], "deleted": [], "site": ["notBlank"], "deployment": ["notBlank"], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
   this.payment = {"updated": [], "created": [], "deleted": [], "account": ["notBlank"], "amount": ["notBlank"], "date": ["notBlank"], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
   this.planetStack = {"updated": [], "description": ["notBlank"], "created": [], "deleted": [], "backend_status": ["notBlank"], "id": [], "enacted": ["notBlank"]};
index 9ede33f..c1647e8 100644 (file)
@@ -423,8 +423,8 @@ class OpenStackManager:
     @require_enabled
     def save_network(self, network):
         if not network.network_id:
-            if network.template.sharedNetworkName:
-                network.network_id = network.template.sharedNetworkId
+            if network.template.shared_network_name:
+                network.network_id = network.template.shared_network_id
                 (network.subnet_id, network.subnet) = self.driver.get_network_subnet(network.network_id)
             else:
                 network_name = network.name
@@ -471,10 +471,10 @@ class OpenStackManager:
             self.driver.delete_network(network.network_id)
 
     def save_network_template(self, template):
-        if (template.sharedNetworkName) and (not template.sharedNetworkId):
-            os_networks = self.driver.shell.quantum.list_networks(name=template.sharedNetworkName)['networks']
+        if (template.shared_network_name) and (not template.shared_network_id):
+            os_networks = self.driver.shell.quantum.list_networks(name=template.shared_network_name)['networks']
             if os_networks:
-                template.sharedNetworkId = os_networks[0]["id"]
+                template.shared_network_id = os_networks[0]["id"]
 
         template.save()
         template.enacted = datetime.now()
@@ -505,8 +505,8 @@ class OpenStackManager:
 
     def refresh_network_templates(self):
         for template in NetworkTemplate.objects.all():
-            if (template.sharedNetworkName) and (not template.sharedNetworkId):
-                 # this will cause us to try to fill in the sharedNetworkId
+            if (template.shared_network_name) and (not template.shared_network_id):
+                 # this will cause us to try to fill in the shared_network_id
                  self.save_network_template(template)
 
     def refresh_networks(self):
index 22cfa82..16bc5a2 100644 (file)
@@ -85,7 +85,7 @@ class SyncNetworkSlivers(OpenStackSyncStep):
 
                 continue
 
-            if network.template.sharedNetworkName:
+            if network.template.shared_network_name:
                 # If it's a shared network template, then more than one network
                 # object maps to the quantum network. We have to do a whole bunch
                 # of extra work to find the right one.
index 6f61f53..6855785 100644 (file)
@@ -55,8 +55,8 @@ class SyncSlivers(OpenStackSyncStep):
                 nics.append(controller_network.net_id)
 
         # now include network template
-        network_templates = [network.template.sharedNetworkName for network in networks \
-                             if network.template.sharedNetworkName]
+        network_templates = [network.template.shared_network_name for network in networks \
+                             if network.template.shared_network_name]
 
         #driver = self.driver.client_driver(caller=sliver.creator, tenant=sliver.slice.name, controller=sliver.controllerNetwork)
         driver = self.driver.admin_driver(tenant='admin', controller=sliver.controllerNetwork)