You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2013/03/14 19:19:04 UTC

[5/15] git commit: CIMI: Migrated service methods from CIMI::Model to CIMI::Service

CIMI: Migrated service methods from CIMI::Model to CIMI::Service


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

Branch: refs/heads/master
Commit: fa200948caef8408bac1e2cc31e3ad6f3617a790
Parents: 874bbf9
Author: Michal Fojtik <mf...@redhat.com>
Authored: Fri Mar 1 14:26:14 2013 +0100
Committer: David Lutterkort <lu...@redhat.com>
Committed: Wed Mar 13 17:28:13 2013 -0700

----------------------------------------------------------------------
 server/lib/cimi/models/action.rb                   |    4 -
 server/lib/cimi/models/address.rb                  |   38 -----
 server/lib/cimi/models/address_create.rb           |   31 ----
 server/lib/cimi/models/address_template.rb         |   47 ------
 server/lib/cimi/models/address_template_create.rb  |   16 --
 server/lib/cimi/models/cloud_entry_point.rb        |   28 ----
 server/lib/cimi/models/credential.rb               |   34 -----
 server/lib/cimi/models/credential_create.rb        |   26 ----
 server/lib/cimi/models/credential_template.rb      |    2 -
 server/lib/cimi/models/disk.rb                     |   56 --------
 server/lib/cimi/models/forwarding_group.rb         |    8 -
 .../lib/cimi/models/forwarding_group_template.rb   |    8 -
 server/lib/cimi/models/machine_configuration.rb    |   31 ----
 server/lib/cimi/models/machine_create.rb           |   30 +----
 server/lib/cimi/models/machine_image_create.rb     |   19 ---
 server/lib/cimi/models/machine_template.rb         |   35 -----
 server/lib/cimi/models/machine_template_create.rb  |   12 --
 server/lib/cimi/models/machine_volume.rb           |   65 ---------
 server/lib/cimi/models/network.rb                  |   32 ----
 server/lib/cimi/models/network_configuration.rb    |   15 --
 server/lib/cimi/models/network_create.rb           |   23 ---
 server/lib/cimi/models/network_port.rb             |   73 ----------
 .../lib/cimi/models/network_port_configuration.rb  |    8 -
 server/lib/cimi/models/network_port_template.rb    |    8 -
 server/lib/cimi/models/network_template.rb         |   10 --
 server/lib/cimi/models/resource_metadata.rb        |   90 +------------
 server/lib/cimi/models/system.rb                   |   52 ++-----
 server/lib/cimi/models/system_template.rb          |   44 ++----
 server/lib/cimi/models/volume.rb                   |   59 --------
 server/lib/cimi/models/volume_configuration.rb     |   63 --------
 server/lib/cimi/models/volume_create.rb            |   38 -----
 server/lib/cimi/models/volume_image.rb             |   30 ----
 server/lib/cimi/models/volume_image_create.rb      |   25 ----
 server/lib/cimi/models/volume_template.rb          |   41 ------
 server/lib/cimi/models/volume_template_create.rb   |   12 --
 server/lib/cimi/service.rb                         |   35 +++++
 server/lib/cimi/service/action.rb                  |   21 +++
 server/lib/cimi/service/address.rb                 |   56 ++++++++
 server/lib/cimi/service/address_create.rb          |   45 ++++++
 server/lib/cimi/service/address_template.rb        |   71 +++++++++
 server/lib/cimi/service/address_template_create.rb |   34 +++++
 server/lib/cimi/service/cloud_entry_point.rb       |   46 ++++++
 server/lib/cimi/service/credential.rb              |   52 +++++++
 server/lib/cimi/service/credential_create.rb       |   38 +++++
 server/lib/cimi/service/credential_template.rb     |   20 +++
 server/lib/cimi/service/disk.rb                    |   80 +++++++++++
 server/lib/cimi/service/forwarding_group.rb        |   26 ++++
 .../lib/cimi/service/forwarding_group_template.rb  |   26 ++++
 server/lib/cimi/service/machine.rb                 |   14 +-
 server/lib/cimi/service/machine_configuration.rb   |   54 +++++++
 server/lib/cimi/service/machine_create.rb          |   49 +++++++
 server/lib/cimi/service/machine_image.rb           |    6 +-
 server/lib/cimi/service/machine_image_create.rb    |   35 +++++
 server/lib/cimi/service/machine_template.rb        |   61 ++++++++
 server/lib/cimi/service/machine_template_create.rb |   29 ++++
 server/lib/cimi/service/machine_volume.rb          |   74 ++++++++++
 server/lib/cimi/service/network.rb                 |   51 +++++++
 server/lib/cimi/service/network_configuration.rb   |   36 +++++
 server/lib/cimi/service/network_create.rb          |   39 +++++
 server/lib/cimi/service/network_port.rb            |   97 +++++++++++++
 .../lib/cimi/service/network_port_configuration.rb |   26 ++++
 server/lib/cimi/service/network_port_template.rb   |   26 ++++
 server/lib/cimi/service/network_template.rb        |   28 ++++
 server/lib/cimi/service/resource_metadata.rb       |  110 +++++++++++++++
 server/lib/cimi/service/system.rb                  |   45 ++++++
 server/lib/cimi/service/system_template.rb         |   32 ++++
 server/lib/cimi/service/volume.rb                  |   81 +++++++++++
 server/lib/cimi/service/volume_configuration.rb    |   92 ++++++++++++
 server/lib/cimi/service/volume_create.rb           |   47 ++++++
 server/lib/cimi/service/volume_image.rb            |   44 ++++++
 server/lib/cimi/service/volume_image_create.rb     |   42 ++++++
 server/lib/cimi/service/volume_template.rb         |   61 ++++++++
 server/lib/cimi/service/volume_template_create.rb  |   29 ++++
 73 files changed, 1779 insertions(+), 1092 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/action.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/action.rb b/server/lib/cimi/models/action.rb
index c1c9908..c83913e 100644
--- a/server/lib/cimi/models/action.rb
+++ b/server/lib/cimi/models/action.rb
@@ -17,8 +17,4 @@ class CIMI::Model::Action < CIMI::Model::Base
 
   text :action
 
-  def name
-    action.split('/').last.strip.intern
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/address.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/address.rb b/server/lib/cimi/models/address.rb
index 57e8be1..453e688 100644
--- a/server/lib/cimi/models/address.rb
+++ b/server/lib/cimi/models/address.rb
@@ -39,42 +39,4 @@ class CIMI::Model::Address < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id==:all
-      addresses = context.driver.addresses(context.credentials)
-      addresses.map{|addr| from_address(addr, context)}
-    else
-      address = context.driver.address(context.credentials, {:id=>id})
-      from_address(address, context)
-    end
-  end
-
-  def self.delete!(id, context)
-    context.driver.delete_address(context.credentials, id)
-    new(:id => id).destroy
-  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",
-      :default_gateway => "unknown",
-      :dns => "unknown",
-      :protocol => protocol_from_address(address.id),
-      :mask => "unknown",
-      :resource => (address.instance_id) ? {:href=> context.machine_url(address.instance_id)} : nil,
-      :network => nil
-    )
-  end
-
-  def self.protocol_from_address(address)
-    addr = IPAddr.new(address)
-    addr.ipv4? ? "ipv4" : "ipv6"
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/address_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/address_create.rb b/server/lib/cimi/models/address_create.rb
index cf321ce..ffa08c4 100644
--- a/server/lib/cimi/models/address_create.rb
+++ b/server/lib/cimi/models/address_create.rb
@@ -17,35 +17,4 @@ class CIMI::Model::AddressCreate < CIMI::Model::Base
 
   ref :address_template, :required => true
 
-  def create(context)
-    validate!
-
-    if address_template.href?
-      template = address_template.find(context)
-    end
-
-    params = {
-      :name => name,
-      :description => description,
-      :address_template => template,
-      :env => context # FIXME: We should not pass the context to the driver (!)
-    }
-
-    unless context.driver.respond_to? :create_address
-       raise Deltacloud::Exceptions.exception_from_status(
-         501,
-         "Creating Address is not supported by the current driver"
-       )
-    end
-
-    address = context.driver.create_address(context.credentials, params)
-
-    result = CIMI::Model::Address.from_address(address, context)
-    result.name = name if name
-    result.description = description if description
-    result.property = property if property
-    result.save
-    result
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/address_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/address_template.rb b/server/lib/cimi/models/address_template.rb
index 9b5000b..bc66ccc 100644
--- a/server/lib/cimi/models/address_template.rb
+++ b/server/lib/cimi/models/address_template.rb
@@ -24,51 +24,4 @@ class CIMI::Model::AddressTemplate < CIMI::Model::Base
   array :operations do
     scalar :rel, :href
   end
