deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [4/9] git commit: CIMI: adds RoutingGroupTemplate methods and mocking data to deltacloud mock driver
Date Tue, 20 Mar 2012 10:10:20 GMT
CIMI: adds RoutingGroupTemplate methods and mocking data to deltacloud mock driver


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

Branch: refs/heads/master
Commit: fdb125039478e234bda2a92c7f311800ed87e96f
Parents: b96375f
Author: marios <marios@redhat.com>
Authored: Fri Mar 16 16:50:06 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200

----------------------------------------------------------------------
 .../cimi/routing_group_template/template1.json     |   12 ++++++++++++
 .../drivers/mock/mock_driver_cimi_methods.rb       |   11 +++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fdb12503/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json
b/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json
new file mode 100644
index 0000000..adbe645
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json
@@ -0,0 +1,12 @@
+{ "id": "http://cimi.example.org/routing_group_templates/template1",
+  "name": "template1",
+  "description": "A mock routing group template",
+  "created": "Fri Mar 16 16:42:50 EET 2012",
+  "networks": [
+    { "href": "http://cimi.example.org/networks/network1"},
+    { "href": "http://cimi.example.org/networks/network2"}
+  ],
+  "operations": [
+    { "rel": "edit", "href": "http://cimi.example.org/routing_group_templates/template1"
},
+    { "rel": "delete", "href": "http://cimi.example.org/routing_group_templates/template1"
}]
+}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fdb12503/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index 1e7b3c2..c61e414 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -65,6 +65,17 @@ module Deltacloud::Drivers::Mock
       end
     end
 
+    def routing_group_templates(credentials, opts={})
+      check_credentials(credentials)
+      if opts[:id].nil?
+        routing_group_templates = @client.load_all_cimi(:routing_group_template).map{|rg_templ|
CIMI::Model::RoutingGroupTemplate.from_json(rg_templ)}
+        routing_group_templates.map{|rg_templ|convert_cimi_mock_urls(:routing_group_template,
rg_templ, opts[:env])}.flatten
+      else
+        routing_group_template = CIMI::Model::RoutingGroupTemplate.from_json(@client.load_cimi(:routing_group_template,
opts[:id]))
+        convert_cimi_mock_urls(:routing_group_template, routing_group_template, opts[:env])
+      end
+    end
+
     private
 
     def convert_cimi_mock_urls(model_name, cimi_object, context)


Mime
View raw message