You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2012/03/19 17:28:26 UTC

[PATCH 1/4] CIMI: Adds RoutingGroupTemplate entity and views to CIMI Client app.

From: marios <ma...@redhat.com>


Signed-off-by: marios <ma...@redhat.com>
---
 clients/cimi/app.rb                                |    1 +
 clients/cimi/lib/entities.rb                       |    1 +
 .../cimi/lib/entities/routing_group_template.rb    |   30 +++++++++++++++++++
 .../cimi/views/routing_group_templates/index.haml  |   30 +++++++++++++++++++
 .../cimi/views/routing_group_templates/show.haml   |   31 ++++++++++++++++++++
 5 files changed, 93 insertions(+), 0 deletions(-)
 create mode 100644 clients/cimi/lib/entities/routing_group_template.rb
 create mode 100644 clients/cimi/views/routing_group_templates/index.haml
 create mode 100644 clients/cimi/views/routing_group_templates/show.haml

diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index c14e36b..5064712 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -32,6 +32,7 @@ module CIMI::Frontend
     use CIMI::Frontend::NetworkConfiguration
     use CIMI::Frontend::NetworkTemplate
     use CIMI::Frontend::RoutingGroup
+    use CIMI::Frontend::RoutingGroupTemplate
     use Rack::Session::Cookie
 
     helpers CIMI::Frontend::Helper
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 7249067..5f9ed53 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -32,3 +32,4 @@ require 'entities/network'
 require 'entities/network_configuration'
 require 'entities/network_template'
 require 'entities/routing_group'
+require 'entities/routing_group_template'
diff --git a/clients/cimi/lib/entities/routing_group_template.rb b/clients/cimi/lib/entities/routing_group_template.rb
new file mode 100644
index 0000000..88a0a47
--- /dev/null
+++ b/clients/cimi/lib/entities/routing_group_template.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::RoutingGroupTemplate < CIMI::Frontend::Entity
+
+  get '/cimi/routing_group_templates/:id' do
+    rg_template_xml = get_entity('routing_group_templates', params[:id], credentials)
+    @rg_template = CIMI::Model::RoutingGroupTemplate.from_xml(rg_template_xml)
+    haml :'routing_group_templates/show'
+  end
+
+  get '/cimi/routing_group_templates' do
+    rg_templates_xml = get_entity_collection('routing_group_templates', credentials)
+    @rg_templates = CIMI::Model::RoutingGroupTemplateCollection.from_xml(rg_templates_xml)
+    haml :'routing_group_templates/index'
+  end
+
+end
diff --git a/clients/cimi/views/routing_group_templates/index.haml b/clients/cimi/views/routing_group_templates/index.haml
new file mode 100644
index 0000000..c601c33
--- /dev/null
+++ b/clients/cimi/views/routing_group_templates/index.haml
@@ -0,0 +1,30 @@
+- @title=@rg_templates.description
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li.active
+      RoutingGroupTemplateCollection
+- content_for :actions do
+  %p
+    %a{ :href => "#{@rg_templates.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@rg_templates.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+  %p
+    A Routing Group Template Collection entity represents the collection of Routing
+    Group Template entities within a Provider. This entity can be used to locate and
+    create Routing Group Templates.
+
+%h3 RoutingGroupTemplateCollection
+%ul
+  - @rg_templates.routing_group_templates.each do |rg_template|
+    %li
+      %a{ :href => "/cimi/routing_group_templates/#{rg_template.href.split('/').last}"}=rg_template.href.split('/').last
+
+-details 'RoutingGroupTemplateCollection details' do
+  -row 'ID', @rg_templates.id
+  -row 'Description', @rg_templates.description
+  -row 'Created', @rg_templates.created
diff --git a/clients/cimi/views/routing_group_templates/show.haml b/clients/cimi/views/routing_group_templates/show.haml
new file mode 100644
index 0000000..89beb9f
--- /dev/null
+++ b/clients/cimi/views/routing_group_templates/show.haml
@@ -0,0 +1,31 @@
+- @title="#{@rg_template.name}"
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/routing_group_templates"} RoutingGroupTemplateCollection
+      %span.divider="/"
+    %li.active
+      =@rg_template.name
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@rg_template.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@rg_template.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+  %p
+    A RoutingGroupTemplate entity captures the configuration values for realizing a RoutingGroup.
+    A Routing Group Template may be used to create multiple RoutingGroup
+
+-details 'RoutingGroupTemplate details' do
+  -row 'ID', @rg_template.id
+  -row 'Description', @rg_template.description
+  -row 'Created', @rg_template.created
+
+-details 'RoutingGroupTemplate networks' do
+  -@rg_template.networks.each do |net|
+    -row 'ID', net.href
-- 
1.7.6.5