On Jan 13, 2012, at 6:58 PM, [email protected] wrote: ACK.
> From: marios <[email protected]> > > > Signed-off-by: marios <[email protected]> > --- > server/lib/cimi/model/network.rb | 69 +++++++++++++++++++++++++++ > server/lib/cimi/model/network_collection.rb | 34 +++++++++++++ > 2 files changed, 103 insertions(+), 0 deletions(-) > create mode 100644 server/lib/cimi/model/network.rb > create mode 100644 server/lib/cimi/model/network_collection.rb > > diff --git a/server/lib/cimi/model/network.rb > b/server/lib/cimi/model/network.rb > new file mode 100644 > index 0000000..d46f244 > --- /dev/null > +++ b/server/lib/cimi/model/network.rb > @@ -0,0 +1,69 @@ > +# 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::Network < CIMI::Model::Base > + > + text :state > + > + text :access > + > + text :bandwidth_limit > + > + text :traffic_priority > + > + text :max_traffic_delay > + > + text :max_traffic_loss > + > + text :max_traffic_jitter > + > + href :routing_group > + > + href :event_log > + > + array :meters do > + scalar :href > + end > + > + array :operations do > + scalar :rel, :href > + end > + > + def self.find(id, context) > + networks=[] > + if id==:all > +#FIXME > + else > +#FIXME > + end Maybe would be better to comment out this if == :all for now. > + networks > + end > + > + def self.create_from_xml(request_body, context) > +#FIXME > + end > + > + def self.create_from_json(request_body,context) > +#FIXME > + end > + > + def self.delete!(id, context) > + #FIXME > + end > + > +#FIXME > +#actions - needs method(s) to facilitate stop/start/suspend/delete > + > +end > diff --git a/server/lib/cimi/model/network_collection.rb > b/server/lib/cimi/model/network_collection.rb > new file mode 100644 > index 0000000..0def427 > --- /dev/null > +++ b/server/lib/cimi/model/network_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::NetworkCollection < CIMI::Model::Base > + > + act_as_root_entity :network > + > + array :networks do > + scalar :href > + end > + > + def self.default(context) > + self.new( > + :uri => context.networks_url, > + :name => 'default', > + :created => Time.now, > + :description => "#{context.driver.name.capitalize} NetworkCollection", > + :networks => Network.all(context).map { |c| { :href => c.uri } } > + ) > + end > + > +end > -- > 1.7.6.5 > ------------------------------------------------------ Michal Fojtik, [email protected] Deltacloud API: http://deltacloud.org
