From: marios <[email protected]>
Signed-off-by: marios <[email protected]> --- 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(-) create mode 100644 server/lib/cimi/model/vsp_configuration.rb create mode 100644 server/lib/cimi/model/vsp_configuration_collection.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' 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 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 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 -- 1.7.6.5
