deltacloud-commits mailing list archives

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


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

Branch: refs/heads/master
Commit: 07ea4af958f21571ad6b70a1db581c61066750a5
Parents: ad720cc
Author: marios <marios@redhat.com>
Authored: Fri Mar 16 19:17:15 2012 +0200
Committer: marios <marios@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200

----------------------------------------------------------------------
 .../data/cimi/vsp_configuration/vspconfig1.json    |   14 ++++++++++++++
 .../data/cimi/vsp_configuration/vspconfig2.json    |   14 ++++++++++++++
 .../drivers/mock/mock_driver_cimi_methods.rb       |   11 +++++++++++
 3 files changed, 39 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/07ea4af9/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig1.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig1.json
b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig1.json
new file mode 100644
index 0000000..f43bd62
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig1.json
@@ -0,0 +1,14 @@
+{ "id": "http://cimi.example.org/vsp_configurations/vspconfig1",
+  "name": "vspconfig1",
+  "description": "a mock vsp configuration",
+  "created": "Fri Mar 16 18:39:41 EET 2012",
+  "bandwidthReservation": 0.5,
+  "trafficPriority": 1,
+  "maxTrafficDelay": 500000,
+  "maxTrafficLoss": 100,
+  "maxTrafficJitter": 100000,
+  "operations": [
+    { "rel": "edit", "href": "http://cimi.example.org/vsp_configurations/vspconfig1" },
+    { "rel": "delete", "href": "http://cimi.example.org/vsp_configurations/vspconfig1" }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/07ea4af9/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig2.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig2.json
b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig2.json
new file mode 100644
index 0000000..1910259
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_configuration/vspconfig2.json
@@ -0,0 +1,14 @@
+{ "id": "http://cimi.example.org/vsp_configurations/vspconfig2",
+  "name": "vspconfig2",
+  "description": "a mock vsp configuration",
+  "created": "Fri Mar 16 18:41:41 EET 2012",
+  "bandwidthReservation": 1,
+  "trafficPriority": 1,
+  "maxTrafficDelay": 500000,
+  "maxTrafficLoss": 100,
+  "maxTrafficJitter": 100000,
+  "operations": [
+    { "rel": "edit", "href": "http://cimi.example.org/vsp_configurations/vspconfig2" },
+    { "rel": "delete", "href": "http://cimi.example.org/vsp_configurations/vspconfig2" }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/07ea4af9/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 7d580ea..8718276 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -87,6 +87,17 @@ module Deltacloud::Drivers::Mock
       end
     end
 
+    def vsp_configurations(credentials, opts={})
+      check_credentials(credentials)
+      if opts[:id].nil?
+        vsp_configurations = @client.load_all_cimi(:vsp_configuration).map{|vsp_config| CIMI::Model::VSPConfiguration.from_json(vsp_config)}
+        vsp_configurations.map{|vsp_config|convert_cimi_mock_urls(:vsp_configuration, vsp_config,
opts[:env])}.flatten
+      else
+        vsp_configuration = CIMI::Model::VSPConfiguration.from_json(@client.load_cimi(:vsp_configuration,
opts[:id]))
+        convert_cimi_mock_urls(:vsp_configuration, vsp_configuration, opts[:env])
+      end
+    end
+
     private
 
     def convert_cimi_mock_urls(model_name, cimi_object, context)


Mime
View raw message