ACK to whole series. Looks good, applied cleanly. Also note that there are is no test unit coverage for this. If you want I can take a look and create some tests.
-- Michal Michal Fojtik http://deltacloud.org [email protected] On Mar 16, 2012, at 6:34 PM, [email protected] wrote: > From: marios <[email protected]> > > > Signed-off-by: marios <[email protected]> > --- > server/lib/cimi/model.rb | 2 + > server/lib/cimi/model/routing_group_template.rb | 34 +++++++++++++++++++ > .../model/routing_group_template_collection.rb | 35 ++++++++++++++++++++ > server/lib/cimi/server.rb | 33 ++++++++++++++++++ > 4 files changed, 104 insertions(+), 0 deletions(-) > create mode 100644 server/lib/cimi/model/routing_group_template.rb > create mode 100644 server/lib/cimi/model/routing_group_template_collection.rb > > diff --git a/server/lib/cimi/model.rb b/server/lib/cimi/model.rb > index 60f2d99..132ae6a 100644 > --- a/server/lib/cimi/model.rb > +++ b/server/lib/cimi/model.rb > @@ -53,3 +53,5 @@ require 'cimi/model/network_template' > require 'cimi/model/network_template_collection' > require 'cimi/model/routing_group' > require 'cimi/model/routing_group_collection' > +require 'cimi/model/routing_group_template' > +require 'cimi/model/routing_group_template_collection' > diff --git a/server/lib/cimi/model/routing_group_template.rb > b/server/lib/cimi/model/routing_group_template.rb > new file mode 100644 > index 0000000..204a353 > --- /dev/null > +++ b/server/lib/cimi/model/routing_group_template.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::RoutingGroupTemplate < CIMI::Model::Base > + > + array :networks do > + scalar :href > + end > + > + array :operations do > + scalar :rel, :href > + end > + > + def self.find(id, context) > + if id==:all > + context.driver.routing_group_templates(context.credentials, > {:env=>context}) > + else > + context.driver.routing_group_templates(context.credentials, > {:env=>context, :id=>id}) > + end > + end > + > +end > diff --git a/server/lib/cimi/model/routing_group_template_collection.rb > b/server/lib/cimi/model/routing_group_template_collection.rb > new file mode 100644 > index 0000000..5e7a9ba > --- /dev/null > +++ b/server/lib/cimi/model/routing_group_template_collection.rb > @@ -0,0 +1,35 @@ > +# 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::RoutingGroupTemplateCollection < CIMI::Model::Base > + > + act_as_root_entity :routing_group_template > + > + array :routing_group_templates do > + scalar :href > + end > + > + def self.default(context) > + self.new( > + :id => context.routing_group_templates_url, > + :name => 'default', > + :created => Time.now, > + :description => "#{context.driver.name.capitalize} > RoutingGroupTemplateCollection", > + :routing_group_templates => RoutingGroupTemplate.all_uri(context) > + ) > + end > + > +end > diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb > index 06ad758..9f541d0 100644 > --- a/server/lib/cimi/server.rb > +++ b/server/lib/cimi/server.rb > @@ -635,3 +635,36 @@ global_collection :routing_groups do > end > > end > + > + > +global_collection :routing_group_templates do > + > + description 'Routing Groups Templates capture the configuration values for > realizing a RoutingGroup. A Routing Group Template may be used to create > multiple RoutingGroups' > + > + operation :index do > + description 'List all RoutingGroupTemplates in the > RoutingGroupTemplateCollection' > + param :CIMISelect, :string, :optional > + control do > + routing_group_templates = > RoutingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect]) > + respond_to do |format| > + format.xml {routing_group_templates.to_xml} > + format.json {routing_group_templates.to_json} > + end > + end > + end > + > + operation :show do > + description 'Show a specific RoutingGroupTemplate' > + param :id, :string, :required > + control do > + routing_group_template = RoutingGroupTemplate.find(params[:id], self) > + respond_to do |format| > + format.xml {routing_group_template.to_xml} > + format.json {routing_group_template.to_json} > + end > + end > + end > + > +end > + > + > -- > 1.7.6.5 >
