From: NjeriChelimo <[email protected]>
---
clients/cimi/app.rb | 1 +
clients/cimi/lib/entities.rb | 1 +
clients/cimi/lib/entities/network_port.rb | 30 +++++++++++++++++++++++++++
clients/cimi/views/network_ports/index.haml | 23 ++++++++++++++++++++
clients/cimi/views/network_ports/show.haml | 26 +++++++++++++++++++++++
5 files changed, 81 insertions(+)
create mode 100644 clients/cimi/lib/entities/network_port.rb
create mode 100644 clients/cimi/views/network_ports/index.haml
create mode 100644 clients/cimi/views/network_ports/show.haml
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index e26f2b9..f7b133e 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -31,6 +31,7 @@ module CIMI::Frontend
use CIMI::Frontend::Network
use CIMI::Frontend::NetworkConfiguration
use CIMI::Frontend::NetworkTemplate
+ use CIMI::Frontend::NetworkPort
use CIMI::Frontend::RoutingGroup
use CIMI::Frontend::RoutingGroupTemplate
use CIMI::Frontend::VSP
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 3442360..91b95c3 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -30,6 +30,7 @@ require 'entities/volume_image'
require 'entities/volume'
require 'entities/network'
require 'entities/network_configuration'
+require 'entities/network_port'
require 'entities/network_template'
require 'entities/routing_group'
require 'entities/routing_group_template'
diff --git a/clients/cimi/lib/entities/network_port.rb
b/clients/cimi/lib/entities/network_port.rb
new file mode 100644
index 0000000..3e823ad
--- /dev/null
+++ b/clients/cimi/lib/entities/network_port.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::NetworkPort < CIMI::Frontend::Entity
+
+ get '/cimi/network_ports/:id' do
+ network_port_xml = get_entity('network_ports', params[:id], credentials)
+ @network_port = CIMI::Model::NetworkPort.from_xml(network_port_xml)
+ haml :'network_ports/show'
+ end
+
+ get '/cimi/network_ports' do
+ network_ports_xml = get_entity_collection('network_ports', credentials)
+ @network_ports =
CIMI::Model::NetworkPortCollection.from_xml(network_ports_xml)
+ haml :'network_ports/index'
+ end
+
+end
diff --git a/clients/cimi/views/network_ports/index.haml
b/clients/cimi/views/network_ports/index.haml
new file mode 100644
index 0000000..2deb64d
--- /dev/null
+++ b/clients/cimi/views/network_ports/index.haml
@@ -0,0 +1,23 @@
+- @title=collection_name @network_ports
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ NetworkPortCollection
+
+- content_for :actions do
+ %p
+ %a{ :href => "#{@network_ports.id}?format=xml", :class => 'label warning'
} XML
+ %a{ :href => "#{@network_ports.id}?format=json", :class => 'label warning'
} JSON
+
+%ul
+ - @network_ports.network_ports.each do |port|
+ %li
+ %a{ :href =>
"/cimi/network_ports/#{href_to_id(port.id)}"}=href_to_id(port.id)
+
+-details do
+ -row 'ID', @network_ports.id
+ -row 'Count', @network_ports.count
diff --git a/clients/cimi/views/network_ports/show.haml
b/clients/cimi/views/network_ports/show.haml
new file mode 100644
index 0000000..8682c43
--- /dev/null
+++ b/clients/cimi/views/network_ports/show.haml
@@ -0,0 +1,26 @@
+- @title="#{@network_port.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/network_ports"} NetworkPortCollection
+ %span.divider="/"
+ %li.active
+ = @network_port.name
+
+- content_for :actions do
+ %p
+ %a{ :href => "#{@network_port.id}?format=xml", :class => 'label warning' }
XML
+ %a{ :href => "#{@network_port.id}?format=json", :class => 'label warning'
} JSON
+
+-details do
+ -row 'ID', @network_port.id
+ -row 'Name',@network_port.name
+ -row 'Description',@network_port.description
+ -row 'Created',@network_port.created
+ -row 'State',@network_port.state
+ -row 'Port Type',@network_port.port_type
+ -row 'State',@network_port.state
--
1.7.9.5