occi 2.5.19 → 3.0.0.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.travis.yml +3 -1
- data/AUTHORS +4 -3
- data/Gemfile +9 -0
- data/Gemfile.lock +64 -21
- data/README.md +19 -14
- data/Rakefile +12 -8
- data/Test Results - discovery_interface.html +862 -0
- data/bin/occi +333 -83
- data/examples/dsl_example.rb +6 -6
- data/examples/x509auth_example.rb +6 -6
- data/features/common/step_definitions/common_steps.rb +32 -0
- data/features/occi/core/create/create.feature +17 -0
- data/features/occi/core/create/step_definitions/create_steps.rb +0 -0
- data/features/occi/core/delete/delete.feature +14 -0
- data/features/occi/core/delete/step_definitions/delete_steps.rb +0 -0
- data/features/occi/core/discovery_interface/discovery_interface.feature +35 -0
- data/features/occi/core/discovery_interface/step_definitions/discovery_interface_steps.rb +19 -0
- data/features/occi/core/miscellaneous/miscellaneous.feature +14 -0
- data/features/occi/core/miscellaneous/step_definitions/miscellaneous_steps.rb +0 -0
- data/features/occi/core/read/read.feature +14 -0
- data/features/occi/core/read/step_definitions/read_steps.rb +0 -0
- data/features/occi/core/update/step_definitions/update_steps.rb +0 -0
- data/features/occi/core/update/update.feature +14 -0
- data/features/occi/infrastructure/create/create.feature +14 -0
- data/features/occi/infrastructure/create/step_definitions/create_steps.rb +0 -0
- data/features/support/env.rb +4 -0
- data/lib/occi.rb +29 -3
- data/lib/occi/api/client/client_amqp.rb +756 -0
- data/lib/occi/api/client/client_http.rb +922 -0
- data/lib/occi/api/client/http/httparty_fix.rb +53 -0
- data/lib/occi/api/client/http/net_http_fix.rb +46 -0
- data/lib/occi/api/dsl.rb +77 -73
- data/lib/occi/bin/helpers.rb +91 -0
- data/lib/occi/bin/occi_opts.rb +251 -0
- data/lib/occi/bin/resource_output_factory.rb +90 -0
- data/lib/occi/bin/templates/compute.erb +15 -0
- data/lib/occi/bin/templates/network.erb +11 -0
- data/lib/occi/bin/templates/os_tpl.erb +9 -0
- data/lib/occi/bin/templates/resource_tpl.erb +9 -0
- data/lib/occi/bin/templates/storage.erb +10 -0
- data/lib/occi/collection.rb +122 -25
- data/lib/occi/core.rb +18 -9
- data/lib/occi/core/action.rb +20 -4
- data/lib/occi/core/action_instance.rb +24 -0
- data/lib/occi/core/actions.rb +22 -0
- data/lib/occi/core/attribute_properties.rb +33 -84
- data/lib/occi/core/attributes.rb +32 -14
- data/lib/occi/core/categories.rb +46 -0
- data/lib/occi/core/category.rb +94 -20
- data/lib/occi/core/entities.rb +50 -0
- data/lib/occi/core/entity.rb +130 -89
- data/lib/occi/core/kind.rb +28 -35
- data/lib/occi/core/kinds.rb +22 -0
- data/lib/occi/core/link.rb +43 -40
- data/lib/occi/core/links.rb +34 -0
- data/lib/occi/core/mixin.rb +28 -23
- data/lib/occi/core/mixins.rb +22 -0
- data/lib/occi/core/related.rb +20 -0
- data/lib/occi/core/resource.rb +40 -40
- data/lib/occi/core/resources.rb +14 -0
- data/lib/occi/infrastructure.rb +27 -0
- data/lib/occi/infrastructure/compute.rb +159 -0
- data/lib/occi/infrastructure/network.rb +131 -0
- data/lib/occi/infrastructure/network/ipnetwork.rb +34 -0
- data/lib/occi/infrastructure/networkinterface.rb +124 -0
- data/lib/occi/infrastructure/networkinterface/ipnetworkinterface.rb +34 -0
- data/lib/occi/infrastructure/os_tpl.rb +19 -0
- data/lib/occi/infrastructure/resource_tpl.rb +19 -0
- data/lib/occi/infrastructure/storage.rb +96 -0
- data/lib/occi/infrastructure/storagelink.rb +73 -0
- data/lib/occi/log.rb +6 -2
- data/lib/occi/model.rb +38 -70
- data/lib/occi/parser.rb +108 -88
- data/lib/occi/version.rb +2 -2
- data/lib/occiantlr/OCCIANTLR.g +6 -5
- data/lib/occiantlr/OCCIANTLRLexer.rb +52 -52
- data/lib/occiantlr/OCCIANTLRParser.rb +678 -569
- data/lib/occiantlr/README.md +1 -1
- data/occi.gemspec +2 -1
- data/spec/cassettes/client_http_text_plain.yml +1066 -0
- data/spec/occi/api/client/client_amqp_spec.rb +148 -0
- data/spec/occi/api/client/client_http_0.5_spec.rb +292 -0
- data/spec/occi/api/client/client_http_spec.rb +259 -0
- data/spec/occi/api/dsl_spec.rb +0 -0
- data/spec/occi/collection_spec.rb +23 -10
- data/spec/occi/core/categories_spec.rb +30 -0
- data/spec/occi/core/category_spec.rb +41 -0
- data/spec/occi/core/entity_spec.rb +52 -0
- data/spec/occi/core/resource_spec.rb +21 -0
- data/spec/occi/infrastructure/compute_spec.rb +32 -0
- data/spec/occi/log_spec.rb +10 -10
- data/spec/occi/model_spec.rb +24 -24
- data/spec/occi/parser_spec.rb +89 -39
- data/spec/occi/test.json +22 -58
- data/spec/occiantlr/parser_spec.rb +5 -7
- data/spec/spec_helper.rb +13 -3
- metadata +116 -19
- data/etc/model/infrastructure/compute.json +0 -108
- data/etc/model/infrastructure/ipnetwork.json +0 -40
- data/etc/model/infrastructure/ipnetworkinterface.json +0 -40
- data/etc/model/infrastructure/network.json +0 -55
- data/etc/model/infrastructure/networkinterface.json +0 -38
- data/etc/model/infrastructure/os_template.json +0 -9
- data/etc/model/infrastructure/resource_template.json +0 -9
- data/etc/model/infrastructure/storage.json +0 -72
- data/etc/model/infrastructure/storagelink.json +0 -38
- data/lib/occi/api/client.rb +0 -596
- data/lib/occi/client/occiopts.rb +0 -146
- data/spec/occi/client_spec.rb +0 -12
@@ -0,0 +1,34 @@
|
|
1
|
+
module Occi
|
2
|
+
module Core
|
3
|
+
class Links < Occi::Core::Entities
|
4
|
+
|
5
|
+
def initialize(links=[])
|
6
|
+
links.collect! {|link| convert link} if links
|
7
|
+
super links
|
8
|
+
end
|
9
|
+
|
10
|
+
def <<(link)
|
11
|
+
super convert link
|
12
|
+
end
|
13
|
+
|
14
|
+
def create(*args)
|
15
|
+
link = Occi::Core::Link.new(*args)
|
16
|
+
link.model = @model
|
17
|
+
self << link
|
18
|
+
link
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def convert(link)
|
24
|
+
if link.kind_of? String
|
25
|
+
target = link
|
26
|
+
link = Occi::Core::Link.new
|
27
|
+
link.target = target
|
28
|
+
end
|
29
|
+
link
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/occi/core/mixin.rb
CHANGED
@@ -1,48 +1,53 @@
|
|
1
|
-
|
2
|
-
require 'occi/core/category'
|
3
|
-
|
4
|
-
module OCCI
|
1
|
+
module Occi
|
5
2
|
module Core
|
6
|
-
class Mixin <
|
3
|
+
class Mixin < Occi::Core::Category
|
7
4
|
|
8
|
-
attr_accessor :entities, :related, :actions
|
5
|
+
attr_accessor :entities, :related, :actions, :location
|
9
6
|
|
10
7
|
# @param [String ] scheme
|
11
8
|
# @param [String] term
|
12
9
|
# @param [String] title
|
13
|
-
# @param [
|
14
|
-
# @param [
|
15
|
-
# @param [
|
16
|
-
def initialize(scheme
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
# @param [Occi::Core::Attributes,Hash,NilClass] attributes
|
11
|
+
# @param [Occi::Core::Categories,Hash,NilClass] related
|
12
|
+
# @param [Occi::Core::Actions,Hash,NilClass] actions
|
13
|
+
def initialize(scheme='http://schemas.ogf.org/occi/core#',
|
14
|
+
term='mixin',
|
15
|
+
title=nil,
|
16
|
+
attributes=Occi::Core::Attributes.new,
|
17
|
+
related=Occi::Core::Related.new,
|
18
|
+
actions=Occi::Core::Actions.new,
|
19
|
+
location='')
|
20
|
+
|
20
21
|
super(scheme, term, title, attributes)
|
22
|
+
@related = Occi::Core::Related.new(related)
|
23
|
+
@actions = Occi::Core::Actions.new(actions)
|
24
|
+
@entities = Occi::Core::Entities.new
|
25
|
+
location.blank? ? @location = '/mixins/' + term + '/' : @location = location
|
21
26
|
end
|
22
27
|
|
23
|
-
# @return [String] string containing location URI of mixin
|
24
28
|
def location
|
25
|
-
|
29
|
+
@location.clone
|
26
30
|
end
|
27
31
|
|
28
32
|
# @param [Hash] options
|
29
33
|
# @return [Hashie::Mash] json representation
|
30
34
|
def as_json(options={ })
|
31
35
|
mixin = Hashie::Mash.new
|
32
|
-
mixin.related = @related if @related.any?
|
36
|
+
mixin.related = @related.join(' ').split(' ') if @related.any?
|
33
37
|
mixin.actions = @actions if @actions.any?
|
38
|
+
mixin.location = @location if @location
|
34
39
|
mixin.merge! super
|
35
40
|
mixin
|
36
41
|
end
|
37
42
|
|
38
43
|
# @return [String] text representation
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
def to_string
|
45
|
+
string = super
|
46
|
+
string << ';rel=' + @related.join(' ').inspect if @related.any?
|
47
|
+
string << ';location=' + self.location.inspect
|
48
|
+
string << ';attributes=' + @attributes.combine.keys.join(' ').inspect if @attributes.any?
|
49
|
+
string << ';actions=' + @actions.join(' ').inspect if @actions.any?
|
50
|
+
string
|
46
51
|
end
|
47
52
|
|
48
53
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Occi
|
2
|
+
module Core
|
3
|
+
class Mixins < Occi::Core::Categories
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def convert(category)
|
8
|
+
category = super category
|
9
|
+
|
10
|
+
if category.kind_of? String
|
11
|
+
scheme, term = category.split '#'
|
12
|
+
scheme += '#'
|
13
|
+
|
14
|
+
klass = Occi::Core::Category.get_class scheme, term, [Occi::Core::Mixin.new]
|
15
|
+
category = klass.new(scheme, term)
|
16
|
+
end
|
17
|
+
category
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Occi
|
2
|
+
module Core
|
3
|
+
class Related < Occi::Core::Categories
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def convert(category)
|
8
|
+
if category.kind_of? String
|
9
|
+
model_category=nil
|
10
|
+
model_category = @model.get_by_id category if @model
|
11
|
+
if model_category
|
12
|
+
return model_category
|
13
|
+
end
|
14
|
+
end
|
15
|
+
category
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/occi/core/resource.rb
CHANGED
@@ -1,52 +1,35 @@
|
|
1
|
-
|
2
|
-
require 'active_support/json'
|
3
|
-
require 'occi/core/entity'
|
4
|
-
require 'occi/core/kind'
|
5
|
-
|
6
|
-
module OCCI
|
1
|
+
module Occi
|
7
2
|
module Core
|
8
|
-
class Resource < Entity
|
3
|
+
class Resource < Occi::Core::Entity
|
9
4
|
|
10
5
|
attr_accessor :links
|
11
6
|
|
12
|
-
|
13
|
-
def self.kind_definition
|
14
|
-
kind = OCCI::Core::Kind.new('http://schemas.ogf.org/occi/core#', 'resource')
|
15
|
-
|
16
|
-
kind.related = %w{http://schemas.ogf.org/occi/core#entity}
|
17
|
-
kind.title = 'Resource'
|
7
|
+
@kind = Occi::Core::Kind.new('http://schemas.ogf.org/occi/core#', 'resource')
|
18
8
|
|
19
|
-
|
20
|
-
|
21
|
-
kind.attributes.occi!.core!.summary!.Required = false
|
22
|
-
kind.attributes.occi!.core!.summary!.Mutable = true
|
9
|
+
@kind.related << Occi::Core::Entity.kind
|
10
|
+
@kind.title = 'resource'
|
23
11
|
|
24
|
-
|
25
|
-
|
12
|
+
@kind.attributes.occi!.core!.summary = Occi::Core::AttributeProperties.new(
|
13
|
+
{ :mutable => true })
|
26
14
|
|
27
15
|
# @param [String] kind
|
28
16
|
# @param [Array] mixins
|
29
|
-
# @param [
|
17
|
+
# @param [Occi::Core::Attributes,Hash] attributes
|
30
18
|
# @param [Array] links
|
31
|
-
|
19
|
+
# @return [Occi::Core::Resource]
|
20
|
+
def initialize(kind=self.kind, mixins=[], attributes={ }, actions=[], links=[])
|
32
21
|
super(kind, mixins, attributes, actions)
|
33
|
-
@links =
|
34
|
-
links.to_a.each do |link|
|
35
|
-
link = OCCI::Core::Link.new(link.kind,link.mixins,link.attributes,link.actions,link.rel) unless link.kind_of? OCCI::Core::Link
|
36
|
-
@links << link
|
37
|
-
end
|
22
|
+
@links = Occi::Core::Links.new(links)
|
38
23
|
end
|
39
24
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
super(id)
|
44
|
-
@links.each { |link| link.attributes.occi!.core!.source = self.location }
|
25
|
+
def model=(model)
|
26
|
+
super model
|
27
|
+
@links.model = model
|
45
28
|
end
|
46
29
|
|
47
30
|
# @return [String] summary attribute of the resource
|
48
31
|
def summary
|
49
|
-
self.attributes.occi
|
32
|
+
self.attributes.occi.core.summary if @attributes.occi.core if @attributes.occi
|
50
33
|
end
|
51
34
|
|
52
35
|
# set summary attribute of resource
|
@@ -55,22 +38,39 @@ module OCCI
|
|
55
38
|
self.attributes.occi!.core!.summary = summary
|
56
39
|
end
|
57
40
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
41
|
+
def link(target, kind=Occi::Core::Link.kind, mixins=[], attributes=Occi::Core::Attributes.new, rel=Occi::Core::Resource.type_identifier)
|
42
|
+
link = kind.entity_type.new
|
43
|
+
link.rel = rel
|
44
|
+
link.attributes = attributes
|
45
|
+
link.target = target
|
46
|
+
link.source = self
|
47
|
+
link.mixins = mixins
|
48
|
+
@links << link
|
49
|
+
link
|
65
50
|
end
|
66
51
|
|
67
52
|
# @return [String] text representation
|
68
53
|
def to_text
|
69
54
|
text = super
|
70
|
-
@links.each { |link| text <<
|
55
|
+
@links.each { |link| text << link.to_text_link + "\n" }
|
71
56
|
text
|
72
57
|
end
|
73
58
|
|
59
|
+
# @return [Hash] hash containing the HTTP headers of the text/occi rendering
|
60
|
+
def to_header
|
61
|
+
header = super
|
62
|
+
header['Links'] = @links.join(',')
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param [Hash] options
|
66
|
+
# @return [Hashie::Mash] link as Hashie::Mash to be parsed into a JSON object
|
67
|
+
def as_json(options={ })
|
68
|
+
resource = super
|
69
|
+
link_strings = @links.collect { |link| link.to_s if link.to_s }.compact
|
70
|
+
resource.links = link_strings unless link_strings.empty?
|
71
|
+
resource
|
72
|
+
end
|
73
|
+
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'occi/infrastructure/compute'
|
2
|
+
require 'occi/infrastructure/storage'
|
3
|
+
require 'occi/infrastructure/storagelink'
|
4
|
+
require 'occi/infrastructure/network'
|
5
|
+
require 'occi/infrastructure/networkinterface'
|
6
|
+
require 'occi/infrastructure/os_tpl'
|
7
|
+
require 'occi/infrastructure/resource_tpl'
|
8
|
+
|
9
|
+
module Occi
|
10
|
+
module Infrastructure
|
11
|
+
|
12
|
+
extend Occi
|
13
|
+
|
14
|
+
def self.kinds
|
15
|
+
Occi::Core::Kinds.new << Occi::Infrastructure::Compute.kind << Occi::Infrastructure::Storage.kind << Occi::Infrastructure::Network.kind << Occi::Infrastructure::Networkinterface.kind << Occi::Infrastructure::Storagelink.kind
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.mixins
|
19
|
+
Occi::Infrastructure::Compute.mixins + Occi::Infrastructure::Storage.mixins + Occi::Infrastructure::Network.mixins + Occi::Infrastructure::Networkinterface.mixins + Occi::Infrastructure::Storagelink.mixins
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.actions
|
23
|
+
Occi::Infrastructure::Compute.actions + Occi::Infrastructure::Storage.actions + Occi::Infrastructure::Network.actions + Occi::Infrastructure::Networkinterface.actions + Occi::Infrastructure::Storagelink.actions
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
module Occi
|
2
|
+
module Infrastructure
|
3
|
+
class Compute < Occi::Core::Resource
|
4
|
+
|
5
|
+
class Start < Occi::Core::Action
|
6
|
+
def initialize(scheme='http://schemas.ogf.org/occi/infrastructure/compute/action#',
|
7
|
+
term='start',
|
8
|
+
title='start compute instance')
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Stop < Occi::Core::Action
|
14
|
+
def initialize(scheme='http://schemas.ogf.org/occi/infrastructure/compute/action#',
|
15
|
+
term='stop',
|
16
|
+
title='stop compute instance')
|
17
|
+
super
|
18
|
+
@attributes.method = Occi::Core::AttributeProperties.new(
|
19
|
+
{ :mutable => true,
|
20
|
+
:pattern => 'graceful|acpioff|poweroff',
|
21
|
+
:default => 'poweroff' })
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Restart < Occi::Core::Action
|
26
|
+
def initialize(scheme='http://schemas.ogf.org/occi/infrastructure/compute/action#',
|
27
|
+
term='restart',
|
28
|
+
title='restart compute instance')
|
29
|
+
super
|
30
|
+
@attributes.method = Occi::Core::AttributeProperties.new(
|
31
|
+
{ :mutable => true,
|
32
|
+
:pattern => 'graceful|warm|cold',
|
33
|
+
:default => 'cold' })
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Suspend < Occi::Core::Action
|
38
|
+
def initialize(scheme='http://schemas.ogf.org/occi/infrastructure/compute/action#',
|
39
|
+
term='suspend',
|
40
|
+
title='suspend compute instance')
|
41
|
+
super
|
42
|
+
@attributes.method = Occi::Core::AttributeProperties.new(
|
43
|
+
{ :mutable => true,
|
44
|
+
:pattern => 'hibernate|suspend',
|
45
|
+
:default => 'suspend' })
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.mixins
|
50
|
+
Occi::Core::Mixins.new << Occi::Infrastructure::Resource_tpl.new << Occi::Infrastructure::Os_tpl.new
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.actions
|
54
|
+
Occi::Core::Actions.new << Start.new << Stop.new << Restart.new << Suspend.new
|
55
|
+
end
|
56
|
+
|
57
|
+
begin
|
58
|
+
@kind = Occi::Core::Kind.new('http://schemas.ogf.org/occi/infrastructure#', 'compute')
|
59
|
+
|
60
|
+
@kind.title = "compute resource"
|
61
|
+
|
62
|
+
@kind.related << Occi::Core::Resource.kind
|
63
|
+
|
64
|
+
@kind.attributes.occi!.compute!.architecture = Occi::Core::AttributeProperties.new(
|
65
|
+
{ :mutable => true,
|
66
|
+
:pattern => 'x86|x64' })
|
67
|
+
|
68
|
+
@kind.attributes.occi!.compute!.cores = Occi::Core::AttributeProperties.new(
|
69
|
+
{ :type => 'number',
|
70
|
+
:mutable => true })
|
71
|
+
|
72
|
+
@kind.attributes.occi!.compute!.hostname = Occi::Core::AttributeProperties.new(
|
73
|
+
{ :mutable => true,
|
74
|
+
:pattern => '(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*' })
|
75
|
+
|
76
|
+
@kind.attributes.occi!.compute!.speed = Occi::Core::AttributeProperties.new(
|
77
|
+
{ :type => 'number',
|
78
|
+
:mutable => true })
|
79
|
+
|
80
|
+
@kind.attributes.occi!.compute!.memory = Occi::Core::AttributeProperties.new(
|
81
|
+
{ :type => 'number',
|
82
|
+
:mutable => true })
|
83
|
+
|
84
|
+
@kind.attributes.occi!.compute!.state = Occi::Core::AttributeProperties.new(
|
85
|
+
{ :pattern => 'inactive|active|suspended|error',
|
86
|
+
:default => 'inactive' })
|
87
|
+
|
88
|
+
@kind.location = '/compute/'
|
89
|
+
|
90
|
+
@kind.actions = self.actions
|
91
|
+
end
|
92
|
+
|
93
|
+
def architecture
|
94
|
+
@attributes.occi.compute.architecture if @attributes.occi.compute if @attributes.occi
|
95
|
+
end
|
96
|
+
|
97
|
+
def architecture=(architecture)
|
98
|
+
@attributes.occi!.compute!.architecture = architecture
|
99
|
+
end
|
100
|
+
|
101
|
+
def cores
|
102
|
+
@attributes.occi.compute.cores if @attributes.occi.compute if @attributes.occi
|
103
|
+
end
|
104
|
+
|
105
|
+
def cores=(cores)
|
106
|
+
@attributes.occi!.compute!.cores = cores
|
107
|
+
end
|
108
|
+
|
109
|
+
def hostname
|
110
|
+
@attributes.occi.compute.hostname if @attributes.occi.compute if @attributes.occi
|
111
|
+
end
|
112
|
+
|
113
|
+
def hostname=(hostname)
|
114
|
+
@attributes.occi!.compute!.hostname = hostname
|
115
|
+
end
|
116
|
+
|
117
|
+
def speed
|
118
|
+
@attributes.occi.compute.speed if @attributes.occi.compute if @attributes.occi
|
119
|
+
end
|
120
|
+
|
121
|
+
def speed=(speed)
|
122
|
+
@attributes.occi!.compute!.speed = speed
|
123
|
+
end
|
124
|
+
|
125
|
+
def memory
|
126
|
+
@attributes.occi.compute.memory if @attributes.occi.compute if @attributes.occi
|
127
|
+
end
|
128
|
+
|
129
|
+
def memory=(memory)
|
130
|
+
@attributes.occi!.compute!.memory = memory
|
131
|
+
end
|
132
|
+
|
133
|
+
def state
|
134
|
+
@attributes.occi.compute.state if @attributes.occi.compute if @attributes.occi
|
135
|
+
end
|
136
|
+
|
137
|
+
def state=(state)
|
138
|
+
@attributes.occi!.compute!.state = state
|
139
|
+
end
|
140
|
+
|
141
|
+
def storagelink(target, mixins=[], attributes=Occi::Core::Attributes.new)
|
142
|
+
link(target, Occi::Infrastructure::Storagelink.kind, mixins, attributes, rel=Occi::Infrastructure::Storage.type_identifier)
|
143
|
+
end
|
144
|
+
|
145
|
+
def networkinterface(target, mixins=[], attributes=Occi::Core::Attributes.new)
|
146
|
+
link(target, Occi::Infrastructure::Networkinterface.kind, mixins, attributes)
|
147
|
+
end
|
148
|
+
|
149
|
+
def storagelinks
|
150
|
+
@links.select { |link| link.kind == Occi::Infrastructure::Storagelink.kind }
|
151
|
+
end
|
152
|
+
|
153
|
+
def networkinterfaces
|
154
|
+
@links.select { |link| link.kind == Occi::Infrastructure::Networkinterface.kind }
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|