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/09/20 11:53:21 UTC

[PATCH 1/4] Adds Address collection support for Mock driver

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


Signed-off-by: marios <ma...@redhat.com>
---
 .../drivers/mock/data/addresses/192.168.0.1.yml    |  3 ++
 .../drivers/mock/data/addresses/192.168.0.2.yml    |  3 ++
 .../drivers/mock/data/addresses/192.168.0.3.yml    |  3 ++
 .../drivers/mock/data/addresses/192.168.0.4.yml    |  3 ++
 server/lib/deltacloud/drivers/mock/mock_driver.rb  | 62 ++++++++++++++++++++++
 5 files changed, 74 insertions(+)
 create mode 100644 server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml
 create mode 100644 server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml
 create mode 100644 server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml
 create mode 100644 server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml

diff --git a/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml
new file mode 100644
index 0000000..e34604a
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.1.yml
@@ -0,0 +1,3 @@
+---
+:id: 192.168.0.1
+:instance_id: 
diff --git a/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml
new file mode 100644
index 0000000..929c4cc
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.2.yml
@@ -0,0 +1,3 @@
+---
+:id: 192.168.0.2
+:instance_id: 
diff --git a/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml
new file mode 100644
index 0000000..9862f21
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.3.yml
@@ -0,0 +1,3 @@
+---
+:id: "192.168.0.3"
+:instance_id:
diff --git a/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml
new file mode 100644
index 0000000..64124f7
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/addresses/192.168.0.4.yml
@@ -0,0 +1,3 @@
+---
+:id: "192.168.0.4"
+:instance_id:
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver.rb b/server/lib/deltacloud/drivers/mock/mock_driver.rb
index b02e653..e765a9f 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver.rb
@@ -17,6 +17,7 @@
 require 'yaml'
 require 'base64'
 require 'etc'
+require 'ipaddr'
 
 require_relative 'mock_client'
 require_relative 'mock_driver_cimi_methods'
@@ -333,6 +334,48 @@ module Deltacloud::Drivers::Mock
       @client.destroy(:keys, key.id)
     end
 
+    def addresses(credentials, opts={})
+      check_credentials(credentials)
+      addresses = @client.build_all(Address)
+      addresses = filter_on( addresses, :id, opts )
+    end
+
+    def create_address(credentials, opts={})
+      check_credentials(credentials)
+      address = {:id => allocate_mock_address.to_s, :instance_id=>nil}
+      @client.store(:addresses, address)
+      Address.new(address)
+    end
+
+    def destroy_address(credentials, opts={})
+      check_credentials(credentials)
+      address = @client.load(:addresses, opts[:id])
+      raise "AddressInUse" unless address[:instance_id].nil?
+      @client.destroy(:addresses, opts[:id])
+    end
+
+    def associate_address(credentials, opts={})
+      check_credentials(credentials)
+      address = @client.load(:addresses, opts[:id])
+      raise "AddressInUse" unless address[:instance_id].nil?
+      instance = @client.load(:instances, opts[:instance_id])
+      address[:instance_id] = instance[:id]
+      instance[:public_addresses] = [InstanceAddress.new(address[:id])]
+      @client.store(:addresses, address)
+      @client.store(:instances, instance)
+    end
+
+    def disassociate_address(credentials, opts={})
+      check_credentials(credentials)
+      address = @client.load(:addresses, opts[:id])
+      raise "AddressNotInUse" unless address[:instance_id]
+      instance = @client.load(:instances, address[:instance_id])
+      address[:instance_id] = nil
+      instance[:public_addresses] = [InstanceAddress.new("#{instance[:image_id]}.#{instance[:id]}.public.com", :type => :hostname)]
+      @client.store(:addresses, address)
+      @client.store(:instances, instance)
+    end
+
     #--
     # Buckets
     #--
@@ -530,6 +573,17 @@ module Deltacloud::Drivers::Mock
       end
     end
 
+    #Mock allocation of 'new' address
+    #There is a synchronization problem (but it's the mock driver,
+    #mutex seemed overkill)
+    def allocate_mock_address
+      addresses = []
+      @client.members(:addresses).each do |addr|
+        addresses << IPAddr.new("#{addr}").to_i
+      end
+      IPAddr.new(addresses.sort.pop+1, Socket::AF_INET)
+    end
+
     def attach_volume_instance(volume_id, device, instance_id)
       volume = @client.load(:storage_volumes, volume_id)
       instance = @client.load(:instances, instance_id)
@@ -597,6 +651,14 @@ module Deltacloud::Drivers::Mock
         message "Key with same name already exists"
       end
 
+      on /AddressInUse/ do
+        status 403
+      end
+
+      on /AddressNotInUse/ do
+        status 403
+      end
+
       on /BucketNotExist/ do
         status 404
       end
-- 
1.7.11.4


Re: [PATCH 3/4] CIMI: Fixes/Updates Address entities

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2012-09-20 at 12:53 +0300, marios@redhat.com wrote:
> From: marios <ma...@redhat.com>
> 
> 
> Signed-off-by: marios <ma...@redhat.com>

