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/16 15:10:52 UTC

[PATCH 1/2] CIMI: Adds network_template and routing_group entities to CIMI Client app

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


Signed-off-by: marios <ma...@redhat.com>
---
 clients/cimi/app.rb                           |    2 +
 clients/cimi/lib/entities.rb                  |    2 +
 clients/cimi/lib/entities/network_template.rb |   30 +++++++++++++++++++++++++
 clients/cimi/lib/entities/routing_group.rb    |   30 +++++++++++++++++++++++++
 4 files changed, 64 insertions(+), 0 deletions(-)
 create mode 100644 clients/cimi/lib/entities/network_template.rb
 create mode 100644 clients/cimi/lib/entities/routing_group.rb

diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 505aaa7..c14e36b 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -30,6 +30,8 @@ module CIMI::Frontend
     use CIMI::Frontend::Volume
     use CIMI::Frontend::Network
     use CIMI::Frontend::NetworkConfiguration
+    use CIMI::Frontend::NetworkTemplate
+    use CIMI::Frontend::RoutingGroup
     use Rack::Session::Cookie
 
     helpers CIMI::Frontend::Helper
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index d6f566b..7249067 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -30,3 +30,5 @@ require 'entities/volume_image'
 require 'entities/volume'
 require 'entities/network'
 require 'entities/network_configuration'
+require 'entities/network_template'
+require 'entities/routing_group'
diff --git a/clients/cimi/lib/entities/network_template.rb b/clients/cimi/lib/entities/network_template.rb
new file mode 100644
index 0000000..97983b5
--- /dev/null
+++ b/clients/cimi/lib/entities/network_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::NetworkTemplate < CIMI::Frontend::Entity
+
+  get '/cimi/network_templates/:id' do
+    network_template_xml = get_entity('network_templates', params[:id], credentials)
+    @network_template = CIMI::Model::NetworkTemplate.from_xml(network_template_xml)
+    haml :'network_templates/show'
+  end
+
+  get '/cimi/network_templates' do
+    network_templates_xml = get_entity_collection('network_templates', credentials)
+    @network_templates = CIMI::Model::NetworkTemplateCollection.from_xml(network_templates_xml)
+    haml :'network_templates/index'
+  end
+
+end
diff --git a/clients/cimi/lib/entities/routing_group.rb b/clients/cimi/lib/entities/routing_group.rb
new file mode 100644
index 0000000..5365393
--- /dev/null
+++ b/clients/cimi/lib/entities/routing_group.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::RoutingGroup < CIMI::Frontend::Entity
+
+  get '/cimi/routing_groups/:id' do
+    routing_group_xml = get_entity('routing_groups', params[:id], credentials)
+    @routing_group = CIMI::Model::RoutingGroup.from_xml(routing_group_xml)
+    haml :'routing_groups/show'
+  end
+
+  get '/cimi/routing_groups' do
+    routing_groups_xml = get_entity_collection('routing_groups', credentials)
+    @routing_groups = CIMI::Model::RoutingGroupCollection.from_xml(routing_groups_xml)
+    haml :'routing_groups/index'
+  end
+
+end
-- 
1.7.6.5


Re: [PATCH 2/2] CIMI: adds views for network_templates and routing_groups entities to CIMI client app

Posted by Michal Fojtik <mi...@mifo.sk>.
ACK both.

Good job!

  -- Michal

On Mar 16, 2012, at 3:10 PM, marios@redhat.com wrote:

