occi 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +9 -0
- data/.project +32 -0
- data/.rspec +1 -0
- data/.travis.yml +8 -0
- data/.yardopts +1 -0
- data/AUTHORS +8 -0
- data/Gemfile +35 -14
- data/Gemfile.lock +89 -32
- data/LICENSE +13 -4
- data/README.md +70 -21
- data/Rakefile +25 -21
- data/lib/OpenNebula/Acl.rb +256 -0
- data/lib/OpenNebula/AclPool.rb +53 -0
- data/lib/OpenNebula/Group.rb +147 -0
- data/lib/OpenNebula/GroupPool.rb +54 -0
- data/lib/OpenNebula/Host.rb +143 -0
- data/lib/OpenNebula/HostPool.rb +55 -0
- data/lib/OpenNebula/Image.rb +256 -0
- data/lib/OpenNebula/ImagePool.rb +74 -0
- data/lib/OpenNebula/OpenNebula.rb +137 -0
- data/lib/OpenNebula/Pool.rb +285 -0
- data/lib/OpenNebula/Template.rb +173 -0
- data/lib/OpenNebula/TemplatePool.rb +74 -0
- data/lib/OpenNebula/User.rb +157 -0
- data/lib/OpenNebula/UserPool.rb +53 -0
- data/lib/OpenNebula/VirtualMachine.rb +319 -0
- data/lib/OpenNebula/VirtualMachinePool.rb +120 -0
- data/lib/OpenNebula/VirtualNetwork.rb +229 -0
- data/lib/OpenNebula/VirtualNetworkPool.rb +74 -0
- data/lib/OpenNebula/XMLUtils.rb +337 -0
- data/lib/occi/antlr/.gitignore +18 -0
- data/lib/occi/antlr/OCCI.g +164 -0
- data/lib/occi/antlr/OCCI.tokens +75 -0
- data/lib/occi/antlr/OCCILexer.rb +1532 -0
- data/lib/occi/antlr/OCCIParser.rb +2472 -0
- data/lib/occi/antlr/README.md +2 -0
- data/lib/occi/backend/dummy.rb +232 -0
- data/lib/occi/backend/ec2/Compute.rb +310 -0
- data/lib/occi/backend/ec2/compute.rb +310 -0
- data/lib/occi/backend/ec2/ec2.rb +215 -0
- data/lib/occi/backend/manager.rb +131 -0
- data/lib/occi/backend/opennebula/compute.rb +360 -0
- data/lib/occi/backend/opennebula/network.rb +143 -0
- data/lib/occi/backend/opennebula/opennebula.rb +188 -0
- data/lib/occi/backend/opennebula/storage.rb +175 -0
- data/lib/occi/configuration.rb +118 -0
- data/lib/occi/core/action.rb +29 -0
- data/lib/occi/core/attribute_properties.rb +54 -0
- data/lib/occi/core/attributes.rb +40 -0
- data/lib/occi/core/category.rb +62 -0
- data/lib/occi/core/collection.rb +27 -0
- data/lib/occi/core/entity.rb +135 -0
- data/lib/occi/core/kind.rb +55 -0
- data/lib/occi/core/link.rb +88 -0
- data/lib/occi/core/mixin.rb +43 -0
- data/lib/occi/core/resource.rb +73 -0
- data/lib/occi/exceptions.rb +59 -0
- data/lib/occi/extensions/monitoring/cpu.rb +51 -0
- data/lib/occi/extensions/monitoring/memory.rb +49 -0
- data/lib/occi/extensions/monitoring/metric.rb +54 -0
- data/lib/occi/extensions/monitoring/netrx.rb +49 -0
- data/lib/occi/extensions/monitoring/nettx.rb +55 -0
- data/lib/occi/extensions/one/VNC.rb +58 -0
- data/lib/occi/extensions/one/vnc.rb +58 -0
- data/lib/occi/log.rb +47 -0
- data/lib/occi/parse.rb +164 -0
- data/lib/occi/registry.rb +87 -0
- data/lib/occi/server.rb +594 -0
- data/lib/occi/version.rb +3 -0
- data/occi.gemspec +18 -96
- data/spec/occi/antlr/parser_spec.rb +82 -0
- data/spec/spec_helper.rb +6 -0
- metadata +100 -208
- data/.autotest +0 -21
- data/.rvmrc +0 -1
- data/VERSION +0 -1
- data/lib/occi.rb +0 -1
- data/lib/occi/client.rb +0 -36
- data/lib/occi/compute.rb +0 -4
- data/lib/occi/network.rb +0 -4
- data/lib/occi/resource.rb +0 -59
- data/lib/occi/storage.rb +0 -7
- data/test/fixtures/cassettes/compute_all.yml +0 -28
- data/test/fixtures/cassettes/compute_create.yml +0 -45
- data/test/fixtures/cassettes/compute_destroy.yml +0 -22
- data/test/fixtures/cassettes/compute_find.yml +0 -28
- data/test/fixtures/cassettes/compute_update.yml +0 -35
- data/test/fixtures/cassettes/network_all.yml +0 -28
- data/test/fixtures/cassettes/network_create.yml +0 -37
- data/test/fixtures/cassettes/network_destroy.yml +0 -22
- data/test/fixtures/cassettes/network_find.yml +0 -28
- data/test/fixtures/cassettes/storage_all.yml +0 -28
- data/test/fixtures/cassettes/storage_create.yml +0 -50
- data/test/fixtures/cassettes/storage_destroy.yml +0 -22
- data/test/fixtures/cassettes/storage_find.yml +0 -28
- data/test/lib/occi/compute_test.rb +0 -91
- data/test/lib/occi/network_test.rb +0 -57
- data/test/lib/occi/storage_test.rb +0 -67
- data/test/test_helper.rb +0 -48
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2011 Service Computing group, TU Dortmund
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI Core Kind
|
|
19
|
+
# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'json'
|
|
23
|
+
require 'occi/core/category'
|
|
24
|
+
require 'occi/core/action'
|
|
25
|
+
require 'occi/core/attribute_properties'
|
|
26
|
+
|
|
27
|
+
module OCCI
|
|
28
|
+
module Core
|
|
29
|
+
class Kind < OCCI::Core::Category
|
|
30
|
+
|
|
31
|
+
attr_accessor :entities
|
|
32
|
+
|
|
33
|
+
def initialize(kind, default = nil)
|
|
34
|
+
@entities = []
|
|
35
|
+
super(kind, default)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def entity_type
|
|
39
|
+
case type_identifier
|
|
40
|
+
when "http://schemas.ogf.org/occi/core#resource"
|
|
41
|
+
return OCCI::Core::Resource.name
|
|
42
|
+
when "http://schemas.ogf.org/occi/core#link"
|
|
43
|
+
return OCCI::Core::Link.name
|
|
44
|
+
else
|
|
45
|
+
OCCI::Registry.get_by_id(self[:related].first).entity_type unless self[:term] == 'entity'
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def location
|
|
50
|
+
'/' + self[:term] + '/'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2011 Service Computing group, TU Dortmund
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI Core Link
|
|
19
|
+
# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'occi/core/entity'
|
|
23
|
+
require 'occi/core/kind'
|
|
24
|
+
require 'hashie'
|
|
25
|
+
|
|
26
|
+
module OCCI
|
|
27
|
+
module Core
|
|
28
|
+
class Link < Entity
|
|
29
|
+
|
|
30
|
+
# Define appropriate kind
|
|
31
|
+
def self.register
|
|
32
|
+
data = Hashie::Mash.new
|
|
33
|
+
data[:actions] = []
|
|
34
|
+
data[:related] = %w{http://schemas.ogf.org/occi/core#entity}
|
|
35
|
+
data[:term] = "link"
|
|
36
|
+
data[:scheme] = "http://schemas.ogf.org/occi/core#"
|
|
37
|
+
data[:title] = "Link"
|
|
38
|
+
|
|
39
|
+
data.attributes!.occi!.core!.target!.type = "string"
|
|
40
|
+
data.attributes!.occi!.core!.target!.pattern = ".*"
|
|
41
|
+
data.attributes!.occi!.core!.target!.required = false
|
|
42
|
+
data.attributes!.occi!.core!.target!.mutable = true
|
|
43
|
+
|
|
44
|
+
data.attributes!.occi!.core!.source!.type = "string"
|
|
45
|
+
data.attributes!.occi!.core!.source!.pattern = ".*"
|
|
46
|
+
data.attributes!.occi!.core!.source!.required = false
|
|
47
|
+
data.attributes!.occi!.core!.source!.mutable = true
|
|
48
|
+
|
|
49
|
+
kind = OCCI::Core::Kind.new(data)
|
|
50
|
+
OCCI::Registry.register(kind)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def target
|
|
54
|
+
return self[:target]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def target=(target)
|
|
58
|
+
self[:target] = target
|
|
59
|
+
self.attributes!.occi!.core!.target = target
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def source
|
|
63
|
+
return self[:source]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def source=(source)
|
|
67
|
+
self[:source] = source
|
|
68
|
+
self.attributes!.occi!.core!.source = source
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def convert_value(val, duping=false) #:nodoc:
|
|
72
|
+
case val
|
|
73
|
+
when self.class
|
|
74
|
+
val.dup
|
|
75
|
+
when ::Hash
|
|
76
|
+
val = val.dup if duping
|
|
77
|
+
self.class.subkey_class.new.merge(val) unless val.kind_of?(Hashie::Mash)
|
|
78
|
+
val
|
|
79
|
+
when Array
|
|
80
|
+
val.collect { |e| convert_value(e) }
|
|
81
|
+
else
|
|
82
|
+
val
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2011 Service Computing group, TU Dortmund
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI Core Mixin
|
|
19
|
+
# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'json'
|
|
23
|
+
require 'occi/core/category'
|
|
24
|
+
require 'occi/core/action'
|
|
25
|
+
|
|
26
|
+
module OCCI
|
|
27
|
+
module Core
|
|
28
|
+
class Mixin < OCCI::Core::Category
|
|
29
|
+
|
|
30
|
+
attr_accessor :entities
|
|
31
|
+
|
|
32
|
+
def initialize(mixin, default = nil)
|
|
33
|
+
@entities = []
|
|
34
|
+
super(mixin, default)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def location
|
|
38
|
+
'/mixin/' + self[:term] + '/'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2011 Service Computing group, TU Dortmund
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI Core Resource
|
|
19
|
+
# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'occi/registry'
|
|
23
|
+
require 'occi/core/entity'
|
|
24
|
+
require 'occi/core/kind'
|
|
25
|
+
require 'hashie'
|
|
26
|
+
|
|
27
|
+
module OCCI
|
|
28
|
+
module Core
|
|
29
|
+
class Resource < Entity
|
|
30
|
+
|
|
31
|
+
def self.register
|
|
32
|
+
data = Hashie::Mash.new
|
|
33
|
+
data[:related] = %w{http://schemas.ogf.org/occi/core#entity}
|
|
34
|
+
data[:term] = "resource"
|
|
35
|
+
data[:scheme] = "http://schemas.ogf.org/occi/core#"
|
|
36
|
+
data[:title] = "Resource"
|
|
37
|
+
|
|
38
|
+
data.attributes!.occi!.core!.summary!.type = "string"
|
|
39
|
+
data.attributes!.occi!.core!.summary!.pattern = ".*"
|
|
40
|
+
data.attributes!.occi!.core!.summary!.required = false
|
|
41
|
+
data.attributes!.occi!.core!.summary!.mutable = true
|
|
42
|
+
|
|
43
|
+
kind = OCCI::Core::Kind.new(data)
|
|
44
|
+
OCCI::Registry.register(kind)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def summary
|
|
48
|
+
return self[:summary]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def summary=(summary)
|
|
52
|
+
self[:summary] = summary
|
|
53
|
+
self.attributes!.occi!.core!.summary = summary
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def convert_value(val, duping=false) #:nodoc:
|
|
57
|
+
case val
|
|
58
|
+
when self.class
|
|
59
|
+
val.dup
|
|
60
|
+
when ::Hash
|
|
61
|
+
val = val.dup if duping
|
|
62
|
+
self.class.subkey_class.new.merge(val) unless val.kind_of?(Hashie::Mash)
|
|
63
|
+
val
|
|
64
|
+
when Array
|
|
65
|
+
val.collect { |e| convert_value(e) }
|
|
66
|
+
else
|
|
67
|
+
val
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2011 Service Computing group, TU Dortmund
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: registry for all Category/Kind/Mixin instances currently
|
|
19
|
+
# known to the OCCI server
|
|
20
|
+
# Author(s): Hayati Bice, Florian Feldhaus, Piotr Kasprzak
|
|
21
|
+
##############################################################################
|
|
22
|
+
|
|
23
|
+
module OCCI
|
|
24
|
+
|
|
25
|
+
# Tried to create an already existing mixin
|
|
26
|
+
class MixinAlreadyExistsError < RuntimeError;
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class CategoryNotFoundException < RuntimeError;
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class CategoryMissingException < RuntimeError;
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class MixinNotFoundException < RuntimeError;
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class MixinCreationException < RuntimeError;
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class LocationAlreadyRegisteredException < RuntimeError;
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class LocationNotRegisteredException < RuntimeError;
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Tried to create an already existing mixin
|
|
48
|
+
class BackendError < RuntimeError;
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class ParserException < RuntimeError;
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class ContentTypeNotSupported < RuntimeError;
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class CategoryNotFound < RuntimeError;
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2012 GWDG
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI monitoring VM cpu usage
|
|
19
|
+
# Author(s): Ali Imran Jehangiri, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'singleton'
|
|
23
|
+
require 'occi/core/mixin'
|
|
24
|
+
|
|
25
|
+
module OCCI
|
|
26
|
+
module Monitor
|
|
27
|
+
class Cpu < OCCI::Core::Mixin
|
|
28
|
+
|
|
29
|
+
# Define appropriate mixin
|
|
30
|
+
begin
|
|
31
|
+
# Define actions
|
|
32
|
+
actions = []
|
|
33
|
+
|
|
34
|
+
related = [OCCI::Monitor::Metric::MIXIN]
|
|
35
|
+
entities = []
|
|
36
|
+
|
|
37
|
+
term = "cpu"
|
|
38
|
+
scheme = "http://example.com/occi/infrastructure/metric/compute#"
|
|
39
|
+
title = "compute.cpu"
|
|
40
|
+
|
|
41
|
+
attributes = OCCI::Core::Attributes.new()
|
|
42
|
+
|
|
43
|
+
MIXIN = OCCI::Core::Mixin.new(term, scheme, title, attributes, actions, related, entities)
|
|
44
|
+
OCCI::CategoryRegistry.register(MIXIN)
|
|
45
|
+
OCCI::Rendering::HTTP::LocationRegistry.register('/metric/compute/cpu', MIXIN)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2012 GWDG
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI monitoring VM memory usage
|
|
19
|
+
# Author(s): Ali Imran Jehangiri, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'singleton'
|
|
23
|
+
require 'occi/core/mixin'
|
|
24
|
+
|
|
25
|
+
module OCCI
|
|
26
|
+
module Monitor
|
|
27
|
+
class Memory < OCCI::Core::Mixin
|
|
28
|
+
|
|
29
|
+
# Define appropriate mixin
|
|
30
|
+
begin
|
|
31
|
+
# Define actions
|
|
32
|
+
actions = []
|
|
33
|
+
|
|
34
|
+
related = [OCCI::Monitor::Metric::MIXIN]
|
|
35
|
+
entities = []
|
|
36
|
+
|
|
37
|
+
term = "memory"
|
|
38
|
+
scheme = "http://example.com/occi/infrastructure/metric/compute#"
|
|
39
|
+
title = "compute.memory"
|
|
40
|
+
|
|
41
|
+
attributes = OCCI::Core::Attributes.new()
|
|
42
|
+
MIXIN = OCCI::Core::Mixin.new(term, scheme, title, attributes, actions, related, entities)
|
|
43
|
+
OCCI::CategoryRegistry.register(MIXIN)
|
|
44
|
+
OCCI::Rendering::HTTP::LocationRegistry.register('/metric/compute/memory', MIXIN)
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Copyright 2012 GWDG
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
##############################################################################
|
|
16
|
+
|
|
17
|
+
##############################################################################
|
|
18
|
+
# Description: OCCI monitoring metric
|
|
19
|
+
# Author(s): Ali Imran Jehangiri, Florian Feldhaus, Piotr Kasprzak
|
|
20
|
+
##############################################################################
|
|
21
|
+
|
|
22
|
+
require 'singleton'
|
|
23
|
+
|
|
24
|
+
require 'occi/core/mixin'
|
|
25
|
+
|
|
26
|
+
module OCCI
|
|
27
|
+
module Monitor
|
|
28
|
+
class Metric < OCCI::Core::Mixin
|
|
29
|
+
|
|
30
|
+
# Define appropriate mixin
|
|
31
|
+
begin
|
|
32
|
+
# Define actions
|
|
33
|
+
actions = []
|
|
34
|
+
|
|
35
|
+
related = []
|
|
36
|
+
entities = []
|
|
37
|
+
|
|
38
|
+
term = "metric"
|
|
39
|
+
scheme = "http://schemas.ogf.org/occi/monitoring#"
|
|
40
|
+
title = "Metric"
|
|
41
|
+
|
|
42
|
+
attributes = OCCI::Core::Attributes.new()
|
|
43
|
+
attributes << OCCI::Core::Attribute.new(name = 'value', mutable = false, mandatory = true, unique = true)
|
|
44
|
+
attributes << OCCI::Core::Attribute.new(name = 'timestamp', mutable = false, mandatory = true, unique = true)
|
|
45
|
+
attributes << OCCI::Core::Attribute.new(name = 'samplerate', mutable = true, mandatory = false, unique = true)
|
|
46
|
+
attributes << OCCI::Core::Attribute.new(name = 'resolution', mutable = true, mandatory = false, unique = true)
|
|
47
|
+
attributes << OCCI::Core::Attribute.new(name = 'unit', mutable = false, mandatory = true, unique = true)
|
|
48
|
+
|
|
49
|
+
MIXIN = OCCI::Core::Mixin.new(term, scheme, title, attributes, actions, related, entities)
|
|
50
|
+
OCCI::CategoryRegistry.register(MIXIN)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|