deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1232039 - in /deltacloud/trunk/server/lib/cimi/model: network.rb network_collection.rb
Date Mon, 16 Jan 2012 15:46:09 GMT
Author: marios
Date: Mon Jan 16 15:46:09 2012
New Revision: 1232039

URL: http://svn.apache.org/viewvc?rev=1232039&view=rev
Log:
Adds CIMI::Network and CIMI::NetworkCollection models

Added:
    deltacloud/trunk/server/lib/cimi/model/network.rb
    deltacloud/trunk/server/lib/cimi/model/network_collection.rb

Added: deltacloud/trunk/server/lib/cimi/model/network.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/network.rb?rev=1232039&view=auto
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/network.rb (added)
+++ deltacloud/trunk/server/lib/cimi/model/network.rb Mon Jan 16 15:46:09 2012
@@ -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
+    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

Added: deltacloud/trunk/server/lib/cimi/model/network_collection.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model/network_collection.rb?rev=1232039&view=auto
==============================================================================
--- deltacloud/trunk/server/lib/cimi/model/network_collection.rb (added)
+++ deltacloud/trunk/server/lib/cimi/model/network_collection.rb Mon Jan 16 15:46:09 2012
@@ -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



Mime
View raw message