NAK; there's a syntax error:

> diff --git a/server/lib/cimi/models/address.rb b/server/lib/cimi/models/address.rb
> index f9e10a1..861a466 100644
> --- a/server/lib/cimi/models/address.rb
> +++ b/server/lib/cimi/models/address.rb
>  
> @@ -69,4 +69,30 @@ class CIMI::Model::Address < CIMI::Model::Base
>      context.driver.delete_address(context.credentials, id)
>    end
>  
> +  private
> +
> +  def self.from_address(address, context)
> +    self.new(
> +      :name => address.id,
> +      :id => context.address_url(address.id),
> +      :description => "Address #{address.id}",
> +      :ip => address.id,
> +      :allocation => "dynamic", #or "static"
> +      :default_gateway => "unkown", #wtf
> +      :dns => "unknown", #wtf
> +      :protocol => protocol_from_address(address.id),
> +      :mask => "unknown",
> +      :resource => (address.instance_id) ? {:href=> context.machine_url(address.instance_id)} : nil,
> +      :network => nil, #unknown

The trailing ',' is not well-received by the Ruby interpreter.

David



[PATCH 3/4] CIMI: Fixes/Updates Address entities

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


Signed-off-by: marios <ma...@redhat.com>
---
 server/lib/cimi/collections/address_templates.rb   |  2 +-
 server/lib/cimi/models/address.rb                  | 34 +++++++++++++++++++---
 server/lib/cimi/models/address_collection.rb       | 11 ++++---
 server/lib/cimi/models/address_template.rb         |  2 --
 .../lib/cimi/models/address_template_collection.rb | 11 ++++---
 .../data/cimi/address_template/addr_template1.json |  3 +-
 .../data/cimi/address_template/addr_template2.json |  1 -
 7 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/server/lib/cimi/collections/address_templates.rb b/server/lib/cimi/collections/address_templates.rb
index 809fc82..ffe48c9 100644
--- a/server/lib/cimi/collections/address_templates.rb
+++ b/server/lib/cimi/collections/address_templates.rb
@@ -32,7 +32,7 @@ module CIMI::Collections
         end
       end
 
-      operation :show, :with_capability => :address_template do
+      operation :show, :with_capability => :address_templates do
         description 'Show a specific AddressTemplate'
         control do
           address_template = CIMI::Model::AddressTemplate.find(params[:id], self)
diff --git a/server/lib/cimi/models/address.rb b/server/lib/cimi/models/address.rb
index f9e10a1..861a466 100644
--- a/server/lib/cimi/models/address.rb
+++ b/server/lib/cimi/models/address.rb
@@ -25,8 +25,6 @@ class CIMI::Model::Address < CIMI::Model::Base
 
   text :dns
 
-  text :mac_address
-
   text :protocol
 
   text :mask
@@ -41,9 +39,11 @@ class CIMI::Model::Address < CIMI::Model::Base
 
   def self.find(id, context)
     if id==:all
-      context.driver.addresses(context.credentials, {:env=>context})
+      addresses = context.driver.addresses(context.credentials)
+      addresses.map{|addr| from_address(addr, context)}
     else
-      context.driver.addresses(context.credentials, {:id=>id, :env=>context})
+      address = context.driver.address(context.credentials, {:id=>id})
+      from_address(address, context)
     end
   end
 
@@ -69,4 +69,30 @@ class CIMI::Model::Address < CIMI::Model::Base
     context.driver.delete_address(context.credentials, id)
   end
 
+  private
+
+  def self.from_address(address, context)
+    self.new(
+      :name => address.id,
+      :id => context.address_url(address.id),
+      :description => "Address #{address.id}",
+      :ip => address.id,
+      :allocation => "dynamic", #or "static"
+      :default_gateway => "unkown", #wtf
+      :dns => "unknown", #wtf
+      :protocol => protocol_from_address(address.id),
+      :mask => "unknown",
+      :resource => (address.instance_id) ? {:href=> context.machine_url(address.instance_id)} : nil,
+      :network => nil, #unknown
+      #optional:
+      #:hostname =>
+      #:
+    )
+  end
+
+  def self.protocol_from_address(address)
+    addr = IPAddr.new(address)
+    addr.ipv4? ? "ipv4" : "ipv6"
+  end
+
 end
diff --git a/server/lib/cimi/models/address_collection.rb b/server/lib/cimi/models/address_collection.rb
index eef6c51..aa2597c 100644
--- a/server/lib/cimi/models/address_collection.rb
+++ b/server/lib/cimi/models/address_collection.rb
@@ -17,17 +17,20 @@ class CIMI::Model::AddressCollection < CIMI::Model::Base
 
   act_as_root_entity :address
 
-  array :addresses do
-    scalar :href
-  end
+  text :count
+
+  self << CIMI::Model::Address
+
 
   def self.default(context)
+    addresses = CIMI::Model::Address.all(context)
     self.new(
       :id => context.addresses_url,
       :name => 'default',
       :created => Time.now,
       :description => "#{context.driver.name.capitalize} AddressCollection",
-      :addresses => CIMI::Model::Address.all(context).map { |addr| { :href => addr.id } }
+      :count => addresses.count,
+      :addresses => addresses
     )
   end
 
diff --git a/server/lib/cimi/models/address_template.rb b/server/lib/cimi/models/address_template.rb
index 9d2c409..56c9902 100644
--- a/server/lib/cimi/models/address_template.rb
+++ b/server/lib/cimi/models/address_template.rb
@@ -25,8 +25,6 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
 
   text :dns
 
-  text :mac_address
-
   text :protocol
 
   text :mask
diff --git a/server/lib/cimi/models/address_template_collection.rb b/server/lib/cimi/models/address_template_collection.rb
index 3bb95cd..c952c37 100644
--- a/server/lib/cimi/models/address_template_collection.rb
+++ b/server/lib/cimi/models/address_template_collection.rb
@@ -17,17 +17,20 @@ class CIMI::Model::AddressTemplateCollection < CIMI::Model::Base
 
   act_as_root_entity :address_template
 
-  array :address_templates do
-    scalar :href
-  end
+  text :count
+
+  self << CIMI::Model::AddressTemplate
+
 
   def self.default(context)
+    address_templates = CIMI::Model::AddressTemplate.all(context)
     self.new(
       :id => context.address_templates_url,
       :name => 'default',
       :created => Time.now,
       :description => "#{context.driver.name.capitalize} AddressTemplateCollection",
-      :address_templates => CIMI::Model::AddressTemplate.all(context).map { |addr| { :href => addr.id } }
+      :count => address_templates.size,
+      :address_templates => address_templates
     )
   end
 
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template1.json b/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template1.json
index fd5140b..9853838 100644
--- a/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template1.json
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template1.json
@@ -4,10 +4,9 @@
   "created": "Tue Apr 03 10:34:45 EET 2012",
   "ip": "192.168.10.1",
   "hostname": "marios.local",
-  "allocation": "static",
+  "allocation": "dynamic",
   "defaultGateway": "192.168.0.1",
   "dns": "192.168.0.10",
-  "macAddress": "",
   "protocol": "IPv4",
   "mask": "255.255.0.0",
   "network": {"href": "http://cimi.example.org/networks/network1"},
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template2.json b/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template2.json
index f4bdb56..de6866f 100644
--- a/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template2.json
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/address_template/addr_template2.json
@@ -7,7 +7,6 @@
   "allocation": "static",
   "defaultGateway": "192.168.0.1",
   "dns": "192.168.0.10",
-  "macAddress": "",
   "protocol": "IPv4",
   "mask": "255.255.0.0",
   "network": {"href": "http://cimi.example.org/networks/network1"},
-- 
1.7.11.4


Re: [PATCH 4/4] CIMI: Fixes ForwardingGroup entities (was RoutingGroup)

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2012-09-20 at 12:53 +0300, marios@redhat.com wrote:
> From: marios <ma...@redhat.com>
> 

I get a test failure from rake test:cimi:models (probably best to look
into this after rebasing): 

test_0006_advertise only supported CIMI collections by
driver(CIMI::Collections::CloudEntryPoint)
[/homes/lutter/code/deltacloud/git/server/tests/cimi/collections/cloud_entry_point_test.rb:52]:
Expected [] to not be empty.

David



[PATCH 4/4] CIMI: Fixes ForwardingGroup entities (was RoutingGroup)

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


Signed-off-by: marios <ma...@redhat.com>
---
 .../cimi/collections/forwarding_group_templates.rb | 48 +++++++++++++++++++++
 server/lib/cimi/collections/forwarding_groups.rb   | 49 ++++++++++++++++++++++
 .../cimi/collections/routing_group_templates.rb    | 48 ---------------------
 server/lib/cimi/collections/routing_groups.rb      | 49 ----------------------
 server/lib/cimi/models.rb                          |  8 ++--
 server/lib/cimi/models/forwarding_group.rb         | 34 +++++++++++++++
 .../lib/cimi/models/forwarding_group_collection.rb | 36 ++++++++++++++++
 .../lib/cimi/models/forwarding_group_template.rb   | 34 +++++++++++++++
 .../models/forwarding_group_template_collection.rb | 37 ++++++++++++++++
 server/lib/cimi/models/routing_group.rb            | 34 ---------------
 server/lib/cimi/models/routing_group_collection.rb | 34 ---------------
 server/lib/cimi/models/routing_group_template.rb   | 34 ---------------
 .../models/routing_group_template_collection.rb    | 35 ----------------
 .../drivers/mock/data/cimi/address/address1.json   | 19 ---------
 .../drivers/mock/data/cimi/address/address2.json   | 19 ---------
 .../drivers/mock/data/cimi/address/address3.json   | 19 ---------
 .../mock/data/cimi/forwarding_group/group1.json    | 13 ++++++
 .../cimi/forwarding_group_template/template1.json  | 12 ++++++
 .../mock/data/cimi/routing_group/group1.json       | 13 ------
 .../cimi/routing_group_template/template1.json     | 12 ------
 .../drivers/mock/mock_driver_cimi_methods.rb       | 31 +++++++++-----
 21 files changed, 288 insertions(+), 330 deletions(-)
 create mode 100644 server/lib/cimi/collections/forwarding_group_templates.rb
 create mode 100644 server/lib/cimi/collections/forwarding_groups.rb
 delete mode 100644 server/lib/cimi/collections/routing_group_templates.rb
 delete mode 100644 server/lib/cimi/collections/routing_groups.rb
 create mode 100644 server/lib/cimi/models/forwarding_group.rb
 create mode 100644 server/lib/cimi/models/forwarding_group_collection.rb
 create mode 100644 server/lib/cimi/models/forwarding_group_template.rb
 create mode 100644 server/lib/cimi/models/forwarding_group_template_collection.rb
 delete mode 100644 server/lib/cimi/models/routing_group.rb
 delete mode 100644 server/lib/cimi/models/routing_group_collection.rb
 delete mode 100644 server/lib/cimi/models/routing_group_template.rb
 delete mode 100644 server/lib/cimi/models/routing_group_template_collection.rb
 delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json
 delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json
 delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json
 create mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json
 create mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json
 delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json
 delete mode 100644 server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json

diff --git a/server/lib/cimi/collections/forwarding_group_templates.rb b/server/lib/cimi/collections/forwarding_group_templates.rb
new file mode 100644
index 0000000..c4217a9
--- /dev/null
+++ b/server/lib/cimi/collections/forwarding_group_templates.rb
@@ -0,0 +1,48 @@
+# 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.
+
+module CIMI::Collections
+  class ForwardingGroupTemplates < Base
+
+    set :capability, lambda { |m| driver.respond_to? m }
+
+    collection :forwarding_group_templates do
+
+      operation :index, :with_capability => :forwarding_groups do
+        description 'List all ForwardingGroupTemplates in the ForwardingGroupTemplateCollection'
+        param :CIMISelect, :string, :optional
+        control do
+          forwarding_group_templates = ForwardingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect])
+          respond_to do |format|
+            format.xml {forwarding_group_templates.to_xml}
+            format.json {forwarding_group_templates.to_json}
+          end
+        end
+      end
+
+      operation :show, :with_capability => :forwarding_groups do
+        description 'Show a specific ForwardingGroupTemplate'
+        control do
+          forwarding_group_template = ForwardingGroupTemplate.find(params[:id], self)
+          respond_to do |format|
+            format.xml {forwarding_group_template.to_xml}
+            format.json {forwarding_group_template.to_json}
+          end
+        end
+      end
+    end
+
+  end
+end
diff --git a/server/lib/cimi/collections/forwarding_groups.rb b/server/lib/cimi/collections/forwarding_groups.rb
new file mode 100644
index 0000000..dd17fde
--- /dev/null
+++ b/server/lib/cimi/collections/forwarding_groups.rb
@@ -0,0 +1,49 @@
+# 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.
+
+module CIMI::Collections
+  class ForwardingGroups < Base
+
+    set :capability, lambda { |m| driver.respond_to? m }
+
+    collection :forwarding_groups do
+
+      operation :index, :with_capability => :forwarding_groups do
+        description 'List all ForwardingGroups in the ForwardingGroupsCollection'
+        param :CIMISelect, :string, :optional
+        control do
+          forwarding_groups = ForwardingGroupCollection.default(self).filter_by(params[:CIMISelect])
+          respond_to do |format|
+            format.xml {forwarding_groups.to_xml}
+            format.json {forwarding_groups.to_json}
+          end
+        end
+      end
+
+      operation :show, :with_capability => :forwarding_groups do
+        description 'Show a specific ForwardingGroup'
+        control do
+          forwarding_group = ForwardingGroup.find(params[:id], self)
+          respond_to do |format|
+            format.xml {forwarding_group.to_xml}
+            format.json {forwarding_group.to_json}
+          end
+        end
+      end
+
+    end
+
+  end
+end
diff --git a/server/lib/cimi/collections/routing_group_templates.rb b/server/lib/cimi/collections/routing_group_templates.rb
deleted file mode 100644
index d320d28..0000000
--- a/server/lib/cimi/collections/routing_group_templates.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# 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.
-
-module CIMI::Collections
-  class RoutingGroupTemplates < Base
-
-    set :capability, lambda { |m| driver.respond_to? m }
-
-    collection :routing_group_templates do
-
-      operation :index, :with_capability => :routing_groups do
-        description 'List all RoutingGroupTemplates in the RoutingGroupTemplateCollection'
-        param :CIMISelect, :string, :optional
-        control do
-          routing_group_templates = RoutingGroupTemplateCollection.default(self).filter_by(params[:CIMISelect])
-          respond_to do |format|
-            format.xml {routing_group_templates.to_xml}
-            format.json {routing_group_templates.to_json}
-          end
-        end
-      end
-
-      operation :show, :with_capability => :routing_group do
-        description 'Show a specific RoutingGroupTemplate'
-        control do
-          routing_group_template = RoutingGroupTemplate.find(params[:id], self)
-          respond_to do |format|
-            format.xml {routing_group_template.to_xml}
-            format.json {routing_group_template.to_json}
-          end
-        end
-      end
-    end
-
-  end
-end
diff --git a/server/lib/cimi/collections/routing_groups.rb b/server/lib/cimi/collections/routing_groups.rb
deleted file mode 100644
index 751290c..0000000
--- a/server/lib/cimi/collections/routing_groups.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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.
-
-module CIMI::Collections
-  class RoutingGroups < Base
-
-    set :capability, lambda { |m| driver.respond_to? m }
-
-    collection :routing_groups do
-
-      operation :index, :with_capability => :routing_groups do
-        description 'List all RoutingGroups in the RoutingGroupsCollection'
-        param :CIMISelect, :string, :optional
-        control do
-          routing_groups = RoutingGroupCollection.default(self).filter_by(params[:CIMISelect])
-          respond_to do |format|
-            format.xml {routing_groups.to_xml}
-            format.json {routing_groups.to_json}
-          end
-        end
-      end
-
-      operation :show, :with_capability => :routing_group do
-        description 'Show a specific RoutingGroup'
-        control do
-          routing_group = RoutingGroup.find(params[:id], self)
-          respond_to do |format|
-            format.xml {routing_group.to_xml}
-            format.json {routing_group.to_json}
-          end
-        end
-      end
-
-    end
-
-  end
-end
diff --git a/server/lib/cimi/models.rb b/server/lib/cimi/models.rb
index 333f5bd..e66021e 100644
--- a/server/lib/cimi/models.rb
+++ b/server/lib/cimi/models.rb
@@ -50,10 +50,10 @@ require_relative './models/network_configuration'
 require_relative './models/network_configuration_collection'
 require_relative './models/network_template'
 require_relative './models/network_template_collection'