-
-  def self.find(id, context)
-    if id==:all
-      if context.driver.respond_to? :address_templates
-        context.driver.address_templates(context.credentials, {:env=>context})
-      else
-        current_db.address_templates.map { |t| from_db(t, context) }
-      end
-    else
-      if context.driver.respond_to? :address_templates
-        context.driver.address_templates(context.credentials, {:id=>id, :env=>context})
-      else
-        template = current_db.address_templates_dataset.first(:id => id)
-        raise CIMI::Model::NotFound unless template
-        from_db(template, context)
-      end
-    end
-  end
-
-  def self.delete!(id, context)
-    current_db.address_templates.first(:id => id).destroy
-  end
-
-  private
-
-  def self.from_db(model, context)
-    self.new(
-      :id => context.address_template_url(model.id),
-      :name => model.name,
-      :description => model.description,
-      :ip => model.ip,
-      :hostname => model.hostname,
-      :allocation => model.allocation,
-      :default_gateway => model.default_gateway,
-      :dns => model.dns,
-      :protocol => model.protocol,
-      :mask => model.mask,
-      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
-      :operations => [
-        {
-          :href => context.destroy_address_template_url(model.id),
-          :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
-        }
-      ]
-    )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/address_template_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/address_template_create.rb b/server/lib/cimi/models/address_template_create.rb
index e9ce3d3..601154d 100644
--- a/server/lib/cimi/models/address_template_create.rb
+++ b/server/lib/cimi/models/address_template_create.rb
@@ -25,20 +25,4 @@ class CIMI::Model::AddressTemplateCreate < CIMI::Model::Base
 
   href :network
 
-  def create(context)
-    validate!
-    new_template = context.current_db.add_address_template(
-      :name => name,
-      :description => description,
-      :hostname => hostname,
-      :ip => ip,
-      :allocation => allocation,
-      :default_gateway => default_gateway,
-      :dns => dns,
-      :protocol => protocol,
-      :mask => mask,
-      :ent_properties => property.to_json
-    )
-    CIMI::Model::AddressTemplate.from_db(new_template, context)
-  end
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/cloud_entry_point.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/cloud_entry_point.rb b/server/lib/cimi/models/cloud_entry_point.rb
index 6c28e53..a016004 100644
--- a/server/lib/cimi/models/cloud_entry_point.rb
+++ b/server/lib/cimi/models/cloud_entry_point.rb
@@ -37,34 +37,6 @@ class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
     href coll.underscore
   end
 
-  def self.create(context)
-    self.new(entities(context).merge({
-      :name => context.driver.name,
-      :description => "Cloud Entry Point for the Deltacloud #{context.driver.name} driver",
-      :driver => context.driver.name,
-      :provider => context.current_provider,
-      :id => context.cloudEntryPoint_url,
-      :base_uri => context.base_uri + "/",
-      :created => Time.now.xmlschema
-    }))
-  end
-
-  # Return an Hash of the CIMI root entities used in CloudEntryPoint
-  def self.entities(context)
-    CIMI::Collections.modules(:cimi).inject({}) do |supported_entities, m|
-      m.collections.each do |c|
-        index_operation_capability = c.operation(:index).required_capability
-        next if m.settings.respond_to?(:capability) and !m.settings.capability(index_operation_capability)
-        supported_entities[c.collection_name.to_s] = { :href => context.send(:"#{c.collection_name}_url") }
-      end
-      supported_entities
-    end
-  end
-
-  def entities
-    @attribute_values.clone.delete_if { |key, value| !value.respond_to? :href }
-  end
-
   private
 
   def self.href_defined?(resource)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/credential.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/credential.rb b/server/lib/cimi/models/credential.rb
index 872248f..e16d64a 100644
--- a/server/lib/cimi/models/credential.rb
+++ b/server/lib/cimi/models/credential.rb
@@ -25,38 +25,4 @@ class CIMI::Model::Credential < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id == :all
-      return [] unless context.driver.respond_to?(:keys)
-      keys = context.driver.keys(context.credentials)
-      keys.map { |key| from_key(key, context) }
-    else
-      key = context.driver.key(context.credentials, :id => id)
-      from_key(key, context)
-    end
-  end
-
-  def self.create_from_xml(body, context)
-    credential = Credential.from_xml(body)
-    key = context.driver.create_key(context.credentials, :key_name => credential.name)
-    from_key(key, context)
-  end
-
-  def self.delete!(id, context)
-    context.driver.destroy_key(context.credentials, :id => id)
-  end
-
-  private
-
-  def self.from_key(key, context)
-    self.new(
-      :name => key.id,
-      :username => key.username,
-      :password => key.is_password? ? key.password : key.fingerprint,
-      :key => key.is_key? ? key.pem_rsa_key : nil,
-      :id => context.credential_url(key.id),
-      :created => Time.now.xmlschema
-    )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/credential_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/credential_create.rb b/server/lib/cimi/models/credential_create.rb
index 6479769..c02d68e 100644
--- a/server/lib/cimi/models/credential_create.rb
+++ b/server/lib/cimi/models/credential_create.rb
@@ -17,30 +17,4 @@ class CIMI::Model::CredentialCreate < CIMI::Model::Base
 
   ref :credential_template, :required => true
 
-  def create(context)
-    validate!
-
-    unless context.driver.respond_to? :create_key
-       raise Deltacloud::Exceptions.exception_from_status(
-         501,
-         "Creating Credential is not supported by the current driver"
-       )
-    end
-
-    if credential_template.href?
-      template = credential_template.find(ctx)
-    else
-      template = credential_template
-    end
-
-    key = context.driver.create_key(context.credentials, :key_name => name)
-
-    result = CIMI::Model::Credential.from_key(key, context)
-    result.name = name if name
-    result.description = description if description
-    result.property = property if property
-    result.save
-    result
-
-  end
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/credential_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/credential_template.rb b/server/lib/cimi/models/credential_template.rb
index 1148c42..c263cef 100644
--- a/server/lib/cimi/models/credential_template.rb
+++ b/server/lib/cimi/models/credential_template.rb
@@ -19,6 +19,4 @@ class CIMI::Model::CredentialTemplate < CIMI::Model::Base
   text :password, :required => true
   text :key, :required => true
 
-  # TODO: tbd
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/disk.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/disk.rb b/server/lib/cimi/models/disk.rb
index c725721..b358568 100644
--- a/server/lib/cimi/models/disk.rb
+++ b/server/lib/cimi/models/disk.rb
@@ -22,60 +22,4 @@ class CIMI::Model::Disk < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(instance, machine_config, context, id=:all)
-    if id == :all
-      name = instance.id+"_disk_" #assuming one disk for now...
-
-      if machine_config
-        mach_config_disks = machine_config.disks
-        return mach_config_disks.map do |d|
-          self.new(
-            :id => context.machine_url(instance.id) + "/disks/#{name}#{d[:capacity]}",
-            :name => "#{name}#{d[:capacity]}",
-            :description => "Disk for Machine #{instance.id}",
-            :created => instance.launch_time.nil? ? Time.now.xmlschema : Time.parse(instance.launch_time).xmlschema,
-            :capacity => d[:capacity]
-          )
-        end
-      else
-        if instance.instance_profile.override? :storage
-          capacity = context.to_kibibyte(instance.instance_profile.storage, 'MB')
-        else
-          hw_profile = context.driver.hardware_profile(context.credentials, :id => instance.instance_profile.name)
-          if hw_profile.storage
-            capacity = context.to_kibibyte(hw_profile.storage.value, 'MB')
-          end
-        end
-
-        return [] unless capacity
-
-        [self.new(
-          :id => context.machine_url(instance.id)+"/disks/#{name}#{capacity}",
-          :name => name + capacity.to_s,
-          :description => "Disk for Machine #{instance.id}",
-          :created => instance.launch_time.nil? ? Time.now.xmlschema : Time.parse(instance.launch_time).xmlschema,
-          :capacity => capacity
-        )]
-      end
-    else
-    end
-  end
-
-  def self.collection_for_instance(instance_id, context)
-    instance = context.driver.instance(context.credentials, :id => instance_id)
-    disks = find(instance, nil, context)
-    unless CIMI::Model.const_defined?('DiskCollection')
-      collection_class = CIMI::Model::Collection.generate(self)
-    else
-      collection_class = CIMI::Model::DiskCollection
-    end
-    collection_class.new(
-      :id => context.url("/machines/#{instance_id}/disks"),
-      :name => 'default',
-      :count => disks.size,
-      :description => "Disk collection for Machine #{instance_id}",
-      :entries => disks
-    )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/forwarding_group.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/forwarding_group.rb b/server/lib/cimi/models/forwarding_group.rb
index 221c0b2..ea55de5 100644
--- a/server/lib/cimi/models/forwarding_group.rb
+++ b/server/lib/cimi/models/forwarding_group.rb
@@ -25,12 +25,4 @@ class CIMI::Model::ForwardingGroup < CIMI::Model::Base
     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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/forwarding_group_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/forwarding_group_template.rb b/server/lib/cimi/models/forwarding_group_template.rb
