You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/08/16 12:05:37 UTC
[PATCH core 1/3] CIMI: Show only supported collections in CEP
From: Michal Fojtik <mf...@redhat.com>
* cloudEntryPoint will advertise *only* the supported collection.
The decision whether the collection is supported or not is made based
on presence of the required driver method in :with_capability.
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/cimi/models/cloud_entry_point.rb | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/server/lib/cimi/models/cloud_entry_point.rb b/server/lib/cimi/models/cloud_entry_point.rb
index 9ec3446..52997e7 100644
--- a/server/lib/cimi/models/cloud_entry_point.rb
+++ b/server/lib/cimi/models/cloud_entry_point.rb
@@ -16,19 +16,11 @@
class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
text :base_uri, :xml_name => "baseURI", :json_name => "baseURI"
+
array :entity_metadata do
scalar :href
end
- DELTACLOUD_MAPPINGS = { "MachineImages" => "images",
- "MachineConfigurations" => "hardware_profiles",
- "Machines" => "instances",
- "Volumes" => "storage_volumes",
- "MachineAdmins" => "keys",
- "VolumeImages" => "storage_snapshots",
- }
-
-
def self.create(context)
self.new(entities(context).merge({
:name => context.driver.name,
@@ -42,12 +34,13 @@ class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
# Return an Hash of the CIMI root entities used in CloudEntryPoint
def self.entities(context)
- CIMI::Model.root_entities.inject({}) do |result, entity|
- if DELTACLOUD_MAPPINGS[entity]
- next result unless context.driver.respond_to?(DELTACLOUD_MAPPINGS[entity])
+ CIMI::Collections.cimi_modules.inject({}) do |supported_entities, m|
+ m.collections.each do |c|
+ index_operation_capability = c.operation(:index).required_capability
+ next if m.settings.respond_to?(:capability) and !m.settings.capability(index_operation_capability)
+ supported_entities[c.collection_name.to_s] = { :href => context.send(:"#{c.collection_name}_url") }
end
- result[entity.underscore] = { :href => context.send(:"#{entity.underscore}_url") }
- result
+ supported_entities
end
end
--
1.7.10.2
[PATCH core 3/3] CIMI: Added unit tests for DTACLOUD-302
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/tests/cimi/collections/cloud_entry_point_test.rb | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/server/tests/cimi/collections/cloud_entry_point_test.rb b/server/tests/cimi/collections/cloud_entry_point_test.rb
index 3f60d0d..3a01fb7 100644
--- a/server/tests/cimi/collections/cloud_entry_point_test.rb
+++ b/server/tests/cimi/collections/cloud_entry_point_test.rb
@@ -43,4 +43,13 @@ describe CIMI::Collections::CloudEntryPoint do
status.must_equal 200
end
+ it 'advertise only supported CIMI collections by driver' do
+ header 'X-Deltacloud-Driver', 'ec2'
+ get root_url + '/cloudEntryPoint'
+ (xml/'CloudEntryPoint/routingGroups').must_be_empty
+ header 'X-Deltacloud-Driver', 'mock'
+ get root_url + '/cloudEntryPoint'
+ (xml/'CloudEntryPoint/routingGroups').wont_be_empty
+ end
+
end
--
1.7.10.2
Re: [PATCH core 1/3] CIMI: Show only supported collections in CEP
Posted by Michal Fojtik <mf...@redhat.com>.
On Aug 17, 2012, at 9:08 PM, David Lutterkort <lu...@redhat.com> wrote:
Thanks! I added this message to the commit log and pushed.
-- Michal
> On Thu, 2012-08-16 at 12:05 +0200, mfojtik@redhat.com wrote:
>> From: Michal Fojtik <mf...@redhat.com>
>>
>> * cloudEntryPoint will advertise *only* the supported collection.
>> The decision whether the collection is supported or not is made based
>> on presence of the required driver method in :with_capability.
>
> ACK to the series; it would be good though if the commit message of one
> of these explained what the issue is this fixes (I assume it's the
> problem with running mulitple frontends in the same server instance)
>
> David
>
>
Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com
Re: [PATCH core 1/3] CIMI: Show only supported collections in CEP
Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2012-08-16 at 12:05 +0200, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
>
> * cloudEntryPoint will advertise *only* the supported collection.
> The decision whether the collection is supported or not is made based
> on presence of the required driver method in :with_capability.
ACK to the series; it would be good though if the commit message of one
of these explained what the issue is this fixes (I assume it's the
problem with running mulitple frontends in the same server instance)
David
[PATCH core 2/3] CIMI: Replaced 'check_capability' with Sinatra::Base
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
* The 'check_capability' is obsoleted in Rabbit and the Sinatra
method 'set' is used instead.
* Added missing driver methods to :with_capability options
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/cimi/collections/address_templates.rb | 6 +++---
server/lib/cimi/collections/addresses.rb | 11 ++++++-----
server/lib/cimi/collections/entity_metadata.rb | 2 --
server/lib/cimi/collections/machine_admins.rb | 10 +++++-----
.../lib/cimi/collections/machine_configurations.rb | 4 ++--
server/lib/cimi/collections/machine_images.rb | 6 +++---
server/lib/cimi/collections/machines.rb | 20 ++++++++++----------
.../lib/cimi/collections/network_configurations.rb | 7 ++++---
server/lib/cimi/collections/network_templates.rb | 7 ++++---
server/lib/cimi/collections/networks.rb | 16 ++++++++--------
.../cimi/collections/routing_group_templates.rb | 7 ++++---
server/lib/cimi/collections/routing_groups.rb | 7 ++++---
.../lib/cimi/collections/volume_configurations.rb | 6 +++---
server/lib/cimi/collections/volume_images.rb | 6 +++---
server/lib/cimi/collections/volumes.rb | 7 ++++---
server/lib/cimi/collections/vsp_configurations.rb | 7 ++++---
server/lib/cimi/collections/vsp_templates.rb | 7 ++++---
server/lib/cimi/collections/vsps.rb | 15 ++++++++-------
18 files changed, 79 insertions(+), 72 deletions(-)
diff --git a/server/lib/cimi/collections/address_templates.rb b/server/lib/cimi/collections/address_templates.rb
index db59507..809fc82 100644
--- a/server/lib/cimi/collections/address_templates.rb
+++ b/server/lib/cimi/collections/address_templates.rb
@@ -16,11 +16,11 @@
module CIMI::Collections
class AddressTemplates < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :address_templates do
- operation :index do
+ operation :index, :with_capability => :address_templates do
description 'List all AddressTemplates in the AddressTemplateCollection'
param :CIMISelect, :string, :optional
control do
@@ -32,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :address_template do
description 'Show a specific AddressTemplate'
control do
address_template = CIMI::Model::AddressTemplate.find(params[:id], self)
diff --git a/server/lib/cimi/collections/addresses.rb b/server/lib/cimi/collections/addresses.rb
index 96871c1..ca2959e 100644
--- a/server/lib/cimi/collections/addresses.rb
+++ b/server/lib/cimi/collections/addresses.rb
@@ -16,12 +16,13 @@
module CIMI::Collections
class Addresses < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :addresses do
description 'An Address represents an IP address, and its associated metdata, for a particular Network.'
- operation :index do
+ operation :index, :with_capability => :addresses do
description 'List all Addresses in the AddressCollection'
param :CIMISelect, :string, :optional
control do
@@ -33,7 +34,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :address do
description 'Show a specific Address'
control do
address = CIMI::Model::Address.find(params[:id], self)
@@ -44,7 +45,7 @@ module CIMI::Collections
end
end
- operation :create do
+ operation :create, :with_capability => :create_address do
description "Create a new Address"
control do
if request.content_type.end_with?("json")
@@ -59,7 +60,7 @@ module CIMI::Collections
end
end
- operation :destroy do
+ operation :destroy, :with_capability => :delete_address do
description "Delete a specified Address"
param :id, :string, :required
control do
diff --git a/server/lib/cimi/collections/entity_metadata.rb b/server/lib/cimi/collections/entity_metadata.rb
index 84e1fec..0bca4e3 100644
--- a/server/lib/cimi/collections/entity_metadata.rb
+++ b/server/lib/cimi/collections/entity_metadata.rb
@@ -16,8 +16,6 @@
module CIMI::Collections
class EntityMetadata < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
-
collection :entity_metadata do
operation :index do
diff --git a/server/lib/cimi/collections/machine_admins.rb b/server/lib/cimi/collections/machine_admins.rb
index c413cc9..d2cf3b4 100644
--- a/server/lib/cimi/collections/machine_admins.rb
+++ b/server/lib/cimi/collections/machine_admins.rb
@@ -16,12 +16,12 @@
module CIMI::Collections
class MachineAdmins < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :machine_admins do
description 'Machine Admin entity'
- operation :index do
+ operation :index, :with_capability => :keys do
description "List all machine admins"
param :CIMISelect, :string, :optional
control do
@@ -33,7 +33,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :key do
description "Show specific machine admin"
control do
machine_admin = MachineAdmin.find(params[:id], self)
@@ -44,7 +44,7 @@ module CIMI::Collections
end
end
- operation :create do
+ operation :create, :with_capability => :create_key do
description "Show specific machine admin"
control do
if request.content_type.end_with?("+json")
@@ -60,7 +60,7 @@ module CIMI::Collections
end
end
- operation :delete do
+ operation :delete, :with_capability => :destroy_key do
description "Delete specified MachineAdmin entity"
control do
MachineAdmin.delete!(params[:id], self)
diff --git a/server/lib/cimi/collections/machine_configurations.rb b/server/lib/cimi/collections/machine_configurations.rb
index 5b09e6a..d7840df 100644
--- a/server/lib/cimi/collections/machine_configurations.rb
+++ b/server/lib/cimi/collections/machine_configurations.rb
@@ -21,7 +21,7 @@ module CIMI::Collections
collection :machine_configurations do
description 'List all machine configurations'
- operation :index do
+ operation :index, :with_capability => :hardware_profiles do
param :CIMISelect, :string, :optional
description "List all machine configurations"
control do
@@ -33,7 +33,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :hardware_profile do
control do
machine_conf = MachineConfiguration.find(params[:id], self)
respond_to do |format|
diff --git a/server/lib/cimi/collections/machine_images.rb b/server/lib/cimi/collections/machine_images.rb
index 1296279..f43fe9b 100644
--- a/server/lib/cimi/collections/machine_images.rb
+++ b/server/lib/cimi/collections/machine_images.rb
@@ -16,12 +16,12 @@
module CIMI::Collections
class MachineImages < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :machine_images do
description 'List all machine images'
- operation :index do
+ operation :index, :with_capability => :images do
description "List all machine configurations"
param :CIMISelect, :string, :optional
control do
@@ -33,7 +33,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :image do
description "Show specific machine image."
control do
machine_image = MachineImage.find(params[:id], self)
diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb
index cadbcad..6084506 100644
--- a/server/lib/cimi/collections/machines.rb
+++ b/server/lib/cimi/collections/machines.rb
@@ -16,12 +16,12 @@
module CIMI::Collections
class Machines < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :machines do
description 'List all machine'
- operation :index do
+ operation :index, :with_capability => :instances do
param :CIMISelect, :string, :optional
description "List all machines"
control do
@@ -33,7 +33,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :instance do
description "Show specific machine."
control do
machine = Machine.find(params[:id], self)
@@ -44,7 +44,7 @@ module CIMI::Collections
end
end
- operation :create do
+ operation :create, :with_capability => :create_instance do
description "Create a new Machine entity."
control do
if request.content_type.end_with?("+json")
@@ -60,7 +60,7 @@ module CIMI::Collections
end
end
- operation :destroy do
+ operation :destroy, :with_capability => :destroy_instance do
description "Delete a specified machine."
param :id, :string, :required
control do
@@ -69,7 +69,7 @@ module CIMI::Collections
end
end
- action :stop do
+ action :stop, :with_capability => :stop_instance do
description "Stop specific machine."
control do
machine = Machine.find(params[:id], self)
@@ -85,7 +85,7 @@ module CIMI::Collections
end
end
- action :restart do
+ action :restart, :with_capability => :restart_instance do
description "Start specific machine."
control do
machine = Machine.find(params[:id], self)
@@ -101,7 +101,7 @@ module CIMI::Collections
end
end
- action :start do
+ action :start, :with_capability => :start_instance do
description "Start specific machine."
control do
machine = Machine.find(params[:id], self)
@@ -120,7 +120,7 @@ module CIMI::Collections
#NOTE: The routes for attach/detach used here are NOT as specified by CIMI
#will likely move later. CIMI specifies PUT of the whole Machine description
#with inclusion/ommission of the volumes you want [att|det]ached
- action :attach_volume, :http_method => :put do
+ action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume do
description "Attach CIMI Volume(s) to a machine."
control do
if request.content_type.end_with?("+json")
@@ -136,7 +136,7 @@ module CIMI::Collections
end
end
- action :detach_volume, :http_method => :put do
+ action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume do
description "Detach CIMI Volume(s) from a machine."
control do
if request.content_type.end_with?("+json")
diff --git a/server/lib/cimi/collections/network_configurations.rb b/server/lib/cimi/collections/network_configurations.rb
index 02452a8..62faf3e 100644
--- a/server/lib/cimi/collections/network_configurations.rb
+++ b/server/lib/cimi/collections/network_configurations.rb
@@ -16,10 +16,11 @@
module CIMI::Collections
class NetworkConfigurations < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :network_configurations do
- operation :index do
+ operation :index, :with_capability => :network_configurations do
description 'List all NetworkConfigurations'
param :CIMISelect, :string, :optional
control do
@@ -31,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :network_configuration do
description 'Show a specific NetworkConfiguration'
control do
network_config = NetworkConfiguration.find(params[:id], self)
diff --git a/server/lib/cimi/collections/network_templates.rb b/server/lib/cimi/collections/network_templates.rb
index 0ff82b2..05d86c2 100644
--- a/server/lib/cimi/collections/network_templates.rb
+++ b/server/lib/cimi/collections/network_templates.rb
@@ -16,10 +16,11 @@
module CIMI::Collections
class NetworkTemplates < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :network_templates do
- operation :index do
+ operation :index, :with_capability => :network_templates do
description 'List all Network Templates in the NetworkTemplateCollection'
param :CIMISelect, :string, :optional
control do
@@ -31,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :network_template do
description 'Show a specific Network Template'
control do
network_template = NetworkTemplate.find(params[:id], self)
diff --git a/server/lib/cimi/collections/networks.rb b/server/lib/cimi/collections/networks.rb
index 0aa21e8..4f26b0b 100644
--- a/server/lib/cimi/collections/networks.rb
+++ b/server/lib/cimi/collections/networks.rb
@@ -16,12 +16,12 @@
module CIMI::Collections
class Networks < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :networks do
description 'A Network represents an abstraction of a layer 2 broadcast domain'
- operation :index do
+ operation :index, :with_capability => :networks do
description "List all Networks"
param :CIMISelect, :string, :optional
control do
@@ -33,7 +33,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :network do
description "Show a specific Network"
control do
network = Network.find(params[:id], self)
@@ -44,7 +44,7 @@ module CIMI::Collections
end
end
- operation :create do
+ operation :create, :with_capability => :create_network do
description "Create a new Network"
control do
if request.content_type.end_with?("json")
@@ -59,7 +59,7 @@ module CIMI::Collections
end
end
- operation :destroy do
+ operation :destroy, :with_capability => :delete_network do
description "Delete a specified Network"
param :id, :string, :required
control do
@@ -68,7 +68,7 @@ module CIMI::Collections
end
end
- action :start do
+ action :start, :with_capability => :start_network do
description "Start specific network."
control do
network = Network.find(params[:id], self)
@@ -85,7 +85,7 @@ module CIMI::Collections
end
end
- action :stop do
+ action :stop, :with_capability => :stop_network do
description "Stop specific network."
control do
network = Network.find(params[:id], self)
@@ -102,7 +102,7 @@ module CIMI::Collections
end
end
- action :suspend do
+ action :suspend, :with_capability => :suspend_network do
description "Suspend specific network."
control do
network = Network.find(params[:id], self)
diff --git a/server/lib/cimi/collections/routing_group_templates.rb b/server/lib/cimi/collections/routing_group_templates.rb
index 995b1f8..d320d28 100644
--- a/server/lib/cimi/collections/routing_group_templates.rb
+++ b/server/lib/cimi/collections/routing_group_templates.rb
@@ -16,10 +16,11 @@
module CIMI::Collections
class RoutingGroupTemplates < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :routing_group_templates do
- operation :index do
+ operation :index, :with_capability => :routing_groups do
description 'List all RoutingGroupTemplates in the RoutingGroupTemplateCollection'
param :CIMISelect, :string, :optional
control do
@@ -31,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :routing_group do
description 'Show a specific RoutingGroupTemplate'
control do
routing_group_template = RoutingGroupTemplate.find(params[:id], self)
diff --git a/server/lib/cimi/collections/routing_groups.rb b/server/lib/cimi/collections/routing_groups.rb
index 5e7ccc5..751290c 100644
--- a/server/lib/cimi/collections/routing_groups.rb
+++ b/server/lib/cimi/collections/routing_groups.rb
@@ -16,10 +16,11 @@
module CIMI::Collections
class RoutingGroups < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :routing_groups do
- operation :index do
+ operation :index, :with_capability => :routing_groups do
description 'List all RoutingGroups in the RoutingGroupsCollection'
param :CIMISelect, :string, :optional
control do
@@ -31,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :routing_group do
description 'Show a specific RoutingGroup'
control do
routing_group = RoutingGroup.find(params[:id], self)
diff --git a/server/lib/cimi/collections/volume_configurations.rb b/server/lib/cimi/collections/volume_configurations.rb
index 055e28c..0887462 100644
--- a/server/lib/cimi/collections/volume_configurations.rb
+++ b/server/lib/cimi/collections/volume_configurations.rb
@@ -16,11 +16,11 @@
module CIMI::Collections
class VolumeConfigurations < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :volume_configurations do
- operation :index do
+ operation :index, :with_capability => :storage_volumes do
description "Get list all VolumeConfigurations"
param :CIMISelect, :string, :optional
control do
@@ -32,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :storage_volume do
description "Get a specific VolumeConfiguration"
control do
volume_config = VolumeConfiguration.find(params[:id], self)
diff --git a/server/lib/cimi/collections/volume_images.rb b/server/lib/cimi/collections/volume_images.rb
index 78432b1..64db9ae 100644
--- a/server/lib/cimi/collections/volume_images.rb
+++ b/server/lib/cimi/collections/volume_images.rb
@@ -16,12 +16,12 @@
module CIMI::Collections
class VolumeImages < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
collection :volume_images do
description 'This entity represents an image that could be place on a pre-loaded volume.'
- operation :index do
+ operation :index, :with_capability => :storage_snapshots do
description "List all volumes images"
param :CIMISelect, :string, :optional
control do
@@ -33,7 +33,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :storage_snapshot do
description "Show a specific volume image"
control do
volume_image = VolumeImage.find(params[:id], self)
diff --git a/server/lib/cimi/collections/volumes.rb b/server/lib/cimi/collections/volumes.rb
index 1c45c9e..80350de 100644
--- a/server/lib/cimi/collections/volumes.rb
+++ b/server/lib/cimi/collections/volumes.rb
@@ -16,10 +16,11 @@
module CIMI::Collections
class Volumes < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :volumes do
- operation :index do
+ operation :index, :with_capability => :storage_volumes do
description "List all volumes"
param :CIMISelect, :string, :optional
control do
@@ -31,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :storage_volume do
description "Show specific Volume."
control do
volume = Volume.find(params[:id], self)
diff --git a/server/lib/cimi/collections/vsp_configurations.rb b/server/lib/cimi/collections/vsp_configurations.rb
index 31acceb..8a76605 100644
--- a/server/lib/cimi/collections/vsp_configurations.rb
+++ b/server/lib/cimi/collections/vsp_configurations.rb
@@ -16,10 +16,11 @@
module CIMI::Collections
class VspConfigurations < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :vsp_configurations do
- operation :index do
+ operation :index, :with_capability => :vsp_configurations do
description 'List all VSPConfigurations in the VSPConfigurationCollection'
param :CIMISelect, :string, :optional
control do
@@ -31,7 +32,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :vsp_configuration do
description 'Show a specific VSPConfiguration'
control do
vsp_config = VSPConfiguration.find(params[:id], self)
diff --git a/server/lib/cimi/collections/vsp_templates.rb b/server/lib/cimi/collections/vsp_templates.rb
index 503de50..dab7db3 100644
--- a/server/lib/cimi/collections/vsp_templates.rb
+++ b/server/lib/cimi/collections/vsp_templates.rb
@@ -16,12 +16,13 @@
module CIMI::Collections
class VspTemplates < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :vsp_templates do
description 'The VSP Template is a set of Configuration values for realizing a VSP. A VSP Template may be used to create multiple VSPs'
- operation :index do
+ operation :index, :with_capability => :vsp_templates do
description 'List all VSPTemplates in the VSPTemplateCollection'
param :CIMISelect, :string, :optional
control do
@@ -33,7 +34,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :vsp_template do
description 'Show a specific VSPTemplate'
control do
vsp_template = VSPTemplate.find(params[:id], self)
diff --git a/server/lib/cimi/collections/vsps.rb b/server/lib/cimi/collections/vsps.rb
index 52b1a5a..7106c91 100644
--- a/server/lib/cimi/collections/vsps.rb
+++ b/server/lib/cimi/collections/vsps.rb
@@ -16,12 +16,13 @@
module CIMI::Collections
class Vsps < Base
- check_capability :for => lambda { |m| driver.respond_to? m }
+ set :capability, lambda { |m| driver.respond_to? m }
+
collection :vsps do
description 'A VSP represents the connection parameters of a network port'
- operation :index do
+ operation :index, :with_capability => :vsps do
description 'List all VSPs in the VSPCollection'
param :CIMISelect, :string, :optional
control do
@@ -33,7 +34,7 @@ module CIMI::Collections
end
end
- operation :show do
+ operation :show, :with_capability => :vsp do
description 'Show a specific VSP'
control do
vsp = VSP.find(params[:id], self)
@@ -44,7 +45,7 @@ module CIMI::Collections
end
end
- operation :create do
+ operation :create, :with_capability => :create_vsp do
description "Create a new VSP"
control do
if request.content_type.end_with?("json")
@@ -59,7 +60,7 @@ module CIMI::Collections
end
end
- operation :destroy do
+ operation :destroy, :with_capability => :delete_vsp do
description "Delete a specified VSP"
control do
CIMI::Model::VSP.delete!(params[:id], self)
@@ -67,7 +68,7 @@ module CIMI::Collections
end
end
- action :start do
+ action :start, :with_capability => :start_vsp do
description "Start specific VSP."
param :id, :string, :required
control do
@@ -85,7 +86,7 @@ module CIMI::Collections
end
end
- action :stop do
+ action :stop, :with_capability => :stop_vsp do
description "Stop specific VSP."
control do
vsp = VSP.find(params[:id], self)
--
1.7.10.2