-require_relative './models/routing_group'
-require_relative './models/routing_group_collection'
-require_relative './models/routing_group_template'
-require_relative './models/routing_group_template_collection'
+require_relative './models/forwarding_group'
+require_relative './models/forwarding_group_collection'
+require_relative './models/forwarding_group_template'
+require_relative './models/forwarding_group_template_collection'
 require_relative './models/network_port'
 require_relative './models/network_port_collection'
 require_relative './models/network_port_configuration'
diff --git a/server/lib/cimi/models/forwarding_group.rb b/server/lib/cimi/models/forwarding_group.rb
new file mode 100644
index 0000000..edc038d
--- /dev/null
+++ b/server/lib/cimi/models/forwarding_group.rb
@@ -0,0 +1,34 @@
+# 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::Model::ForwardingGroup < CIMI::Model::Base
+
+  array :networks do
+    scalar :href
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.forwarding_groups(context.credentials, {:env=>context})
+    else
+      context.driver.forwarding_groups(context.credentials, {:env=>context, :id=>id})
+    end
+  end
+
+end
diff --git a/server/lib/cimi/models/forwarding_group_collection.rb b/server/lib/cimi/models/forwarding_group_collection.rb
new file mode 100644
index 0000000..a54d5a7
--- /dev/null
+++ b/server/lib/cimi/models/forwarding_group_collection.rb
@@ -0,0 +1,36 @@
+# 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::Model::ForwardingGroupCollection < CIMI::Model::Base
+
+  act_as_root_entity :forwarding_group
+
+  text :count
+
+  self << CIMI::Model::ForwardingGroup
+
+  def self.default(context)
+    forwarding_groups = CIMI::Model::ForwardingGroup.all(context)
+    self.new(
+      :id => context.forwarding_groups_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} ForwardingGroupCollection",
+      :count => forwarding_groups.size,
+      :forwarding_groups => forwarding_groups
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/forwarding_group_template.rb b/server/lib/cimi/models/forwarding_group_template.rb
new file mode 100644
index 0000000..1c54d23
--- /dev/null
+++ b/server/lib/cimi/models/forwarding_group_template.rb
@@ -0,0 +1,34 @@
+# 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::Model::ForwardingGroupTemplate < CIMI::Model::Base
+
+  array :networks do
+    scalar :href
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.forwarding_group_templates(context.credentials, {:env=>context})
+    else
+      context.driver.forwarding_group_templates(context.credentials, {:env=>context, :id=>id})
+    end
+  end
+
+end
diff --git a/server/lib/cimi/models/forwarding_group_template_collection.rb b/server/lib/cimi/models/forwarding_group_template_collection.rb
new file mode 100644
index 0000000..f6d6a18
--- /dev/null
+++ b/server/lib/cimi/models/forwarding_group_template_collection.rb
@@ -0,0 +1,37 @@
+# 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::Model::ForwardingGroupTemplateCollection < CIMI::Model::Base
+
+  act_as_root_entity :forwarding_group_template
+
+  text :count
+
+  self << CIMI::Model::ForwardingGroupTemplate
+
+  def self.default(context)
+    fg_templates = CIMI::Model::ForwardingGroupTemplate.all(context)
+    self.new(
+      :id => context.forwarding_group_templates_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} ForwardingGroupTemplateCollection",
+      :count => fg_templates.size,
+      :forwarding_group_templates => fg_templates
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/routing_group.rb b/server/lib/cimi/models/routing_group.rb
deleted file mode 100644
index d26f4d7..0000000
--- a/server/lib/cimi/models/routing_group.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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::Model::RoutingGroup < CIMI::Model::Base
-
-  array :networks do
-    scalar :href
-  end
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.routing_groups(context.credentials, {:env=>context})
-    else
-      context.driver.routing_groups(context.credentials, {:env=>context, :id=>id})
-    end
-  end
-
-end
diff --git a/server/lib/cimi/models/routing_group_collection.rb b/server/lib/cimi/models/routing_group_collection.rb
deleted file mode 100644
index 285e164..0000000
--- a/server/lib/cimi/models/routing_group_collection.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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::Model::RoutingGroupCollection < CIMI::Model::Base
-
-  act_as_root_entity :routing_group
-
-  array :routing_groups do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.routing_groups_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} RoutingGroupCollection",
-      :routing_groups => CIMI::Model::RoutingGroup.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/models/routing_group_template.rb b/server/lib/cimi/models/routing_group_template.rb
deleted file mode 100644
index 204a353..0000000
--- a/server/lib/cimi/models/routing_group_template.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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::Model::RoutingGroupTemplate < CIMI::Model::Base
-
-  array :networks do
-    scalar :href
-  end
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.routing_group_templates(context.credentials, {:env=>context})
-    else
-      context.driver.routing_group_templates(context.credentials, {:env=>context, :id=>id})
-    end
-  end
-
-end
diff --git a/server/lib/cimi/models/routing_group_template_collection.rb b/server/lib/cimi/models/routing_group_template_collection.rb
deleted file mode 100644
index 61a4a68..0000000
--- a/server/lib/cimi/models/routing_group_template_collection.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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::Model::RoutingGroupTemplateCollection < CIMI::Model::Base
-
-  act_as_root_entity :routing_group_template
-
-  array :routing_group_templates do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.routing_group_templates_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} RoutingGroupTemplateCollection",
-      :routing_group_templates => CIMI::Model::RoutingGroupTemplate.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json b/server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json
deleted file mode 100644
index ccf0695..0000000
--- a/server/lib/deltacloud/drivers/mock/data/cimi/address/address1.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{ "id": "http://cimi.example.org/addresses/address1",
-  "name": "address1",
-  "description": "an IP address",
-  "created": "Wed Apr 04 11:59:15 EET 2012",
-  "ip": "192.168.10.1",
-  "hostname": "marios.local",
-  "allocation": "static",
-  "defaultGateway": "192.168.0.1",
-  "dns": "192.168.0.10",
-  "macAddress": "",
-  "protocol": "IPv4",
-  "mask": "255.255.0.0",
-  "network": {"href": "http://cimi.example.org/networks/network1"},
-  "resource": {},
-  "operations": [
-    { "rel": "edit", "href": "http://cimi.example.org/addresses/address1" },
-    { "rel": "delete", "href": "http://cimi.example.org/addresses/address1" }
-  ]
-}
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json b/server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json
deleted file mode 100644
index 13891eb..0000000
--- a/server/lib/deltacloud/drivers/mock/data/cimi/address/address2.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{ "id": "http://cimi.example.org/addresses/address2",
-  "name": "address2",
-  "description": "an IP address",
-  "created": "Thu Apr 05 12:57:59 EET 2012",
-  "ip": "192.168.10.2",
-  "hostname": "foo.bar",
-  "allocation": "static",
-  "defaultGateway": "192.168.0.1",
-  "dns": "192.168.0.10",
-  "macAddress": "",
-  "protocol": "IPv4",
-  "mask": "255.255.0.0",
-  "network": {"href": "http://cimi.example.org/networks/network1"},
-  "resource": {},
-  "operations": [
-    { "rel": "edit", "href": "http://cimi.example.org/addresses/address2" },
-    { "rel": "delete", "href": "http://cimi.example.org/addresses/address2" }
-  ]
-}
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json b/server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json
deleted file mode 100644
index 6dc72cb..0000000
--- a/server/lib/deltacloud/drivers/mock/data/cimi/address/address3.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{ "id": "http://cimi.example.org/addresses/address3",
-  "name": "address3",
-  "description": "an IP address",
-  "created": "Wed Apr 04 11:59:15 EET 2012",
-  "ip": "192.168.10.3",
-  "hostname": "jsmith.local",
-  "allocation": "static",
-  "defaultGateway": "192.168.0.1",
-  "dns": "192.168.0.10",
-  "macAddress": "",
-  "protocol": "IPv4",
-  "mask": "255.255.0.0",
-  "network": {"href": "http://cimi.example.org/networks/network1"},
-  "resource": {},
-  "operations": [
-    { "rel": "edit", "href": "http://cimi.example.org/addresses/address3" },
-    { "rel": "delete", "href": "http://cimi.example.org/addresses/address3" }
-  ]
-}
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json
new file mode 100644
index 0000000..e10e0bd
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group/group1.json
@@ -0,0 +1,13 @@
+{ "id": "http://cimi.example.org/routing_groups/group1",
+  "name": "group1",
+  "description": "a mock routing group",
+  "created": "Thu Jan 12 16:02:56 EET 2012",
+  "networks": [
+    { "href": "http://cimi.example.org/networks/network1"},
+    { "href": "http://cimi.example.org/networks/network2"}
+  ],
+  "operations": [
+    { "rel": "edit", "href": "http://cimi.example.org/routing_groups/group1" },
+    { "rel": "delete", "href": "http://cimi.example.org/routing_groups/group1" }
+  ]
+}
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json
new file mode 100644
index 0000000..adbe645
--- /dev/null
+++ b/server/lib/deltacloud/drivers/mock/data/cimi/forwarding_group_template/template1.json
@@ -0,0 +1,12 @@
+{ "id": "http://cimi.example.org/routing_group_templates/template1",
+  "name": "template1",
+  "description": "A mock routing group template",
+  "created": "Fri Mar 16 16:42:50 EET 2012",
+  "networks": [
+    { "href": "http://cimi.example.org/networks/network1"},
+    { "href": "http://cimi.example.org/networks/network2"}
+  ],
+  "operations": [
+    { "rel": "edit", "href": "http://cimi.example.org/routing_group_templates/template1" },
+    { "rel": "delete", "href": "http://cimi.example.org/routing_group_templates/template1" }]
+}
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json b/server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json
deleted file mode 100644
index e10e0bd..0000000
--- a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group/group1.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{ "id": "http://cimi.example.org/routing_groups/group1",
-  "name": "group1",
-  "description": "a mock routing group",
-  "created": "Thu Jan 12 16:02:56 EET 2012",
-  "networks": [
-    { "href": "http://cimi.example.org/networks/network1"},
-    { "href": "http://cimi.example.org/networks/network2"}
-  ],
-  "operations": [
-    { "rel": "edit", "href": "http://cimi.example.org/routing_groups/group1" },
-    { "rel": "delete", "href": "http://cimi.example.org/routing_groups/group1" }
-  ]
-}
diff --git a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json b/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json
deleted file mode 100644
index adbe645..0000000
--- a/server/lib/deltacloud/drivers/mock/data/cimi/routing_group_template/template1.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{ "id": "http://cimi.example.org/routing_group_templates/template1",
-  "name": "template1",
-  "description": "A mock routing group template",
-  "created": "Fri Mar 16 16:42:50 EET 2012",
-  "networks": [
-    { "href": "http://cimi.example.org/networks/network1"},
-    { "href": "http://cimi.example.org/networks/network2"}
-  ],
-  "operations": [
-    { "rel": "edit", "href": "http://cimi.example.org/routing_group_templates/template1" },
-    { "rel": "delete", "href": "http://cimi.example.org/routing_group_templates/template1" }]
-}
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index 3431e51..336f77b 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -53,25 +53,25 @@ module Deltacloud::Drivers::Mock
       end
     end
 
