You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/01/18 11:24:44 UTC

[3/4] git commit: DTACLOUD-409:added network addresses view files and address to entities

DTACLOUD-409:added network addresses view files and address to entities


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/2890c78f
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/2890c78f
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/2890c78f

Branch: refs/heads/master
Commit: 2890c78f08cea731dfa4222645e0d836319edb98
Parents: 2ec0b18
Author: NjeriChelimo <ma...@gmail.com>
Authored: Fri Jan 18 12:52:09 2013 +0300
Committer: Michal fojtik <mf...@redhat.com>
Committed: Fri Jan 18 11:23:41 2013 +0100

----------------------------------------------------------------------
 clients/cimi/app.rb                     |    1 +
 clients/cimi/lib/entities.rb            |    1 +
 clients/cimi/lib/entities/address.rb    |   30 ++++++++++++++++++++++++++
 clients/cimi/views/addresses/index.haml |   23 +++++++++++++++++++
 clients/cimi/views/addresses/show.haml  |   29 +++++++++++++++++++++++++
 5 files changed, 84 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2890c78f/clients/cimi/app.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index c326b8b..be358b8 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -19,6 +19,7 @@ module CIMI::Frontend
 
   class Application < Sinatra::Base
 
+    use CIMI::Frontend::Address
     use CIMI::Frontend::CloudEntryPoint
     use CIMI::Frontend::MachineConfiguration
     use CIMI::Frontend::MachineImage

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2890c78f/clients/cimi/lib/entities.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 292f647..87a02f4 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -20,6 +20,7 @@ end
 
 require 'entities/base_entity'
 require 'entities/cloud_entry_point'
+require 'entities/address'
 require 'entities/machine_configuration'
 require 'entities/machine_admin'
 require 'entities/machine_image'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2890c78f/clients/cimi/lib/entities/address.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/address.rb b/clients/cimi/lib/entities/address.rb
new file mode 100644
index 0000000..31f5de9
--- /dev/null
+++ b/clients/cimi/lib/entities/address.rb
@@ -0,0 +1,30 @@
+# 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::Frontend::Address < CIMI::Frontend::Entity
+
+  get '/cimi/addresses/:id' do
+    address_xml = get_entity('addresses', params[:id], credentials)
+    @address = CIMI::Model::Address.from_xml(address_xml)
+    haml :'addresses/show'
+  end
+
+  get '/cimi/addresses' do
+    addresses_xml = get_entity_collection('addresses', credentials)
+    @addresses = CIMI::Model::AddressCollection.from_xml(addresses_xml)
+    haml :'addresses/index'
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2890c78f/clients/cimi/views/addresses/index.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/addresses/index.haml b/clients/cimi/views/addresses/index.haml
new file mode 100644
index 0000000..128ebef
--- /dev/null
+++ b/clients/cimi/views/addresses/index.haml
@@ -0,0 +1,23 @@
+- @title=collection_name @addresses
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li.active
+      AddressCollection
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@addresses.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@addresses.id}?format=json", :class => 'label warning' } JSON
+
+%ul
+  - @addresses.addresses.each do |address|
+    %li
+      %a{ :href => "/cimi/addresses/#{href_to_id(address.id)}"}=href_to_id(address.id)
+
+-details 'AddressCollection details' do
+  -row 'ID', @addresses.id
+  -row 'Count', @addresses.count

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2890c78f/clients/cimi/views/addresses/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/addresses/show.haml b/clients/cimi/views/addresses/show.haml
new file mode 100644
index 0000000..b45ce6e
--- /dev/null
+++ b/clients/cimi/views/addresses/show.haml
@@ -0,0 +1,29 @@
+- @title="#{@address.name}"
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/addresses"} AddressCollection
+      %span.divider="/"
+    %li.active
+      = @address.name
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@address.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@address.id}?format=json", :class => 'label warning' } JSON
+
+-details do
+  -row 'ID', @address.id
+  -row 'Description',@address.description
+  -row 'Created',@address.created
+  -row 'IP',@address.ip
+  -row 'Host name',@address.hostname
+  -row 'Allocation',@address.allocation
+  -row 'Default gateway',@address.default_gateway
+  -row 'DNS',@address.dns
+  -row 'Protocol',@address.protocol
+  -row 'Mask',@address.mask