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
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
|
3
|
-
request: !ruby/struct:VCR::Request
|
|
4
|
-
method: :post
|
|
5
|
-
uri: http://oneadmin:a9464e3228ae563be6207bbf50437a219550f48b@one.example.com:4567/storage
|
|
6
|
-
body: |
|
|
7
|
-
-------------RubyMultipartPost
|
|
8
|
-
Content-Disposition: form-data; name="file"; filename="null"
|
|
9
|
-
Content-Length: 0
|
|
10
|
-
Content-Type: application/octet-stream
|
|
11
|
-
Content-Transfer-Encoding: binary
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-------------RubyMultipartPost
|
|
15
|
-
Content-Disposition: form-data; name="occixml"
|
|
16
|
-
|
|
17
|
-
<?xml version="1.0"?>
|
|
18
|
-
<STORAGE>
|
|
19
|
-
<NAME>Test Framework</NAME>
|
|
20
|
-
<DESCRIPTION>Test Framework Image.</DESCRIPTION>
|
|
21
|
-
<TYPE>OS</TYPE>
|
|
22
|
-
<URL>file:///dev/null</URL>
|
|
23
|
-
</STORAGE>
|
|
24
|
-
|
|
25
|
-
-------------RubyMultipartPost--
|
|
26
|
-
|
|
27
|
-
headers:
|
|
28
|
-
content-type:
|
|
29
|
-
- multipart/form-data; boundary=-----------RubyMultipartPost
|
|
30
|
-
content-length:
|
|
31
|
-
- "480"
|
|
32
|
-
connection:
|
|
33
|
-
- keep-alive
|
|
34
|
-
keep-alive:
|
|
35
|
-
- 30
|
|
36
|
-
response: !ruby/struct:VCR::Response
|
|
37
|
-
status: !ruby/struct:VCR::ResponseStatus
|
|
38
|
-
code: 201
|
|
39
|
-
message: Created
|
|
40
|
-
headers:
|
|
41
|
-
content-type:
|
|
42
|
-
- text/html;charset=utf-8
|
|
43
|
-
content-length:
|
|
44
|
-
- "193"
|
|
45
|
-
connection:
|
|
46
|
-
- keep-alive
|
|
47
|
-
server:
|
|
48
|
-
- thin 1.2.7 codename No Hup
|
|
49
|
-
body: <STORAGE href="http://cm-01.cloud.int.ev1.atti.com:4567/storage/39"><ID>39</ID><NAME>Test Framework</NAME><TYPE>OS</TYPE><DESCRIPTION>Test Framework Image.</DESCRIPTION><SIZE>0</SIZE></STORAGE>
|
|
50
|
-
http_version: "1.1"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
|
3
|
-
request: !ruby/struct:VCR::Request
|
|
4
|
-
method: :delete
|
|
5
|
-
uri: http://oneadmin:a9464e3228ae563be6207bbf50437a219550f48b@one.example.com:4567/storage/39
|
|
6
|
-
body:
|
|
7
|
-
headers:
|
|
8
|
-
accept:
|
|
9
|
-
- application/xml
|
|
10
|
-
connection:
|
|
11
|
-
- keep-alive
|
|
12
|
-
keep-alive:
|
|
13
|
-
- 30
|
|
14
|
-
response: !ruby/struct:VCR::Response
|
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
|
16
|
-
code: 204
|
|
17
|
-
message: No Content
|
|
18
|
-
headers:
|
|
19
|
-
server:
|
|
20
|
-
- thin 1.2.7 codename No Hup
|
|
21
|
-
body:
|
|
22
|
-
http_version: "1.1"
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
|
3
|
-
request: !ruby/struct:VCR::Request
|
|
4
|
-
method: :get
|
|
5
|
-
uri: http://oneadmin:a9464e3228ae563be6207bbf50437a219550f48b@one.example.com:4567/storage/39
|
|
6
|
-
body:
|
|
7
|
-
headers:
|
|
8
|
-
accept:
|
|
9
|
-
- application/xml
|
|
10
|
-
connection:
|
|
11
|
-
- keep-alive
|
|
12
|
-
keep-alive:
|
|
13
|
-
- 30
|
|
14
|
-
response: !ruby/struct:VCR::Response
|
|
15
|
-
status: !ruby/struct:VCR::ResponseStatus
|
|
16
|
-
code: 200
|
|
17
|
-
message: OK
|
|
18
|
-
headers:
|
|
19
|
-
content-type:
|
|
20
|
-
- text/html;charset=utf-8
|
|
21
|
-
content-length:
|
|
22
|
-
- "193"
|
|
23
|
-
connection:
|
|
24
|
-
- keep-alive
|
|
25
|
-
server:
|
|
26
|
-
- thin 1.2.7 codename No Hup
|
|
27
|
-
body: <STORAGE href="http://cm-01.cloud.int.ev1.atti.com:4567/storage/39"><ID>39</ID><NAME>Test Framework</NAME><TYPE>OS</TYPE><DESCRIPTION>Test Framework Image.</DESCRIPTION><SIZE>0</SIZE></STORAGE>
|
|
28
|
-
http_version: "1.1"
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
describe Occi::Compute do
|
|
4
|
-
describe "#all" do
|
|
5
|
-
it "returns a parsed XML document" do
|
|
6
|
-
VCR.use_cassette "compute_all" do
|
|
7
|
-
response = CONNECTION.compute.all
|
|
8
|
-
|
|
9
|
-
is_okay response
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe "#create" do
|
|
15
|
-
before do
|
|
16
|
-
##
|
|
17
|
-
# Adding NETWORK_NAME to the CONTEXT should be reworked.
|
|
18
|
-
# We want the vm to divine it's IP from its MAC Address on
|
|
19
|
-
# boot. Then we no longer need the coupling in the XML.
|
|
20
|
-
# CLOUD-35 open to address this.
|
|
21
|
-
|
|
22
|
-
@xml = Nokogiri::XML::Builder.new do
|
|
23
|
-
COMPUTE {
|
|
24
|
-
NAME "Test Framework"
|
|
25
|
-
INSTANCE_TYPE "small"
|
|
26
|
-
DISK {
|
|
27
|
-
STORAGE(:href => "http://www.opennebula.org/storage/11")
|
|
28
|
-
}
|
|
29
|
-
NIC {
|
|
30
|
-
NETWORK(:href => "http://www.opennebula.org/network/25")
|
|
31
|
-
}
|
|
32
|
-
CONTEXT {
|
|
33
|
-
NETWORK_NAME "10.3.172.0"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
end.to_xml
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "returns a parsed XML document" do
|
|
40
|
-
VCR.use_cassette "compute_create" do
|
|
41
|
-
response = CONNECTION.compute.create @xml
|
|
42
|
-
|
|
43
|
-
is_created response
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
describe "#find" do
|
|
49
|
-
it "returns a parsed XML document" do
|
|
50
|
-
id = cassette_for("compute_create").xpath('//ID').text
|
|
51
|
-
|
|
52
|
-
VCR.use_cassette "compute_find" do
|
|
53
|
-
response = CONNECTION.compute.find id
|
|
54
|
-
|
|
55
|
-
is_okay response
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
describe "#destroy" do
|
|
61
|
-
it "returns a parsed XML document" do
|
|
62
|
-
id = cassette_for("compute_create").xpath('//ID').text
|
|
63
|
-
|
|
64
|
-
VCR.use_cassette "compute_destroy" do
|
|
65
|
-
response = CONNECTION.compute.destroy id
|
|
66
|
-
|
|
67
|
-
is_no_content response
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
describe "#update" do
|
|
73
|
-
before do
|
|
74
|
-
@xml = Nokogiri::XML::Builder.new do
|
|
75
|
-
COMPUTE {
|
|
76
|
-
STATE "shutdown"
|
|
77
|
-
}
|
|
78
|
-
end.to_xml
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
it "returns a parsed XML document" do
|
|
82
|
-
id = cassette_for("compute_create").xpath('//ID').text
|
|
83
|
-
|
|
84
|
-
VCR.use_cassette "compute_update" do
|
|
85
|
-
response = CONNECTION.compute.update id, @xml
|
|
86
|
-
|
|
87
|
-
is_accepted response
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
describe Occi::Network do
|
|
4
|
-
describe "#all" do
|
|
5
|
-
it "returns a parsed XML document" do
|
|
6
|
-
VCR.use_cassette "network_all" do
|
|
7
|
-
response = CONNECTION.network.all
|
|
8
|
-
|
|
9
|
-
is_okay response
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe "#create" do
|
|
15
|
-
before do
|
|
16
|
-
@xml = Nokogiri::XML::Builder.new do
|
|
17
|
-
NETWORK {
|
|
18
|
-
NAME "Test Framework"
|
|
19
|
-
ADDRESS "192.168.1.1"
|
|
20
|
-
SIZE "200"
|
|
21
|
-
}
|
|
22
|
-
end.to_xml
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "returns a parsed XML document" do
|
|
26
|
-
VCR.use_cassette "network_create" do
|
|
27
|
-
response = CONNECTION.network.create @xml
|
|
28
|
-
|
|
29
|
-
is_created response
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe "#find" do
|
|
35
|
-
it "returns a parsed XML document" do
|
|
36
|
-
id = cassette_for("network_create").xpath('//ID').text
|
|
37
|
-
|
|
38
|
-
VCR.use_cassette "network_find" do
|
|
39
|
-
response = CONNECTION.network.find id
|
|
40
|
-
|
|
41
|
-
is_okay response
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe "#destroy" do
|
|
47
|
-
it "returns a parsed XML document" do
|
|
48
|
-
id = cassette_for("network_create").xpath('//ID').text
|
|
49
|
-
|
|
50
|
-
VCR.use_cassette "network_destroy" do
|
|
51
|
-
response = CONNECTION.network.destroy id
|
|
52
|
-
|
|
53
|
-
is_no_content response
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
describe Occi::Storage do
|
|
4
|
-
describe "#all" do
|
|
5
|
-
it "returns a parsed XML document" do
|
|
6
|
-
VCR.use_cassette "storage_all" do
|
|
7
|
-
response = CONNECTION.network.all
|
|
8
|
-
|
|
9
|
-
is_okay response
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe "#create" do
|
|
15
|
-
before do
|
|
16
|
-
@xml = Nokogiri::XML::Builder.new do
|
|
17
|
-
STORAGE {
|
|
18
|
-
NAME "Test Framework"
|
|
19
|
-
DESCRIPTION "Test Framework Image."
|
|
20
|
-
TYPE "OS"
|
|
21
|
-
### Not exactly sure what URL does.
|
|
22
|
-
URL "file:///dev/null"
|
|
23
|
-
}
|
|
24
|
-
end.to_xml
|
|
25
|
-
|
|
26
|
-
@upload = {
|
|
27
|
-
:parts => {
|
|
28
|
-
:file => "/dev/null",
|
|
29
|
-
:occixml => @xml,
|
|
30
|
-
},
|
|
31
|
-
:content_type => "application/octet-stream"
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "returns a parsed XML document" do
|
|
36
|
-
VCR.use_cassette "storage_create" do
|
|
37
|
-
response = CONNECTION.storage.create @upload
|
|
38
|
-
|
|
39
|
-
is_created response
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
describe "#find" do
|
|
45
|
-
it "returns a parsed XML document" do
|
|
46
|
-
id = cassette_for("storage_create").xpath('//ID').text
|
|
47
|
-
|
|
48
|
-
VCR.use_cassette "storage_find" do
|
|
49
|
-
response = CONNECTION.storage.find id
|
|
50
|
-
|
|
51
|
-
is_okay response
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
describe "#destroy" do
|
|
57
|
-
it "returns a parsed XML document" do
|
|
58
|
-
id = cassette_for("storage_create").xpath('//ID').text
|
|
59
|
-
|
|
60
|
-
VCR.use_cassette "storage_destroy" do
|
|
61
|
-
response = CONNECTION.storage.destroy id
|
|
62
|
-
|
|
63
|
-
is_no_content response
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
data/test/test_helper.rb
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require "bundler"
|
|
2
|
-
Bundler.setup :default, :test
|
|
3
|
-
|
|
4
|
-
%w(minitest/autorun minitest/spec nokogiri vcr webmock occi).each { |r| require r }
|
|
5
|
-
|
|
6
|
-
class MiniTest::Unit::TestCase
|
|
7
|
-
CONNECTION = Occi::Client.new(
|
|
8
|
-
:host => "one.example.com",
|
|
9
|
-
:user => ENV['ONE_USER'],
|
|
10
|
-
:password => ENV['ONE_PASSWORD'],
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
def okay response, code
|
|
14
|
-
response.code.must_equal code
|
|
15
|
-
response.body.errors.must_be_empty
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def is_okay response
|
|
19
|
-
okay response, "200"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def is_accepted response
|
|
23
|
-
okay response, "202"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def is_no_content response
|
|
27
|
-
okay response, "204"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def is_created response
|
|
31
|
-
okay response, "201"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def cassette_for cassette
|
|
36
|
-
c = VCR::Cassette.new(cassette).send :recorded_interactions
|
|
37
|
-
|
|
38
|
-
Nokogiri::XML::Document.parse c.first.response.body
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
WebMock.disable_net_connect! :allow => "one.example.com"
|
|
42
|
-
VCR.config do |c|
|
|
43
|
-
c.stub_with :webmock
|
|
44
|
-
c.cassette_library_dir = "test/fixtures/cassettes"
|
|
45
|
-
c.default_cassette_options = { :record => :none }
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
MiniTest::Unit.autorun
|