From: marios <[email protected]>
Signed-off-by: marios <[email protected]> --- .../mock/data/cimi/vsp_template/template1.json | 10 ++++++++++ .../mock/data/cimi/vsp_template/template2.json | 10 ++++++++++ .../drivers/mock/mock_driver_cimi_methods.rb | 11 +++++++++++ 3 files changed, 31 insertions(+), 0 deletions(-) create mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template1.json create mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template2.json diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template1.json b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template1.json new file mode 100644 index 0000000..5df8fdd --- /dev/null +++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template1.json @@ -0,0 +1,10 @@ +{ "id": "http://cimi.example.org/vsp_templates/template1", + "name": "template1", + "description": "A mock VSP template", + "created": "Fri Mar 16 19:26:41 EET 2012", + "network": { "href": "http://cimi.example.org/networks/network1"}, + "vspConfig": { "href": "http://cimi.example.org/vsp_configs/vspconfig1"}, + "operations": [ + { "rel": "edit", "href": "http://cimi.example.org/vsp_templates/template1" }, + { "rel": "delete", "href": "http://cimi.example.org/vsp_templates/template1" }] +} diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template2.json b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template2.json new file mode 100644 index 0000000..cc17c1b --- /dev/null +++ b/server/lib/deltacloud/drivers/mock/data/cimi/vsp_template/template2.json @@ -0,0 +1,10 @@ +{ "id": "http://cimi.example.org/vsp_templates/template2", + "name": "template2", + "description": "A mock VSP template", + "created": "Fri Mar 16 19:26:41 EET 2012", + "network": { "href": "http://cimi.example.org/networks/network2"}, + "vspConfig": { "href": "http://cimi.example.org/vsp_configs/vspconfig2"}, + "operations": [ + { "rel": "edit", "href": "http://cimi.example.org/vsp_templates/template2" }, + { "rel": "delete", "href": "http://cimi.example.org/vsp_templates/template2" }] +} 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 8718276..bebc45c 100644 --- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb @@ -98,6 +98,17 @@ module Deltacloud::Drivers::Mock end end + def vsp_templates(credentials, opts={}) + check_credentials(credentials) + if opts[:id].nil? + vsp_templates = @client.load_all_cimi(:vsp_template).map{|vsp_templ| CIMI::Model::VSPTemplate.from_json(vsp_templ)} + vsp_templates.map{|vsp_templ|convert_cimi_mock_urls(:vsp_template, vsp_templ, opts[:env])}.flatten + else + vsp_template = CIMI::Model::VSPTemplate.from_json(@client.load_cimi(:vsp_template, opts[:id])) + convert_cimi_mock_urls(:vsp_template, vsp_template, opts[:env]) + end + end + private def convert_cimi_mock_urls(model_name, cimi_object, context) -- 1.7.6.5