index fca2f71..ae4c280 100644
--- a/server/lib/cimi/models/forwarding_group_template.rb
+++ b/server/lib/cimi/models/forwarding_group_template.rb
@@ -25,12 +25,4 @@ class CIMI::Model::ForwardingGroupTemplate < CIMI::Model::Base
     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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/machine_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_configuration.rb b/server/lib/cimi/models/machine_configuration.rb
index 69c9eb5..5226582 100644
--- a/server/lib/cimi/models/machine_configuration.rb
+++ b/server/lib/cimi/models/machine_configuration.rb
@@ -30,35 +30,4 @@ class CIMI::Model::MachineConfiguration < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    profiles = []
-    if id == :all
-      profiles = context.driver.hardware_profiles(context.credentials)
-      profiles.map { |profile| from_hardware_profile(profile, context) }.compact
-    else
-      profile = context.driver.hardware_profile(context.credentials, id)
-      from_hardware_profile(profile, context)
-    end
-  end
-
-  private
-  def self.from_hardware_profile(profile, context)
-    # We accept just profiles with all properties set
-    return unless profile.memory or profile.cpu or profile.storage
-    memory = profile.memory ? context.to_kibibyte((profile.memory.value || profile.memory.default), profile.memory.unit) : nil
-    cpu = (profile.cpu ? (profile.cpu.value || profile.cpu.default) : nil )
-    storage = profile.storage ? context.to_kibibyte((profile.storage.value || profile.storage.default), profile.storage.unit) :  nil
-    machine_hash = {
-      :name => profile.name,
-      :description => "Machine Configuration with #{memory} KiB "+
-        "of memory and #{cpu} CPU",
-      :cpu => ( cpu.to_i.to_s if cpu ) ,
-      :created => Time.now.xmlschema,  # FIXME: DC hardware_profile has no mention about created_at
-      :memory => (memory if memory),
-      :disks => (  [ { :capacity => storage, :format => (profile.storage.respond_to?(:format) ? profile.storage.format : "unknown")  } ] if storage ), #no format attr for hwp - may be added if providers support...,
-      :id => context.machine_configuration_url(profile.id)
-    }
-    self.new(machine_hash)
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/machine_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_create.rb b/server/lib/cimi/models/machine_create.rb
index 0f04c01..3b3e0d9 100644
--- a/server/lib/cimi/models/machine_create.rb
+++ b/server/lib/cimi/models/machine_create.rb
@@ -14,36 +14,8 @@
 # under the License.
 
 class CIMI::Model::MachineCreate < CIMI::Model::Base
+
   ref :machine_template
   text :realm
 
-  def create(ctx)
-    params = {}
-    if machine_template.href
-      template = machine_template.find(ctx)
-      params[:hwp_id] = template.machine_config.ref_id(ctx)
-      params[:initial_state] = template.initial_state
-      image_id = template.machine_image.ref_id(ctx)
-    else
-      # FIXME: What if either of these href's isn't there ? What if the user
-      # tries to override some aspect of the machine_config/machine_image ?
-      params[:hwp_id] = machine_template.machine_config.href.split('/').last
-      params[:initial_state] = machine_template.initial_state
-      image_id = machine_template.machine_image.href.split('/').last
-      if machine_template.credential.href
-        params[:keyname] = machine_template.credential.href.split('/').last
-      end
-    end
-
-    params[:name] = name if name
-    params[:realm_id] = realm if realm
-    instance = ctx.driver.create_instance(ctx.credentials, image_id, params)
-
-    result = CIMI::Model::Machine::from_instance(instance, ctx)
-    result.name = name if name
-    result.description = description if description
-    result.property = property if property
-    result.save
-    result
-  end
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/machine_image_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_image_create.rb b/server/lib/cimi/models/machine_image_create.rb
index 365d640..890241d 100644
--- a/server/lib/cimi/models/machine_image_create.rb
+++ b/server/lib/cimi/models/machine_image_create.rb
@@ -19,23 +19,4 @@ class CIMI::Model::MachineImageCreate < CIMI::Model::Base
   text :image_location, :required => true
   href :related_image
 
-  def create(context)
-    validate!
-
-    params = {
-      :id => context.href_id(image_location, :machines),
-      :name => name,
-      :description => description
-    }
-
-    img = context.driver.create_image(context.credentials, params)
-
-    result = CIMI::Model::MachineImage.from_image(img, context)
-    result.name = name if name
-    result.description = description if description
-    result.property = property if property
-    result.save
-    result
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/machine_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_template.rb b/server/lib/cimi/models/machine_template.rb
index eed8fa9..812ad15 100644
--- a/server/lib/cimi/models/machine_template.rb
+++ b/server/lib/cimi/models/machine_template.rb
@@ -43,39 +43,4 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  class << self
-    def find(id, context)
-      if id == :all
-        current_db.machine_templates.map { |t| from_db(t, context) }
-      else
-        template = current_db.machine_templates_dataset.first(:id => id)
-        raise CIMI::Model::NotFound unless template
-        from_db(template, context)
-      end
-    end
-
-    def delete!(id, context)
-      current_db.machine_templates.first(:id => id).destroy
-    end
-
-    def from_db(model, context)
-      self.new(
-        :id => context.machine_template_url(model.id),
-        :name => model.name,
-        :description => model.description,
-        :machine_config => { :href => model.machine_config },
-        :machine_image => { :href => model.machine_image },
-        :realm => model.realm,
-        :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
-        :created => Time.parse(model.created_at.to_s).xmlschema,
-        :operations => [
-          {
-            :href => context.destroy_machine_template_url(model.id),
-            :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
-          }
-        ]
-      )
-    end
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/machine_template_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_template_create.rb b/server/lib/cimi/models/machine_template_create.rb
index 5e5e411..4d46b79 100644
--- a/server/lib/cimi/models/machine_template_create.rb
+++ b/server/lib/cimi/models/machine_template_create.rb
@@ -18,16 +18,4 @@ class CIMI::Model::MachineTemplateCreate < CIMI::Model::Base
   href :machine_config, :required => true
   href :machine_image, :required => true
 