-    def routing_groups(credentials, opts={})
+    def forwarding_groups(credentials, opts={})
       check_credentials(credentials)
       if opts[:id].nil?
-        routing_groups = @client.load_all_cimi(:routing_group).map{|rg| CIMI::Model::RoutingGroup.from_json(rg)}
-        routing_groups.map{|rg|convert_cimi_mock_urls(:routing_group, rg, opts[:env])}.flatten
+        forwarding_groups = @client.load_all_cimi(:forwarding_group).map{|fg| CIMI::Model::ForwardingGroup.from_json(fg)}
+        forwarding_groups.map{|fg|convert_cimi_mock_urls(:forwarding_group, fg, opts[:env])}.flatten
       else
-        routing_group = CIMI::Model::RoutingGroup.from_json(@client.load_cimi(:routing_group, opts[:id]))
-        convert_cimi_mock_urls(:routing_group, routing_group, opts[:env])
+        forwarding_group = CIMI::Model::ForwardingGroup.from_json(@client.load_cimi(:forwarding_group, opts[:id]))
+        convert_cimi_mock_urls(:forwarding_group, forwarding_group, opts[:env])
       end
     end
 
-    def routing_group_templates(credentials, opts={})
+    def forwarding_group_templates(credentials, opts={})
       check_credentials(credentials)
       if opts[:id].nil?
