occi-api 4.1.1 → 4.2.0.beta.2
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/Gemfile +9 -0
- data/README.md +37 -11
- data/Rakefile +2 -9
- data/examples/dsl_example.rb +2 -2
- data/examples/x509auth_example.rb +9 -9
- data/lib/occi-api.rb +0 -1
- data/lib/occi/api/client/client_base.rb +102 -92
- data/lib/occi/api/client/client_http.rb +6 -6
- data/lib/occi/api/client/http/authn_plugins/keystone.rb +27 -11
- data/lib/occi/api/dsl.rb +7 -3
- data/lib/occi/api/version.rb +1 -1
- data/occi-api.gemspec +2 -14
- data/{features/cassettes/Create_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml → spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/describes_all_available_mixins.yml} +125 -147
- data/{features/cassettes/Miscellaneous_operation_on_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml → spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/looks_up_a_mixin_type_identifier_for_os_tpl.yml} +126 -148
- data/{features/cassettes/Delete_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml → spec/cassettes/Occi_Api_Client_ClientHttp/using_media_type_text_plain/looks_up_a_mixin_type_identifier_for_resource_tpl.yml} +126 -148
- data/spec/occi/api/client/client_http_spec.rb +52 -28
- data/spec/occi/api/dsl_spec.rb +0 -6
- data/spec/spec_helper.rb +4 -1
- metadata +31 -200
- checksums.yaml +0 -7
- data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__application_json_200_.yml +0 -333
- data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_.yml +0 -529
- data/features/cassettes/Discovery_Interface/Retrieving_all_OCCI_Categories_supported_by_the_OCCI_Server/_http_http___141_5_99_69__text_plain_200_action_.yml +0 -288
- data/features/cassettes/Read_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +0 -288
- data/features/cassettes/Update_an_OCCI_Resource/_http_http___141_5_99_69__text_plain_201_.yml +0 -288
- data/features/common/step_definitions/common_steps.rb +0 -32
- data/features/occi/core/create/create.feature +0 -18
- data/features/occi/core/create/step_definitions/create_steps.rb +0 -0
- data/features/occi/core/delete/delete.feature +0 -18
- data/features/occi/core/delete/step_definitions/delete_steps.rb +0 -0
- data/features/occi/core/discovery_interface/discovery_interface.feature +0 -37
- data/features/occi/core/discovery_interface/step_definitions/discovery_interface_steps.rb +0 -19
- data/features/occi/core/miscellaneous/miscellaneous.feature +0 -18
- data/features/occi/core/miscellaneous/step_definitions/miscellaneous_steps.rb +0 -0
- data/features/occi/core/read/read.feature +0 -18
- 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 +0 -18
- data/features/occi/infrastructure/create/create.feature +0 -18
- data/features/occi/infrastructure/create/step_definitions/create_steps.rb +0 -0
- data/features/support/env.rb +0 -16
- data/lib/occi/api/client/client_amqp.rb +0 -766
- data/spec/occi/api/client/client_amqp_spec.rb +0 -158
@@ -1,158 +0,0 @@
|
|
1
|
-
require "rspec"
|
2
|
-
|
3
|
-
#Todo mock the amqp messages
|
4
|
-
|
5
|
-
module Occi
|
6
|
-
module Api
|
7
|
-
module Client
|
8
|
-
|
9
|
-
describe ClientAmqp do
|
10
|
-
|
11
|
-
context "using media type application/occi+json" do
|
12
|
-
|
13
|
-
it "does something"
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
context "using media type text/plain" do
|
18
|
-
|
19
|
-
it "does something"
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
=begin
|
24
|
-
before(:all) do
|
25
|
-
@client = Occi::Api::Client::ClientAmqp.new({
|
26
|
-
:endpoint => "http://localhost:9292/",
|
27
|
-
:auth => { :type => "none" },
|
28
|
-
:log => { :out => STDERR, :level => Occi::Log::WARN, :logger => nil },
|
29
|
-
:media_type => "application/occi+json"
|
30
|
-
})
|
31
|
-
end
|
32
|
-
|
33
|
-
it "initialize and connect client" do
|
34
|
-
@client.connected.should be_true
|
35
|
-
|
36
|
-
@client.model.actions .should have_at_least(1).actions
|
37
|
-
@client.model.kinds .should have_at_least(3).kinds
|
38
|
-
@client.model.mixins .should have_at_least(1).mixins
|
39
|
-
@client.model.links .should be_empty
|
40
|
-
@client.model.resources.should be_empty
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
it "create compute" do
|
45
|
-
res = Occi::Infrastructure::Compute.new
|
46
|
-
res.title = "MyComputeResource1"
|
47
|
-
res.mixins << @client.find_mixin('small', "resource_tpl")
|
48
|
-
res.mixins << @client.find_mixin('my_os', "os_tpl")
|
49
|
-
#
|
50
|
-
uri_new = @client.create res
|
51
|
-
uri_new.should include('/compute/')
|
52
|
-
@client.last_response_status.should == 201
|
53
|
-
|
54
|
-
res.title = "MyComputeResource2"
|
55
|
-
uri_new = @client.create res
|
56
|
-
uri_new.should include('/compute/')
|
57
|
-
@client.last_response_status.should == 201
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
it "list /" do
|
62
|
-
list = @client.list
|
63
|
-
list.should have_at_least(1).list
|
64
|
-
end
|
65
|
-
|
66
|
-
it "list compute" do
|
67
|
-
list = @client.list "compute"
|
68
|
-
list.should have_at_least(1).list
|
69
|
-
end
|
70
|
-
|
71
|
-
it "describe /" do
|
72
|
-
description = @client.describe
|
73
|
-
|
74
|
-
description[0].resources.should have_at_least(1).resources
|
75
|
-
end
|
76
|
-
|
77
|
-
it "describe compute" do
|
78
|
-
description = @client.describe "compute"
|
79
|
-
|
80
|
-
description[0].resources.should have_at_least(1).resources
|
81
|
-
end
|
82
|
-
|
83
|
-
it "describe compute/uuid" do
|
84
|
-
list = @client.list "compute"
|
85
|
-
list.should have_at_least(1).list
|
86
|
-
|
87
|
-
compute = list.first
|
88
|
-
|
89
|
-
description = @client.describe compute
|
90
|
-
|
91
|
-
description[0].resources.should have_at_least(1).resources
|
92
|
-
resource = description[0].resources.first
|
93
|
-
|
94
|
-
resource_type_identifier = @client.endpoint.chomp('/') + resource.kind.location + resource.id
|
95
|
-
resource_type_identifier.should == compute.to_s
|
96
|
-
end
|
97
|
-
|
98
|
-
it "trigger compute stop" do
|
99
|
-
list = @client.list "compute"
|
100
|
-
list.should have_at_least(1).list
|
101
|
-
|
102
|
-
list.each do |key, value|
|
103
|
-
description = @client.describe key
|
104
|
-
@compute = key
|
105
|
-
@resource = description[0].resources.first
|
106
|
-
|
107
|
-
if @resource.attributes.occi.compute.state == "active"
|
108
|
-
break
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
@resource.actions.each do |key , value|
|
113
|
-
if key.term == "stop"
|
114
|
-
@action = key
|
115
|
-
break
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
@action.should_not be_nil, "action is nil"
|
120
|
-
@action.term.should == "stop"
|
121
|
-
|
122
|
-
@client.trigger(@compute, @action.to_s)
|
123
|
-
|
124
|
-
description = @client.describe @compute
|
125
|
-
@resource = description[0].resources.first
|
126
|
-
|
127
|
-
@resource.attributes.occi.compute.state.should == "inactive"
|
128
|
-
end
|
129
|
-
|
130
|
-
it "delete compute/uuid" do
|
131
|
-
list = @client.list "compute"
|
132
|
-
list_count = list.count
|
133
|
-
list_count.should >= 1
|
134
|
-
|
135
|
-
compute = list.first
|
136
|
-
|
137
|
-
response = @client.delete compute
|
138
|
-
response.should == true
|
139
|
-
@client.last_response_status.should == 200
|
140
|
-
|
141
|
-
list = @client.list "compute"
|
142
|
-
list.count.should < list_count
|
143
|
-
end
|
144
|
-
|
145
|
-
it "delete /" do
|
146
|
-
response = @client.delete "/"
|
147
|
-
response.should == true
|
148
|
-
@client.last_response_status.should == 200
|
149
|
-
|
150
|
-
list = @client.list "compute"
|
151
|
-
list.count.should == 0
|
152
|
-
end
|
153
|
-
=end
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|