deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 25/32] CIMI: Moved the CIMI models from 'model' directory to 'models'
Date Tue, 17 Apr 2012 13:40:04 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/cimi/model/action.rb                    |   24 --
 server/lib/cimi/model/address.rb                   |   72 -----
 server/lib/cimi/model/address_collection.rb        |   34 ---
 server/lib/cimi/model/address_template.rb          |   54 ----
 .../lib/cimi/model/address_template_collection.rb  |   34 ---
 server/lib/cimi/model/base.rb                      |  249 ------------------
 server/lib/cimi/model/cloud_entry_point.rb         |   48 ----
 server/lib/cimi/model/entity_metadata.rb           |   83 ------
 .../lib/cimi/model/entity_metadata_collection.rb   |   31 ---
 server/lib/cimi/model/errors.rb                    |   48 ----
 server/lib/cimi/model/machine.rb                   |  229 ----------------
 server/lib/cimi/model/machine_admin.rb             |   59 -----
 server/lib/cimi/model/machine_admin_collection.rb  |   34 ---
 server/lib/cimi/model/machine_collection.rb        |   34 ---
 server/lib/cimi/model/machine_configuration.rb     |   70 -----
 .../cimi/model/machine_configuration_collection.rb |   34 ---
 server/lib/cimi/model/machine_image.rb             |   46 ----
 server/lib/cimi/model/machine_image_collection.rb  |   34 ---
 server/lib/cimi/model/machine_template.rb          |   41 ---
 .../lib/cimi/model/machine_template_collection.rb  |   34 ---
 server/lib/cimi/model/network.rb                   |  106 --------
 server/lib/cimi/model/network_collection.rb        |   34 ---
 server/lib/cimi/model/network_configuration.rb     |   49 ----
 .../cimi/model/network_configuration_collection.rb |   34 ---
 server/lib/cimi/model/network_template.rb          |   36 ---
 .../lib/cimi/model/network_template_collection.rb  |   35 ---
 server/lib/cimi/model/routing_group.rb             |   34 ---
 server/lib/cimi/model/routing_group_collection.rb  |   34 ---
 server/lib/cimi/model/routing_group_template.rb    |   34 ---
 .../model/routing_group_template_collection.rb     |   35 ---
 server/lib/cimi/model/schema.rb                    |  277 --------------------
 server/lib/cimi/model/volume.rb                    |  103 --------
 server/lib/cimi/model/volume_collection.rb         |   34 ---
 server/lib/cimi/model/volume_configuration.rb      |   60 -----
 .../cimi/model/volume_configuration_collection.rb  |   34 ---
 server/lib/cimi/model/volume_image.rb              |   49 ----
 server/lib/cimi/model/volume_image_collection.rb   |   34 ---
 server/lib/cimi/model/volume_template.rb           |   23 --
 .../lib/cimi/model/volume_template_collection.rb   |   34 ---
 server/lib/cimi/model/vsp.rb                       |  102 -------
 server/lib/cimi/model/vsp_collection.rb            |   34 ---
 server/lib/cimi/model/vsp_configuration.rb         |   40 ---
 .../lib/cimi/model/vsp_configuration_collection.rb |   34 ---
 server/lib/cimi/model/vsp_template.rb              |   34 ---
 server/lib/cimi/model/vsp_template_collection.rb   |   34 ---
 server/lib/cimi/models/action.rb                   |   24 ++
 server/lib/cimi/models/address.rb                  |   72 +++++
 server/lib/cimi/models/address_collection.rb       |   34 +++
 server/lib/cimi/models/address_template.rb         |   54 ++++
 .../lib/cimi/models/address_template_collection.rb |   34 +++
 server/lib/cimi/models/base.rb                     |  249 ++++++++++++++++++
 server/lib/cimi/models/cloud_entry_point.rb        |   46 ++++
 server/lib/cimi/models/entity_metadata.rb          |   84 ++++++
 .../lib/cimi/models/entity_metadata_collection.rb  |   31 +++
 server/lib/cimi/models/errors.rb                   |   48 ++++
 server/lib/cimi/models/machine.rb                  |  227 ++++++++++++++++
 server/lib/cimi/models/machine_admin.rb            |   59 +++++
 server/lib/cimi/models/machine_admin_collection.rb |   34 +++
 server/lib/cimi/models/machine_collection.rb       |   34 +++
 server/lib/cimi/models/machine_configuration.rb    |   70 +++++
 .../models/machine_configuration_collection.rb     |   34 +++
 server/lib/cimi/models/machine_image.rb            |   46 ++++
 server/lib/cimi/models/machine_image_collection.rb |   34 +++
 server/lib/cimi/models/machine_template.rb         |   41 +++
 .../lib/cimi/models/machine_template_collection.rb |   34 +++
 server/lib/cimi/models/network.rb                  |  109 ++++++++
 server/lib/cimi/models/network_collection.rb       |   34 +++
 server/lib/cimi/models/network_configuration.rb    |   49 ++++
 .../models/network_configuration_collection.rb     |   34 +++
 server/lib/cimi/models/network_template.rb         |   36 +++
 .../lib/cimi/models/network_template_collection.rb |   35 +++
 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 +++
 server/lib/cimi/models/schema.rb                   |  277 ++++++++++++++++++++
 server/lib/cimi/models/volume.rb                   |  103 ++++++++
 server/lib/cimi/models/volume_collection.rb        |   34 +++
 server/lib/cimi/models/volume_configuration.rb     |   60 +++++
 .../cimi/models/volume_configuration_collection.rb |   34 +++
 server/lib/cimi/models/volume_image.rb             |   49 ++++
 server/lib/cimi/models/volume_image_collection.rb  |   34 +++
 server/lib/cimi/models/volume_template.rb          |   23 ++
 .../lib/cimi/models/volume_template_collection.rb  |   34 +++
 server/lib/cimi/models/vsp.rb                      |  102 +++++++
 server/lib/cimi/models/vsp_collection.rb           |   34 +++
 server/lib/cimi/models/vsp_configuration.rb        |   40 +++
 .../cimi/models/vsp_configuration_collection.rb    |   34 +++
 server/lib/cimi/models/vsp_template.rb             |   34 +++
 server/lib/cimi/models/vsp_template_collection.rb  |   34 +++
 90 files changed, 2649 insertions(+), 2649 deletions(-)
 delete mode 100644 server/lib/cimi/model/action.rb
 delete mode 100644 server/lib/cimi/model/address.rb
 delete mode 100644 server/lib/cimi/model/address_collection.rb
 delete mode 100644 server/lib/cimi/model/address_template.rb
 delete mode 100644 server/lib/cimi/model/address_template_collection.rb
 delete mode 100644 server/lib/cimi/model/base.rb
 delete mode 100644 server/lib/cimi/model/cloud_entry_point.rb
 delete mode 100644 server/lib/cimi/model/entity_metadata.rb
 delete mode 100644 server/lib/cimi/model/entity_metadata_collection.rb
 delete mode 100644 server/lib/cimi/model/errors.rb
 delete mode 100644 server/lib/cimi/model/machine.rb
 delete mode 100644 server/lib/cimi/model/machine_admin.rb
 delete mode 100644 server/lib/cimi/model/machine_admin_collection.rb
 delete mode 100644 server/lib/cimi/model/machine_collection.rb
 delete mode 100644 server/lib/cimi/model/machine_configuration.rb
 delete mode 100644 server/lib/cimi/model/machine_configuration_collection.rb
 delete mode 100644 server/lib/cimi/model/machine_image.rb
 delete mode 100644 server/lib/cimi/model/machine_image_collection.rb
 delete mode 100644 server/lib/cimi/model/machine_template.rb
 delete mode 100644 server/lib/cimi/model/machine_template_collection.rb
 delete mode 100644 server/lib/cimi/model/network.rb
 delete mode 100644 server/lib/cimi/model/network_collection.rb
 delete mode 100644 server/lib/cimi/model/network_configuration.rb
 delete mode 100644 server/lib/cimi/model/network_configuration_collection.rb
 delete mode 100644 server/lib/cimi/model/network_template.rb
 delete mode 100644 server/lib/cimi/model/network_template_collection.rb
 delete mode 100644 server/lib/cimi/model/routing_group.rb
 delete mode 100644 server/lib/cimi/model/routing_group_collection.rb
 delete mode 100644 server/lib/cimi/model/routing_group_template.rb
 delete mode 100644 server/lib/cimi/model/routing_group_template_collection.rb
 delete mode 100644 server/lib/cimi/model/schema.rb
 delete mode 100644 server/lib/cimi/model/volume.rb
 delete mode 100644 server/lib/cimi/model/volume_collection.rb
 delete mode 100644 server/lib/cimi/model/volume_configuration.rb
 delete mode 100644 server/lib/cimi/model/volume_configuration_collection.rb
 delete mode 100644 server/lib/cimi/model/volume_image.rb
 delete mode 100644 server/lib/cimi/model/volume_image_collection.rb
 delete mode 100644 server/lib/cimi/model/volume_template.rb
 delete mode 100644 server/lib/cimi/model/volume_template_collection.rb
 delete mode 100644 server/lib/cimi/model/vsp.rb
 delete mode 100644 server/lib/cimi/model/vsp_collection.rb
 delete mode 100644 server/lib/cimi/model/vsp_configuration.rb
 delete mode 100644 server/lib/cimi/model/vsp_configuration_collection.rb
 delete mode 100644 server/lib/cimi/model/vsp_template.rb
 delete mode 100644 server/lib/cimi/model/vsp_template_collection.rb
 create mode 100644 server/lib/cimi/models/action.rb
 create mode 100644 server/lib/cimi/models/address.rb
 create mode 100644 server/lib/cimi/models/address_collection.rb
 create mode 100644 server/lib/cimi/models/address_template.rb
 create mode 100644 server/lib/cimi/models/address_template_collection.rb
 create mode 100644 server/lib/cimi/models/base.rb
 create mode 100644 server/lib/cimi/models/cloud_entry_point.rb
 create mode 100644 server/lib/cimi/models/entity_metadata.rb
 create mode 100644 server/lib/cimi/models/entity_metadata_collection.rb
 create mode 100644 server/lib/cimi/models/errors.rb
 create mode 100644 server/lib/cimi/models/machine.rb
 create mode 100644 server/lib/cimi/models/machine_admin.rb
 create mode 100644 server/lib/cimi/models/machine_admin_collection.rb
 create mode 100644 server/lib/cimi/models/machine_collection.rb
 create mode 100644 server/lib/cimi/models/machine_configuration.rb
 create mode 100644 server/lib/cimi/models/machine_configuration_collection.rb
 create mode 100644 server/lib/cimi/models/machine_image.rb
 create mode 100644 server/lib/cimi/models/machine_image_collection.rb
 create mode 100644 server/lib/cimi/models/machine_template.rb
 create mode 100644 server/lib/cimi/models/machine_template_collection.rb
 create mode 100644 server/lib/cimi/models/network.rb
 create mode 100644 server/lib/cimi/models/network_collection.rb
 create mode 100644 server/lib/cimi/models/network_configuration.rb
 create mode 100644 server/lib/cimi/models/network_configuration_collection.rb
 create mode 100644 server/lib/cimi/models/network_template.rb
 create mode 100644 server/lib/cimi/models/network_template_collection.rb
 create mode 100644 server/lib/cimi/models/routing_group.rb
 create mode 100644 server/lib/cimi/models/routing_group_collection.rb
 create mode 100644 server/lib/cimi/models/routing_group_template.rb
 create mode 100644 server/lib/cimi/models/routing_group_template_collection.rb
 create mode 100644 server/lib/cimi/models/schema.rb
 create mode 100644 server/lib/cimi/models/volume.rb
 create mode 100644 server/lib/cimi/models/volume_collection.rb
 create mode 100644 server/lib/cimi/models/volume_configuration.rb
 create mode 100644 server/lib/cimi/models/volume_configuration_collection.rb
 create mode 100644 server/lib/cimi/models/volume_image.rb
 create mode 100644 server/lib/cimi/models/volume_image_collection.rb
 create mode 100644 server/lib/cimi/models/volume_template.rb
 create mode 100644 server/lib/cimi/models/volume_template_collection.rb
 create mode 100644 server/lib/cimi/models/vsp.rb
 create mode 100644 server/lib/cimi/models/vsp_collection.rb
 create mode 100644 server/lib/cimi/models/vsp_configuration.rb
 create mode 100644 server/lib/cimi/models/vsp_configuration_collection.rb
 create mode 100644 server/lib/cimi/models/vsp_template.rb
 create mode 100644 server/lib/cimi/models/vsp_template_collection.rb