-  def create(context)
-    validate!
-    new_template = self.class.current_db.add_machine_template(
-      :name => name,
-      :description => description,
-      :machine_config => machine_config.href,
-      :machine_image => machine_image.href,
-      :ent_properties => property.to_json
-    )
-    CIMI::Model::MachineTemplate.from_db(new_template, context)
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/machine_volume.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_volume.rb b/server/lib/cimi/models/machine_volume.rb
index 7631138..50b8b76 100644
--- a/server/lib/cimi/models/machine_volume.rb
+++ b/server/lib/cimi/models/machine_volume.rb
@@ -22,69 +22,4 @@ class CIMI::Model::MachineVolume < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(instance_id, context, id=:all)
-    if id == :all
-      volumes = context.driver.storage_volumes(context.credentials)
-      volumes.inject([]) do |attached, vol|
-        id = context.machine_url(instance_id)+"/volumes/#{vol.id}"
-        attached <<  self.new(
-          :id => id,
-          :name => vol.id,
-          :description => "MachineVolume #{vol.id} for Machine #{instance_id}",
-          :created => vol.created.nil? ? nil : Time.parse(vol.created).xmlschema,
-          :initial_location => vol.device,
-          :volume => {:href=>context.volume_url(vol.id)},
-          :operations => [{:href=>id, :rel => "delete" }]
-          ) if vol.instance_id == instance_id
-        attached
-      end
-    else
-      vol = context.driver.storage_volume(context.credentials, {:id=>id})
-      id = context.machine_url(instance_id)+"/volumes/#{vol.id}"
-      raise CIMI::Model::NotFound unless vol.instance_id == instance_id
-      self.new(
-        :id => id,
-        :name => vol.id,
-        :description => "MachineVolume #{vol.id} for Machine #{instance_id}",
-        :created => vol.created.nil? ? nil : Time.parse(vol.created).xmlschema,
-        :initial_location => vol.device,
-        :volume => {:href=>context.volume_url(vol.id)},
-        :operations => [{:href=>id, :rel => "delete" }]
-        )
-    end
-  end
-
-  def self.find_to_attach_from_xml(xml_in, context)
-    xml = XmlSimple.xml_in(xml_in)
-    vol_id = xml["volume"].first["href"].split("/").last
-    location = xml["initialLocation"].first.strip
-    [vol_id, location]
-  end
-
-  def self.find_to_attach_from_json(json_in, context)
-    json = JSON.parse(json_in)
-    vol_id = json["volume"]["href"].split("/").last
-    location = json["initialLocation"]
-    [vol_id, location]
-  end
-
-
-  def self.collection_for_instance(instance_id, context)
-    machine_volumes = self.find(instance_id, context)
-    volumes_url = context.url("/machines/#{instance_id}/volumes")
-    unless CIMI::Model.const_defined?('MachineVolumeCollection')
-      collection_class = CIMI::Model::Collection.generate(self)
-    else
-      collection_class = CIMI::Model::MachineVolumeCollection
-    end
-    collection_class.new(
-      :id => volumes_url,
-      :name => 'default',
-      :count => machine_volumes.size,
-      :description => "Volume collection for Machine #{instance_id}",
-      :entries => machine_volumes,
-      :operations => [{ :href => volumes_url.singularize+"_attach", :rel => "add" }]
-    )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network.rb b/server/lib/cimi/models/network.rb
index 789e83f..1b8587a 100644
--- a/server/lib/cimi/models/network.rb
+++ b/server/lib/cimi/models/network.rb
@@ -37,36 +37,4 @@ class CIMI::Model::Network < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    networks=[]
-    if id==:all
-      networks = context.driver.networks(context.credentials, {:env=>context})
-    else
-      networks = context.driver.networks(context.credentials, {:id=>id, :env=>context})
-    end
-    if context.expand? :networkPorts
-      networks.each do |network|
-        network.network_ports = CIMI::Model::NetworkPort.collection_for_network(network.id, context)
-      end
-    end
-    networks
-  end
-
-
-  def self.delete!(id, context)
-    context.driver.delete_network(context.credentials, id)
-  end
-
-  def perform(action, context, &block)
-    begin
-      if context.driver.send(:"#{action.name}_network", context.credentials, self.name)
-        block.callback :success
-      else
-        raise "Operation #{action.name} failed to execute on the Network #{self.name} "
-      end
-    rescue => e
-      block.callback :failure, e.message
-    end
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_configuration.rb b/server/lib/cimi/models/network_configuration.rb
index 1010d54..c7d37ba 100644
--- a/server/lib/cimi/models/network_configuration.rb
+++ b/server/lib/cimi/models/network_configuration.rb
@@ -27,19 +27,4 @@ class CIMI::Model::NetworkConfiguration < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    network_configs = []
-    if id==:all
-      network_configs = context.driver.network_configurations(context.credentials, {:env=>context})
-    else
-      network_configs = context.driver.network_configurations(context.credentials, {:env=>context, :id=>id})
-    end
-    network_configs
-  end
-
-  def self.create_from_xml(request_body, context)
-  end
-
-  def self.create_from_json(request_body, context)
-  end
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_create.rb b/server/lib/cimi/models/network_create.rb
index 2496269..ea3e170 100644
--- a/server/lib/cimi/models/network_create.rb
+++ b/server/lib/cimi/models/network_create.rb
@@ -17,27 +17,4 @@ class CIMI::Model::NetworkCreate < CIMI::Model::Base
 
   ref :network_template, :required => true
 
-  def create(context)
-    validate!
-    if network_template.href?
-      template = network_template.find(context)
-      network_config = template.network_config.find(context)
-      forwarding_group = template.forwarding_group.find(context)
-    else
-      network_config = CIMI::Model::NetworkConfiguration.find(context.href_id(network_template.network_config.href, :network_configurations), context)
-      forwarding_group = CIMI::Model::ForwardingGroup.find(context.href_id(network_template.forwarding_group.href, :forwarding_groups), context)
-    end
-    params = {
-      :network_config => network_config,
-      :forwarding_group => forwarding_group,
-      :name => name,
-      :description => description,
-      :env => context # FIXME: We should not pass the context to the driver (!)
-    }
-    network = context.driver.create_network(context.credentials, params)
-    network.property = property if property
-    network.save
-    network
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network_port.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_port.rb b/server/lib/cimi/models/network_port.rb
index 03b0ca3..3f6b371 100644
--- a/server/lib/cimi/models/network_port.rb
+++ b/server/lib/cimi/models/network_port.rb
@@ -33,77 +33,4 @@ class CIMI::Model::NetworkPort < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id==:all
-      context.driver.network_ports(context.credentials, {:env=>context})
-    else
-      context.driver.network_ports(context.credentials, {:id=>id, :env=>context})
-    end
-  end
-
-  def self.create(request_body, context, type)
-    input = (type == :xml)? XmlSimple.xml_in(request_body, {"ForceArray"=>false, "NormaliseSpace"=>2}) : JSON.parse(request_body)
-    if input["networkPortTemplate"]["href"] #template by reference
-      network_port_config, network = get_by_reference(input, context)
-    else
-      if input["networkPortTemplate"]["networkPortConfig"]["href"] # configuration by reference
-        network_port_config = CIMI::Model::NetworkPortConfiguration.find(context.href_id(input["networkPortTemplate"]["networkPortConfig"]["href"],:network_port_configurations), context)
-      else #configuration by value
-        network_port_config = get_by_value(request_body, type)
-      end
-      network = CIMI::Model::Network.find(context.href_id(input["networkPortTemplate"]["network"]["href"], :networks), context)
-    end
-    params = {:network_port_config => network_port_config, :network => network, :name=>input["name"], :description=>input["description"], :env=>context}
-    raise CIMI::Model::BadRequest.new("Bad request - missing required parameters. Client sent: #{request_body} which produced #{params.inspect}")  if params.has_value?(nil)
-    context.driver.create_network_port(context.credentials, params)
-  end
-
-  def self.delete!(id, context)
-    context.driver.delete_network_port(context.credentials, id)
-  end
-
-  def perform(action, context, &block)
-    begin
-      if context.driver.send(:"#{action.name}_network_port", context.credentials, self.name)
-        block.callback :success
-      else
-        raise "Operation #{action.name} failed to execute on the NetworkPort #{self.name} "
-      end
-    rescue => e
-      block.callback :failure, e.message
-    end
-  end
-
-  def self.collection_for_network(network_id, context)
-    net_url = context.network_url(network_id)
-    network_ports = CIMI::Model::NetworkPort.all(context)
-    ports_collection = network_ports.inject([]){|res, current| res << current if current.network.href == net_url ; res}
-    CIMI::Model::NetworkPortCollection.new(
-      :id => net_url+"/network_ports",
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} NetworkPortCollection",
-      :count => ports_collection.size,
-      :network_ports => ports_collection
-    )
-  end
-
-  private
-
-  def self.get_by_reference(input, context)
-    network_port_template = CIMI::Model::NetworkPortTemplate.find(context.href_id(input["networkPortTemplate"]["href"], :network_port_templates), context)
-    network_port_config = CIMI::Model::NetworkPortConfiguration.find(context.href_id(network_port_template.network_port_config.href, :network_port_configurations), context)
-    network = CIMI::Model::Network.find(context.href_id(network_port_template.network.href, :networks), context)
-    return network_port_config, network
-  end
-
-  def self.get_by_value(request_body, type)
-    if type == :xml
-      xml_arrays = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
-      network_port_config = CIMI::Model::NetworkPortConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["networkPortTemplate"][0]["networkPortConfig"][0]))
-    else
-     json = JSON.parse(request_body)
-      network_port_config = CIMI::Model::NetworkPortConfiguration.from_json(JSON.generate(json["networkPortTemplate"]["networkPortConfig"]))
-    end
-  end
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network_port_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_port_configuration.rb b/server/lib/cimi/models/network_port_configuration.rb
index 3789b35..8f505b5 100644
--- a/server/lib/cimi/models/network_port_configuration.rb
+++ b/server/lib/cimi/models/network_port_configuration.rb
@@ -25,12 +25,4 @@ class CIMI::Model::NetworkPortConfiguration < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id==:all
-      context.driver.network_port_configurations(context.credentials, {:env=>context})
-    else
-      context.driver.network_port_configurations(context.credentials, {:env=>context, :id=>id})
-    end
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network_port_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_port_template.rb b/server/lib/cimi/models/network_port_template.rb
index 774d6e9..8e7c738 100644
--- a/server/lib/cimi/models/network_port_template.rb
+++ b/server/lib/cimi/models/network_port_template.rb
@@ -25,12 +25,4 @@ class CIMI::Model::NetworkPortTemplate < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id==:all
-      context.driver.network_port_templates(context.credentials, {:env=>context})
-    else
-      context.driver.network_port_templates(context.credentials, {:env=>context, :id=>id})
-    end
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/network_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/network_template.rb b/server/lib/cimi/models/network_template.rb
index a16c094..4f69f52 100644
--- a/server/lib/cimi/models/network_template.rb
+++ b/server/lib/cimi/models/network_template.rb
@@ -24,14 +24,4 @@ class CIMI::Model::NetworkTemplate < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    network_templates = []
-    if id==:all
-      network_templates = context.driver.network_templates(context.credentials, {:env=>context})
-    else
-      network_templates = context.driver.network_templates(context.credentials, {:env=>context, :id=>id})
-    end
-    network_templates
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/resource_metadata.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/resource_metadata.rb b/server/lib/cimi/models/resource_metadata.rb
index 3ed88db..2c4ee08 100644
--- a/server/lib/cimi/models/resource_metadata.rb
+++ b/server/lib/cimi/models/resource_metadata.rb
@@ -16,6 +16,7 @@
 
 class CIMI::Model::ResourceMetadata < CIMI::Model::Base
 
