occi-core 4.1.3 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +8 -0
- data/README.md +49 -17
- data/lib/occi/collection.rb +37 -21
- data/lib/occi/core/action.rb +5 -5
- data/lib/occi/core/action_instance.rb +45 -3
- data/lib/occi/core/actions.rb +2 -1
- data/lib/occi/core/attributes.rb +253 -73
- data/lib/occi/core/categories.rb +1 -0
- data/lib/occi/core/category.rb +25 -8
- data/lib/occi/core/entities.rb +1 -0
- data/lib/occi/core/entity.rb +51 -74
- data/lib/occi/core/kind.rb +15 -11
- data/lib/occi/core/kinds.rb +1 -1
- data/lib/occi/core/link.rb +14 -15
- data/lib/occi/core/links.rb +1 -1
- data/lib/occi/core/mixin.rb +5 -5
- data/lib/occi/core/mixins.rb +2 -2
- data/lib/occi/core/properties.rb +90 -12
- data/lib/occi/core/resource.rb +7 -3
- data/lib/occi/core/resources.rb +2 -2
- data/lib/occi/errors/attribute_definitions_converted_error.rb +5 -0
- data/lib/occi/errors/attribute_missing_error.rb +5 -0
- data/lib/occi/errors/attribute_name_invalid_error.rb +5 -0
- data/lib/occi/errors/attribute_not_defined_error.rb +5 -0
- data/lib/occi/errors/attribute_property_type_error.rb +5 -0
- data/lib/occi/errors/attribute_type_error.rb +5 -0
- data/lib/occi/errors/kind_not_defined_error.rb +5 -0
- data/lib/occi/errors/parser_input_error.rb +5 -0
- data/lib/occi/errors/parser_type_error.rb +5 -0
- data/lib/occi/errors.rb +1 -0
- data/lib/occi/extensions/hashie.rb +25 -0
- data/lib/occi/helpers/comparators/action_instance.rb +22 -0
- data/lib/occi/helpers/comparators/attributes.rb +22 -0
- data/lib/occi/helpers/comparators/categories.rb +22 -0
- data/lib/occi/helpers/comparators/category.rb +22 -0
- data/lib/occi/helpers/comparators/collection.rb +40 -0
- data/lib/occi/helpers/comparators/entities.rb +22 -0
- data/lib/occi/helpers/comparators/entity.rb +22 -0
- data/lib/occi/helpers/comparators/properties.rb +26 -0
- data/lib/occi/helpers/comparators.rb +1 -0
- data/lib/occi/infrastructure/compute.rb +11 -9
- data/lib/occi/infrastructure/network.rb +27 -27
- data/lib/occi/infrastructure/networkinterface.rb +22 -23
- data/lib/occi/infrastructure/os_tpl.rb +1 -1
- data/lib/occi/infrastructure/resource_tpl.rb +1 -1
- data/lib/occi/infrastructure/storage.rb +7 -6
- data/lib/occi/infrastructure/storagelink.rb +4 -4
- data/lib/occi/log.rb +13 -10
- data/lib/occi/model.rb +9 -8
- data/lib/occi/parser/json.rb +11 -9
- data/lib/occi/parser/ova.rb +12 -6
- data/lib/occi/parser/ovf.rb +173 -116
- data/lib/occi/parser/text/constants.rb +87 -0
- data/lib/occi/parser/text.rb +161 -200
- data/lib/occi/parser/xml.rb +10 -8
- data/lib/occi/parser.rb +100 -50
- data/lib/occi/settings.rb +2 -1
- data/lib/occi/version.rb +1 -1
- data/lib/occi-core.rb +6 -4
- data/occi-core.gemspec +0 -7
- data/spec/occi/collection_samples/collection1.json +1 -0
- data/spec/occi/collection_samples/directory2/collection2.json +1 -0
- data/spec/occi/collection_spec.rb +961 -31
- data/spec/occi/core/action_instance_spec.rb +317 -0
- data/spec/occi/core/action_spec.rb +71 -0
- data/spec/occi/core/attributes_spec.rb +582 -27
- data/spec/occi/core/category_spec.rb +194 -18
- data/spec/occi/core/entities_spec.rb +96 -0
- data/spec/occi/core/entity_spec.rb +317 -28
- data/spec/occi/core/kind_spec.rb +127 -16
- data/spec/occi/core/link_spec.rb +35 -0
- data/spec/occi/core/links_spec.rb +130 -0
- data/spec/occi/core/mixins_spec.rb +107 -0
- data/spec/occi/core/properties_spec.rb +167 -0
- data/spec/occi/core/resource_spec.rb +23 -9
- data/spec/occi/core_spec.rb +12 -0
- data/spec/occi/infrastructure/compute_spec.rb +218 -18
- data/spec/occi/infrastructure/network_spec.rb +96 -0
- data/spec/occi/infrastructure/networkinterface_spec.rb +96 -0
- data/spec/occi/infrastructure/storage_spec.rb +33 -0
- data/spec/occi/infrastructure/storagelink_spec.rb +45 -0
- data/spec/occi/log_spec.rb +104 -1
- data/spec/occi/model_spec.rb +251 -39
- data/spec/occi/{test.json → parser/json_samples/test.json} +0 -0
- data/spec/occi/parser/ova_samples/test.dump +0 -0
- data/spec/occi/{test.ova → parser/ova_samples/test.ova} +0 -0
- data/spec/occi/parser/ovf_samples/test.dump +0 -0
- data/spec/occi/{test.ovf → parser/ovf_samples/test.ovf} +0 -0
- data/spec/occi/parser/text_samples/occi_categories.dump +0 -0
- data/spec/occi/parser/text_samples/occi_categories.text +2 -0
- data/spec/occi/parser/text_samples/occi_compute_rocci_server.dump +0 -0
- data/spec/occi/parser/text_samples/occi_compute_rocci_server.resource.dump +0 -0
- data/spec/occi/parser/text_samples/occi_compute_rocci_server.text +10 -0
- data/spec/occi/parser/text_samples/occi_link_resource_instance.dump +0 -0
- data/spec/occi/parser/text_samples/occi_link_resource_instance.text +7 -0
- data/spec/occi/parser/text_samples/occi_link_simple.dump +0 -0
- data/spec/occi/parser/text_samples/occi_link_simple.link_string.dump +0 -0
- data/spec/occi/parser/text_samples/occi_link_simple.text +1 -0
- data/spec/occi/parser/text_samples/occi_link_w_attributes.dump +0 -0
- data/spec/occi/parser/text_samples/occi_link_w_attributes.text +7 -0
- data/spec/occi/parser/text_samples/occi_link_w_category.dump +0 -0
- data/spec/occi/parser/text_samples/occi_link_w_category.text +3 -0
- data/spec/occi/parser/text_samples/occi_model_rocci_server.dump +0 -0
- data/spec/occi/parser/text_samples/occi_model_rocci_server.text +51 -0
- data/spec/occi/parser/text_samples/occi_network_rocci_server.dump +0 -0
- data/spec/occi/parser/text_samples/occi_network_rocci_server.resource.dump +0 -0
- data/spec/occi/parser/text_samples/occi_network_rocci_server.text +11 -0
- data/spec/occi/parser/text_samples/occi_resource_w_attributes.dump +0 -0
- data/spec/occi/parser/text_samples/occi_resource_w_attributes.text +11 -0
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links.dump +0 -0
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links.text +16 -0
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links_only.dump +0 -0
- data/spec/occi/parser/text_samples/occi_resource_w_inline_links_only.text +13 -0
- data/spec/occi/parser/text_samples/occi_storage_rocci_server.dump +0 -0
- data/spec/occi/parser/text_samples/occi_storage_rocci_server.resource.dump +0 -0
- data/spec/occi/parser/text_samples/occi_storage_rocci_server.text +9 -0
- data/spec/occi/parser/text_spec.rb +274 -78
- data/spec/occi/parser/xml_samples/test.xml +352 -0
- data/spec/occi/parser_spec.rb +255 -104
- data/spec/occi-core_spec.rb +31 -0
- data/spec/spec_helper.rb +6 -2
- metadata +110 -111
- checksums.yaml +0 -7
- data/spec/occi/core/attribute_spec.rb +0 -0
data/lib/occi-core.rb
CHANGED
@@ -16,21 +16,23 @@ require 'zlib'
|
|
16
16
|
require 'tempfile'
|
17
17
|
require 'settingslogic'
|
18
18
|
|
19
|
+
require 'occi/extensions/hashie'
|
20
|
+
|
19
21
|
require 'occi/helpers/inspect'
|
22
|
+
require 'occi/helpers/comparators'
|
20
23
|
|
24
|
+
require 'occi/errors'
|
21
25
|
require 'occi/settings'
|
22
26
|
require 'occi/log'
|
23
27
|
require 'occi/version'
|
28
|
+
require 'occi/core'
|
29
|
+
require 'occi/infrastructure'
|
24
30
|
require 'occi/collection'
|
25
31
|
require 'occi/parser'
|
26
32
|
require 'occi/model'
|
27
|
-
require 'occi/core'
|
28
|
-
require 'occi/infrastructure'
|
29
33
|
|
30
34
|
module Occi
|
31
35
|
|
32
|
-
VERIFY_ATTRIBUTE_PATTERN = false
|
33
|
-
|
34
36
|
def kinds
|
35
37
|
Occi::Core::Kinds.new
|
36
38
|
end
|
data/occi-core.gemspec
CHANGED
@@ -25,12 +25,5 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_dependency 'activesupport', '~>4.0.0'
|
26
26
|
gem.add_dependency 'settingslogic'
|
27
27
|
|
28
|
-
gem.add_development_dependency 'rspec'
|
29
|
-
gem.add_development_dependency 'rake'
|
30
|
-
gem.add_development_dependency 'builder'
|
31
|
-
gem.add_development_dependency 'simplecov'
|
32
|
-
gem.add_development_dependency 'yard'
|
33
|
-
gem.add_development_dependency 'yard-rspec'
|
34
|
-
|
35
28
|
gem.required_ruby_version = '>= 1.9.3'
|
36
29
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"kinds":[{"parent":"http://schemas.ogf.org/occi/core#resource","related":["http://schemas.ogf.org/occi/core#resource"],"actions":["http://schemas.ogf.org/occi/infrastructure/compute/action#start","http://schemas.ogf.org/occi/infrastructure/compute/action#stop","http://schemas.ogf.org/occi/infrastructure/compute/action#restart","http://schemas.ogf.org/occi/infrastructure/compute/action#suspend"],"location":"/compute/","scheme":"http://schemas.ogf.org/occi/infrastructure#","term":"compute","title":"compute resource","attributes":{"occi":{"core":{"id":{"type":"string","pattern":"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"},"title":{"type":"string","mutable":true,"pattern":".*"},"summary":{"type":"string","mutable":true,"pattern":".*"}},"compute":{"architecture":{"type":"string","mutable":true,"pattern":"x86|x64"},"cores":{"type":"number","mutable":true,"pattern":".*"},"hostname":{"type":"string","mutable":true,"pattern":"(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*"},"memory":{"type":"number","mutable":true,"pattern":".*"},"speed":{"type":"number","mutable":true,"pattern":".*"},"state":{"type":"string","pattern":"inactive|active|suspended|error"}}}}}],"mixins":[{"location":"/mixins/my_mixin/","scheme":"http://example.com/occi/tags#","term":"my_mixin","attributes":{}}],"actions":[{"scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#","term":"start","attributes":{}}],"resources":[{"kind":"http://schemas.ogf.org/occi/core#resource","attributes":{"occi":{"core":{"id":"d51cc509-e1b7-4796-98a4-ccae05964ea8"}}},"id":"d51cc509-e1b7-4796-98a4-ccae05964ea8"}],"links":[{"kind":"http://schemas.ogf.org/occi/core#link","attributes":{"occi":{"core":{"id":"35e6f510-4617-465d-9f92-e1079b78f420"}}},"id":"35e6f510-4617-465d-9f92-e1079b78f420","rel":"http://schemas.ogf.org/occi/core#link"}],"action":{"action":"http://schemas.ogf.org/occi/core#action_instance"}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"kinds":[{"parent":"http://schemas.ogf.org/occi/core#resource","related":["http://schemas.ogf.org/occi/core#resource"],"actions":["http://schemas.ogf.org/occi/infrastructure/storage/action#online","http://schemas.ogf.org/occi/infrastructure/storage/action#offline","http://schemas.ogf.org/occi/infrastructure/storage/action#backup","http://schemas.ogf.org/occi/infrastructure/storage/action#snapshot","http://schemas.ogf.org/occi/infrastructure/storage/action#resize"],"location":"/storage/","scheme":"http://schemas.ogf.org/occi/infrastructure#","term":"storage","title":"storage resource","attributes":{"occi":{"core":{"id":{"type":"string","pattern":"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"},"title":{"type":"string","mutable":true,"pattern":".*"},"summary":{"type":"string","mutable":true,"pattern":".*"}},"storage":{"size":{"type":"number","mutable":true,"pattern":".*"},"state":{"type":"string","pattern":"online|offline|backup|snapshot|resize|degraded"}}}}}],"mixins":[{"location":"/mixins/another_mixin/","scheme":"http://example.com/occi/tags#","term":"another_mixin","attributes":{}}],"actions":[{"scheme":"http://schemas.ogf.org/occi/infrastructure/compute/action#","term":"stop","attributes":{}}],"resources":[{"kind":"http://schemas.ogf.org/occi/core#resource","attributes":{"occi":{"core":{"id":"556ed1b1-183d-4ece-8649-a2d1a0825cde"}}},"id":"556ed1b1-183d-4ece-8649-a2d1a0825cde"}],"links":[{"kind":"http://schemas.ogf.org/occi/core#link","attributes":{"occi":{"core":{"id":"3dbfbd1e-5fcd-4ad2-98a3-fd167838431d"}}},"id":"3dbfbd1e-5fcd-4ad2-98a3-fd167838431d","rel":"http://schemas.ogf.org/occi/core#link"}],"action":{"action":"http://schemas.ogf.org/occi/core/entity/action#testaction","attributes":{}}}
|