You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/01/03 12:05:09 UTC

[6/7] git commit: CIMI: Added AddressTemplate database model

CIMI: Added AddressTemplate database model


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

Branch: refs/heads/master
Commit: 69ed3b5206614af51213d9d85678773864ff5fa1
Parents: 56bfe16
Author: Michal Fojtik <mf...@redhat.com>
Authored: Wed Jan 2 13:22:44 2013 +0100
Committer: Michal fojtik <mf...@redhat.com>
Committed: Thu Jan 3 12:02:19 2013 +0100

----------------------------------------------------------------------
 server/lib/db.rb                  |    1 +
 server/lib/db/address_template.rb |   17 +++++++++++++++++
 server/lib/db/provider.rb         |    5 +++++
 3 files changed, 23 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/69ed3b52/server/lib/db.rb
----------------------------------------------------------------------
diff --git a/server/lib/db.rb b/server/lib/db.rb
index 2a5114d..9564b79 100644
--- a/server/lib/db.rb
+++ b/server/lib/db.rb
@@ -9,6 +9,7 @@ module Deltacloud
     require_relative './db/provider'
     require_relative './db/entity'
     require_relative './db/machine_template'
+    require_relative './db/address_template'
   end
 
   DATABASE_LOCATION = ENV['DATABASE_LOCATION'] || File.join('/', 'var', 'tmp', "deltacloud-mock-#{ENV['USER']}", 'db.sqlite')

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/69ed3b52/server/lib/db/address_template.rb
----------------------------------------------------------------------
diff --git a/server/lib/db/address_template.rb b/server/lib/db/address_template.rb
new file mode 100644
index 0000000..c3272c4
--- /dev/null
+++ b/server/lib/db/address_template.rb
@@ -0,0 +1,17 @@
+module Deltacloud
+  module Database
+
+    class AddressTemplate < Entity
+      belongs_to :provider
+
+      property :ip, String
+      property :allocation, String, :default => 'dynamic'
+      property :default_gateway, String, :default => 'unknown'
+      property :dns, String, :default => 'unknown'
+      property :protocol, String, :default => 'ipv4'
+      property :mask, String, :default => 'unknown'
+      property :network, String
+    end
+
+  end
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/69ed3b52/server/lib/db/provider.rb
----------------------------------------------------------------------
diff --git a/server/lib/db/provider.rb b/server/lib/db/provider.rb
index 25e2ca9..789bf3e 100644
--- a/server/lib/db/provider.rb
+++ b/server/lib/db/provider.rb
@@ -10,6 +10,7 @@ module Deltacloud
 
       has n, :entities
       has n, :machine_templates
+      has n, :address_templates
 
       # This is a workaround for strange bug in Fedora MRI:
       #
@@ -17,6 +18,10 @@ module Deltacloud
         MachineTemplate.all(:provider_id => self.id)
       end
 
+      def address_templates
+        AddressTemplate.all(:provider_id => self.id)
+      end
+
       def entities
         Entity.all(:provider_id => self.id)
       end