Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 62481B322 for ; Mon, 16 Jan 2012 15:47:04 +0000 (UTC) Received: (qmail 57085 invoked by uid 500); 16 Jan 2012 15:47:04 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 57067 invoked by uid 500); 16 Jan 2012 15:47:04 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 57060 invoked by uid 99); 16 Jan 2012 15:47:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 15:47:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2012 15:47:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 09B5A2388A9B for ; Mon, 16 Jan 2012 15:46:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1232041 - in /deltacloud/trunk/server/lib/cimi: model.rb server.rb Date: Mon, 16 Jan 2012 15:46:42 -0000 To: commits@deltacloud.apache.org From: marios@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120116154643.09B5A2388A9B@eris.apache.org> Author: marios Date: Mon Jan 16 15:46:42 2012 New Revision: 1232041 URL: http://svn.apache.org/viewvc?rev=1232041&view=rev Log: Adds new CIMI::Network models and routes for Sinatra Modified: deltacloud/trunk/server/lib/cimi/model.rb deltacloud/trunk/server/lib/cimi/server.rb Modified: deltacloud/trunk/server/lib/cimi/model.rb URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/model.rb?rev=1232041&r1=1232040&r2=1232041&view=diff ============================================================================== --- deltacloud/trunk/server/lib/cimi/model.rb (original) +++ deltacloud/trunk/server/lib/cimi/model.rb Mon Jan 16 15:46:42 2012 @@ -45,3 +45,8 @@ require 'cimi/model/volume_image_collect require 'cimi/model/volume_template_collection' require 'cimi/model/entity_metadata' require 'cimi/model/entity_metadata_collection' +require 'cimi/model/network' +require 'cimi/model/network_collection' +require 'cimi/model/network_configuration' +require 'cimi/model/network_configuration_collection' +require 'cimi/model/network_template' Modified: deltacloud/trunk/server/lib/cimi/server.rb URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/lib/cimi/server.rb?rev=1232041&r1=1232040&r2=1232041&view=diff ============================================================================== --- deltacloud/trunk/server/lib/cimi/server.rb (original) +++ deltacloud/trunk/server/lib/cimi/server.rb Mon Jan 16 15:46:42 2012 @@ -492,4 +492,84 @@ global_collection :entity_metadata do end +global_collection :networks do + description 'A Network represents an abstraction of a layer 2 broadcast domain' + + operation :index do + description "List all Networks" + param :CIMISelect, :string, :optional + control do + networks = NetworkCollection.default(self).filter_by(params[:CIMISelect]) + respond_to do |format| + format.xml { networks.to_xml } + format.json { networks.to_json } + end + end + end + + operation :show do + description "Show a specific Network" + param :id, :string, :required + control do + network = Network.find(params[:id], self) + respond_to do |format| + format.xml { network.to_xml } + format.json { network.to_json } + end + end + end + + operation :create do + description "Create a new Network" + control do + if request.content_type.end_with("+json") + network = Network.create_from_json(request.body.read, self) + else + network = Network.create_from_xml(request.body.read, self) + end + respond_to do |format| + format.xml { network.to_xml} + format.json { network.to_json } + end + end + end + + operation :destroy do + description "Delete a specified Network" + param :id, :string, :required + control do + Network.delete!(params[:id], self) + no_content_with_status(200) + end + end + +end + +global_collection :network_configurations do + description 'Network Configurations contain the set of configuration values representing the information needed to create a Network with certain characteristics' + + operation :index do + description 'List all NetworkConfigurations' + param :CIMISelect, :string, :optional + control do + network_configurations = NetworkConfigurationCollection.default(self).filter_by(params[:CIMISelect]) + respond_to do |format| + format.xml { network_configurations.to_xml } + format.json { network_configurations.to_json } + end + end + end + + operation :show do + description 'Show a specific NetworkConfiguration' + param :id, :string, :required + control do + network_config = NetworkConfiguration.find(params[:id], self) + respond_to do + format.xml { network_config.to_xml } + format.json { network_config.to_json } + end + end + end +end end