-        routing_group_templates = @client.load_all_cimi(:routing_group_template).map{|rg_templ| CIMI::Model::RoutingGroupTemplate.from_json(rg_templ)}
-        routing_group_templates.map{|rg_templ|convert_cimi_mock_urls(:routing_group_template, rg_templ, opts[:env])}.flatten
+        forwarding_group_templates = @client.load_all_cimi(:forwarding_group_template).map{|fg_templ| CIMI::Model::ForwardingGroupTemplate.from_json(fg_templ)}
+        forwarding_group_templates.map{|fg_templ|convert_cimi_mock_urls(:forwarding_group_template, fg_templ, opts[:env])}.flatten
       else
-        routing_group_template = CIMI::Model::RoutingGroupTemplate.from_json(@client.load_cimi(:routing_group_template, opts[:id]))
-        convert_cimi_mock_urls(:routing_group_template, routing_group_template, opts[:env])
+        forwarding_group_template = CIMI::Model::ForwardingGroupTemplate.from_json(@client.load_cimi(:forwarding_group_template, opts[:id]))
+        convert_cimi_mock_urls(:forwarding_group_template, forwarding_group_template, opts[:env])
       end
     end
 
@@ -108,6 +108,17 @@ module Deltacloud::Drivers::Mock
       end
     end
 