> From: marios <ma...@redhat.com>
> 
> 
> Signed-off-by: marios <ma...@redhat.com>
> ---
> clients/cimi/views/network_templates/index.haml |   29 +++++++++++++++++++++++
> clients/cimi/views/network_templates/show.haml  |   28 ++++++++++++++++++++++
> clients/cimi/views/networks/show.haml           |    1 +
> clients/cimi/views/routing_groups/index.haml    |   29 +++++++++++++++++++++++
> clients/cimi/views/routing_groups/show.haml     |   29 +++++++++++++++++++++++
> 5 files changed, 116 insertions(+), 0 deletions(-)
> create mode 100644 clients/cimi/views/network_templates/index.haml
> create mode 100644 clients/cimi/views/network_templates/show.haml
> create mode 100644 clients/cimi/views/routing_groups/index.haml
> create mode 100644 clients/cimi/views/routing_groups/show.haml
> 
> diff --git a/clients/cimi/views/network_templates/index.haml b/clients/cimi/views/network_templates/index.haml
> new file mode 100644
> index 0000000..09eed69
> --- /dev/null
> +++ b/clients/cimi/views/network_templates/index.haml
> @@ -0,0 +1,29 @@
> +- @title=@network_templates.description
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li.active
> +      NetworkTemplateCollection
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@network_templates.id}?format=xml", :class => 'label warning' } XML
> +    %a{ :href => "#{@network_templates.id}?format=json", :class => 'label warning' } JSON
> +
> +%blockquote
> +  %p
> +    A Network Template Collection entity represents the collection of NetworkTemplates within a Provider.
> +    This resource can be used to locate and create NetworkTemplates
> +
> +%h3 NetworkTemplateCollection
> +%ul
> +  - @network_templates.network_templates.each do |template|
> +    %li
> +      %a{ :href => "/cimi/network_templates/#{template.href.split('/').last}"}=template.href.split('/').last
> +
> +-details 'NetworkTemplateCollection details' do
> +  -row 'ID', @network_templates.id
> +  -row 'Description', @network_templates.description
> +  -row 'Created', @network_templates.created
> diff --git a/clients/cimi/views/network_templates/show.haml b/clients/cimi/views/network_templates/show.haml
> new file mode 100644
> index 0000000..7977b74
> --- /dev/null
> +++ b/clients/cimi/views/network_templates/show.haml
> @@ -0,0 +1,28 @@
> +- @title="#{@network_template.name}"
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li
> +      %a{ :href => "/cimi/network_templates"} NetworkTemplateCollection
> +      %span.divider="/"
> +    %li.active
> +      = @network_template.name
> +
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@network_template.id}?format=xml", :class => 'label warning' } XML
> +    %a{ :href => "#{@network_template.id}?format=json", :class => 'label warning' } JSON
> +%blockquote
> +  %p
> +    The Network Template is a set of configuration values for realizing a Network.
> +    An instance of Network Template may be used to create multiple Networks
> +
> +-details 'NetworkConfiguration details' do
> +  -row 'ID', @network_template.id
> +  -row 'Description',@network_template.description
> +  -row 'Created',@network_template.created
> +  -row 'NetworkConfiguration', @network_template.network_config.href
> +  -row 'RoutingGroup', @network_template.routing_group.href
> diff --git a/clients/cimi/views/networks/show.haml b/clients/cimi/views/networks/show.haml
> index 7aaf37e..8ec560a 100644
> --- a/clients/cimi/views/networks/show.haml
> +++ b/clients/cimi/views/networks/show.haml
> @@ -27,6 +27,7 @@
>   -row 'Created', @network.created
>   -row 'State', @network.state
>   -row 'Access', @network.access
> +  -row 'RoutingGroup', @network.routing_group.href
>   -row 'Bandwidth Limit', @network.bandwidth_limit
>   -row 'Traffic Priority', @network.traffic_priority
>   -row 'Maximum Traffic Delay', @network.max_traffic_delay
> diff --git a/clients/cimi/views/routing_groups/index.haml b/clients/cimi/views/routing_groups/index.haml
> new file mode 100644
> index 0000000..0fde8b4
> --- /dev/null
> +++ b/clients/cimi/views/routing_groups/index.haml
> @@ -0,0 +1,29 @@
> +- @title=@routing_groups.description
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li.active
> +      RoutingGroupCollection
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@routing_groups.id}?format=xml", :class => 'label warning' } XML
> +    %a{ :href => "#{@routing_groups.id}?format=json", :class => 'label warning' } JSON
> +
> +%blockquote
> +  %p
> +    A Routing Group Collection entity represents the collection of Routing Groups
> +    within a Provider. This entity can be used to locate and create Routing Groups.
> +
> +%h3 RoutingGroupCollection
> +%ul
> +  - @routing_groups.routing_groups.each do |group|
> +    %li
> +      %a{ :href => "/cimi/routing_groups/#{group.href.split('/').last}"}=group.href.split('/').last
> +
> +-details 'RoutingGroupCollection details' do
> +  -row 'ID', @routing_groups.id
> +  -row 'Description', @routing_groups.description
> +  -row 'Created', @routing_groups.created
> diff --git a/clients/cimi/views/routing_groups/show.haml b/clients/cimi/views/routing_groups/show.haml
> new file mode 100644
> index 0000000..757de0b
> --- /dev/null
> +++ b/clients/cimi/views/routing_groups/show.haml
> @@ -0,0 +1,29 @@
> +- @title="#{@routing_group.name}"
> +
> +- content_for :breadcrumb do
> +  %ul.breadcrumb
> +    %li
> +      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
> +      %span.divider="/"
> +    %li
> +      %a{ :href => "/cimi/routing_groups"} RoutingGroupCollection
> +      %span.divider="/"
> +    %li.active
> +      = @routing_group.name
> +
> +- content_for :actions do
> +  %p
> +    %a{ :href => "#{@routing_group.id}?format=xml", :class => 'label warning' } XML
> +    %a{ :href => "#{@routing_group.id}?format=json", :class => 'label warning' } JSON
> +%blockquote
> +  %p
> +    A Routing Group represents a collection of Networks that route to each other.
> +
> +-details 'RoutingGroup details' do
> +  -row 'ID', @routing_group.id
> +  -row 'Description',@routing_group.description
> +  -row 'Created',@routing_group.created
> +
> +-details 'RoutingGroup Networks' do
> +  -@routing_group.networks.each do |net|
> +    -row 'ID', net.href
> -- 
> 1.7.6.5
> 