+  # FIXME: Is this property really needed? (Base model include 'name'
   text :name
 
   text :type_uri
@@ -51,98 +52,13 @@ class CIMI::Model::ResourceMetadata < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id == :all
-      resource_metadata = []
-      CIMI::Model.root_entities.each do |resource_class|
-        meta = resource_metadata_for(resource_class, context)
-        resource_metadata << meta unless none_defined(meta)
-      end
-      return resource_metadata
-    else
-      resource_class = CIMI::Model.const_get("#{id.camelize}")
-      resource_metadata_for(resource_class, context)
-    end
-  end
-
-  def self.resource_metadata_for(resource_class, context)
-    attributes = rm_attributes_for(resource_class, context)
-    capabilities = rm_capabilities_for(resource_class, context)
-    actions = rm_actions_for(resource_class, context)
-    cimi_resource = resource_class.name.split("::").last
-    self.new({ :id => context.resource_metadata_url(cimi_resource.underscore),
-              :name => cimi_resource,
-              :type_uri => resource_class.resource_uri,
-              :attributes => attributes,
-              :capabilities => capabilities,
-              :actions => actions
-    })
-  end
-
-  def self.resource_attributes
-    @resource_attributes ||= {}
-  end
-
   def self.add_resource_attribute!(klass, name, opts={})
     resource_attributes[klass.name] ||= {}
     resource_attributes[klass.name][name] = opts
   end
 
-  private
-
-  def self.rm_attributes_for(resource_class, context)
-    return [] if resource_attributes[resource_class.name].nil?
-    resource_attributes[resource_class.name].map do |attr_name, attr_def|
-      if attr_def.has_key? :constraints
-        constraints = attr_def[:constraints].call(context)
-      else
-        constraints = []
-      end
-      {
-        :name => attr_name.to_s,
-        # TODO: We need to make this URI return description of this 'non-CIMI'
-        # attribute
-        :namespace => "http://deltacloud.org/cimi/#{resource_class.name.split('::').last}/#{attr_name}",
-        :type => translate_attr_type(attr_def[:type]),
-        :required => attr_def[:required] ? 'true' : 'false',
-        :constraints => constraints.map { |v| { :value => v }}
-      }
-    end
-  end
-
-  def self.rm_capabilities_for(resource_class,context)
-    cimi_object = resource_class.name.split("::").last.underscore.pluralize.to_sym
-    capabilities = (context.driver.class.features[cimi_object] || []).inject([]) do |res, cur|
-      feat = CIMI::FakeCollection.feature(cur)
-      values = (context.driver.class.constraints[cimi_object][feat.name][:values] || []).inject([]) do |vals, val|
-        vals <<  val
-        vals
-      end
-      res << {:name => feat.name.to_s.camelize,
-       :uri => CMWG_NAMESPACE+"/capability/#{cimi_object.to_s.camelize.singularize}/#{feat.name.to_s.camelize}",
-       :description => feat.description,
-       :value => values.join(",") }
-      res
-    end
-#cimi_resource.underscore.pluralize.to_sym
-  end
-
-  def self.rm_actions_for(resource_class, context)
-    []
-  end
-
-  def self.translate_attr_type(type)
-    case type
-      when :href then 'URI'
-      when :text then 'string'
-      when :boolean then 'boolean'
-      else 'text'
-    end
-  end
-
-  def self.none_defined(metadata)
-    return true if metadata.capabilities.empty? && metadata.capabilities.empty? && metadata.attributes.empty?
-    return false
+  def self.resource_attributes
+    @resource_attributes ||= {}
   end
 
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/system.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/system.rb b/server/lib/cimi/models/system.rb
index e238259..118f9f5 100644
--- a/server/lib/cimi/models/system.rb
+++ b/server/lib/cimi/models/system.rb
@@ -19,49 +19,25 @@ class CIMI::Model::System < CIMI::Model::Base
 
   text :state
 
-#  collection :systems, :class => CIMI::Model::SystemSystem
-#  collection :machines, :class => CIMI::Model::SystemMachine
-#  collection :credentials, :class => CIMI::Model::SystemCredential
-#  collection :volumes, :class => CIMI::Model::SystemVolume
-#  collection :networks, :class => CIMI::Model::SystemNetwork
-#  collection :network_ports, :class => CIMI::Model::SystemNetworkPort
-#  collection :addresses, :class => CIMI::Model::SystemAddress
-#  collection :forwarding_groups, :class => CIMI::Model::SystemForwardingGroup
+  # FIXME: Any reason for these comments?
 
-#  array :meters do
-#    scalar :href
-#  end
+  #  collection :systems, :class => CIMI::Model::SystemSystem
+  #  collection :machines, :class => CIMI::Model::SystemMachine
+  #  collection :credentials, :class => CIMI::Model::SystemCredential
+  #  collection :volumes, :class => CIMI::Model::SystemVolume
+  #  collection :networks, :class => CIMI::Model::SystemNetwork
+  #  collection :network_ports, :class => CIMI::Model::SystemNetworkPort
+  #  collection :addresses, :class => CIMI::Model::SystemAddress
+  #  collection :forwarding_groups, :class => CIMI::Model::SystemForwardingGroup
 
-#  href :event_log
+  #  array :meters do
+  #    scalar :href
+  #  end
+
+  #  href :event_log
 
   array :operations do
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id == :all
-      systems = context.driver.systems(context.credentials, {:env=>context})
-    else
-      systems = context.driver.systems(context.credentials, {:env=>context, :id=>id})
-      raise CIMI::Model::NotFound unless systems.first
-      systems.first
-    end
-  end
-
-  def perform(action, context, &block)
-    begin
-      if context.driver.send(:"#{action.name}_system", context.credentials, self.id.split("/").last)
-        block.callback :success
-      else
-        raise "Operation failed to execute on given System"
-      end
-    rescue => e
-      block.callback :failure, e.message
-    end
-  end
-
-  def self.delete!(id, context)
-    context.driver.destroy_system(context.credentials, id)
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/system_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/system_template.rb b/server/lib/cimi/models/system_template.rb
index 6a6e1f2..82e418b 100644
--- a/server/lib/cimi/models/system_template.rb
+++ b/server/lib/cimi/models/system_template.rb
@@ -21,43 +21,29 @@ class CIMI::Model::SystemTemplate < CIMI::Model::Base
     text :name, :description
     hash_map :properties
     text :type
+
+    # FIXME: Any reasons for these comments?
+
     #component_template, comprises:
-#    struct :machine_template, :class => CIMI::Model::MachineTemplate
-#    struct :system_template, :class => CIMI::Model::SystemTemplate
-#    struct :credential_template, :class => CIMI::Model::CredentialTemplate
-#    struct :volume_template, :class => CIMI::Model::VolumeTemplate
-#    struct :network_template, :class => CIMI::Model::NetworkTemplate
-#    struct :network_port_template, :class => CIMI::Model::NetworkPortTemplate
-#    struct :forwarding_group_template, :class => CIMI::Model::ForwardingGroupTemplate
-#    struct :address_template, :class => CIMI::Model::AddressTemplate
+    #    struct :machine_template, :class => CIMI::Model::MachineTemplate
+    #    struct :system_template, :class => CIMI::Model::SystemTemplate
+    #    struct :credential_template, :class => CIMI::Model::CredentialTemplate
+    #    struct :volume_template, :class => CIMI::Model::VolumeTemplate
+    #    struct :network_template, :class => CIMI::Model::NetworkTemplate
+    #    struct :network_port_template, :class => CIMI::Model::NetworkPortTemplate
+    #    struct :forwarding_group_template, :class => CIMI::Model::ForwardingGroupTemplate
+    #    struct :address_template, :class => CIMI::Model::AddressTemplate
     text :quantity
   end
 
