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/03/20 11:10:20 UTC
[5/9] git commit: CIMI: adds VSP methods and mocking data to
deltacloud mock driver
CIMI: adds VSP 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/5418e6d9
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/5418e6d9
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/5418e6d9
Branch: refs/heads/master
Commit: 5418e6d91f5fe6ecffb0f0367e7181fe6ebe9055
Parents: b051ea1
Author: marios <ma...@redhat.com>
Authored: Fri Mar 16 18:50:58 2012 +0200
Committer: marios <ma...@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200
----------------------------------------------------------------------
.../drivers/mock/data/cimi/vsp/vsp1.json | 16 +++++++++++++
.../drivers/mock/data/cimi/vsp/vsp2.json | 16 +++++++++++++
.../drivers/mock/data/cimi/vsp/vsp3.json | 18 +++++++++++++++
.../drivers/mock/data/cimi/vsp/vsp4.json | 18 +++++++++++++++
.../drivers/mock/mock_driver_cimi_methods.rb | 11 +++++++++
5 files changed, 79 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5418e6d9/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp1.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp1.json b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp1.json
new file mode 100644
index 0000000..191ed4e
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp1.json
@@ -0,0 +1,16 @@
+{ "id": "http://cimi.example.org/vsps/vsp1",
+ "name": "vsp1",
+ "description": "a mock switchport",
+ "created": "Fri Mar 16 17:06:41 EET 2012",
+ "state": "STARTED",
+ "network": {"href": "http://cimi.example.org/networks/network1"},
+ "bandwidthReservation": 0.5,
+ "trafficPriority": 1,
+ "maxTrafficDelay": 500000,
+ "maxTrafficLoss": 100,
+ "maxTrafficJitter": 100000,
+ "operations": [
+ { "rel": "edit", "href": "http://cimi.example.org/vsps/vsp1" },
+ { "rel": "delete", "href": "http://cimi.example.org/vsps/vsp1" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5418e6d9/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp2.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp2.json b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp2.json
new file mode 100644
index 0000000..4173f0c
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp2.json
@@ -0,0 +1,16 @@
+{ "id": "http://cimi.example.org/vsps/vsp2",
+ "name": "vsp2",
+ "description": "a mock switchport",
+ "created": "Fri Mar 16 17:09:27 EET 2012",
+ "state": "STARTED",
+ "network": {"href": "http://cimi.example.org/networks/network1"},
+ "bandwidthReservation": 0.5,
+ "trafficPriority": 1,
+ "maxTrafficDelay": 500000,
+ "maxTrafficLoss": 100,
+ "maxTrafficJitter": 100000,
+ "operations": [
+ { "rel": "edit", "href": "http://cimi.example.org/vsps/vsp2" },
+ { "rel": "delete", "href": "http://cimi.example.org/vsps/vsp2" }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5418e6d9/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp3.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp3.json b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp3.json
new file mode 100644
index 0000000..b7f9cf5
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp3.json
@@ -0,0 +1,18 @@
+{ "id": "http://cimi.example.org/vsps/vsp3",
+ "name": "vsp3",
+ "description": "a mock switchport",
+ "created": "Fri Mar 16 17:10:36 EET 2012",
+ "state": "STARTED",
+ "network": {"href": "http://cimi.example.org/networks/network2"},
+ "bandwidthReservation": 1,
+ "trafficPriority": 1,
+ "maxTrafficDelay": 500000,
+ "maxTrafficLoss": 100,
+ "maxTrafficJitter": 100000,
+ "operations": [
+ { "rel": "edit", "href": "http://cimi.example.org/vsps/vsp3" },
+ { "rel": "delete", "href": "http://cimi.example.org/vsps/vsp3" }
+ ]
+}
+
+
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5418e6d9/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp4.json
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp4.json b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp4.json
new file mode 100644
index 0000000..33fcbf8
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp/vsp4.json
@@ -0,0 +1,18 @@
+{ "id": "http://cimi.example.org/vsps/vsp4",
+ "name": "vsp4",
+ "description": "a mock switchport",
+ "created": "Fri Mar 16 17:10:36 EET 2012",
+ "state": "STARTED",
+ "network": {"href": "http://cimi.example.org/networks/network2"},
+ "bandwidthReservation": 1,
+ "trafficPriority": 1,
+ "maxTrafficDelay": 500000,
+ "maxTrafficLoss": 100,
+ "maxTrafficJitter": 100000,
+ "operations": [
+ { "rel": "edit", "href": "http://cimi.example.org/vsps/vsp4" },
+ { "rel": "delete", "href": "http://cimi.example.org/vsps/vsp4" }
+ ]
+}
+
+
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5418e6d9/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 c61e414..7d580ea 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -76,6 +76,17 @@ module Deltacloud::Drivers::Mock
end
end
+ def vsps(credentials, opts={})
+ check_credentials(credentials)
+ if opts[:id].nil?
+ vsps = @client.load_all_cimi(:vsp).map{|vsp| CIMI::Model::VSP.from_json(vsp)}
+ vsps.map{|vsp|convert_cimi_mock_urls(:vsp, vsp, opts[:env])}.flatten
+ else
+ vsp = CIMI::Model::VSP.from_json(@client.load_cimi(:vsp, opts[:id]))
+ convert_cimi_mock_urls(:vsp, vsp, opts[:env])
+ end
+ end
+
private
def convert_cimi_mock_urls(model_name, cimi_object, context)