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
[6/9] git commit: CIMI: adds VSPConfiguration + Collection to CIMI
server
CIMI: adds VSPConfiguration + Collection to CIMI server
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/ad720cc5
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/ad720cc5
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/ad720cc5
Branch: refs/heads/master
Commit: ad720cc5bb27b73714e1347c655d6bdd8e4a4913
Parents: b48fa1e
Author: marios <ma...@redhat.com>
Authored: Fri Mar 16 19:16:50 2012 +0200
Committer: marios <ma...@redhat.com>
Committed: Tue Mar 20 12:09:08 2012 +0200
----------------------------------------------------------------------
server/lib/cimi/model.rb | 2 +
server/lib/cimi/model/vsp_configuration.rb | 40 +++++++++++++++
.../lib/cimi/model/vsp_configuration_collection.rb | 34 ++++++++++++
server/lib/cimi/server.rb | 30 +++++++++++
4 files changed, 106 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ad720cc5/server/lib/cimi/model.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb
index 6f19673..1136593 100644
--- a/server/lib/cimi/model.rb
+++ b/server/lib/cimi/model.rb
@@ -57,3 +57,5 @@ require 'cimi/model/routing_group_template'
require 'cimi/model/routing_group_template_collection'
require 'cimi/model/vsp'
require 'cimi/model/vsp_collection'
+require 'cimi/model/vsp_configuration'
+require 'cimi/model/vsp_configuration_collection'
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ad720cc5/server/lib/cimi/model/vsp_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/vsp_configuration.rb b/server/lib/cimi/model/vsp_configuration.rb
new file mode 100644
index 0000000..c9a9bf3
--- /dev/null
+++ b/server/lib/cimi/model/vsp_configuration.rb
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class CIMI::Model::VSPConfiguration < CIMI::Model::Base
+
+ text :bandwidth_reservation
+
+ text :traffic_priority
+
+ text :max_traffic_delay
+
+ text :max_traffic_loss
+
+ text :max_traffic_jitter
+
+ array :operations do
+ scalar :rel, :href
+ end
+
+ def self.find(id, context)
+ if id==:all
+ context.driver.vsp_configurations(context.credentials, {:env=>context})
+ else
+ context.driver.vsp_configurations(context.credentials, {:env=>context, :id=>id})
+ end
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ad720cc5/server/lib/cimi/model/vsp_configuration_collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/vsp_configuration_collection.rb b/server/lib/cimi/model/vsp_configuration_collection.rb
new file mode 100644
index 0000000..addff1c
--- /dev/null
+++ b/server/lib/cimi/model/vsp_configuration_collection.rb
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class CIMI::Model::VSPConfigurationCollection < CIMI::Model::Base
+
+ CIMI::Model.register_as_root_entity! "VSPConfigurations"
+
+ array :vsp_configurations do
+ scalar :href
+ end
+
+ def self.default(context)
+ self.new(
+ :id => context.vsp_configurations_url,
+ :name => 'default',
+ :created => Time.now,
+ :description => "#{context.driver.name.capitalize} VSPConfigurationCollection",
+ :vsp_configurations => VSPConfiguration.all_uri(context)
+ )
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ad720cc5/server/lib/cimi/server.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 308d922..4dc0606 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -697,3 +697,33 @@ global_collection :vsps do
end
end
+
+global_collection :vsp_configurations do
+
+ description 'A VSP Configuration is the set of configuration values representing the information needed to create a VSP with certain characteristics'
+
+ operation :index do
+ description 'List all VSPConfigurations in the VSPConfigurationCollection'
+ param :CIMISelect, :string, :optional
+ control do
+ vsp_configs = VSPConfigurationCollection.default(self).filter_by(params[:CIMISelect])
+ respond_to do |format|
+ format.xml {vsp_configs.to_xml}
+ format.json {vsp_configs.to_json}
+ end
+ end
+ end
+
+ operation :show do
+ description 'Show a specific VSPConfiguration'
+ param :id, :string, :required
+ control do
+ vsp_config = VSPConfiguration.find(params[:id], self)
+ respond_to do |format|
+ format.xml {vsp_config.to_xml}
+ format.json {vsp_config.to_json}
+ end
+ end
+ end
+
+end