You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/09/18 15:37:28 UTC

[6/7] git commit: CIMI: Fixes NetworkTemplates

CIMI: Fixes NetworkTemplates


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/42f564c1
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/42f564c1
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/42f564c1

Branch: refs/heads/master
Commit: 42f564c131a216d5e02aad46400ca16f704e951e
Parents: 2054a47
Author: marios <ma...@redhat.com>
Authored: Fri Sep 14 18:37:03 2012 +0300
Committer: marios <ma...@redhat.com>
Committed: Tue Sep 18 16:34:36 2012 +0300

----------------------------------------------------------------------
 server/lib/cimi/collections/network_templates.rb   |    2 +-
 server/lib/cimi/models/network_template.rb         |    2 +-
 .../lib/cimi/models/network_template_collection.rb |   11 +++++++----
 .../mock/data/cimi/network_template/template1.json |    2 +-
 .../mock/data/cimi/network_template/template2.json |    2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/42f564c1/server/lib/cimi/collections/network_templates.rb
----------------------------------------------------------------------
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)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/42f564c1/server/lib/cimi/models/network_template.rb
----------------------------------------------------------------------
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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/42f564c1/server/lib/cimi/models/network_template_collection.rb
----------------------------------------------------------------------
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
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/42f564c1/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template1.json
----------------------------------------------------------------------
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" }]

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/42f564c1/server/lib/deltacloud/drivers/mock/data/cimi/network_template/template2.json
----------------------------------------------------------------------
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" }]