[PATCH 2/2] CIMI: adds views for network_templates and routing_groups entities to CIMI client app

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


Signed-off-by: marios <ma...@redhat.com>
---
 clients/cimi/views/network_templates/index.haml |   29 +++++++++++++++++++++++
 clients/cimi/views/network_templates/show.haml  |   28 ++++++++++++++++++++++
 clients/cimi/views/networks/show.haml           |    1 +
 clients/cimi/views/routing_groups/index.haml    |   29 +++++++++++++++++++++++
 clients/cimi/views/routing_groups/show.haml     |   29 +++++++++++++++++++++++
 5 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 clients/cimi/views/network_templates/index.haml
 create mode 100644 clients/cimi/views/network_templates/show.haml
 create mode 100644 clients/cimi/views/routing_groups/index.haml
 create mode 100644 clients/cimi/views/routing_groups/show.haml

diff --git a/clients/cimi/views/network_templates/index.haml b/clients/cimi/views/network_templates/index.haml
new file mode 100644
index 0000000..09eed69
--- /dev/null
+++ b/clients/cimi/views/network_templates/index.haml
@@ -0,0 +1,29 @@
+- @title=@network_templates.description
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li.active
+      NetworkTemplateCollection
+- content_for :actions do
+  %p
+    %a{ :href => "#{@network_templates.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@network_templates.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+  %p
+    A Network Template Collection entity represents the collection of NetworkTemplates within a Provider.
+    This resource can be used to locate and create NetworkTemplates
+
+%h3 NetworkTemplateCollection
+%ul
+  - @network_templates.network_templates.each do |template|
+    %li
+      %a{ :href => "/cimi/network_templates/#{template.href.split('/').last}"}=template.href.split('/').last
+
+-details 'NetworkTemplateCollection details' do
+  -row 'ID', @network_templates.id
+  -row 'Description', @network_templates.description
+  -row 'Created', @network_templates.created
diff --git a/clients/cimi/views/network_templates/show.haml b/clients/cimi/views/network_templates/show.haml
new file mode 100644
index 0000000..7977b74
--- /dev/null
+++ b/clients/cimi/views/network_templates/show.haml
@@ -0,0 +1,28 @@
+- @title="#{@network_template.name}"
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/network_templates"} NetworkTemplateCollection
+      %span.divider="/"
+    %li.active
+      = @network_template.name
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@network_template.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@network_template.id}?format=json", :class => 'label warning' } JSON
+%blockquote
+  %p
+    The Network Template is a set of configuration values for realizing a Network.
+    An instance of Network Template may be used to create multiple Networks
+
+-details 'NetworkConfiguration details' do
+  -row 'ID', @network_template.id
+  -row 'Description',@network_template.description
+  -row 'Created',@network_template.created
+  -row 'NetworkConfiguration', @network_template.network_config.href
+  -row 'RoutingGroup', @network_template.routing_group.href
diff --git a/clients/cimi/views/networks/show.haml b/clients/cimi/views/networks/show.haml
index 7aaf37e..8ec560a 100644
--- a/clients/cimi/views/networks/show.haml
+++ b/clients/cimi/views/networks/show.haml
@@ -27,6 +27,7 @@
   -row 'Created', @network.created
   -row 'State', @network.state
   -row 'Access', @network.access
