deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 5/7] CIMI: Fixes NetworkTemplates
Date Fri, 14 Sep 2012 15:42:18 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/cimi/collections/network_templates.rb              |  2 +-
 server/lib/cimi/models/network_template.rb                    |  2 +-
 server/lib/cimi/models/network_template_collection.rb         | 11 +++++++----
 .../drivers/mock/data/cimi/network_template/template1.json    |  2 +-
 .../drivers/mock/data/cimi/network_template/template2.json    |  2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/server/lib/cimi/collections/network_templates.rb b/server/lib/cimi/collections/network_templates.rb
index 05d86c2..9fff8ff 100644
--- a/server/lib/cimi/collections/network_templates.rb
+++ b/server/lib/cimi/collections/network_templates.rb
@@ -32,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show, :with_capability => :network_template do
+      operation :show, :with_capability => :network_templates do
         description 'Show a specific Network Template'
         control do
           network_template = NetworkTemplate.find(params[:id], self)
diff --git a/server/lib/cimi/models/network_template.rb b/server/lib/cimi/models/network_template.rb
index ce3b990..edb0837 100644
--- a/server/lib/cimi/models/network_template.rb
+++ b/server/lib/cimi/models/network_template.rb
@@ -17,7 +17,7 @@ class CIMI::Model::NetworkTemplate < CIMI::Model::Base
 
   href :network_config
 
-  href :routing_group
+  href :forwarding_group
 
   array :operations do
     scalar :rel, :href
diff --git a/server/lib/cimi/models/network_template_collection.rb b/server/lib/cimi/models/network_template_collection.rb
index b2ac537..adb3e7d 100644
--- a/server/lib/cimi/models/network_template_collection.rb
+++ b/server/lib/cimi/models/network_template_collection.rb
@@ -18,17 +18,20 @@ class CIMI::Model::NetworkTemplateCollection < CIMI::Model::Base
 
   act_as_root_entity :network_template
 
-  array :network_templates do
-    scalar :href
-  end
+  text :count
+
+  #add member array:
+  self << CIMI::Model::NetworkTemplate
 
   def self.default(context)
+    network_templates = CIMI::Model::NetworkTemplate.all(context)
     self.new(
       :id => context.network_templates_url,
       :name => 'default',
       :created => Time.now,
       :description => "#{context.driver.name.capitalize} NetworkTemplateCollection",
-      :network_templates => CIMI::Model::NetworkTemplate.all_uri(context)
+      :count => network_templates.size,
+      :network_templates => network_templates
     )
   end
 
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template1.json
b/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template1.json
index 682d39b..b6f6b0e 100644
--- a/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template1.json
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template1.json
@@ -3,7 +3,7 @@
   "description": "A mock network template",
   "created": "Thu Mar 15 12:15:15 EET 2012",
   "networkConfig": {"href": "http://cimi.example.org/network_configurations/network_config1"},
-  "routingGroup": {"href": "http://cimi.example.org/routing_groups/group1"},
+  "forwardingGroup": {"href": "http://cimi.example.org/forwarding_groups/group1"},
   "operations": [
     { "rel": "edit", "href": "http://cimi.example.org/network_templates/template1" },
     { "rel": "delete", "href": "http://cimi.example.org/network_templates/template1" }]
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template2.json
b/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template2.json
index b7222cc..2b4885a 100644
--- a/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template2.json
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template2.json
@@ -3,7 +3,7 @@
   "description": "Another mock network template",
   "created": "Thu Mar 15 13:51:12 EET 2012",
   "networkConfig": {"href": "http://cimi.example.org/network_configurations/network_config2"},
-  "routingGroup": {"href": "http://cimi.example.org/routing_groups/group1"},
+  "forwardingGroup": {"href": "http://cimi.example.org/forwarding_groups/group1"},
   "operations": [
     { "rel": "edit", "href": "http://cimi.example.org/network_templates/template2" },
     { "rel": "delete", "href": "http://cimi.example.org/network_templates/template2" }]
-- 
1.7.11.4


Mime
View raw message