-#  array :meter_templates do
-#    scalar :href
-#  end
+  #  array :meter_templates do
+  #    scalar :href
+  #  end
 
-#  href :event_log_template
+  #  href :event_log_template
 
   array :operations do
     scalar :rel, :href
   end
 
-  class << self
-    def find(id, context)
-      if id == :all
-        templates = context.driver.system_templates(context.credentials, {:env=>context})
-      else
-        templates = context.driver.system_templates(context.credentials, {:env=>context, :id=>id})
-        raise CIMI::Model::NotFound unless templates.first
-        templates.first
-      end
-    end
-
-    def delete!(id, context)
-      context.driver.destroy_system_template(context.credentials, id)
-    end
-
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume.rb b/server/lib/cimi/models/volume.rb
index 888589a..a1b4423 100644
--- a/server/lib/cimi/models/volume.rb
+++ b/server/lib/cimi/models/volume.rb
@@ -37,63 +37,4 @@ class CIMI::Model::Volume < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    creds = context.credentials
-    if id == :all
-      volumes = context.driver.storage_volumes(creds)
-      volumes.collect{ |volume| from_storage_volume(volume, context) }
-    else
-      volume = context.driver.storage_volumes(creds, :id => id).first
-      raise CIMI::Model::NotFound unless volume
-      from_storage_volume(volume, context)
-    end
-  end
-
-  def self.all(context); find(:all, context); end
-
-  def self.delete!(id, context)
-    context.driver.destroy_storage_volume(context.credentials, {:id=>id} )
-    new(:id => id).destroy
-  end
-
-  def self.find_to_attach_from_json(json_in, context)
-    json = JSON.parse(json_in)
-    json["volumes"].map{|v| {:volume=>self.find(v["volume"]["href"].split("/volumes/").last, context),
-                             :initial_location=>v["initialLocation"]  }}
-  end
-
-  def self.find_to_attach_from_xml(xml_in, context)
-    xml = XmlSimple.xml_in(xml_in)
-    xml["volume"].map{|v| {:volume => self.find(v["href"].split("/volumes/").last, context),
-                           :initial_location=>v["initialLocation"] }}
-  end
-
-  def self.from_storage_volume(volume, context)
-    self.new( { :name => volume.id,
-                :created => volume.created.nil? ? nil : Time.parse(volume.created).xmlschema,
-                :id => context.volume_url(volume.id),
-                :capacity => context.to_kibibyte(volume.capacity, 'GB'),
-                :bootable => "false", #fixme ... will vary... ec2 doesn't expose this
-                :snapshots => [], #fixme...
-                :type => 'http://schemas.dmtf.org/cimi/1/mapped',
-                :state => volume.state == 'IN-USE' ? 'AVAILABLE' : volume.state,
-                :meters => [],
-                :operations => [{:href=> context.volume_url(volume.id), :rel => "delete"}]
-            } )
-  end
-
-  def self.collection_for_instance(instance_id, context)
-    instance = context.driver.instance(context.credentials, :id => instance_id)
-    volumes = instance.storage_volumes.map do |mappings|
-      mappings.keys.map { |volume_id| from_storage_volume(context.driver.storage_volume(context.credentials, :id => volume_id), context) }
-    end.flatten
-    CIMI::Model::VolumeCollection.new(
-      :id => context.url("/machines/#{instance_id}/volumes"),
-      :name => 'default',
-      :count => volumes.size,
-      :description => "Volume collection for Machine #{instance_id}",
-      :entries => volumes
-    )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume_configuration.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_configuration.rb b/server/lib/cimi/models/volume_configuration.rb
index bf94a3a..7393b53 100644
--- a/server/lib/cimi/models/volume_configuration.rb
+++ b/server/lib/cimi/models/volume_configuration.rb
@@ -25,67 +25,4 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.create_from_json(body, context)
-    json = JSON.parse(body)
-    new_config = current_db.add_volume_configuration(
-      :name => json['name'],
-      :description => json['description'],
-      :format => json['format'],
-      :capacity => json['capacity'],
-      :ent_properties => (json['properties'] || {}).to_json
-    )
-    from_db(new_config, context)
-  end
-
-  def self.create_from_xml(body, context)
-    xml = XmlSimple.xml_in(body)
-    xml['property'] ||= []
-    new_config = current_db.add_volume_configuration(
-      :name => xml['name'].first,
-      :description => xml['description'].first,
-      :format => xml['format'].first,
-      :capacity => xml['capacity'].first,
-      :ent_properties =>  JSON::dump((xml['property'] || {}).inject({}){ |r, p| r[p['key']]=p['content']; r })
-    )
-    from_db(new_config, context)
-  end
-
-  def self.delete!(id, context)
-    current_db.volume_configurations.first(:id => id).destroy
-  end
-
-  def self.find(id, context)
-    if id==:all
-      if context.driver.respond_to? :volume_configurations
-        context.driver.volume_configurations(context.credentials, {:env=>context})
-      else
-        current_db.volume_configurations.map { |t| from_db(t, context) }
-      end
-    else
-      if context.driver.respond_to? :volume_configuration
-        context.driver.volume_configuration(context.credentials, id, :env=>context)
-      else
-        config = current_db.volume_configurations_dataset.first(:id => id)
-        raise CIMI::Model::NotFound unless config
-        from_db(config, context)
-      end
-    end
-  end
-
-  private
-
-  def self.from_db(model, context)
-    self.new(
-      :id => context.volume_configuration_url(model.id),
-      :name => model.name,
-      :description => model.description,
-      :format => model.format,
-      :capacity => context.to_kibibyte(model.capacity, "GB"),
-      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
-      :operations => [
-        { :href => context.destroy_volume_configuration_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete' }
-      ]
-    )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_create.rb b/server/lib/cimi/models/volume_create.rb
index 607c407..1408c77 100644
--- a/server/lib/cimi/models/volume_create.rb
+++ b/server/lib/cimi/models/volume_create.rb
@@ -17,42 +17,4 @@ class CIMI::Model::VolumeCreate < CIMI::Model::Base
 
   ref :volume_template, :required => true
 
-  def create(context)
-    validate!
-
-    if volume_template.href?
-      template = volume_template.find(context)
-    else
-      template = CIMI::Model::VolumeTemplate.from_xml(volume_template.to_xml)
-    end
-
-    volume_image = template.volume_image.href? ?
-      template.volume_image.find(context) : template.volume_image
-
-    volume_config = template.volume_config.href? ?
-      template.volume_config.find(context) : template.volume_config
-
-    params = {
-      :name => name,
-      :capacity => volume_config.capacity,
-      :snapshot_id => ref_id(volume_image.id),
-    }
-
-    unless context.driver.respond_to? :create_storage_volume
-       raise Deltacloud::Exceptions.exception_from_status(
-         501,
-         "Creating Volume is not supported by the current driver"
-       )
-    end
-
-    volume = context.driver.create_storage_volume(context.credentials, params)
-
-    result = CIMI::Model::Volume.from_storage_volume(volume, context)
-    result.name = name if result.name.nil?
-    result.description = description if description
-    result.property = property if property
-    result.save
-    result
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume_image.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_image.rb b/server/lib/cimi/models/volume_image.rb
index ef06552..ec94289 100644
--- a/server/lib/cimi/models/volume_image.rb
+++ b/server/lib/cimi/models/volume_image.rb
@@ -24,34 +24,4 @@ class CIMI::Model::VolumeImage < CIMI::Model::Base
   array :operations do
     scalar :rel, :href
   end
-
-  def self.find(id, context)
-    creds = context.credentials
-    if id == :all
-      snapshots = context.driver.storage_snapshots(creds)
-      snapshots.collect{ |snapshot| from_storage_snapshot(snapshot, context) }
-    else
-      snapshot = context.driver.storage_snapshots(creds, id => :id).first
-      raise CIMI::Model::NotFound unless snapshot
-      from_storage_snapshot(snapshot, context)
-    end
-  end
-
-  def self.all(context); find(:all, context); end
-
-  def self.delete!(vol_image_id, context)
-    context.driver.destroy_storage_snapshot(context.credentials, {:id=>vol_image_id})
-  end
-
-  def self.from_storage_snapshot(snapshot, context)
-    self.new( {
-      :name => snapshot.name,
-      :description => snapshot.description,
-      :created => snapshot.created.nil? ? nil : Time.parse(snapshot.created).xmlschema,
-      :id => context.volume_image_url(snapshot.id),
-      :image_location => {:href=>context.volume_url(snapshot.storage_volume_id)},
-      :bootable => "false"  #FIXME
-    } )
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume_image_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_image_create.rb b/server/lib/cimi/models/volume_image_create.rb
index f953146..4eb0ed1 100644
--- a/server/lib/cimi/models/volume_image_create.rb
+++ b/server/lib/cimi/models/volume_image_create.rb
@@ -19,29 +19,4 @@ class CIMI::Model::VolumeImageCreate < CIMI::Model::Base
   text :image_data
   text :bootable, :required => true
 
-  def create(context)
-    validate!
-
-    params = {
-      :volume_id => context.href_id(image_location.href, :volumes),
-      :name => name,
-      :description => description
-    }
-
-    unless context.driver.respond_to? :create_storage_snapshot
-      raise Deltacloud::Exceptions.exception_from_status(
-        501,
-        'Creating VolumeImage is not supported by the current driver'
-      )
-    end
-
-    new_snapshot = context.driver.create_storage_snapshot(context.credentials, params)
-    result = CIMI::Model::VolumeImage.from_storage_snapshot(new_snapshot, context)
-    result.name= name unless new_snapshot.name
-    result.description = description unless new_snapshot.description
-    result.property = property if property
-    result.save
-    result
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_template.rb b/server/lib/cimi/models/volume_template.rb
index 15cbcd0..bda4657 100644
--- a/server/lib/cimi/models/volume_template.rb
+++ b/server/lib/cimi/models/volume_template.rb
@@ -29,45 +29,4 @@ class CIMI::Model::VolumeTemplate < CIMI::Model::Base
     scalar :rel, :href
   end
 
-  def self.find(id, context)
-    if id==:all
-      if context.driver.respond_to? :volume_templates
-        context.driver.volume_templates(context.credentials, {:env=>context})
-      else
-        current_db.volume_templates.map { |t| from_db(t, context) }
-      end
-    else
-      if context.driver.respond_to? :volume_template
-        context.driver.volume_template(context.credentials, id, :env=>context)
-      else
-        template = current_db.volume_templates_dataset.first(:id => id)
-        raise CIMI::Model::NotFound unless template
-        from_db(template, context)
-      end
-    end
-  end
-
-  def self.delete!(id, context)
-    current_db.volume_templates.first(:id => id).destroy
-  end
-
-  def self.from_db(model, context)
-    self.new(
-      :id => context.volume_template_url(model.id),
-      :name => model.name,
-      :description => model.description,
-      :volume_config => {:href => model.volume_config},
-      :volume_image => {:href => model.volume_image},
-      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
-      :operations => [
-        {
-          :href => context.destroy_volume_template_url(model.id),
-          :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
-        }
-      ]
-    )
-  end
-
-
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/models/volume_template_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_template_create.rb b/server/lib/cimi/models/volume_template_create.rb
index b6dbec2..3064ae8 100644
--- a/server/lib/cimi/models/volume_template_create.rb
+++ b/server/lib/cimi/models/volume_template_create.rb
@@ -18,16 +18,4 @@ class CIMI::Model::VolumeTemplateCreate < CIMI::Model::Base
   ref :volume_config, :required => true
   ref :volume_image, :required => true
 
-  def create(context)
-    validate!
-    new_template = self.class.current_db.add_volume_template(
-      :name => name,
-      :description => description,
-      :volume_config => volume_config.href,
-      :volume_image => volume_image.href,
-      :ent_properties => property.to_json
-    )
-    CIMI::Model::VolumeTemplate.from_db(new_template, context)
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service.rb b/server/lib/cimi/service.rb
index f6b933f..b05efbf 100644
--- a/server/lib/cimi/service.rb
+++ b/server/lib/cimi/service.rb
@@ -27,3 +27,38 @@ require_relative './../db/volume_template'
 require_relative './service/base'
 require_relative './service/machine'
 require_relative './service/machine_image'
+require_relative './service/volume_image'
+require_relative './service/system_template'
+require_relative './service/network_port_configuration'
+require_relative './service/credential_create'
+require_relative './service/machine_template_create'
+require_relative './service/volume_create'
+require_relative './service/network_create'
+require_relative './service/network'
+require_relative './service/forwarding_group'
+require_relative './service/volume_template_create'
+require_relative './service/system'
+require_relative './service/address_template_create'
+require_relative './service/volume'
+require_relative './service/volume_image_create'
+require_relative './service/machine_configuration'
+require_relative './service/volume_template'
+require_relative './service/machine_template'
+require_relative './service/network_port'
+require_relative './service/forwarding_group_template'
+require_relative './service/credential_template'
+require_relative './service/volume_configuration'
+require_relative './service/cloud_entry_point'
+require_relative './service/network_configuration'
+require_relative './service/address_template'
+require_relative './service/action'
+require_relative './service/machine_create'
+require_relative './service/address'
+require_relative './service/credential'
+require_relative './service/network_port_template'
+require_relative './service/machine_image_create'
+require_relative './service/address_create'
+require_relative './service/network_template'
+require_relative './service/disk'
+require_relative './service/machine_volume'
+require_relative './service/resource_metadata'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/action.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/action.rb b/server/lib/cimi/service/action.rb
new file mode 100644
index 0000000..9503704
--- /dev/null
+++ b/server/lib/cimi/service/action.rb
@@ -0,0 +1,21 @@
+# 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::Service::Action < CIMI::Service::Base
+
+  def operation
+    action.split('/').last.strip.intern
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/address.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/address.rb b/server/lib/cimi/service/address.rb
new file mode 100644
index 0000000..f883c15
--- /dev/null
+++ b/server/lib/cimi/service/address.rb
@@ -0,0 +1,56 @@
+# 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::Service::Address < CIMI::Service::Base
+
+  def self.find(id, context)
+    if id==:all
+      addresses = context.driver.addresses(context.credentials)
+      addresses.map{|addr| from_address(addr, context)}
+    else
+      address = context.driver.address(context.credentials, {:id=>id})
+      from_address(address, context)
+    end
+  end
+
+  def self.delete!(id, context)
+    context.driver.delete_address(context.credentials, id)
+    self.new(context, :values => { :id => id }).destroy
+  end
+
+  private
+
+  def self.from_address(address, context)
+    self.new(context, :values => {
+      :name => address.id,
+      :id => context.address_url(address.id),
+      :description => "Address #{address.id}",
+      :ip => address.id,
+      :allocation => "dynamic",
+      :default_gateway => "unknown",
+      :dns => "unknown",
+      :protocol => protocol_from_address(address.id),
+      :mask => "unknown",
+      :resource => (address.instance_id) ? {:href=> context.machine_url(address.instance_id)} : nil,
+      :network => nil
+    })
+  end
+
+  def self.protocol_from_address(address)
+    addr = IPAddr.new(address)
+    addr.ipv4? ? "ipv4" : "ipv6"
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/address_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/address_create.rb b/server/lib/cimi/service/address_create.rb
new file mode 100644
index 0000000..20bda09
--- /dev/null
+++ b/server/lib/cimi/service/address_create.rb
@@ -0,0 +1,45 @@
+# 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::Service::AddressCreate < CIMI::Service::Base
+
+  def create
+    template = resolve(address_template)
+
+    params = {
+      :name => name,
+      :description => description,
+      :address_template => template,
+      :env => context # FIXME: We should not pass the context to the driver (!)
+    }
+
+    unless context.driver.respond_to? :create_address
+       raise Deltacloud::Exceptions.exception_from_status(
+         501,
+         "Creating Address is not supported by the current driver"
+       )
+    end
+
+    address = context.driver.create_address(context.credentials, params)
+
+    result = CIMI::Service::Address.from_address(address, context)
+    result.name = name if name
+    result.description = description if description
+    result.property = property if property
+    result.save
+    result
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/address_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/address_template.rb b/server/lib/cimi/service/address_template.rb
new file mode 100644
index 0000000..2a5a0d3
--- /dev/null
+++ b/server/lib/cimi/service/address_template.rb
@@ -0,0 +1,71 @@
+# 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::Service::AddressTemplate < CIMI::Service::Base
+
+  def self.find(id, context)
+    if id==:all
+      if context.driver.respond_to? :address_templates
+        context.driver.address_templates(context.credentials, {:env=>context})
+      else
+        current_db.address_templates.map { |t| from_db(t, context) }
+      end
+    else
+      if context.driver.respond_to? :address_template
+        context.driver.address_template(context.credentials, :id => id, :env=>context)
+      else
+        template = current_db.address_templates_dataset.first(:id => id)
+        raise CIMI::Model::NotFound unless template
+        from_db(template, context)
+      end
+    end
+  end
+
+  def self.delete!(id, context)
+    current_db.address_templates.first(:id => id).destroy
+  end
+
+  protected
+  def attributes_to_copy
+    super + [ :ip, :hostname, :allocation, :default_gateway,
+              :dns, :protocol, :mask ]
+  end
+
+  private
+
+  def self.from_db(model, context)
+    self.new(context, :values => {
+      :id => context.address_template_url(model.id),
+      :name => model.name,
+      :description => model.description,
+      :ip => model.ip,
+      :hostname => model.hostname,
+      :allocation => model.allocation,
+      :default_gateway => model.default_gateway,
+      :dns => model.dns,
+      :protocol => model.protocol,
+      :mask => model.mask,
+      :property => (model.ent_properties ? JSON::parse(model.ent_properties) :  nil),
+      :operations => [
+        {
+          :href => context.destroy_address_template_url(model.id),
+          :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
+        }
+      ]
+    })
+  end
+
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/address_template_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/address_template_create.rb b/server/lib/cimi/service/address_template_create.rb
new file mode 100644
index 0000000..01566ab
--- /dev/null
+++ b/server/lib/cimi/service/address_template_create.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::Service::AddressTemplateCreate < CIMI::Service::Base
+
+  def create
+    new_template = context.current_db.add_address_template(
+      :name => name,
+      :description => description,
+      :hostname => hostname,
+      :ip => ip,
+      :allocation => allocation,
+      :default_gateway => default_gateway,
+      :dns => dns,
+      :protocol => protocol,
+      :mask => mask,
+      :ent_properties => property.to_json
+    )
+    CIMI::Service::AddressTemplate.from_db(new_template, context)
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/cloud_entry_point.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/cloud_entry_point.rb b/server/lib/cimi/service/cloud_entry_point.rb
new file mode 100644
index 0000000..5029e12
--- /dev/null
+++ b/server/lib/cimi/service/cloud_entry_point.rb
@@ -0,0 +1,46 @@
+# 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::Service::CloudEntryPoint < CIMI::Service::Base
+
+  def self.create(context)
+    self.new(context, :values => entities(context).merge({
+      :name => context.driver.name,
+      :description => "Cloud Entry Point for the Deltacloud #{context.driver.name} driver",
+      :driver => context.driver.name,
+      :provider => context.current_provider,
+      :id => context.cloudEntryPoint_url,
+      :base_uri => context.base_uri + "/",
+      :created => Time.now.xmlschema
+    }))
+  end
+
+  # Return an Hash of the CIMI root entities used in CloudEntryPoint
+  def self.entities(context)
+    CIMI::Collections.modules(:cimi).inject({}) do |supported_entities, m|
+      m.collections.each do |c|
+        index_operation_capability = c.operation(:index).required_capability
+        next if m.settings.respond_to?(:capability) and !m.settings.capability(index_operation_capability)
+        supported_entities[c.collection_name.to_s] = { :href => context.send(:"#{c.collection_name}_url") }
+      end
+      supported_entities
+    end
+  end
+
+  def entities
+    @attribute_values.clone.delete_if { |key, value| !value.respond_to? :href }
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/credential.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/credential.rb b/server/lib/cimi/service/credential.rb
new file mode 100644
index 0000000..c48f372
--- /dev/null
+++ b/server/lib/cimi/service/credential.rb
@@ -0,0 +1,52 @@
+# 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::Service::Credential < CIMI::Service::Base
+
+  def self.find(id, context)
+    if id == :all
+      return [] unless context.driver.respond_to?(:keys)
+      keys = context.driver.keys(context.credentials)
+      keys.map { |key| from_key(key, context) }
+    else
+      key = context.driver.key(context.credentials, :id => id)
+      from_key(key, context)
+    end
+  end
+
+  def self.create_from_xml(body, context)
+    credential = Credential.from_xml(body)
+    key = context.driver.create_key(context.credentials, :key_name => credential.name)
+    from_key(key, context)
+  end
+
+  def self.delete!(id, context)
+    context.driver.destroy_key(context.credentials, :id => id)
+  end
+
+  private
+
+  def self.from_key(key, context)
+    self.new(context, :values => {
+      :name => key.id,
+      :username => key.username,
+      :password => key.is_password? ? key.password : key.fingerprint,
+      :key => key.is_key? ? key.pem_rsa_key : nil,
+      :id => context.credential_url(key.id),
+      :created => Time.now.xmlschema
+    })
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/credential_create.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/credential_create.rb b/server/lib/cimi/service/credential_create.rb
new file mode 100644
index 0000000..3290596
--- /dev/null
+++ b/server/lib/cimi/service/credential_create.rb
@@ -0,0 +1,38 @@
+# 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::Service::CredentialCreate < CIMI::Service::Base
+
+  def create
+    unless context.driver.respond_to? :create_key
+       raise Deltacloud::Exceptions.exception_from_status(
+         501,
+         "Creating Credential is not supported by the current driver"
+       )
+    end
+
+    template = resolve(credential_template)
+
+    key = context.driver.create_key(context.credentials, :key_name => name)
+
+    result = CIMI::Service::Credential.from_key(key, context)
+    result.name = name if name
+    result.description = description if description
+    result.property = property if property
+    result.save
+    result
+  end
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/credential_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/credential_template.rb b/server/lib/cimi/service/credential_template.rb
new file mode 100644
index 0000000..513160d
--- /dev/null
+++ b/server/lib/cimi/service/credential_template.rb
@@ -0,0 +1,20 @@
+# 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::Service::CredentialTemplate < CIMI::Service::Base
+
+  # FIXME: TBD
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/fa200948/server/lib/cimi/service/disk.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/disk.rb b/server/lib/cimi/service/disk.rb
new file mode 100644
index 0000000..1af908e
--- /dev/null
+++ b/server/lib/cimi/service/disk.rb
@@ -0,0 +1,80 @@
+# 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::Service::Disk < CIMI::Service::Base
+
+  def self.find(instance, machine_config, context, id=:all)
+    if id == :all
+      name = instance.id+"_disk_" #assuming one disk for now...
+
+      if machine_config
+        mach_config_disks = machine_config.disks
+        return mach_config_disks.map do |d|
+          self.new(context, :values => {
+            :id => context.machine_url(instance.id) + "/disks/#{name}#{d[:capacity]}",
+            :name => "#{name}#{d[:capacity]}",
+            :description => "Disk for Machine #{instance.id}",
+            :created => instance.launch_time.nil? ?
+            Time.now.xmlschema : Time.parse(instance.launch_time).xmlschema,
+            :capacity => d[:capacity]
+          })
+        end
+      else
+        if instance.instance_profile.override? :storage
+          capacity = context.to_kibibyte(instance.instance_profile.storage, 'MB')
+        else
+          hw_profile = context.driver.hardware_profile(
+            context.credentials,
+            :id => instance.instance_profile.name
+          )
+          if hw_profile.storage
+            capacity = context.to_kibibyte(hw_profile.storage.value, 'MB')
+          end
+        end
+
+        return [] unless capacity
+
+        [self.new(context, :values => {
+          :id => context.machine_url(instance.id)+"/disks/#{name}#{capacity}",
+          :name => name + capacity.to_s,
+          :description => "Disk for Machine #{instance.id}",
+          :created => instance.launch_time.nil? ?
+            Time.now.xmlschema : Time.parse(instance.launch_time).xmlschema,
+          :capacity => capacity
+        })]
+      end
+    else
+    end
+  end
+
+  def self.collection_for_instance(instance_id, context)
+    instance = context.driver.instance(context.credentials, :id => instance_id)
+    disks = find(instance, nil, context)
+    unless CIMI::Model.const_defined?('DiskCollection')
+      collection_class = CIMI::Model::Collection.generate(self)
+    else
+      collection_class = CIMI::Model::DiskCollection
+    end
+    collection_class.new(context, :values => {
+      :id => context.url("/machines/#{instance_id}/disks"),
+      :name => 'default',
+      :count => disks.size,
+      :description => "Disk collection for Machine #{instance_id}",
+      :entries => disks
+    })
+  end
+
+
+end