+  -row 'RoutingGroup', @network.routing_group.href
   -row 'Bandwidth Limit', @network.bandwidth_limit
   -row 'Traffic Priority', @network.traffic_priority
   -row 'Maximum Traffic Delay', @network.max_traffic_delay
diff --git a/clients/cimi/views/routing_groups/index.haml b/clients/cimi/views/routing_groups/index.haml
new file mode 100644
index 0000000..0fde8b4
--- /dev/null
+++ b/clients/cimi/views/routing_groups/index.haml
@@ -0,0 +1,29 @@
+- @title=@routing_groups.description
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li.active
+      RoutingGroupCollection
+- content_for :actions do
+  %p
+    %a{ :href => "#{@routing_groups.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@routing_groups.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+  %p
+    A Routing Group Collection entity represents the collection of Routing Groups
+    within a Provider. This entity can be used to locate and create Routing Groups.
+
+%h3 RoutingGroupCollection
+%ul
+  - @routing_groups.routing_groups.each do |group|
+    %li
+      %a{ :href => "/cimi/routing_groups/#{group.href.split('/').last}"}=group.href.split('/').last
+
+-details 'RoutingGroupCollection details' do
+  -row 'ID', @routing_groups.id
+  -row 'Description', @routing_groups.description
+  -row 'Created', @routing_groups.created
diff --git a/clients/cimi/views/routing_groups/show.haml b/clients/cimi/views/routing_groups/show.haml
new file mode 100644
index 0000000..757de0b
--- /dev/null
+++ b/clients/cimi/views/routing_groups/show.haml
@@ -0,0 +1,29 @@
+- @title="#{@routing_group.name}"
+
+- content_for :breadcrumb do
+  %ul.breadcrumb
+    %li
+      %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+      %span.divider="/"
+    %li
+      %a{ :href => "/cimi/routing_groups"} RoutingGroupCollection
+      %span.divider="/"
+    %li.active
+      = @routing_group.name
+
+- content_for :actions do
+  %p
+    %a{ :href => "#{@routing_group.id}?format=xml", :class => 'label warning' } XML
+    %a{ :href => "#{@routing_group.id}?format=json", :class => 'label warning' } JSON
+%blockquote
+  %p
+    A Routing Group represents a collection of Networks that route to each other.
+
+-details 'RoutingGroup details' do
+  -row 'ID', @routing_group.id
+  -row 'Description',@routing_group.description
+  -row 'Created',@routing_group.created
+
+-details 'RoutingGroup Networks' do
+  -@routing_group.networks.each do |net|
+    -row 'ID', net.href
-- 
1.7.6.5