diff --git a/server/lib/cimi/model/action.rb b/server/lib/cimi/model/action.rb
deleted file mode 100644
index c1c9908..0000000
--- a/server/lib/cimi/model/action.rb
+++ /dev/null
@@ -1,24 +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::Action < CIMI::Model::Base
-
-  text :action
-
-  def name
-    action.split('/').last.strip.intern
-  end
-
-end
diff --git a/server/lib/cimi/model/address.rb b/server/lib/cimi/model/address.rb
deleted file mode 100644
index 8838331..0000000
--- a/server/lib/cimi/model/address.rb
+++ /dev/null
@@ -1,72 +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::Address < CIMI::Model::Base
-
-  text :ip
-
-  text :hostname
-
-  text :allocation
-
-  text :default_gateway
-
-  text :dns
-
-  text :mac_address
-
-  text :protocol
-
-  text :mask
-
-  href :network
-
-  href :resource
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.addresses(context.credentials, {:env=>context})
-    else
-      context.driver.addresses(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["addressTemplate"]["href"] #by reference
-      address_template = AddressTemplate.find(context.href_id(input["addressTemplate"]["href"], :address_templates), context)
-    else
-      case type
-        when :json
-          address_template = AddressTemplate.from_json(JSON.generate(input["addressTemplate"]))
-        when :xml
-          xml = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
-          address_template = AddressTemplate.from_xml(XmlSimple.xml_out(xml["addressTemplate"][0]))
-      end
-    end
-    params = {:name=>input["name"], :description=>input["description"], :address_template=>address_template, :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_address(context.credentials, params)
-  end
-
-  def self.delete!(id, context)
-    context.driver.delete_address(context.credentials, id)
-  end
-
-end
diff --git a/server/lib/cimi/model/address_collection.rb b/server/lib/cimi/model/address_collection.rb
deleted file mode 100644
index eef6c51..0000000
--- a/server/lib/cimi/model/address_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::AddressCollection < CIMI::Model::Base
-
-  act_as_root_entity :address
-
-  array :addresses do
-    scalar :href
-  end
-
-  def self.default(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 } }
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/address_template.rb b/server/lib/cimi/model/address_template.rb
deleted file mode 100644
index 9d2c409..0000000
--- a/server/lib/cimi/model/address_template.rb
+++ /dev/null
@@ -1,54 +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::AddressTemplate < CIMI::Model::Base
-
-  text :ip
-
-  text :hostname
-
-  text :allocation
-
-  text :default_gateway
-
-  text :dns
-
-  text :mac_address
-
-  text :protocol
-
-  text :mask
-
-  href :network
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.address_templates(context.credentials, {:env=>context})
-    else
-      context.driver.address_templates(context.credentials, {:id=>id, :env=>context})
-    end
-  end
-
-  def self.create(request_body, context, type)
-  end
-
-  def self.delete!(id, context)
-  end
-
-end
diff --git a/server/lib/cimi/model/address_template_collection.rb b/server/lib/cimi/model/address_template_collection.rb
deleted file mode 100644
index e973252..0000000
--- a/server/lib/cimi/model/address_template_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::AddressTemplateCollection < CIMI::Model::Base
-
-  act_as_root_entity :address_template
-
-  array :address_templates do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.address_templates_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} AddressTemplateCollection",
-      :address_templates => AddressTemplate.all(context).map { |addr| { :href => addr.id } }
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/base.rb b/server/lib/cimi/model/base.rb
deleted file mode 100644
index 16812ac..0000000
--- a/server/lib/cimi/model/base.rb
+++ /dev/null
@@ -1,249 +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.
-
-require 'xmlsimple'
-require 'json'
-
-# The base class for any CIMI object that we either read from a request or
-# write as a response. This class handles serializing/deserializing XML and
-# JSON into a common form.
-#
-# == Defining the schema
-#
-# The conversion of XML and JSON into internal objects is based on a schema
-# that is defined through a DSL:
-#
-#   class Machine < CIMI::Model::Base
-#     text :status
-#     href :meter
-#     array :volumes do
-#       scalar :href, :attachment_point, :protocol
-#     end
-#   end
-#
-# The DSL automatically takes care of converting identifiers from their
-# underscored form to the camel-cased form used by CIMI. The above class
-# can be used in the following way:
-#
-#   machine = Machine.from_xml(some_xml)
-#   if machine.status == "UP"
-#     ...
-#   end
-#   sda = machine.volumes.find { |v| v.attachment_point == "/dev/sda" }
-#   handle_meter(machine.meter.href)
-#
-# The keywords for the DSL are
-#   [scalar(names, ...)]
-#     Define a scalar attribute; in JSON, this is represented as a string
-#     property. In XML, this can be represented in a number of ways,
-#     depending on whether the option :text is set:
-#       * :text not set: attribute on the enclosing element
-#       * :text == :direct: the text content of the enclosing element
-#       * :text == :nested: the text content of an element +<name>...</name>+
-#   [text(names)]
-#     A shorthand for +scalar(names, :text => :nested)+, i.e., for
-#     attributes that in XML are represented by their own tags
-#   [href(name)]
-#     A shorthand for +struct name { scalar :href }+; in JSON, this is
-#     represented as +{ name: { "href": string } }+, and in XML as +<name
-#     href="..."/>+
-#   [struct(name, opts, &block)]
-#     A structured subobject; the block defines the schema of the
-#     subobject. The +:content+ option can be used to specify the attribute
-#     that should receive the content of hte corresponding XML element
-#   [array(name, opts, &block)]
-#     An array of structured subobjects; the block defines the schema of
-#     the subobjects.
-
-module CIMI::Model
-
-  def self.register_as_root_entity!(name)
-    @root_entities ||= []
-    @root_entities << name
-    unless CIMI::Model::CloudEntryPoint.href_defined?(name)
-      CIMI::Model::CloudEntryPoint.send(:href, name.underscore)
-    end
-  end
-
-  def self.root_entities
-    @root_entities || []
-  end
-
-end
-
-class CIMI::Model::Base
-
-  #
-  # We keep the values of the attributes in a hash
-  #
-  attr_reader :attribute_values
-
-  # Keep the list of all attributes in an array +attributes+; for each
-  # attribute, we also define a getter and a setter to access/change the
-  # value for that attribute
-  class << self
-    def base_schema
-      @schema ||= CIMI::Model::Schema.new
-    end
-
-    def clone_base_schema
-      @schema_duped = true
-      @schema = Marshal::load(Marshal.dump(superclass.base_schema))
-    end
-
-    def base_schema_cloned?
-      @schema_duped
-    end
-
-    private :'clone_base_schema', :'base_schema_cloned?'
-
-    def inherited(child)
-      child.instance_eval do
-        def schema
-          base_schema_cloned? ? @schema : clone_base_schema
-        end
-      end
-    end
-
-    def add_attributes!(names, attr_klass, &block)
-      if self.respond_to? :schema
-        schema.add_attributes!(names, attr_klass, &block)
-      else
-        base_schema.add_attributes!(names, attr_klass, &block)
-      end
-      names.each do |name|
-        define_method(name) { @attribute_values[name] }
-        define_method(:"#{name}=") { |newval| @attribute_values[name] = newval }
-      end
-    end
-
-    # Return Array of links to current CIMI object
-    def all_uri(context)
-      self.all(context).map { |e| { :href => e.id } }
-    end
-  end
-
-  extend CIMI::Model::Schema::DSL
-
-  def [](a)
-    @attribute_values[a]
-  end
-
-  def []=(a, v)
-    @attribute_values[a] = v
-  end
-
-  #
-  # Factory methods
-  #
-  def initialize(values = {})
-    @attribute_values = values
-  end
-
-  # Construct a new object from the XML representation +xml+
-  def self.from_xml(text)
-    xml = XmlSimple.xml_in(text, :force_content => true)
-    model = self.new
-    @schema.from_xml(xml, model)
-    model
-  end
-
-  # Construct a new object
-  def self.from_json(text)
-    json = JSON::parse(text)
-    model = self.new
-    @schema.from_json(json, model)
-    model
-  end
-
-  #
-  # Serialize
-  #
-
-  def self.xml_tag_name
-    self.name.split("::").last
-  end
-
-  def self.to_json(model)
-    JSON::unparse(@schema.to_json(model))
-  end
-
-  def self.to_xml(model)
-    xml = @schema.to_xml(model)
-    xml["xmlns"] = "http://www.dmtf.org/cimi"
-    XmlSimple.xml_out(xml, :root_name => xml_tag_name)
-  end
-
-  def to_json
-    self.class.to_json(self)
-  end
-
-  def to_xml
-    self.class.to_xml(self)
-  end
-
-  #
-  # Common attributes for all resources
-  #
-  text :id, :name, :description, :created
-
-  # FIXME: this doesn't match with JSON
-  hash :property, :content => :value do
-    scalar :name
-  end
-
-  def self.act_as_root_entity(name=nil)
-    if name
-      name = name.to_s.camelize.pluralize
-    else
-      name = xml_tag_name.pluralize.uncapitalize
-    end
-    CIMI::Model.register_as_root_entity! name
-  end
-
-  def self.all(_self); find(:all, _self); end
-
-  def filter_by(filter_opts)
-    return self if filter_opts.nil?
-    return filter_attributes(filter_opts.split(',').map{ |a| a.intern }) if filter_opts.include? ','
-    case filter_opts
-      when /^([\w\_]+)$/ then filter_attributes([$1.intern])
-      when /^([\w\_]+)\[(\d+\-\d+)\]$/ then filter_by_arr_range($1.intern, $2)
-      when /^([\w\_]+)\[(\d+)\]$/ then filter_by_arr_index($1.intern, $2)
-      else self
-    end
-  end
-
-  private
-
-  def filter_attributes(attr_list)
-    attrs = attr_list.inject({}) do |result, attr|
-      result[attr] = self.send(attr) if self.respond_to?(attr)
-      result
-    end
-    self.class.new(attrs)
-  end
-
-  def filter_by_arr_index(attr, filter)
-    return self unless self.respond_to?(attr)
-    self.class.new(attr => [self.send(attr)[filter.to_i]])
-  end
-
-  def filter_by_arr_range(attr, filter)
-    return self unless self.respond_to?(attr)
-    filter = filter.split('-').inject { |s,e| s.to_i..e.to_i }
-    self.class.new(attr => self.send(attr)[filter])
-  end
-end
diff --git a/server/lib/cimi/model/cloud_entry_point.rb b/server/lib/cimi/model/cloud_entry_point.rb
deleted file mode 100644
index 5db94df..0000000
--- a/server/lib/cimi/model/cloud_entry_point.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.
-
-class CIMI::Model::CloudEntryPoint < CIMI::Model::Base
-
-  array :entity_metadata do
-    scalar :href
-  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",
-      :id => context.cloudEntryPoint_url,
-      :created => Time.now,
-      :entity_metadata => EntityMetadata.all_uri(context)
-    }))
-  end
-
-  # Return an Hash of the CIMI root entities used in CloudEntryPoint
-  def self.entities(context)
-    CIMI::Model.root_entities.inject({}) do |result, entity|
-      if context.respond_to? :"#{entity.underscore}_url"
-        result[entity.underscore] = { :href => context.send(:"#{entity.underscore}_url") }
-      end
-      result
-    end
-  end
-
-  private
-
-  def self.href_defined?(entity)
-    true if schema.attribute_names.include? entity.underscore
-  end
-
-end
diff --git a/server/lib/cimi/model/entity_metadata.rb b/server/lib/cimi/model/entity_metadata.rb
deleted file mode 100644
index bc20ff3..0000000
--- a/server/lib/cimi/model/entity_metadata.rb
+++ /dev/null
@@ -1,83 +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::EntityMetadata < CIMI::Model::Base
-
-text :type_uri
-
-  array :attributes do
-    scalar :name
-    scalar :namespace
-    scalar :type
-    scalar :required
-    scalar :constraints
-  end
-
-  array :operations do
-    scalar :name
-    scalar :uri
-    scalar :description
-    scalar :method
-    scalar :input_message
-    scalar :output_message
-  end
-
-  def self.find(id, context)
-    entity_metadata = []
-    if id == :all
-      CIMI::Model.root_entities.each do |entity|
-        entity_class = CIMI::Model.const_get("#{entity.singularize}")
-        entity_metadata << entity_class.create_entity_metadata(context) if entity_class.respond_to?(:create_entity_metadata)
-      end
-      return entity_metadata
-    else
-      entity_class = CIMI::Model.const_get("#{id.camelize}")
-      if entity_class.respond_to?(:create_entity_metadata)
-        entity_class.create_entity_metadata(context)
-      end
-    end
-  end
-
-  def self.metadata_from_deltacloud_features(cimi_entity, dcloud_entity, context)
-    deltacloud_features = context.driver.features(dcloud_entity)
-    metadata_attributes = deltacloud_features.map{|f| attributes_from_feature(f)}
-    from_feature(cimi_entity, context, metadata_attributes.flatten!)
-  end
-
-  def includes_attribute?(attribute)
-    self.attributes.any?{|attr| attr[:name] == attribute}
-  end
-
-  private
-
-  def self.attributes_from_feature(feature)
-    feature.operations.first.params.inject([]) do |result, param|
-      result << {
-        :name=>(feature.name == :user_name ? :name : param[0]),
-        :type=> "xs:string",
-        :required=> (param[1] and param[1].optional?) ? "false" : "true",
-        :constraints=> (feature.constraints.empty? ? (feature.description.nil? ? "" : feature.description): feature.constraints)
-      }
-    end
-  end
-
-  def self.from_feature(cimi_entity, context, metadata_attributes)
-    self.new(:name => cimi_entity, :uri=>"#{context.entity_metadata_url}/#{cimi_entity.underscore}",
-             :type_uri=> context.send("#{cimi_entity.pluralize.underscore}_url"),
-             :attributes => metadata_attributes)
-  end
-
-end
diff --git a/server/lib/cimi/model/entity_metadata_collection.rb b/server/lib/cimi/model/entity_metadata_collection.rb
deleted file mode 100644
index 63db7f7..0000000
--- a/server/lib/cimi/model/entity_metadata_collection.rb
+++ /dev/null
@@ -1,31 +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::EntityMetadataCollection < CIMI::Model::Base
-
-  array :entity_metadata do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.entity_metadata_url,
-      :name => 'default',
-      :created => Time.now,
-      :entity_metadata => EntityMetadata.all_uri(context)
-   )
-  end
-
-end
diff --git a/server/lib/cimi/model/errors.rb b/server/lib/cimi/model/errors.rb
deleted file mode 100644
index 7c090ed..0000000
--- a/server/lib/cimi/model/errors.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::Model
-
-  class NotFound < StandardError
-    attr_accessor :code
-
-    def initialize
-      super("Requested Entity Not Found")
-      self.code = 404
-    end
-
-  end
-
-  class BadRequest < StandardError
-    attr_accessor :code
-    def initialize(msg="")
-      super(msg)
-      self.code=400
-    end
-  end
-
-  class NotImplemented < StandardError
-    attr_accessor :code
-
-    def initialize
-      super("Requested operation is not implemented by backend provider")
-      self.code = 501
-    end
-
-  end
-
-end
-
-
diff --git a/server/lib/cimi/model/machine.rb b/server/lib/cimi/model/machine.rb
deleted file mode 100644
index 939629a..0000000
--- a/server/lib/cimi/model/machine.rb
+++ /dev/null
@@ -1,229 +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.
-
-require 'deltacloud/models/instance_address'
-
-class CIMI::Model::Machine < CIMI::Model::Base
-
-  text :state
-  text :cpu
-
-  struct :memory do
-    scalar :quantity
-    scalar :units
-  end
-
-  href :event_log
-
-  array :disks do
-    struct :capacity do
-      scalar :quantity
-      scalar :units
-    end
-    scalar :format
-    scalar :attachment_point
-  end
-
-  array :volumes do
-    scalar :href
-    scalar :protocol
-    scalar :attachment_point
-  end
-
-  array :network_interfaces do
-    href :vsp
-    text :hostname, :mac_address, :state, :protocol, :allocation
-    text :address, :default_gateway, :dns, :max_transmission_unit
-  end
-
-  array :meters do
-    scalar :href
-  end
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    instances = []
-    if id == :all
-      instances = context.driver.instances(context.credentials)
-      instances.map { |instance| from_instance(instance, context) }.compact
-    else
-      instance = context.driver.instance(context.credentials, :id => id)
-      raise CIMI::Model::NotFound unless instance
-      from_instance(instance, context)
-    end
-  end
-
-  def self.create_from_json(body, context)
-    json = JSON.parse(body)
-    hardware_profile_id = xml['machineTemplate']['machineConfig']["href"].split('/').last
-    image_id = xml['machineTemplate']['machineImage']["href"].split('/').last
-    instance = context.create_instance(context.credentials, image_id, { :hwp_id => hardware_profile_id })
-    from_instance(instance, context)
-  end
-
-  def self.create_from_xml(body, context)
-    xml = XmlSimple.xml_in(body)
-    machine_template = xml['machineTemplate'][0]
-    hardware_profile_id = machine_template['machineConfig'][0]["href"].split('/').last
-    image_id = machine_template['machineImage'][0]["href"].split('/').last
-    additional_params = {}
-    additional_params[:name] =xml['name'][0] if xml['name']
-    if machine_template.has_key? 'machineAdmin'
-      additional_params[:keyname] = machine_template['machineAdmin'][0]["href"].split('/').last
-    end
-    instance = context.driver.create_instance(context.credentials, image_id, {
-      :hwp_id => hardware_profile_id
-    }.merge(additional_params))
-    from_instance(instance, context)
-  end
-
-  def perform(action, context, &block)
-    begin
-      if context.driver.send(:"#{action.name}_instance", context.credentials, self.name)
-        block.callback :success
-      else
-        raise "Operation failed to execute on given Machine"
-      end
-    rescue => e
-      block.callback :failure, e.message
-    end
-  end
-
-  def self.delete!(id, context)
-    context.driver.destroy_instance(context.credentials, id)
-  end
-
-  def self.create_entity_metadata(context)
-    cimi_entity = self.name.split("::").last
-    metadata = EntityMetadata.metadata_from_deltacloud_features(cimi_entity, :instances, context)
-    unless metadata.includes_attribute?(:name)
-      metadata.attributes << {:name=>"name", :required=>"false",
-                   :constraints=>"Determined by the cloud provider", :type=>"xs:string"}
-    end
-    metadata
-  end
-
-  def self.attach_volumes(volumes, context)
-    volumes.each do |vol|
-      context.driver.attach_storage_volume(context.credentials,
-      {:id=>vol[:volume].name, :instance_id=>context.params[:id], :device=>vol[:attachment_point]})
-    end
-    self.find(context.params[:id], context)
-  end
-
-  def self.detach_volumes(volumes, context)
-    volumes.each do |vol|
-      context.driver.detach_storage_volume(context.credentials, {:id=>vol[:volume].name, :instance_id => context.params[:id]})
-    end
-    self.find(context.params[:id], context)
-  end
-
-  private
-
-  def self.from_instance(instance, context)
-    cpu =  memory = disks = (instance.instance_profile.id == "opaque")? "n/a" : nil
-    self.new(
-      :name => instance.id,
-      :description => instance.name,
-      :created => instance.launch_time,
-      :id => context.machine_url(instance.id),
-      :state => convert_instance_state(instance.state),
-      :cpu => cpu || convert_instance_cpu(instance.instance_profile, context),
-      :memory => memory || convert_instance_memory(instance.instance_profile, context),
-      :disks => disks || convert_instance_storage(instance.instance_profile, context),
-      :network_interfaces => convert_instance_addresses(instance),
-      :operations => convert_instance_actions(instance, context),
-      :volumes=>convert_storage_volumes(instance, context),
-      :property => convert_instance_properties(instance, context)
-    )
-  end
-
-  # FIXME: This will convert 'RUNNING' state to 'STARTED'
-  # which is defined in CIMI (p65)
-  #
-  def self.convert_instance_state(state)
-    ('RUNNING' == state) ? 'STARTED' : state
-  end
-
-  def self.convert_instance_properties(instance, context)
-    properties = []
-    properties << { :name => :machine_image, :value => context.machine_image_url(instance.image_id) }
-    if instance.respond_to? :keyname
-      properties << { :name => :machine_admin, :value => context.machine_admin_url(instance.keyname) }
-    end
-    properties
-  end
-
-  def self.convert_instance_cpu(profile, context)
-    cpu_override = profile.overrides.find { |p, v| p == :cpu }
-    if cpu_override.nil?
-      MachineConfiguration.find(profile.id, context).cpu
-    else
-      cpu_override[1]
-    end
-  end
-
-  def self.convert_instance_memory(profile, context)
-    machine_conf = MachineConfiguration.find(profile.name, context)
-    memory_override = profile.overrides.find { |p, v| p == :memory }
-    {
-      :quantity => memory_override.nil? ? machine_conf.memory[:quantity] : memory_override[1],
-      :units => machine_conf.memory[:units]
-    }
-  end
-
-  def self.convert_instance_storage(profile, context)
-    machine_conf = MachineConfiguration.find(profile.name, context)
-    storage_override = profile.overrides.find { |p, v| p == :storage }
-    [
-      { :capacity => {
-          :quantity => storage_override.nil? ? machine_conf.disks.first[:capacity][:quantity] : storage_override[1],
-          :units => machine_conf.disks.first[:capacity][:units]
-        }
-      }
-    ]
-  end
-
-  def self.convert_instance_addresses(instance)
-    (instance.public_addresses + instance.private_addresses).collect do |address|
-      {
-        :hostname => address.is_hostname? ? address : nil,
-        :mac_address => address.is_mac? ? address : nil,
-        :state => 'Active',
-        :protocol => 'IPv4',
-        :address => address.is_ipv4? ? address : nil,
-        :allocation => 'Static'
-      }
-    end
-  end
-
-  def self.convert_instance_actions(instance, context)
-    instance.actions.collect do |action|
-      action = :destroy if action == :delete # In CIMI destroy operation become delete
-      action = :restart if action == :reboot  # In CIMI reboot operation become restart
-      { :href => context.send(:"#{action}_machine_url", instance.id), :rel => "http://www.dmtf.org/cimi/action/#{action}" }
-    end
-  end
-
-  def self.convert_storage_volumes(instance, context)
-    instance.storage_volumes ||= [] #deal with nilpointers
-    instance.storage_volumes.map{|vol| {:href=>context.volume_url(vol.keys.first),
-                                       :attachment_point=>vol.values.first} }
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_admin.rb b/server/lib/cimi/model/machine_admin.rb
deleted file mode 100644
index fed7c80..0000000
--- a/server/lib/cimi/model/machine_admin.rb
+++ /dev/null
@@ -1,59 +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::MachineAdmin < CIMI::Model::Base
-
-  text :username
-  text :password
-  text :key
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id == :all
-      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)
-    machine_admin = MachineAdmin.from_xml(body)
-    key = context.driver.create_key(context.credentials, :key_name => machine_admin.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.machine_admin_url(key.id),
-      :created => Time.now
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_admin_collection.rb b/server/lib/cimi/model/machine_admin_collection.rb
deleted file mode 100644
index fd76a52..0000000
--- a/server/lib/cimi/model/machine_admin_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::MachineAdminCollection < CIMI::Model::Base
-
-  act_as_root_entity :machine_admin
-
-  array :machine_admins do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.machine_admins_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} MachineAdminCollection",
-      :machine_admins => MachineAdmin.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_collection.rb b/server/lib/cimi/model/machine_collection.rb
deleted file mode 100644
index 27aa61b..0000000
--- a/server/lib/cimi/model/machine_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::MachineCollection < CIMI::Model::Base
-
-  act_as_root_entity :machine
-
-  array :machines do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.machines_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} MachineCollection",
-      :machines => Machine.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_configuration.rb b/server/lib/cimi/model/machine_configuration.rb
deleted file mode 100644
index f9d98f2..0000000
--- a/server/lib/cimi/model/machine_configuration.rb
+++ /dev/null
@@ -1,70 +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::MachineConfiguration < CIMI::Model::Base
-
-  struct :memory do
-    scalar :quantity
-    scalar :units
-  end
-
-  text :cpu
-
-  array :disks do
-    struct :capacity do
-      scalar :quantity
-      scalar :units
-    end
-    scalar :format
-    scalar :attachment_point
-  end
-
-  array :operations do
-    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.value || profile.memory.default
-    cpu = profile.cpu.value || profile.cpu.default
-    storage = profile.storage.value || profile.storage.default
-    machine_hash = {
-      :name => profile.name,
-      :description => "Machine Configuration with #{memory} #{profile.memory.unit} "+
-        "of memory and #{cpu} CPU",
-      :cpu => cpu,
-      :created => Time.now.to_s,  # FIXME: DC hardware_profile has no mention about created_at
-      :memory => { :quantity => profile.memory.value || profile.memory.default, :units => profile.memory.unit },
-      :disks => [ { :capacity => { :quantity => profile.storage.value || profile.storage.default, :units => profile.storage.unit } } ],
-      :id => context.machine_configuration_url(profile.name)
-    }
-    self.new(machine_hash)
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_configuration_collection.rb b/server/lib/cimi/model/machine_configuration_collection.rb
deleted file mode 100644
index 171acac..0000000
--- a/server/lib/cimi/model/machine_configuration_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::MachineConfigurationCollection < CIMI::Model::Base
-
-  act_as_root_entity :machine_configuration
-
-  array :machine_configurations do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.machine_configurations_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} MachineConfigurationCollection",
-      :machine_configurations => MachineConfiguration.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_image.rb b/server/lib/cimi/model/machine_image.rb
deleted file mode 100644
index 7389475..0000000
--- a/server/lib/cimi/model/machine_image.rb
+++ /dev/null
@@ -1,46 +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::MachineImage < CIMI::Model::Base
-
-  href :image_location
-  text :image_data
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    images = []
-    if id == :all
-      images = context.driver.images(context.credentials)
-      images.map { |image| from_image(image, context) }
-    else
-      image = context.driver.image(context.credentials, :id => id)
-      from_image(image, context)
-    end
-  end
-
-  def self.from_image(image, context)
-    self.new(
-      :name => image.id,
-      :id => context.machine_image_url(image.id),
-      :description => image.description,
-      :created => Time.now.to_s,
-      :image_location => { :href => "#{context.driver.name}://#{image.id}" } # FIXME
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_image_collection.rb b/server/lib/cimi/model/machine_image_collection.rb
deleted file mode 100644
index b02ede7..0000000
--- a/server/lib/cimi/model/machine_image_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::MachineImageCollection < CIMI::Model::Base
-
-  act_as_root_entity :machine_image
-
-  array :machine_images do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.machine_images_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} MachineImageCollection",
-      :machine_images => MachineImage.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/machine_template.rb b/server/lib/cimi/model/machine_template.rb
deleted file mode 100644
index 8a88052..0000000
--- a/server/lib/cimi/model/machine_template.rb
+++ /dev/null
@@ -1,41 +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::MachineTemplate < CIMI::Model::Base
-
-  href :machine_config
-  href :machine_image
-  href :machine_admin
-
-  array :volumes do
-    scalar :href
-    scalar :protocol
-    scalar :attachment_point
-  end
-
-  array :volume_templates do
-    scalar :href, :attachment_point, :protocol
-  end
-
-  array :network_interfaces do
-    href :vsp
-    text :hostname, :mac_address, :state, :protocol, :allocation
-    text :address, :default_gateway, :dns, :max_transmission_unit
-  end
-
-  array :operations do
-    scalar :rel, :href
-  end
-end
diff --git a/server/lib/cimi/model/machine_template_collection.rb b/server/lib/cimi/model/machine_template_collection.rb
deleted file mode 100644
index e1e8d30..0000000
--- a/server/lib/cimi/model/machine_template_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::MachineTemplateCollection < CIMI::Model::Base
-
-  act_as_root_entity :machine_template
-
-  array :machine_templates do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.machine_template_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} MachineTemplateCollection",
-      :machine_templates => MachineTemplate.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/network.rb b/server/lib/cimi/model/network.rb
deleted file mode 100644
index cbfbae0..0000000
--- a/server/lib/cimi/model/network.rb
+++ /dev/null
@@ -1,106 +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::Network < CIMI::Model::Base
-
-  text :state
-
-  text :access
-
-  text :bandwidth_limit
-
-  text :traffic_priority
-
-  text :max_traffic_delay
-
-  text :max_traffic_loss
-
-  text :max_traffic_jitter
-
-  href :routing_group
-
-  href :event_log
-
-  array :meters do
-    scalar :href
-  end
-
-  array :operations do
-    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
-    networks
-  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["networkTemplate"]["href"] #template by reference
-      network_config, routing_group = get_by_reference(input, context)
-    else
-      if input["networkTemplate"]["networkConfig"]["href"] # configuration by reference
-        network_config = NetworkConfiguration.find(context.href_id(input["networkTemplate"]["networkConfig"]["href"],:network_configurations), context)
-      else #configuration by value
-        network_config = get_by_value(request_body, type)
-      end
-      routing_group = RoutingGroup.find(context.href_id(input["networkTemplate"]["routingGroup"]["href"], :routing_groups), context)
-    end
-    params = {:network_config => network_config, :routing_group => routing_group, :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(context.credentials, params)
-  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
-
-  private
-
-  def self.get_by_reference(input, context)
-    network_template = NetworkTemplate.find(context.href_id(input["networkTemplate"]["href"], :network_templates), context)
-    network_config = NetworkConfiguration.find(context.href_id(network_template.network_config.href, :network_configurations), context)
-    routing_group = RoutingGroup.find(context.href_id(network_template.routing_group.href, :routing_groups), context)
-    return network_config, routing_group
-  end
-
-  def self.get_by_value(request_body, type)
-    if type == :xml
-      xml_arrays = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
-      network_config = NetworkConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["networkTemplate"][0]["networkConfig"][0]))
-    else
-     json = JSON.parse(request_body)
-      network_config = NetworkConfiguration.from_json(JSON.generate(json["networkTemplate"]["networkConfig"]))
-    end
-  end
-
-end
diff --git a/server/lib/cimi/model/network_collection.rb b/server/lib/cimi/model/network_collection.rb
deleted file mode 100644
index 836d8e8..0000000
--- a/server/lib/cimi/model/network_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::NetworkCollection < CIMI::Model::Base
-
-  act_as_root_entity :network
-
-  array :networks do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.networks_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} NetworkCollection",
-      :networks => Network.all(context).map { |c| { :href => c.id } }
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/network_configuration.rb b/server/lib/cimi/model/network_configuration.rb
deleted file mode 100644
index 1b04548..0000000
--- a/server/lib/cimi/model/network_configuration.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.
-
-class CIMI::Model::NetworkConfiguration < CIMI::Model::Base
-
-  text :access
-
-  text :bandwidth_limit
-
-  text :traffic_priority
-
-  text :max_traffic_delay
-
-  text :max_traffic_loss
-
-  text :max_traffic_jitter
-
-  array :operations do
-    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
diff --git a/server/lib/cimi/model/network_configuration_collection.rb b/server/lib/cimi/model/network_configuration_collection.rb
deleted file mode 100644
index fd70047..0000000
--- a/server/lib/cimi/model/network_configuration_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::NetworkConfigurationCollection < CIMI::Model::Base
-
-  act_as_root_entity :network_configuration
-
-  array :network_configurations do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.network_configurations_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} NetworkConfigurationCollection",
-      :network_configurations => NetworkConfiguration.all(context).map { |c| { :href => c.id } }
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/network_template.rb b/server/lib/cimi/model/network_template.rb
deleted file mode 100644
index ce3b990..0000000
--- a/server/lib/cimi/model/network_template.rb
+++ /dev/null
@@ -1,36 +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::NetworkTemplate < CIMI::Model::Base
-
-  href :network_config
-
-  href :routing_group
-
-  array :operations do
-    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
diff --git a/server/lib/cimi/model/network_template_collection.rb b/server/lib/cimi/model/network_template_collection.rb
deleted file mode 100644
index 6b97b6e..0000000
--- a/server/lib/cimi/model/network_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::NetworkTemplateCollection < CIMI::Model::Base
-
-  act_as_root_entity :network_template
-
-  array :network_templates do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.network_templates_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} NetworkTemplateCollection",
-      :network_templates => NetworkTemplate.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/routing_group.rb b/server/lib/cimi/model/routing_group.rb
deleted file mode 100644
index d26f4d7..0000000
--- a/server/lib/cimi/model/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/model/routing_group_collection.rb b/server/lib/cimi/model/routing_group_collection.rb
deleted file mode 100644
index 1546c80..0000000
--- a/server/lib/cimi/model/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 => RoutingGroup.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/routing_group_template.rb b/server/lib/cimi/model/routing_group_template.rb
deleted file mode 100644
index 204a353..0000000
--- a/server/lib/cimi/model/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/model/routing_group_template_collection.rb b/server/lib/cimi/model/routing_group_template_collection.rb
deleted file mode 100644
index 5e7a9ba..0000000
--- a/server/lib/cimi/model/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 => RoutingGroupTemplate.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/schema.rb b/server/lib/cimi/model/schema.rb
deleted file mode 100644
index f301b69..0000000
--- a/server/lib/cimi/model/schema.rb
+++ /dev/null
@@ -1,277 +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.
-#
-
-# The smarts of converting from XML and JSON into internal objects
-class CIMI::Model::Schema
-
-  #
-  # Attributes describe how we extract values from XML/JSON
-  #
-  class Attribute
-    attr_reader :name, :xml_name, :json_name
-
-    def initialize(name, opts = {})
-      @name = name
-      @xml_name = (opts[:xml_name] || name).to_s.camelize(true)
-      @json_name = (opts[:json_name] || name).to_s.camelize(true)
-    end
-
-    def from_xml(xml, model)
-      model[@name] = xml[@xml_name].first if xml.has_key?(@xml_name)
-    end
-
-    def from_json(json, model)
-      model[@name] = json[@json_name]
-    end
-
-    def to_xml(model, xml)
-      xml[@xml_name] = [model[@name]] if model[@name]
-    end
-
-    def to_json(model, json)
-      json[@json_name] = model[@name] if model and model[@name]
-    end
-  end
-
-  class Scalar < Attribute
-    def initialize(name, opts)
-      @text = opts[:text]
-      if ! [nil, :nested, :direct].include?(@text)
-        raise "text option for scalar must be :nested or :direct"
-      end
-      super(name, opts)
-    end
-
-    def text?; @text; end
-
-    def nested_text?; @text == :nested; end
-
-    def from_xml(xml, model)
-      case @text
-        when :nested then model[@name] = xml[@xml_name].first["content"] if xml[@xml_name]
-        when :direct then model[@name] = xml["content"]
-        else model[@name] = xml[@xml_name]
-      end
-    end
-
-    def to_xml(model, xml)
-      return unless model
-      return unless model[@name]
-      case @text
-        when :nested then xml[@xml_name] = [{ "content" => model[@name] }]
-        when :direct then xml["content"] = model[@name]
-        else xml[@xml_name] = model[@name]
-      end
-    end
-  end
-
-  class Struct < Attribute
-    def initialize(name, opts, &block)
-      content = opts[:content]
-      super(name, opts)
-      @schema = CIMI::Model::Schema.new
-      @schema.instance_eval(&block) if block_given?
-      @schema.scalar(content, :text => :direct) if content
-    end
-
-    def from_xml(xml, model)
-      xml = xml.has_key?(xml_name) ? xml[xml_name].first : {}
-      model[name] = convert_from_xml(xml)
-    end
-
-    def from_json(json, model)
-      json = json.has_key?(json_name) ? json[json_name] : {}
-      model[name] = convert_from_json(json)
-    end
-
-    def to_xml(model, xml)
-      conv = convert_to_xml(model[name])
-      xml[xml_name] = [conv] unless conv.empty?
-    end
-
-    def to_json(model, json)
-      conv = convert_to_json(model[name])
-      json[json_name] = conv unless conv.empty?
-    end
-
-    def convert_from_xml(xml)
-      sub = struct.new
-      @schema.from_xml(xml, sub)
-      sub
-    end
-
-    def convert_from_json(json)
-      sub = struct.new
-      @schema.from_json(json, sub)
-      sub
-    end
-
-    def convert_to_xml(model)
-      xml = {}
-      @schema.to_xml(model, xml)
-      xml
-    end
-
-    def convert_to_json(model)
-      json = {}
-      @schema.to_json(model, json)
-      json
-    end
-
-    private
-    def struct
-      cname = "CIMI_#{json_name.upcase_first}"
-      if ::Struct.const_defined?(cname)
-        ::Struct.const_get(cname)
-      else
-        ::Struct.new("CIMI_#{json_name.upcase_first}",
-                     *@schema.attribute_names)
-      end
-    end
-  end
-
-  class Array < Attribute
-    # For an array :things, we collect all <thing/> elements (XmlSimple
-    # actually does the collecting)
-    def initialize(name, opts = {}, &block)
-      opts[:xml_name] = name.to_s.singularize unless opts[:xml_name]
-      super(name, opts)
-      @struct = Struct.new(name, opts, &block)
-    end
-
-    def from_xml(xml, model)
-      model[name] = (xml[xml_name] || []).map { |elt| @struct.convert_from_xml(elt) }
-    end
-
-    def from_json(json, model)
-      model[name] = (json[json_name] || []).map { |elt| @struct.convert_from_json(elt) }
-    end
-
-    def to_xml(model, xml)
-      ary = (model[name] || []).map { |elt| @struct.convert_to_xml(elt) }
-      xml[xml_name] = ary unless ary.empty?
-    end
-
-    def to_json(model, json)
-      ary = (model[name] || []).map { |elt| @struct.convert_to_json(elt) }
-      json[json_name] = ary unless ary.empty?
-    end
-  end
-
-  class Hash < Attribute
-
-    def initialize(name, opts = {}, &block)
-      opts[:json_name] = name.to_s.pluralize unless opts[:json_name]
-      super(name, opts)
-      @struct = Struct.new(name, opts, &block)
-    end
-
-    def from_xml(xml, model)
-      model[name] = (xml[xml_name] || []).map { |elt| @struct.convert_from_xml(elt) }
-    end
-
-    def from_json(json, model)
-      model[name] = (json[json_name] || {}).inject([]) do |result,item|
-        result << @struct.convert_from_json({ 'name' => item[0], 'value' => item[1] })
-      end
-    end
-
-    def to_xml(model, xml)
-      ary = (model[name] || []).map { |elt| @struct.convert_to_xml(elt) }
-      xml[xml_name] = ary unless ary.empty?
-    end
-
-    def to_json(model, json)
-      ary = (model[name] || []).map { |elt| @struct.convert_to_json(elt) }
-      json[json_name] = ary.inject({}) { |result, item| result[item['name']] = item['value']; result } unless ary.empty?
-    end
-  end
-
-  #
-  # The actual Schema class
-  #
-  def initialize
-    @attributes = []
-  end
-
-  def from_xml(xml, model = {})
-    @attributes.freeze
-    @attributes.each { |attr| attr.from_xml(xml, model) }
-    model
-  end
-
-  def from_json(json, model = {})
-    @attributes.freeze
-    @attributes.each { |attr| attr.from_json(json, model) }
-    model
-  end
-
-  def to_xml(model, xml = {})
-    @attributes.freeze
-    @attributes.each { |attr| attr.to_xml(model, xml) }
-    xml
-  end
-
-  def to_json(model, json = {})
-    @attributes.freeze
-    @attributes.each { |attr| attr.to_json(model, json) }
-    json
-  end
-
-  def attribute_names
-    @attributes.map { |a| a.name }
-  end
-
-  #
-  # The DSL
-  #
-  # Requires that the class into which this is included has a
-  # +add_attributes!+ method
-  module DSL
-    def href(*args)
-      args.each { |arg| struct(arg) { scalar :href } }
-    end
-
-    def text(*args)
-      args.expand_opts!(:text => :nested)
-      scalar(*args)
-    end
-
-    def scalar(*args)
-      add_attributes!(args, Scalar)
-    end
-
-    def array(name, opts={}, &block)
-      add_attributes!([name, opts], Array, &block)
-    end
-
-    def struct(name, opts={}, &block)
-      add_attributes!([name, opts], Struct, &block)
-    end
-
-    def hash(name, opts={}, &block)
-      add_attributes!([name, opts], Hash, &block)
-    end
-  end
-
-  include DSL
-
-  def add_attributes!(args, attr_klass, &block)
-    raise "The schema has already been used to convert objects" if @attributes.frozen?
-    opts = args.extract_opts!
-    args.each { |arg| @attributes << attr_klass.new(arg, opts, &block) }
-  end
-end
diff --git a/server/lib/cimi/model/volume.rb b/server/lib/cimi/model/volume.rb
deleted file mode 100644
index 0a232d5..0000000
--- a/server/lib/cimi/model/volume.rb
+++ /dev/null
@@ -1,103 +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::Volume < CIMI::Model::Base
-
-  struct :capacity do
-    scalar :quantity
-    scalar :units
-  end
-  text :bootable
-  text :supports_snapshots
-  array :snapshots do
-    scalar :ref
-  end
-  text :guest_interface
-  array :meters do
-    scalar :ref
-  end
-  href :eventlog
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    volumes = []
-    opts = ( id == :all ) ? {} : { :id => id }
-    volumes = self.driver.storage_volumes(context.credentials, opts)
-    volumes.collect!{ |volume| from_storage_volume(volume, context) }
-    return volumes.first unless volumes.length > 1
-    return volumes
-  end
-
-  def self.all(context); find(:all, context); end
-
-  def self.create_from_json(json_in, context)
-    json = JSON.parse(json_in)
-    volume_config_id = json["volumeTemplate"]["volumeConfig"]["href"].split("/").last
-    volume_image_id = (json["volumeTemplate"].has_key?("volumeImage") ?
-                json["volumeTemplate"]["volumeImage"]["href"].split("/").last  : nil)
-    create_volume({:volume_config_id=>volume_config_id, :volume_image_id=>volume_image_id}, context)
-  end
-
-  def self.create_from_xml(xml_in, context)
-    xml = XmlSimple.xml_in(xml_in)
-    volume_config_id = xml["volumeTemplate"][0]["volumeConfig"][0]["href"].split("/").last
-    volume_image_id = (xml["volumeTemplate"][0].has_key?("volumeImage") ?
-             xml["volumeTemplate"][0]["volumeImage"][0]["href"].split("/").last  : nil)
-    create_volume({:volume_config_id=>volume_config_id, :volume_image_id=>volume_image_id}, context)
-  end
-
-  def self.delete!(id, context)
-    context.driver.destroy_storage_volume(context.credentials, {:id=>id} )
-  end
-
-  def self.find_to_attach_from_json(json_in, context)
-    json = JSON.parse(json_in)
-    volumes = json["volumes"].map{|v| {:volume=>self.find(v["volume"]["href"].split("/volumes/").last, context),
-                                       :attachment_point=>v["attachmentPoint"]  }}
-  end
-
-  def self.find_to_attach_from_xml(xml_in, context)
-    xml = XmlSimple.xml_in(xml_in)
-    volumes = xml["volume"].map{|v| {:volume => self.find(v["href"].split("/volumes/").last, context),
-                                      :attachment_point=>v["attachmentPoint"] }}
-  end
-
-  private
-
-  def self.create_volume(params, context)
-    volume_config = VolumeConfiguration.find(params[:volume_config_id], context)
-    opts = {:capacity=>volume_config.capacity[:quantity], :snapshot_id=>params[:volume_image_id] }
-    storage_volume = self.driver.create_storage_volume(context.credentials, opts)
-    from_storage_volume(storage_volume, context)
-  end
-
-  def self.from_storage_volume(volume, context)
-    self.new( { :name => volume.id,
-                :description => volume.id,
-                :created => volume.created,
-                :id => context.volume_url(volume.id),
-                :capacity => { :quantity=>volume.capacity, :units=>"gibibyte"  }, #FIXME... units will vary
-                :bootable => "false", #fixme ... will vary... ec2 doesn't expose this
-                :supports_snapshots => "true", #fixme, will vary (true for ec2)
-                :snapshots => [], #fixme...
-                :guest_interface => "",
-                :eventlog => {:href=> "http://eventlogs"},#FIXME
-                :meters => []
-            } )
-  end
-
-end
diff --git a/server/lib/cimi/model/volume_collection.rb b/server/lib/cimi/model/volume_collection.rb
deleted file mode 100644
index d5053c7..0000000
--- a/server/lib/cimi/model/volume_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::VolumeCollection < CIMI::Model::Base
-
-  act_as_root_entity :volume
-
-  array :volumes do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.volumes_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VolumeCollection",
-      :volumes => Volume.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/volume_configuration.rb b/server/lib/cimi/model/volume_configuration.rb
deleted file mode 100644
index 75b37ea..0000000
--- a/server/lib/cimi/model/volume_configuration.rb
+++ /dev/null
@@ -1,60 +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::VolumeConfiguration < CIMI::Model::Base
-
-  text :format
-  struct :capacity do
-    scalar :quantity
-    scalar :units
-  end
-  text :supports_snapshots
-  text :guest_interface
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    volume_configs = []
-    if id == :all
-      #ec2 ebs volumes can 1gb..1tb
-      (1..1000).each do |size|
-        volume_configs << create(size, context)
-      end
-    else
-      volume_configs << create(id, context)
-      return volume_configs.first
-    end
-    return volume_configs
-  end
-
-
-  def self.all(context); find(:all, context); end
-
-  private
-
-  def self.create(size, context)
-    self.new( {
-                :id => context.volume_configuration_url(size),
-                :name => size,
-                :description => "volume configuration with #{size} GiB",
-                :created => Time.now.to_s,
-                :capacity => {:quantity=>size, :units=>"gibibytes"},
-                :supports_snapshots => "true"
-                # FIXME :guest_interface => "NFS"
-            } )
-  end
-
-end
diff --git a/server/lib/cimi/model/volume_configuration_collection.rb b/server/lib/cimi/model/volume_configuration_collection.rb
deleted file mode 100644
index ace31bf..0000000
--- a/server/lib/cimi/model/volume_configuration_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::VolumeConfigurationCollection < CIMI::Model::Base
-
-  act_as_root_entity :volume_configuration
-
-  array :volume_configurations do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.volume_configurations_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VolumeConfigurationCollection",
-      :volume_configurations => VolumeConfiguration.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/volume_image.rb b/server/lib/cimi/model/volume_image.rb
deleted file mode 100644
index 03cc7fd..0000000
--- a/server/lib/cimi/model/volume_image.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.
-
-class CIMI::Model::VolumeImage < CIMI::Model::Base
-
-  href :image_location
-  text :image_data
-  text :bootable
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    storage_snapshots = []
-    opts = ( id==:all  ) ? {}  : { :id=>id }
-    storage_snapshots = self.driver.storage_snapshots(context.credentials, opts)
-    storage_snapshots.collect!{ |snapshot| from_storage_snapshot(snapshot, context) }
-    return storage_snapshots.first unless storage_snapshots.length > 1
-    return storage_snapshots
-  end
-
-  def self.all(context); find(:all, context); end
-
-  private
-
-  def self.from_storage_snapshot(snapshot, context)
-    self.new( {
-               :name => snapshot.id,
-               :description => snapshot.id,
-               :created => snapshot.created,
-               :id => context.volume_image_url(snapshot.id),
-               :image_location => {:href=>context.volume_url(snapshot.storage_volume_id)},
-               :bootable => "false"  #FIXME
-            } )
-  end
-
-end
diff --git a/server/lib/cimi/model/volume_image_collection.rb b/server/lib/cimi/model/volume_image_collection.rb
deleted file mode 100644
index 0172c04..0000000
--- a/server/lib/cimi/model/volume_image_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::VolumeImageCollection < CIMI::Model::Base
-
-  act_as_root_entity :volume_image
-
-  array :volume_images do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.volume_images_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VolumeImageCollection",
-      :volume_images => VolumeImage.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/volume_template.rb b/server/lib/cimi/model/volume_template.rb
deleted file mode 100644
index b9c82db..0000000
--- a/server/lib/cimi/model/volume_template.rb
+++ /dev/null
@@ -1,23 +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::VolumeTemplate < CIMI::Model::Base
-
-  href :volume_config
-  href :volume_image
-  array :operations do
-    scalar :rel, :href
-  end
-end
diff --git a/server/lib/cimi/model/volume_template_collection.rb b/server/lib/cimi/model/volume_template_collection.rb
deleted file mode 100644
index 6b6e4ac..0000000
--- a/server/lib/cimi/model/volume_template_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::VolumeTemplateCollection < CIMI::Model::Base
-
-  act_as_root_entity :volume_template
-
-  array :volume_templates do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.volume_template_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VolumeTemplateCollection",
-      :volume_templates => VolumeTemplate.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/vsp.rb b/server/lib/cimi/model/vsp.rb
deleted file mode 100644
index 40a526f..0000000
--- a/server/lib/cimi/model/vsp.rb
+++ /dev/null
@@ -1,102 +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::VSP < CIMI::Model::Base
-
-  text :state
-
-  href :network
-
-  text :bandwidth_reservation
-
-  text :traffic_priority
-
-  text :max_traffic_delay
-
-  text :max_traffic_loss
-
-  text :max_traffic_jitter
-
-  href :event_log
-
-  array :meters do
-    scalar :href
-  end
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.vsps(context.credentials, {:env=>context})
-    else
-      context.driver.vsps(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["vspTemplate"]["href"] #template by reference
-      vsp_config, network = get_by_reference(input, context)
-    else
-      if input["vspTemplate"]["vspConfig"]["href"] # configuration by reference
-        vsp_config = VSPConfiguration.find(context.href_id(input["vspTemplate"]["vspConfig"]["href"],:vsp_configurations), context)
-      else #configuration by value
-        vsp_config = get_by_value(request_body, type)
-      end
-      network = Network.find(context.href_id(input["vspTemplate"]["network"]["href"], :networks), context)
-    end
-    params = {:vsp_config => vsp_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_vsp(context.credentials, params)
-  end
-
-  def self.delete!(id, context)
-    context.driver.delete_vsp(context.credentials, id)
-  end
-
-  def perform(action, context, &block)
-    begin
-      if context.driver.send(:"#{action.name}_vsp", context.credentials, self.name)
-        block.callback :success
-      else
-        raise "Operation #{action.name} failed to execute on the VSP #{self.name} "
-      end
-    rescue => e
-      block.callback :failure, e.message
-    end
-  end
-
-
-  private
-
-  def self.get_by_reference(input, context)
-    vsp_template = VSPTemplate.find(context.href_id(input["vspTemplate"]["href"], :vsp_templates), context)
-    vsp_config = VSPConfiguration.find(context.href_id(vsp_template.vsp_config.href, :vsp_configurations), context)
-    network = Network.find(context.href_id(vsp_template.network.href, :networks), context)
-    return vsp_config, network
-  end
-
-  def self.get_by_value(request_body, type)
-    if type == :xml
-      xml_arrays = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
-      vsp_config = VSPConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["vspTemplate"][0]["vspConfig"][0]))
-    else
-     json = JSON.parse(request_body)
-      vsp_config = VSPConfiguration.from_json(JSON.generate(json["vspTemplate"]["vspConfig"]))
-    end
-  end
-end
diff --git a/server/lib/cimi/model/vsp_collection.rb b/server/lib/cimi/model/vsp_collection.rb
deleted file mode 100644
index 6f659e1..0000000
--- a/server/lib/cimi/model/vsp_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::VSPCollection < CIMI::Model::Base
-
-  CIMI::Model.register_as_root_entity! "VSPs"
-
-  array :vsps do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.vsps_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VSPCollection",
-      :vsps => VSP.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/vsp_configuration.rb b/server/lib/cimi/model/vsp_configuration.rb
deleted file mode 100644
index c9a9bf3..0000000
--- a/server/lib/cimi/model/vsp_configuration.rb
+++ /dev/null
@@ -1,40 +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::VSPConfiguration < CIMI::Model::Base
-
-  text :bandwidth_reservation
-
-  text :traffic_priority
-
-  text :max_traffic_delay
-
-  text :max_traffic_loss
-
-  text :max_traffic_jitter
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.vsp_configurations(context.credentials, {:env=>context})
-    else
-      context.driver.vsp_configurations(context.credentials, {:env=>context, :id=>id})
-    end
-  end
-
-end
diff --git a/server/lib/cimi/model/vsp_configuration_collection.rb b/server/lib/cimi/model/vsp_configuration_collection.rb
deleted file mode 100644
index addff1c..0000000
--- a/server/lib/cimi/model/vsp_configuration_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::VSPConfigurationCollection < CIMI::Model::Base
-
-  CIMI::Model.register_as_root_entity! "VSPConfigurations"
-
-  array :vsp_configurations do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.vsp_configurations_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VSPConfigurationCollection",
-      :vsp_configurations => VSPConfiguration.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/model/vsp_template.rb b/server/lib/cimi/model/vsp_template.rb
deleted file mode 100644
index f1b8078..0000000
--- a/server/lib/cimi/model/vsp_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::VSPTemplate < CIMI::Model::Base
-
-  href :network
-
-  href :vsp_config
-
-  array :operations do
-    scalar :rel, :href
-  end
-
-  def self.find(id, context)
-    if id==:all
-      context.driver.vsp_templates(context.credentials, {:env=>context})
-    else
-      context.driver.vsp_templates(context.credentials, {:env=>context, :id=>id})
-    end
-  end
-
-end
diff --git a/server/lib/cimi/model/vsp_template_collection.rb b/server/lib/cimi/model/vsp_template_collection.rb
deleted file mode 100644
index 4acb74e..0000000
--- a/server/lib/cimi/model/vsp_template_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::VSPTemplateCollection < CIMI::Model::Base
-
-  CIMI::Model.register_as_root_entity! "VSPTemplates"
-
-  array :vsp_templates do
-    scalar :href
-  end
-
-  def self.default(context)
-    self.new(
-      :id => context.vsp_templates_url,
-      :name => 'default',
-      :created => Time.now,
-      :description => "#{context.driver.name.capitalize} VSPTemplateCollection",
-      :vsp_templates => VSPTemplate.all_uri(context)
-    )
-  end
-
-end
diff --git a/server/lib/cimi/models/action.rb b/server/lib/cimi/models/action.rb
new file mode 100644
index 0000000..c1c9908
--- /dev/null
+++ b/server/lib/cimi/models/action.rb
@@ -0,0 +1,24 @@
+# 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::Action < CIMI::Model::Base
+
+  text :action
+
+  def name
+    action.split('/').last.strip.intern
+  end
+
+end
diff --git a/server/lib/cimi/models/address.rb b/server/lib/cimi/models/address.rb
new file mode 100644
index 0000000..f9e10a1
--- /dev/null
+++ b/server/lib/cimi/models/address.rb
@@ -0,0 +1,72 @@
+# 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::Address < CIMI::Model::Base
+
+  text :ip
+
+  text :hostname
+
+  text :allocation
+
+  text :default_gateway
+
+  text :dns
+
+  text :mac_address
+
+  text :protocol
+
+  text :mask
+
+  href :network
+
+  href :resource
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.addresses(context.credentials, {:env=>context})
+    else
+      context.driver.addresses(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["addressTemplate"]["href"] #by reference
+      address_template = CIMI::Model::AddressTemplate.find(context.href_id(input["addressTemplate"]["href"], :address_templates), context)
+    else
+      case type
+        when :json
+          address_template = CIMI::Model::AddressTemplate.from_json(JSON.generate(input["addressTemplate"]))
+        when :xml
+          xml = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
+          address_template = CIMI::Model::AddressTemplate.from_xml(XmlSimple.xml_out(xml["addressTemplate"][0]))
+      end
+    end
+    params = {:name=>input["name"], :description=>input["description"], :address_template=>address_template, :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_address(context.credentials, params)
+  end
+
+  def self.delete!(id, context)
+    context.driver.delete_address(context.credentials, id)
+  end
+
+end
diff --git a/server/lib/cimi/models/address_collection.rb b/server/lib/cimi/models/address_collection.rb
new file mode 100644
index 0000000..eef6c51
--- /dev/null
+++ b/server/lib/cimi/models/address_collection.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::AddressCollection < CIMI::Model::Base
+
+  act_as_root_entity :address
+
+  array :addresses do
+    scalar :href
+  end
+
+  def self.default(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 } }
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/address_template.rb b/server/lib/cimi/models/address_template.rb
new file mode 100644
index 0000000..9d2c409
--- /dev/null
+++ b/server/lib/cimi/models/address_template.rb
@@ -0,0 +1,54 @@
+# 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::AddressTemplate < CIMI::Model::Base
+
+  text :ip
+
+  text :hostname
+
+  text :allocation
+
+  text :default_gateway
+
+  text :dns
+
+  text :mac_address
+
+  text :protocol
+
+  text :mask
+
+  href :network
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.address_templates(context.credentials, {:env=>context})
+    else
+      context.driver.address_templates(context.credentials, {:id=>id, :env=>context})
+    end
+  end
+
+  def self.create(request_body, context, type)
+  end
+
+  def self.delete!(id, context)
+  end
+
+end
diff --git a/server/lib/cimi/models/address_template_collection.rb b/server/lib/cimi/models/address_template_collection.rb
new file mode 100644
index 0000000..3bb95cd
--- /dev/null
+++ b/server/lib/cimi/models/address_template_collection.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::AddressTemplateCollection < CIMI::Model::Base
+
+  act_as_root_entity :address_template
+
+  array :address_templates do
+    scalar :href
+  end
+
+  def self.default(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 } }
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
new file mode 100644
index 0000000..16812ac
--- /dev/null
+++ b/server/lib/cimi/models/base.rb
@@ -0,0 +1,249 @@
+# 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.
+
+require 'xmlsimple'
+require 'json'
+
+# The base class for any CIMI object that we either read from a request or
+# write as a response. This class handles serializing/deserializing XML and
+# JSON into a common form.
+#
+# == Defining the schema
+#
+# The conversion of XML and JSON into internal objects is based on a schema
+# that is defined through a DSL:
+#
+#   class Machine < CIMI::Model::Base
+#     text :status
+#     href :meter
+#     array :volumes do
+#       scalar :href, :attachment_point, :protocol
+#     end
+#   end
+#
+# The DSL automatically takes care of converting identifiers from their
+# underscored form to the camel-cased form used by CIMI. The above class
+# can be used in the following way:
+#
+#   machine = Machine.from_xml(some_xml)
+#   if machine.status == "UP"
+#     ...
+#   end
+#   sda = machine.volumes.find { |v| v.attachment_point == "/dev/sda" }
+#   handle_meter(machine.meter.href)
+#
+# The keywords for the DSL are
+#   [scalar(names, ...)]
+#     Define a scalar attribute; in JSON, this is represented as a string
+#     property. In XML, this can be represented in a number of ways,
+#     depending on whether the option :text is set:
+#       * :text not set: attribute on the enclosing element
+#       * :text == :direct: the text content of the enclosing element
+#       * :text == :nested: the text content of an element +<name>...</name>+
+#   [text(names)]
+#     A shorthand for +scalar(names, :text => :nested)+, i.e., for
+#     attributes that in XML are represented by their own tags
+#   [href(name)]
+#     A shorthand for +struct name { scalar :href }+; in JSON, this is
+#     represented as +{ name: { "href": string } }+, and in XML as +<name
+#     href="..."/>+
+#   [struct(name, opts, &block)]
+#     A structured subobject; the block defines the schema of the
+#     subobject. The +:content+ option can be used to specify the attribute
+#     that should receive the content of hte corresponding XML element
+#   [array(name, opts, &block)]
+#     An array of structured subobjects; the block defines the schema of
+#     the subobjects.
+
+module CIMI::Model
+
+  def self.register_as_root_entity!(name)
+    @root_entities ||= []
+    @root_entities << name
+    unless CIMI::Model::CloudEntryPoint.href_defined?(name)
+      CIMI::Model::CloudEntryPoint.send(:href, name.underscore)
+    end
+  end
+
+  def self.root_entities
+    @root_entities || []
+  end
+
+end
+
+class CIMI::Model::Base
+
+  #
+  # We keep the values of the attributes in a hash
+  #
+  attr_reader :attribute_values
+
+  # Keep the list of all attributes in an array +attributes+; for each
+  # attribute, we also define a getter and a setter to access/change the
+  # value for that attribute
+  class << self
+    def base_schema
+      @schema ||= CIMI::Model::Schema.new
+    end
+
+    def clone_base_schema
+      @schema_duped = true
+      @schema = Marshal::load(Marshal.dump(superclass.base_schema))
+    end
+
+    def base_schema_cloned?
+      @schema_duped
+    end
+
+    private :'clone_base_schema', :'base_schema_cloned?'
+
+    def inherited(child)
+      child.instance_eval do
+        def schema
+          base_schema_cloned? ? @schema : clone_base_schema
+        end
+      end
+    end
+
+    def add_attributes!(names, attr_klass, &block)
+      if self.respond_to? :schema
+        schema.add_attributes!(names, attr_klass, &block)
+      else
+        base_schema.add_attributes!(names, attr_klass, &block)
+      end
+      names.each do |name|
+        define_method(name) { @attribute_values[name] }
+        define_method(:"#{name}=") { |newval| @attribute_values[name] = newval }
+      end
+    end
+
+    # Return Array of links to current CIMI object
+    def all_uri(context)
+      self.all(context).map { |e| { :href => e.id } }
+    end
+  end
+
+  extend CIMI::Model::Schema::DSL
+
+  def [](a)
+    @attribute_values[a]
+  end
+
+  def []=(a, v)
+    @attribute_values[a] = v
+  end
+
+  #
+  # Factory methods
+  #
+  def initialize(values = {})
+    @attribute_values = values
+  end
+
+  # Construct a new object from the XML representation +xml+
+  def self.from_xml(text)
+    xml = XmlSimple.xml_in(text, :force_content => true)
+    model = self.new
+    @schema.from_xml(xml, model)
+    model
+  end
+
+  # Construct a new object
+  def self.from_json(text)
+    json = JSON::parse(text)
+    model = self.new
+    @schema.from_json(json, model)
+    model
+  end
+
+  #
+  # Serialize
+  #
+
+  def self.xml_tag_name
+    self.name.split("::").last
+  end
+
+  def self.to_json(model)
+    JSON::unparse(@schema.to_json(model))
+  end
+
+  def self.to_xml(model)
+    xml = @schema.to_xml(model)
+    xml["xmlns"] = "http://www.dmtf.org/cimi"
+    XmlSimple.xml_out(xml, :root_name => xml_tag_name)
+  end
+
+  def to_json
+    self.class.to_json(self)
+  end
+
+  def to_xml
+    self.class.to_xml(self)
+  end
+
+  #
+  # Common attributes for all resources
+  #
+  text :id, :name, :description, :created
+
+  # FIXME: this doesn't match with JSON
+  hash :property, :content => :value do
+    scalar :name
+  end
+
+  def self.act_as_root_entity(name=nil)
+    if name
+      name = name.to_s.camelize.pluralize
+    else
+      name = xml_tag_name.pluralize.uncapitalize
+    end
+    CIMI::Model.register_as_root_entity! name
+  end
+
+  def self.all(_self); find(:all, _self); end
+
+  def filter_by(filter_opts)
+    return self if filter_opts.nil?
+    return filter_attributes(filter_opts.split(',').map{ |a| a.intern }) if filter_opts.include? ','
+    case filter_opts
+      when /^([\w\_]+)$/ then filter_attributes([$1.intern])
+      when /^([\w\_]+)\[(\d+\-\d+)\]$/ then filter_by_arr_range($1.intern, $2)
+      when /^([\w\_]+)\[(\d+)\]$/ then filter_by_arr_index($1.intern, $2)
+      else self
+    end
+  end
+
+  private
+
+  def filter_attributes(attr_list)
+    attrs = attr_list.inject({}) do |result, attr|
+      result[attr] = self.send(attr) if self.respond_to?(attr)
+      result
+    end
+    self.class.new(attrs)
+  end
+
+  def filter_by_arr_index(attr, filter)
+    return self unless self.respond_to?(attr)
+    self.class.new(attr => [self.send(attr)[filter.to_i]])
+  end
+
+  def filter_by_arr_range(attr, filter)
+    return self unless self.respond_to?(attr)
+    filter = filter.split('-').inject { |s,e| s.to_i..e.to_i }
+    self.class.new(attr => self.send(attr)[filter])
+  end
+end
diff --git a/server/lib/cimi/models/cloud_entry_point.rb b/server/lib/cimi/models/cloud_entry_point.rb
new file mode 100644
index 0000000..ffe1ef5
--- /dev/null
+++ b/server/lib/cimi/models/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::Model::CloudEntryPoint < CIMI::Model::Base
+
+  array :entity_metadata do
+    scalar :href
+  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",
+      :id => context.cloudEntryPoint_url,
+      :created => Time.now,
+      :entity_metadata => CIMI::Model::EntityMetadata.all_uri(context)
+    }))
+  end
+
+  # Return an Hash of the CIMI root entities used in CloudEntryPoint
+  def self.entities(context)
+    CIMI::Model.root_entities.inject({}) do |result, entity|
+      result[entity.underscore] = { :href => context.send(:"#{entity.underscore}_url") }
+      result
+    end
+  end
+
+  private
+
+  def self.href_defined?(entity)
+    true if schema.attribute_names.include? entity.underscore
+  end
+
+end
diff --git a/server/lib/cimi/models/entity_metadata.rb b/server/lib/cimi/models/entity_metadata.rb
new file mode 100644
index 0000000..5455c75
--- /dev/null
+++ b/server/lib/cimi/models/entity_metadata.rb
@@ -0,0 +1,84 @@
+# 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::EntityMetadata < CIMI::Model::Base
+
+  text :type_uri
+
+  array :attributes do
+    scalar :name
+    scalar :namespace
+    scalar :type
+    scalar :required
+    scalar :constraints
+  end
+
+  array :operations do
+    scalar :name
+    scalar :uri
+    scalar :description
+    scalar :method
+    scalar :input_message
+    scalar :output_message
+  end
+
+  def self.find(id, context)
+    entity_metadata = []
+    if id == :all
+      CIMI::Model.root_entities.each do |entity|
+        entity_class = CIMI::Model.const_get("#{entity.singularize}")
+        entity_metadata << entity_class.create_entity_metadata(context) if entity_class.respond_to?(:create_entity_metadata)
+      end
+      return entity_metadata
+    else
+      entity_class = CIMI::Model.const_get("#{id.camelize}")
+      if entity_class.respond_to?(:create_entity_metadata)
+        entity_class.create_entity_metadata(context)
+      end
+    end
+  end
+
+  def self.metadata_from_deltacloud_features(cimi_entity, dcloud_entity, context)
+    deltacloud_features = context.driver.class.features_for(dcloud_entity)
+    metadata_attributes = deltacloud_features.map{|f| attributes_from_feature(f)}
+    from_feature(cimi_entity, context, metadata_attributes.flatten!)
+  end
+
+  def includes_attribute?(attribute)
+    self.attributes.any?{|attr| attr[:name] == attribute}
+  end
+
+  private
+
+  def self.attributes_from_feature(feature)
+    feature = CIMI::FakeCollection.feature(feature)
+    feature.operations.first.params_array.map do |p|
+      {
+        :name=> p.name,
+        :type=> "xs:string",
+        :required=> p.required? ? "true" : "false",
+        :constraints=> (feature.constraints.empty? ? (feature.description.nil? ? "" : feature.description): feature.constraints)
+      }
+    end
+  end
+
+  def self.from_feature(cimi_entity, context, metadata_attributes)
+    self.new(:name => cimi_entity, :uri=>"#{context.entity_metadata_url}/#{cimi_entity.underscore}",
+             :type_uri=> context.send("#{cimi_entity.pluralize.underscore}_url"),
+             :attributes => metadata_attributes)
+  end
+
+end
diff --git a/server/lib/cimi/models/entity_metadata_collection.rb b/server/lib/cimi/models/entity_metadata_collection.rb
new file mode 100644
index 0000000..595b502
--- /dev/null
+++ b/server/lib/cimi/models/entity_metadata_collection.rb
@@ -0,0 +1,31 @@
+# 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::EntityMetadataCollection < CIMI::Model::Base
+
+  array :entity_metadata do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.entity_metadata_url,
+      :name => 'default',
+      :created => Time.now,
+      :entity_metadata => CIMI::Model::EntityMetadata.all_uri(context)
+   )
+  end
+
+end
diff --git a/server/lib/cimi/models/errors.rb b/server/lib/cimi/models/errors.rb
new file mode 100644
index 0000000..7c090ed
--- /dev/null
+++ b/server/lib/cimi/models/errors.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::Model
+
+  class NotFound < StandardError
+    attr_accessor :code
+
+    def initialize
+      super("Requested Entity Not Found")
+      self.code = 404
+    end
+
+  end
+
+  class BadRequest < StandardError
+    attr_accessor :code
+    def initialize(msg="")
+      super(msg)
+      self.code=400
+    end
+  end
+
+  class NotImplemented < StandardError
+    attr_accessor :code
+
+    def initialize
+      super("Requested operation is not implemented by backend provider")
+      self.code = 501
+    end
+
+  end
+
+end
+
+
diff --git a/server/lib/cimi/models/machine.rb b/server/lib/cimi/models/machine.rb
new file mode 100644
index 0000000..0540bd8
--- /dev/null
+++ b/server/lib/cimi/models/machine.rb
@@ -0,0 +1,227 @@
+# 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::Machine < CIMI::Model::Base
+
+  text :state
+  text :cpu
+
+  struct :memory do
+    scalar :quantity
+    scalar :units
+  end
+
+  href :event_log
+
+  array :disks do
+    struct :capacity do
+      scalar :quantity
+      scalar :units
+    end
+    scalar :format
+    scalar :attachment_point
+  end
+
+  array :volumes do
+    scalar :href
+    scalar :protocol
+    scalar :attachment_point
+  end
+
+  array :network_interfaces do
+    href :vsp
+    text :hostname, :mac_address, :state, :protocol, :allocation
+    text :address, :default_gateway, :dns, :max_transmission_unit
+  end
+
+  array :meters do
+    scalar :href
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    instances = []
+    if id == :all
+      instances = context.driver.instances(context.credentials)
+      instances.map { |instance| from_instance(instance, context) }.compact
+    else
+      instance = context.driver.instance(context.credentials, :id => id)
+      raise CIMI::Model::NotFound unless instance
+      from_instance(instance, context)
+    end
+  end
+
+  def self.create_from_json(body, context)
+    json = JSON.parse(body)
+    hardware_profile_id = xml['machineTemplate']['machineConfig']["href"].split('/').last
+    image_id = xml['machineTemplate']['machineImage']["href"].split('/').last
+    instance = context.create_instance(context.credentials, image_id, { :hwp_id => hardware_profile_id })
+    from_instance(instance, context)
+  end
+
+  def self.create_from_xml(body, context)
+    xml = XmlSimple.xml_in(body)
+    machine_template = xml['machineTemplate'][0]
+    hardware_profile_id = machine_template['machineConfig'][0]["href"].split('/').last
+    image_id = machine_template['machineImage'][0]["href"].split('/').last
+    additional_params = {}
+    additional_params[:name] =xml['name'][0] if xml['name']
+    if machine_template.has_key? 'machineAdmin'
+      additional_params[:keyname] = machine_template['machineAdmin'][0]["href"].split('/').last
+    end
+    instance = context.driver.create_instance(context.credentials, image_id, {
+      :hwp_id => hardware_profile_id
+    }.merge(additional_params))
+    from_instance(instance, context)
+  end
+
+  def perform(action, context, &block)
+    begin
+      if context.driver.send(:"#{action.name}_instance", context.credentials, self.name)
+        block.callback :success
+      else
+        raise "Operation failed to execute on given Machine"
+      end
+    rescue => e
+      block.callback :failure, e.message
+    end
+  end
+
+  def self.delete!(id, context)
+    context.driver.destroy_instance(context.credentials, id)
+  end
+
+  def self.create_entity_metadata(context)
+    cimi_entity = self.name.split("::").last
+    metadata = CIMI::Model::EntityMetadata.metadata_from_deltacloud_features(cimi_entity, :instances, context)
+    unless metadata.includes_attribute?(:name)
+      metadata.attributes << {:name=>"name", :required=>"false",
+                   :constraints=>"Determined by the cloud provider", :type=>"xs:string"}
+    end
+    metadata
+  end
+
+  def self.attach_volumes(volumes, context)
+    volumes.each do |vol|
+      context.driver.attach_storage_volume(context.credentials,
+      {:id=>vol[:volume].name, :instance_id=>context.params[:id], :device=>vol[:attachment_point]})
+    end
+    self.find(context.params[:id], context)
+  end
+
+  def self.detach_volumes(volumes, context)
+    volumes.each do |vol|
+      context.driver.detach_storage_volume(context.credentials, {:id=>vol[:volume].name, :instance_id => context.params[:id]})
+    end
+    self.find(context.params[:id], context)
+  end
+
+  private
+
+  def self.from_instance(instance, context)
+    cpu =  memory = disks = (instance.instance_profile.id == "opaque")? "n/a" : nil
+    self.new(
+      :name => instance.id,
+      :description => instance.name,
+      :created => instance.launch_time,
+      :id => context.machine_url(instance.id),
+      :state => convert_instance_state(instance.state),
+      :cpu => cpu || convert_instance_cpu(instance.instance_profile, context),
+      :memory => memory || convert_instance_memory(instance.instance_profile, context),
+      :disks => disks || convert_instance_storage(instance.instance_profile, context),
+      :network_interfaces => convert_instance_addresses(instance),
+      :operations => convert_instance_actions(instance, context),
+      :volumes=>convert_storage_volumes(instance, context),
+      :property => convert_instance_properties(instance, context)
+    )
+  end
+
+  # FIXME: This will convert 'RUNNING' state to 'STARTED'
+  # which is defined in CIMI (p65)
+  #
+  def self.convert_instance_state(state)
+    ('RUNNING' == state) ? 'STARTED' : state
+  end
+
+  def self.convert_instance_properties(instance, context)
+    properties = []
+    properties << { :name => :machine_image, :value => context.machine_image_url(instance.image_id) }
+    if instance.respond_to? :keyname
+      properties << { :name => :machine_admin, :value => context.machine_admin_url(instance.keyname) }
+    end
+    properties
+  end
+
+  def self.convert_instance_cpu(profile, context)
+    cpu_override = profile.overrides.find { |p, v| p == :cpu }
+    if cpu_override.nil?
+      CIMI::Model::MachineConfiguration.find(profile.id, context).cpu
+    else
+      cpu_override[1]
+    end
+  end
+
+  def self.convert_instance_memory(profile, context)
+    machine_conf = CIMI::Model::MachineConfiguration.find(profile.name, context)
+    memory_override = profile.overrides.find { |p, v| p == :memory }
+    {
+      :quantity => memory_override.nil? ? machine_conf.memory[:quantity] : memory_override[1],
+      :units => machine_conf.memory[:units]
+    }
+  end
+
+  def self.convert_instance_storage(profile, context)
+    machine_conf = CIMI::Model::MachineConfiguration.find(profile.name, context)
+    storage_override = profile.overrides.find { |p, v| p == :storage }
+    [
+      { :capacity => {
+          :quantity => storage_override.nil? ? machine_conf.disks.first[:capacity][:quantity] : storage_override[1],
+          :units => machine_conf.disks.first[:capacity][:units]
+        }
+      }
+    ]
+  end
+
+  def self.convert_instance_addresses(instance)
+    (instance.public_addresses + instance.private_addresses).collect do |address|
+      {
+        :hostname => address.is_hostname? ? address : nil,
+        :mac_address => address.is_mac? ? address : nil,
+        :state => 'Active',
+        :protocol => 'IPv4',
+        :address => address.is_ipv4? ? address : nil,
+        :allocation => 'Static'
+      }
+    end
+  end
+
+  def self.convert_instance_actions(instance, context)
+    instance.actions.collect do |action|
+      action = :destroy if action == :delete # In CIMI destroy operation become delete
+      action = :restart if action == :reboot  # In CIMI reboot operation become restart
+      { :href => context.send(:"#{action}_machine_url", instance.id), :rel => "http://www.dmtf.org/cimi/action/#{action}" }
+    end
+  end
+
+  def self.convert_storage_volumes(instance, context)
+    instance.storage_volumes ||= [] #deal with nilpointers
+    instance.storage_volumes.map{|vol| {:href=>context.volume_url(vol.keys.first),
+                                       :attachment_point=>vol.values.first} }
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_admin.rb b/server/lib/cimi/models/machine_admin.rb
new file mode 100644
index 0000000..fed7c80
--- /dev/null
+++ b/server/lib/cimi/models/machine_admin.rb
@@ -0,0 +1,59 @@
+# 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::MachineAdmin < CIMI::Model::Base
+
+  text :username
+  text :password
+  text :key
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id == :all
+      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)
+    machine_admin = MachineAdmin.from_xml(body)
+    key = context.driver.create_key(context.credentials, :key_name => machine_admin.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.machine_admin_url(key.id),
+      :created => Time.now
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_admin_collection.rb b/server/lib/cimi/models/machine_admin_collection.rb
new file mode 100644
index 0000000..08c1559
--- /dev/null
+++ b/server/lib/cimi/models/machine_admin_collection.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::MachineAdminCollection < CIMI::Model::Base
+
+  act_as_root_entity :machine_admin
+
+  array :machine_admins do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.machine_admins_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineAdminCollection",
+      :machine_admins => CIMI::Model::MachineAdmin.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_collection.rb b/server/lib/cimi/models/machine_collection.rb
new file mode 100644
index 0000000..9154aa9
--- /dev/null
+++ b/server/lib/cimi/models/machine_collection.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::MachineCollection < CIMI::Model::Base
+
+  act_as_root_entity :machine
+
+  array :machines do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.machines_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineCollection",
+      :machines => CIMI::Model::Machine.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_configuration.rb b/server/lib/cimi/models/machine_configuration.rb
new file mode 100644
index 0000000..f9d98f2
--- /dev/null
+++ b/server/lib/cimi/models/machine_configuration.rb
@@ -0,0 +1,70 @@
+# 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::MachineConfiguration < CIMI::Model::Base
+
+  struct :memory do
+    scalar :quantity
+    scalar :units
+  end
+
+  text :cpu
+
+  array :disks do
+    struct :capacity do
+      scalar :quantity
+      scalar :units
+    end
+    scalar :format
+    scalar :attachment_point
+  end
+
+  array :operations do
+    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.value || profile.memory.default
+    cpu = profile.cpu.value || profile.cpu.default
+    storage = profile.storage.value || profile.storage.default
+    machine_hash = {
+      :name => profile.name,
+      :description => "Machine Configuration with #{memory} #{profile.memory.unit} "+
+        "of memory and #{cpu} CPU",
+      :cpu => cpu,
+      :created => Time.now.to_s,  # FIXME: DC hardware_profile has no mention about created_at
+      :memory => { :quantity => profile.memory.value || profile.memory.default, :units => profile.memory.unit },
+      :disks => [ { :capacity => { :quantity => profile.storage.value || profile.storage.default, :units => profile.storage.unit } } ],
+      :id => context.machine_configuration_url(profile.name)
+    }
+    self.new(machine_hash)
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_configuration_collection.rb b/server/lib/cimi/models/machine_configuration_collection.rb
new file mode 100644
index 0000000..6d7ebad
--- /dev/null
+++ b/server/lib/cimi/models/machine_configuration_collection.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::MachineConfigurationCollection < CIMI::Model::Base
+
+  act_as_root_entity :machine_configuration
+
+  array :machine_configurations do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.machine_configurations_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineConfigurationCollection",
+      :machine_configurations => CIMI::Model::MachineConfiguration.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_image.rb b/server/lib/cimi/models/machine_image.rb
new file mode 100644
index 0000000..7389475
--- /dev/null
+++ b/server/lib/cimi/models/machine_image.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::Model::MachineImage < CIMI::Model::Base
+
+  href :image_location
+  text :image_data
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    images = []
+    if id == :all
+      images = context.driver.images(context.credentials)
+      images.map { |image| from_image(image, context) }
+    else
+      image = context.driver.image(context.credentials, :id => id)
+      from_image(image, context)
+    end
+  end
+
+  def self.from_image(image, context)
+    self.new(
+      :name => image.id,
+      :id => context.machine_image_url(image.id),
+      :description => image.description,
+      :created => Time.now.to_s,
+      :image_location => { :href => "#{context.driver.name}://#{image.id}" } # FIXME
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_image_collection.rb b/server/lib/cimi/models/machine_image_collection.rb
new file mode 100644
index 0000000..70bdc7b
--- /dev/null
+++ b/server/lib/cimi/models/machine_image_collection.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::MachineImageCollection < CIMI::Model::Base
+
+  act_as_root_entity :machine_image
+
+  array :machine_images do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.machine_images_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineImageCollection",
+      :machine_images => CIMI::Model::MachineImage.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/machine_template.rb b/server/lib/cimi/models/machine_template.rb
new file mode 100644
index 0000000..8a88052
--- /dev/null
+++ b/server/lib/cimi/models/machine_template.rb
@@ -0,0 +1,41 @@
+# 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::MachineTemplate < CIMI::Model::Base
+
+  href :machine_config
+  href :machine_image
+  href :machine_admin
+
+  array :volumes do
+    scalar :href
+    scalar :protocol
+    scalar :attachment_point
+  end
+
+  array :volume_templates do
+    scalar :href, :attachment_point, :protocol
+  end
+
+  array :network_interfaces do
+    href :vsp
+    text :hostname, :mac_address, :state, :protocol, :allocation
+    text :address, :default_gateway, :dns, :max_transmission_unit
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+end
diff --git a/server/lib/cimi/models/machine_template_collection.rb b/server/lib/cimi/models/machine_template_collection.rb
new file mode 100644
index 0000000..d2a3f23
--- /dev/null
+++ b/server/lib/cimi/models/machine_template_collection.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::MachineTemplateCollection < CIMI::Model::Base
+
+  act_as_root_entity :machine_template
+
+  array :machine_templates do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.machine_template_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} MachineTemplateCollection",
+      :machine_templates => CIMI::Model::MachineTemplate.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/network.rb b/server/lib/cimi/models/network.rb
new file mode 100644
index 0000000..3d9c7ed
--- /dev/null
+++ b/server/lib/cimi/models/network.rb
@@ -0,0 +1,109 @@
+# 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::Network < CIMI::Model::Base
+
+  text :state
+
+  text :access
+
+  text :bandwidth_limit
+
+  text :traffic_priority
+
+  text :max_traffic_delay
+
+  text :max_traffic_loss
+
+  text :max_traffic_jitter
+
+  href :routing_group
+
+  href :event_log
+
+  array :meters do
+    scalar :href
+  end
+
+  array :operations do
+    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
+    networks
+  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["networkTemplate"]["href"] #template by reference
+      network_config, routing_group = get_by_reference(input, context)
+    else
+      if input["networkTemplate"]["networkConfig"]["href"] # configuration by reference
+        network_config = CIMI::Model::NetworkConfiguration.find(context.href_id(input["networkTemplate"]["networkConfig"]["href"],
+                                                                                :network_configurations), context)
+      else #configuration by value
+        network_config = get_by_value(request_body, type)
+      end
+      routing_group = CIMI::Model::RoutingGroup.find(context.href_id(input["networkTemplate"]["routingGroup"]["href"],
+                                                                     :routing_groups), context)
+    end
+    params = {:network_config => network_config, :routing_group => routing_group, :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(context.credentials, params)
+  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
+
+  private
+
+  def self.get_by_reference(input, context)
+    network_template = CIMI::Model::NetworkTemplate.find(context.href_id(input["networkTemplate"]["href"], :network_templates), context)
+    network_config = CIMI::Model::NetworkConfiguration.find(context.href_id(network_template.network_config.href, :network_configurations), context)
+    routing_group = CIMI::Model::RoutingGroup.find(context.href_id(network_template.routing_group.href, :routing_groups), context)
+    return network_config, routing_group
+  end
+
+  def self.get_by_value(request_body, type)
+    if type == :xml
+      xml_arrays = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
+      network_config = CIMI::Model::NetworkConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["networkTemplate"][0]["networkConfig"][0]))
+    else
+     json = JSON.parse(request_body)
+      network_config = CIMI::Model::NetworkConfiguration.from_json(JSON.generate(json["networkTemplate"]["networkConfig"]))
+    end
+  end
+
+end
diff --git a/server/lib/cimi/models/network_collection.rb b/server/lib/cimi/models/network_collection.rb
new file mode 100644
index 0000000..d76a3dd
--- /dev/null
+++ b/server/lib/cimi/models/network_collection.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::NetworkCollection < CIMI::Model::Base
+
+  act_as_root_entity :network
+
+  array :networks do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.networks_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} NetworkCollection",
+      :networks => CIMI::Model::Network.all(context).map { |c| { :href => c.id } }
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/network_configuration.rb b/server/lib/cimi/models/network_configuration.rb
new file mode 100644
index 0000000..1b04548
--- /dev/null
+++ b/server/lib/cimi/models/network_configuration.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.
+
+class CIMI::Model::NetworkConfiguration < CIMI::Model::Base
+
+  text :access
+
+  text :bandwidth_limit
+
+  text :traffic_priority
+
+  text :max_traffic_delay
+
+  text :max_traffic_loss
+
+  text :max_traffic_jitter
+
+  array :operations do
+    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
diff --git a/server/lib/cimi/models/network_configuration_collection.rb b/server/lib/cimi/models/network_configuration_collection.rb
new file mode 100644
index 0000000..fc14592
--- /dev/null
+++ b/server/lib/cimi/models/network_configuration_collection.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::NetworkConfigurationCollection < CIMI::Model::Base
+
+  act_as_root_entity :network_configuration
+
+  array :network_configurations do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.network_configurations_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} NetworkConfigurationCollection",
+      :network_configurations => CIMI::Model::NetworkConfiguration.all(context).map { |c| { :href => c.id } }
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/network_template.rb b/server/lib/cimi/models/network_template.rb
new file mode 100644
index 0000000..ce3b990
--- /dev/null
+++ b/server/lib/cimi/models/network_template.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::NetworkTemplate < CIMI::Model::Base
+
+  href :network_config
+
+  href :routing_group
+
+  array :operations do
+    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
diff --git a/server/lib/cimi/models/network_template_collection.rb b/server/lib/cimi/models/network_template_collection.rb
new file mode 100644
index 0000000..b2ac537
--- /dev/null
+++ b/server/lib/cimi/models/network_template_collection.rb
@@ -0,0 +1,35 @@
+# 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::NetworkTemplateCollection < CIMI::Model::Base
+
+  act_as_root_entity :network_template
+
+  array :network_templates do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.network_templates_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} NetworkTemplateCollection",
+      :network_templates => CIMI::Model::NetworkTemplate.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/routing_group.rb b/server/lib/cimi/models/routing_group.rb
new file mode 100644
index 0000000..d26f4d7
--- /dev/null
+++ b/server/lib/cimi/models/routing_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::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
new file mode 100644
index 0000000..285e164
--- /dev/null
+++ b/server/lib/cimi/models/routing_group_collection.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::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
new file mode 100644
index 0000000..204a353
--- /dev/null
+++ b/server/lib/cimi/models/routing_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::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
new file mode 100644
index 0000000..61a4a68
--- /dev/null
+++ b/server/lib/cimi/models/routing_group_template_collection.rb
@@ -0,0 +1,35 @@
+# 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/cimi/models/schema.rb b/server/lib/cimi/models/schema.rb
new file mode 100644
index 0000000..f301b69
--- /dev/null
+++ b/server/lib/cimi/models/schema.rb
@@ -0,0 +1,277 @@
+# 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.
+#
+
+# The smarts of converting from XML and JSON into internal objects
+class CIMI::Model::Schema
+
+  #
+  # Attributes describe how we extract values from XML/JSON
+  #
+  class Attribute
+    attr_reader :name, :xml_name, :json_name
+
+    def initialize(name, opts = {})
+      @name = name
+      @xml_name = (opts[:xml_name] || name).to_s.camelize(true)
+      @json_name = (opts[:json_name] || name).to_s.camelize(true)
+    end
+
+    def from_xml(xml, model)
+      model[@name] = xml[@xml_name].first if xml.has_key?(@xml_name)
+    end
+
+    def from_json(json, model)
+      model[@name] = json[@json_name]
+    end
+
+    def to_xml(model, xml)
+      xml[@xml_name] = [model[@name]] if model[@name]
+    end
+
+    def to_json(model, json)
+      json[@json_name] = model[@name] if model and model[@name]
+    end
+  end
+
+  class Scalar < Attribute
+    def initialize(name, opts)
+      @text = opts[:text]
+      if ! [nil, :nested, :direct].include?(@text)
+        raise "text option for scalar must be :nested or :direct"
+      end
+      super(name, opts)
+    end
+
+    def text?; @text; end
+
+    def nested_text?; @text == :nested; end
+
+    def from_xml(xml, model)
+      case @text
+        when :nested then model[@name] = xml[@xml_name].first["content"] if xml[@xml_name]
+        when :direct then model[@name] = xml["content"]
+        else model[@name] = xml[@xml_name]
+      end
+    end
+
+    def to_xml(model, xml)
+      return unless model
+      return unless model[@name]
+      case @text
+        when :nested then xml[@xml_name] = [{ "content" => model[@name] }]
+        when :direct then xml["content"] = model[@name]
+        else xml[@xml_name] = model[@name]
+      end
+    end
+  end
+
+  class Struct < Attribute
+    def initialize(name, opts, &block)
+      content = opts[:content]
+      super(name, opts)
+      @schema = CIMI::Model::Schema.new
+      @schema.instance_eval(&block) if block_given?
+      @schema.scalar(content, :text => :direct) if content
+    end
+
+    def from_xml(xml, model)
+      xml = xml.has_key?(xml_name) ? xml[xml_name].first : {}
+      model[name] = convert_from_xml(xml)
+    end
+
+    def from_json(json, model)
+      json = json.has_key?(json_name) ? json[json_name] : {}
+      model[name] = convert_from_json(json)
+    end
+
+    def to_xml(model, xml)
+      conv = convert_to_xml(model[name])
+      xml[xml_name] = [conv] unless conv.empty?
+    end
+
+    def to_json(model, json)
+      conv = convert_to_json(model[name])
+      json[json_name] = conv unless conv.empty?
+    end
+
+    def convert_from_xml(xml)
+      sub = struct.new
+      @schema.from_xml(xml, sub)
+      sub
+    end
+
+    def convert_from_json(json)
+      sub = struct.new
+      @schema.from_json(json, sub)
+      sub
+    end
+
+    def convert_to_xml(model)
+      xml = {}
+      @schema.to_xml(model, xml)
+      xml
+    end
+
+    def convert_to_json(model)
+      json = {}
+      @schema.to_json(model, json)
+      json
+    end
+
+    private
+    def struct
+      cname = "CIMI_#{json_name.upcase_first}"
+      if ::Struct.const_defined?(cname)
+        ::Struct.const_get(cname)
+      else
+        ::Struct.new("CIMI_#{json_name.upcase_first}",
+                     *@schema.attribute_names)
+      end
+    end
+  end
+
+  class Array < Attribute
+    # For an array :things, we collect all <thing/> elements (XmlSimple
+    # actually does the collecting)
+    def initialize(name, opts = {}, &block)
+      opts[:xml_name] = name.to_s.singularize unless opts[:xml_name]
+      super(name, opts)
+      @struct = Struct.new(name, opts, &block)
+    end
+
+    def from_xml(xml, model)
+      model[name] = (xml[xml_name] || []).map { |elt| @struct.convert_from_xml(elt) }
+    end
+
+    def from_json(json, model)
+      model[name] = (json[json_name] || []).map { |elt| @struct.convert_from_json(elt) }
+    end
+
+    def to_xml(model, xml)
+      ary = (model[name] || []).map { |elt| @struct.convert_to_xml(elt) }
+      xml[xml_name] = ary unless ary.empty?
+    end
+
+    def to_json(model, json)
+      ary = (model[name] || []).map { |elt| @struct.convert_to_json(elt) }
+      json[json_name] = ary unless ary.empty?
+    end
+  end
+
+  class Hash < Attribute
+
+    def initialize(name, opts = {}, &block)
+      opts[:json_name] = name.to_s.pluralize unless opts[:json_name]
+      super(name, opts)
+      @struct = Struct.new(name, opts, &block)
+    end
+
+    def from_xml(xml, model)
+      model[name] = (xml[xml_name] || []).map { |elt| @struct.convert_from_xml(elt) }
+    end
+
+    def from_json(json, model)
+      model[name] = (json[json_name] || {}).inject([]) do |result,item|
+        result << @struct.convert_from_json({ 'name' => item[0], 'value' => item[1] })
+      end
+    end
+
+    def to_xml(model, xml)
+      ary = (model[name] || []).map { |elt| @struct.convert_to_xml(elt) }
+      xml[xml_name] = ary unless ary.empty?
+    end
+
+    def to_json(model, json)
+      ary = (model[name] || []).map { |elt| @struct.convert_to_json(elt) }
+      json[json_name] = ary.inject({}) { |result, item| result[item['name']] = item['value']; result } unless ary.empty?
+    end
+  end
+
+  #
+  # The actual Schema class
+  #
+  def initialize
+    @attributes = []
+  end
+
+  def from_xml(xml, model = {})
+    @attributes.freeze
+    @attributes.each { |attr| attr.from_xml(xml, model) }
+    model
+  end
+
+  def from_json(json, model = {})
+    @attributes.freeze
+    @attributes.each { |attr| attr.from_json(json, model) }
+    model
+  end
+
+  def to_xml(model, xml = {})
+    @attributes.freeze
+    @attributes.each { |attr| attr.to_xml(model, xml) }
+    xml
+  end
+
+  def to_json(model, json = {})
+    @attributes.freeze
+    @attributes.each { |attr| attr.to_json(model, json) }
+    json
+  end
+
+  def attribute_names
+    @attributes.map { |a| a.name }
+  end
+
+  #
+  # The DSL
+  #
+  # Requires that the class into which this is included has a
+  # +add_attributes!+ method
+  module DSL
+    def href(*args)
+      args.each { |arg| struct(arg) { scalar :href } }
+    end
+
+    def text(*args)
+      args.expand_opts!(:text => :nested)
+      scalar(*args)
+    end
+
+    def scalar(*args)
+      add_attributes!(args, Scalar)
+    end
+
+    def array(name, opts={}, &block)
+      add_attributes!([name, opts], Array, &block)
+    end
+
+    def struct(name, opts={}, &block)
+      add_attributes!([name, opts], Struct, &block)
+    end
+
+    def hash(name, opts={}, &block)
+      add_attributes!([name, opts], Hash, &block)
+    end
+  end
+
+  include DSL
+
+  def add_attributes!(args, attr_klass, &block)
+    raise "The schema has already been used to convert objects" if @attributes.frozen?
+    opts = args.extract_opts!
+    args.each { |arg| @attributes << attr_klass.new(arg, opts, &block) }
+  end
+end
diff --git a/server/lib/cimi/models/volume.rb b/server/lib/cimi/models/volume.rb
new file mode 100644
index 0000000..9c106e2
--- /dev/null
+++ b/server/lib/cimi/models/volume.rb
@@ -0,0 +1,103 @@
+# 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::Volume < CIMI::Model::Base
+
+  struct :capacity do
+    scalar :quantity
+    scalar :units
+  end
+  text :bootable
+  text :supports_snapshots
+  array :snapshots do
+    scalar :ref
+  end
+  text :guest_interface
+  array :meters do
+    scalar :ref
+  end
+  href :eventlog
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    volumes = []
+    opts = ( id == :all ) ? {} : { :id => id }
+    volumes = context.driver.storage_volumes(context.credentials, opts)
+    volumes.collect!{ |volume| from_storage_volume(volume, context) }
+    return volumes.first unless volumes.length > 1
+    return volumes
+  end
+
+  def self.all(context); find(:all, context); end
+
+  def self.create_from_json(json_in, context)
+    json = JSON.parse(json_in)
+    volume_config_id = json["volumeTemplate"]["volumeConfig"]["href"].split("/").last
+    volume_image_id = (json["volumeTemplate"].has_key?("volumeImage") ?
+                json["volumeTemplate"]["volumeImage"]["href"].split("/").last  : nil)
+    create_volume({:volume_config_id=>volume_config_id, :volume_image_id=>volume_image_id}, context)
+  end
+
+  def self.create_from_xml(xml_in, context)
+    xml = XmlSimple.xml_in(xml_in)
+    volume_config_id = xml["volumeTemplate"][0]["volumeConfig"][0]["href"].split("/").last
+    volume_image_id = (xml["volumeTemplate"][0].has_key?("volumeImage") ?
+             xml["volumeTemplate"][0]["volumeImage"][0]["href"].split("/").last  : nil)
+    create_volume({:volume_config_id=>volume_config_id, :volume_image_id=>volume_image_id}, context)
+  end
+
+  def self.delete!(id, context)
+    context.driver.destroy_storage_volume(context.credentials, {:id=>id} )
+  end
+
+  def self.find_to_attach_from_json(json_in, context)
+    json = JSON.parse(json_in)
+    volumes = json["volumes"].map{|v| {:volume=>self.find(v["volume"]["href"].split("/volumes/").last, context),
+                                       :attachment_point=>v["attachmentPoint"]  }}
+  end
+
+  def self.find_to_attach_from_xml(xml_in, context)
+    xml = XmlSimple.xml_in(xml_in)
+    volumes = xml["volume"].map{|v| {:volume => self.find(v["href"].split("/volumes/").last, context),
+                                      :attachment_point=>v["attachmentPoint"] }}
+  end
+
+  private
+
+  def self.create_volume(params, context)
+    volume_config = CIMI::Model::VolumeConfiguration.find(params[:volume_config_id], context)
+    opts = {:capacity=>volume_config.capacity[:quantity], :snapshot_id=>params[:volume_image_id] }
+    storage_volume = self.driver.create_storage_volume(context.credentials, opts)
+    from_storage_volume(storage_volume, context)
+  end
+
+  def self.from_storage_volume(volume, context)
+    self.new( { :name => volume.id,
+                :description => volume.id,
+                :created => volume.created,
+                :id => context.volume_url(volume.id),
+                :capacity => { :quantity=>volume.capacity, :units=>"gibibyte"  }, #FIXME... units will vary
+                :bootable => "false", #fixme ... will vary... ec2 doesn't expose this
+                :supports_snapshots => "true", #fixme, will vary (true for ec2)
+                :snapshots => [], #fixme...
+                :guest_interface => "",
+                :eventlog => {:href=> "http://eventlogs"},#FIXME
+                :meters => []
+            } )
+  end
+
+end
diff --git a/server/lib/cimi/models/volume_collection.rb b/server/lib/cimi/models/volume_collection.rb
new file mode 100644
index 0000000..1f4152e
--- /dev/null
+++ b/server/lib/cimi/models/volume_collection.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::VolumeCollection < CIMI::Model::Base
+
+  act_as_root_entity :volume
+
+  array :volumes do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.volumes_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeCollection",
+      :volumes => CIMI::Model::Volume.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/volume_configuration.rb b/server/lib/cimi/models/volume_configuration.rb
new file mode 100644
index 0000000..75b37ea
--- /dev/null
+++ b/server/lib/cimi/models/volume_configuration.rb
@@ -0,0 +1,60 @@
+# 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::VolumeConfiguration < CIMI::Model::Base
+
+  text :format
+  struct :capacity do
+    scalar :quantity
+    scalar :units
+  end
+  text :supports_snapshots
+  text :guest_interface
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    volume_configs = []
+    if id == :all
+      #ec2 ebs volumes can 1gb..1tb
+      (1..1000).each do |size|
+        volume_configs << create(size, context)
+      end
+    else
+      volume_configs << create(id, context)
+      return volume_configs.first
+    end
+    return volume_configs
+  end
+
+
+  def self.all(context); find(:all, context); end
+
+  private
+
+  def self.create(size, context)
+    self.new( {
+                :id => context.volume_configuration_url(size),
+                :name => size,
+                :description => "volume configuration with #{size} GiB",
+                :created => Time.now.to_s,
+                :capacity => {:quantity=>size, :units=>"gibibytes"},
+                :supports_snapshots => "true"
+                # FIXME :guest_interface => "NFS"
+            } )
+  end
+
+end
diff --git a/server/lib/cimi/models/volume_configuration_collection.rb b/server/lib/cimi/models/volume_configuration_collection.rb
new file mode 100644
index 0000000..2120ae6
--- /dev/null
+++ b/server/lib/cimi/models/volume_configuration_collection.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::VolumeConfigurationCollection < CIMI::Model::Base
+
+  act_as_root_entity :volume_configuration
+
+  array :volume_configurations do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.volume_configurations_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeConfigurationCollection",
+      :volume_configurations => CIMI::Model::VolumeConfiguration.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/volume_image.rb b/server/lib/cimi/models/volume_image.rb
new file mode 100644
index 0000000..03cc7fd
--- /dev/null
+++ b/server/lib/cimi/models/volume_image.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.
+
+class CIMI::Model::VolumeImage < CIMI::Model::Base
+
+  href :image_location
+  text :image_data
+  text :bootable
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    storage_snapshots = []
+    opts = ( id==:all  ) ? {}  : { :id=>id }
+    storage_snapshots = self.driver.storage_snapshots(context.credentials, opts)
+    storage_snapshots.collect!{ |snapshot| from_storage_snapshot(snapshot, context) }
+    return storage_snapshots.first unless storage_snapshots.length > 1
+    return storage_snapshots
+  end
+
+  def self.all(context); find(:all, context); end
+
+  private
+
+  def self.from_storage_snapshot(snapshot, context)
+    self.new( {
+               :name => snapshot.id,
+               :description => snapshot.id,
+               :created => snapshot.created,
+               :id => context.volume_image_url(snapshot.id),
+               :image_location => {:href=>context.volume_url(snapshot.storage_volume_id)},
+               :bootable => "false"  #FIXME
+            } )
+  end
+
+end
diff --git a/server/lib/cimi/models/volume_image_collection.rb b/server/lib/cimi/models/volume_image_collection.rb
new file mode 100644
index 0000000..f3da877
--- /dev/null
+++ b/server/lib/cimi/models/volume_image_collection.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::VolumeImageCollection < CIMI::Model::Base
+
+  act_as_root_entity :volume_image
+
+  array :volume_images do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.volume_images_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeImageCollection",
+      :volume_images => CIMI::Model::VolumeImage.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/volume_template.rb b/server/lib/cimi/models/volume_template.rb
new file mode 100644
index 0000000..b9c82db
--- /dev/null
+++ b/server/lib/cimi/models/volume_template.rb
@@ -0,0 +1,23 @@
+# 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::VolumeTemplate < CIMI::Model::Base
+
+  href :volume_config
+  href :volume_image
+  array :operations do
+    scalar :rel, :href
+  end
+end
diff --git a/server/lib/cimi/models/volume_template_collection.rb b/server/lib/cimi/models/volume_template_collection.rb
new file mode 100644
index 0000000..f53547c
--- /dev/null
+++ b/server/lib/cimi/models/volume_template_collection.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::VolumeTemplateCollection < CIMI::Model::Base
+
+  act_as_root_entity :volume_template
+
+  array :volume_templates do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.volume_template_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VolumeTemplateCollection",
+      :volume_templates => CIMI::Model::VolumeTemplate.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/vsp.rb b/server/lib/cimi/models/vsp.rb
new file mode 100644
index 0000000..b8b27f5
--- /dev/null
+++ b/server/lib/cimi/models/vsp.rb
@@ -0,0 +1,102 @@
+# 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::VSP < CIMI::Model::Base
+
+  text :state
+
+  href :network
+
+  text :bandwidth_reservation
+
+  text :traffic_priority
+
+  text :max_traffic_delay
+
+  text :max_traffic_loss
+
+  text :max_traffic_jitter
+
+  href :event_log
+
+  array :meters do
+    scalar :href
+  end
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.vsps(context.credentials, {:env=>context})
+    else
+      context.driver.vsps(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["vspTemplate"]["href"] #template by reference
+      vsp_config, network = get_by_reference(input, context)
+    else
+      if input["vspTemplate"]["vspConfig"]["href"] # configuration by reference
+        vsp_config = CIMI::Model::VSPConfiguration.find(context.href_id(input["vspTemplate"]["vspConfig"]["href"],:vsp_configurations), context)
+      else #configuration by value
+        vsp_config = get_by_value(request_body, type)
+      end
+      network = CIMI::Model::Network.find(context.href_id(input["vspTemplate"]["network"]["href"], :networks), context)
+    end
+    params = {:vsp_config => vsp_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_vsp(context.credentials, params)
+  end
+
+  def self.delete!(id, context)
+    context.driver.delete_vsp(context.credentials, id)
+  end
+
+  def perform(action, context, &block)
+    begin
+      if context.driver.send(:"#{action.name}_vsp", context.credentials, self.name)
+        block.callback :success
+      else
+        raise "Operation #{action.name} failed to execute on the VSP #{self.name} "
+      end
+    rescue => e
+      block.callback :failure, e.message
+    end
+  end
+
+
+  private
+
+  def self.get_by_reference(input, context)
+    vsp_template = CIMI::Model::VSPTemplate.find(context.href_id(input["vspTemplate"]["href"], :vsp_templates), context)
+    vsp_config = CIMI::Model::VSPConfiguration.find(context.href_id(vsp_template.vsp_config.href, :vsp_configurations), context)
+    network = CIMI::Model::Network.find(context.href_id(vsp_template.network.href, :networks), context)
+    return vsp_config, network
+  end
+
+  def self.get_by_value(request_body, type)
+    if type == :xml
+      xml_arrays = XmlSimple.xml_in(request_body, {"NormaliseSpace"=>2})
+      vsp_config = CIMI::Model::VSPConfiguration.from_xml(XmlSimple.xml_out(xml_arrays["vspTemplate"][0]["vspConfig"][0]))
+    else
+     json = JSON.parse(request_body)
+      vsp_config = CIMI::Model::VSPConfiguration.from_json(JSON.generate(json["vspTemplate"]["vspConfig"]))
+    end
+  end
+end
diff --git a/server/lib/cimi/models/vsp_collection.rb b/server/lib/cimi/models/vsp_collection.rb
new file mode 100644
index 0000000..fc72024
--- /dev/null
+++ b/server/lib/cimi/models/vsp_collection.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::VSPCollection < CIMI::Model::Base
+
+  CIMI::Model.register_as_root_entity! "VSPs"
+
+  array :vsps do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.vsps_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VSPCollection",
+      :vsps => CIMI::Model::VSP.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/vsp_configuration.rb b/server/lib/cimi/models/vsp_configuration.rb
new file mode 100644
index 0000000..c9a9bf3
--- /dev/null
+++ b/server/lib/cimi/models/vsp_configuration.rb
@@ -0,0 +1,40 @@
+# 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::VSPConfiguration < CIMI::Model::Base
+
+  text :bandwidth_reservation
+
+  text :traffic_priority
+
+  text :max_traffic_delay
+
+  text :max_traffic_loss
+
+  text :max_traffic_jitter
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.vsp_configurations(context.credentials, {:env=>context})
+    else
+      context.driver.vsp_configurations(context.credentials, {:env=>context, :id=>id})
+    end
+  end
+
+end
diff --git a/server/lib/cimi/models/vsp_configuration_collection.rb b/server/lib/cimi/models/vsp_configuration_collection.rb
new file mode 100644
index 0000000..d4927e7
--- /dev/null
+++ b/server/lib/cimi/models/vsp_configuration_collection.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::VSPConfigurationCollection < CIMI::Model::Base
+
+  CIMI::Model.register_as_root_entity! "VSPConfigurations"
+
+  array :vsp_configurations do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.vsp_configurations_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VSPConfigurationCollection",
+      :vsp_configurations => CIMI::Model::VSPConfiguration.all_uri(context)
+    )
+  end
+
+end
diff --git a/server/lib/cimi/models/vsp_template.rb b/server/lib/cimi/models/vsp_template.rb
new file mode 100644
index 0000000..f1b8078
--- /dev/null
+++ b/server/lib/cimi/models/vsp_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::VSPTemplate < CIMI::Model::Base
+
+  href :network
+
+  href :vsp_config
+
+  array :operations do
+    scalar :rel, :href
+  end
+
+  def self.find(id, context)
+    if id==:all
+      context.driver.vsp_templates(context.credentials, {:env=>context})
+    else
+      context.driver.vsp_templates(context.credentials, {:env=>context, :id=>id})
+    end
+  end
+
+end
diff --git a/server/lib/cimi/models/vsp_template_collection.rb b/server/lib/cimi/models/vsp_template_collection.rb
new file mode 100644
index 0000000..61d5311
--- /dev/null
+++ b/server/lib/cimi/models/vsp_template_collection.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::VSPTemplateCollection < CIMI::Model::Base
+
+  CIMI::Model.register_as_root_entity! "VSPTemplates"
+
+  array :vsp_templates do
+    scalar :href
+  end
+
+  def self.default(context)
+    self.new(
+      :id => context.vsp_templates_url,
+      :name => 'default',
+      :created => Time.now,
+      :description => "#{context.driver.name.capitalize} VSPTemplateCollection",
+      :vsp_templates => CIMI::Model::VSPTemplate.all_uri(context)
+    )
+  end
+
+end
-- 
1.7.10


Mime
View raw message