Skip to content

Commit

Permalink
backend
Browse files Browse the repository at this point in the history
- add accounting, monitoring, security
- add methods for backend register
- add rspec
  • Loading branch information
Maik Srba committed Feb 1, 2013
1 parent 8b1d0f4 commit bab6ff0
Show file tree
Hide file tree
Showing 26 changed files with 130 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/occi/server.rb
Expand Up @@ -8,7 +8,7 @@
Encoding.default_internal = Encoding::UTF_8 if defined? Encoding

module Occi
class Server
module Server
VERSION = "0.9.0"

def self.start(frontend_identifier = 'http')
Expand Down
8 changes: 8 additions & 0 deletions lib/occi/server/backend.rb
Expand Up @@ -5,7 +5,15 @@ module Backend
#compute = Frontend.backend.infrastructure.compute

def self.register(backends)
@backends ||= Hashie::Mash.new

attributes = backends.dup # prevent delete from having side effects
backends = backends.delete(:backends).to_s.downcase.to_sym

backends.each do |layer_backend|
require "occi/server/backend/#{layer_backend.to_s.downcase}"
#...new :layer_backend => layer_backend
end
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions lib/occi/server/backend/accounting.rb
@@ -0,0 +1,9 @@
module Occi
module Server
module Backend
module Accounting

end
end
end
end
3 changes: 2 additions & 1 deletion lib/occi/server/backend/infrastructure.rb
Expand Up @@ -2,7 +2,8 @@ module Occi
module Server
module Backend
module Infrastructure
class Infrastructure
def self.register(attributes)

end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/occi/server/backend/infrastructure/compute.rb
Expand Up @@ -3,7 +3,8 @@ module Server
module Backend
module Infrastructure
module Compute
class Compute
def self.new(compute_backend)

end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/compute/cloudstack.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Compute
class Cloudstack
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/compute/dummy.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Compute
class Dummy
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/compute/ec2.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Compute
class EC2
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/compute/opennebula.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Compute
class Opennebula
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/compute/openstack.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Compute
class Openstack
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/compute/vsphere.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Compute
class Vsphere
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/occi/server/backend/infrastructure/network.rb
Expand Up @@ -3,7 +3,8 @@ module Server
module Backend
module Infrastructure
module Network
class Network
def self.register(network_backend)

end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/network/cloudstack.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Network
class Cloudstack
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/network/dummy.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Network
class Dummy
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/network/opennebula.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Network
class Opennebula
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/occi/server/backend/infrastructure/network/openstack.rb
Expand Up @@ -4,6 +4,9 @@ module Backend
module Infrastructure
module Network
class Openstack
def initialize(attributes)
attributes = attributes.dup
end
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/occi/server/backend/infrastructure/storage.rb
Expand Up @@ -3,7 +3,8 @@ module Server
module Backend
module Infrastructure
module Storage
class Storage
def self.register(storage_backend)

end
end
end
Expand Down
9 changes: 9 additions & 0 deletions lib/occi/server/backend/monitoring.rb
@@ -0,0 +1,9 @@
module Occi
module Server
module Backend
module Monitoring

end
end
end
end
3 changes: 1 addition & 2 deletions lib/occi/server/backend/platform.rb
Expand Up @@ -2,8 +2,7 @@ module Occi
module Server
module Backend
module Platform
class Platform
end

end
end
end
Expand Down
9 changes: 9 additions & 0 deletions lib/occi/server/backend/security.rb
@@ -0,0 +1,9 @@
module Occi
module Server
module Backend
module Security

end
end
end
end
10 changes: 10 additions & 0 deletions lib/occi/server/backend/security/keystone.rb
@@ -0,0 +1,10 @@
module Occi
module Server
module Backend
module Security
class Keystone
end
end
end
end
end
3 changes: 1 addition & 2 deletions lib/occi/server/backend/service.rb
Expand Up @@ -2,8 +2,7 @@ module Occi
module Server
module Backend
module Service
class Service
end

end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/occi/server/frontend.rb
@@ -1,7 +1,7 @@
module Occi
module Server
module Frontend
attr_accessor :backends
attr_accessor :backend

def self.[](frontend)
self.new(:frontend => frontend)
Expand Down
8 changes: 8 additions & 0 deletions lib/occi/server/usermanagement.rb
@@ -0,0 +1,8 @@
module Occi
module Server
module Usermanaagment
class Usermanagement
end
end
end
end
11 changes: 11 additions & 0 deletions spec/occi/server.rb
@@ -0,0 +1,11 @@
require "rspec"

module Occi
module Server
describe Occi::Server do
describe "start" do

end
end
end
end
24 changes: 24 additions & 0 deletions spec/occi/server/backend.rb
@@ -0,0 +1,24 @@
require "rspec"

module Occi
module Server
module Backend
describe Occi::Server::Backend do
describe "Register Infrastructure" do
describe "Register Compute" do
backends = Backend.register :backends => config[:backends]
#TODO test if we get the right things
end

describe "Register Network" do

end

describe "Register Storage" do

end
end
end
end
end
end

0 comments on commit bab6ff0

Please sign in to comment.