+    def address_templates(credentials, opts={})
+      check_credentials(credentials)
+      if opts[:id].nil?
+        address_templates = @client.load_all_cimi(:address_template).map{|addr_templ| CIMI::Model::AddressTemplate.from_json(addr_templ)}
+        address_templates.map{|addr_templ|convert_cimi_mock_urls(:address_template, addr_templ, opts[:env])}.flatten
+      else
+        address_template = CIMI::Model::AddressTemplate.from_json(@client.load_cimi(:address_template, opts[:id]))
+        convert_cimi_mock_urls(:address_template, address_template, opts[:env])
+      end
+    end
+
     private
 
     def convert_cimi_mock_urls(model_name, cimi_object, context)
-- 
1.7.11.4


Re: [PATCH 1/4] Adds Address collection support for Mock driver

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2012-09-20 at 12:53 +0300, marios@redhat.com wrote:
> From: marios <ma...@redhat.com>
> 
> 
> Signed-off-by: marios <ma...@redhat.com>

ACK (though you need to rebase this series on top of latest master,
because of hte patches I just pushed. I applied them to 7b2ef712 for
testing)

David



Re: [PATCH 2/4] Tidy up - move 'address' method (singular) to base driver

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2012-09-20 at 12:53 +0300, marios@redhat.com wrote:
> From: marios <ma...@redhat.com>

ACK



[PATCH 2/4] Tidy up - move 'address' method (singular) to base driver

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


Signed-off-by: marios <ma...@redhat.com>
---
 server/lib/deltacloud/drivers/aruba/aruba_driver.rb | 5 -----
 server/lib/deltacloud/drivers/base_driver.rb        | 5 +++++
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb     | 4 ----
 server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb   | 4 ----
 4 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/server/lib/deltacloud/drivers/aruba/aruba_driver.rb b/server/lib/deltacloud/drivers/aruba/aruba_driver.rb
index 12698db..adfa092 100644
--- a/server/lib/deltacloud/drivers/aruba/aruba_driver.rb
+++ b/server/lib/deltacloud/drivers/aruba/aruba_driver.rb
@@ -248,11 +248,6 @@ class ArubaDriver < Deltacloud::BaseDriver
     end
   end
 
-  def address(credentials, opts={})
-    addrs = addresses(credentials, opts)
-    filter_on(addrs, :id, opts).first
-  end
-
   def create_address(credentials, opts={})
     client = new_client(credentials)
     safely do
diff --git a/server/lib/deltacloud/drivers/base_driver.rb b/server/lib/deltacloud/drivers/base_driver.rb
index 3b37721..068ff59 100644
--- a/server/lib/deltacloud/drivers/base_driver.rb
+++ b/server/lib/deltacloud/drivers/base_driver.rb
@@ -255,6 +255,11 @@ module Deltacloud
       firewalls(credentials, opts).first if has_capability?(:firewalls)
     end
 
+    def address(credentials, opts={})
+      addresses(credentials, opts).first if has_capability?(:addresses)
+    end
+
+
     MEMBER_SHOW_METHODS = [ :realm, :image, :instance, :storage_volume, :bucket, :blob,
                             :key, :firewall ] unless defined?(MEMBER_SHOW_METHODS)
 
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 265e231..c7bed05 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -697,10 +697,6 @@ module Deltacloud
           end
         end
 
-        def address(credentials, opts={})
-          addresses(credentials, :id => opts[:id]).first
-        end
-
         def create_address(credentials, opts={})
           ec2 = new_client(credentials)
           safely do
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
index 18a1e76..666de0c 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb
@@ -678,10 +678,6 @@ class FgcpDriver < Deltacloud::BaseDriver
     addresses
   end
 
-  def address(credentials, opts={})
-    addresses(credentials, opts).first
-  end
-
   def create_address(credentials, opts={})
     safely do
       client = new_client(credentials)
-- 
1.7.11.4