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,148 @@
|
|
1
|
+
require "rspec"
|
2
|
+
require "occi"
|
3
|
+
|
4
|
+
#Todo mock the amqp messages
|
5
|
+
|
6
|
+
module Occi
|
7
|
+
module Api
|
8
|
+
module Client
|
9
|
+
|
10
|
+
describe ClientAmqp do
|
11
|
+
|
12
|
+
it "should do something" do
|
13
|
+
|
14
|
+
# TODO: Implement scenarios for client
|
15
|
+
end
|
16
|
+
=begin
|
17
|
+
before(:all) do
|
18
|
+
@client = Occi::Api::Client::ClientAmqp.new("http://localhost:9292/", auth_options = { :type => "none" },
|
19
|
+
log_options = { :out => STDERR, :level => Occi::Log::WARN, :logger => nil },
|
20
|
+
media_type = "application/occi+json")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "initialize and connect client" do
|
24
|
+
@client.connected.should be_true
|
25
|
+
|
26
|
+
@client.model.actions .should have_at_least(1).actions
|
27
|
+
@client.model.kinds .should have_at_least(3).kinds
|
28
|
+
@client.model.mixins .should have_at_least(1).mixins
|
29
|
+
@client.model.links .should be_empty
|
30
|
+
@client.model.resources.should be_empty
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
it "create compute" do
|
35
|
+
res = Occi::Infrastructure::Compute.new
|
36
|
+
res.title = "MyComputeResource1"
|
37
|
+
res.mixins << @client.find_mixin('small', "resource_tpl")
|
38
|
+
res.mixins << @client.find_mixin('my_os', "os_tpl")
|
39
|
+
#
|
40
|
+
uri_new = @client.create res
|
41
|
+
uri_new.should include('/compute/')
|
42
|
+
@client.last_response_status.should == 201
|
43
|
+
|
44
|
+
res.title = "MyComputeResource2"
|
45
|
+
uri_new = @client.create res
|
46
|
+
uri_new.should include('/compute/')
|
47
|
+
@client.last_response_status.should == 201
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
it "list /" do
|
52
|
+
list = @client.list
|
53
|
+
list.should have_at_least(1).list
|
54
|
+
end
|
55
|
+
|
56
|
+
it "list compute" do
|
57
|
+
list = @client.list "compute"
|
58
|
+
list.should have_at_least(1).list
|
59
|
+
end
|
60
|
+
|
61
|
+
it "describe /" do
|
62
|
+
description = @client.describe
|
63
|
+
|
64
|
+
description[0].resources.should have_at_least(1).resources
|
65
|
+
end
|
66
|
+
|
67
|
+
it "describe compute" do
|
68
|
+
description = @client.describe "compute"
|
69
|
+
|
70
|
+
description[0].resources.should have_at_least(1).resources
|
71
|
+
end
|
72
|
+
|
73
|
+
it "describe compute/uuid" do
|
74
|
+
list = @client.list "compute"
|
75
|
+
list.should have_at_least(1).list
|
76
|
+
|
77
|
+
compute = list.first
|
78
|
+
|
79
|
+
description = @client.describe compute
|
80
|
+
|
81
|
+
description[0].resources.should have_at_least(1).resources
|
82
|
+
resource = description[0].resources.first
|
83
|
+
|
84
|
+
resource_type_identifier = @client.endpoint.chomp('/') + resource.kind.location + resource.id
|
85
|
+
resource_type_identifier.should == compute.to_s
|
86
|
+
end
|
87
|
+
|
88
|
+
it "trigger compute stop" do
|
89
|
+
list = @client.list "compute"
|
90
|
+
list.should have_at_least(1).list
|
91
|
+
|
92
|
+
list.each do |key, value|
|
93
|
+
description = @client.describe key
|
94
|
+
@compute = key
|
95
|
+
@resource = description[0].resources.first
|
96
|
+
|
97
|
+
if @resource.attributes.occi.compute.state == "active"
|
98
|
+
break
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
@resource.actions.each do |key , value|
|
103
|
+
if key.term == "stop"
|
104
|
+
@action = key
|
105
|
+
break
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
@action.should_not be_nil, "action is nil"
|
110
|
+
@action.term.should == "stop"
|
111
|
+
|
112
|
+
@client.trigger(@compute, @action.to_s)
|
113
|
+
|
114
|
+
description = @client.describe @compute
|
115
|
+
@resource = description[0].resources.first
|
116
|
+
|
117
|
+
@resource.attributes.occi.compute.state.should == "inactive"
|
118
|
+
end
|
119
|
+
|
120
|
+
it "delete compute/uuid" do
|
121
|
+
list = @client.list "compute"
|
122
|
+
list_count = list.count
|
123
|
+
list_count.should >= 1
|
124
|
+
|
125
|
+
compute = list.first
|
126
|
+
|
127
|
+
response = @client.delete compute
|
128
|
+
response.should == true
|
129
|
+
@client.last_response_status.should == 200
|
130
|
+
|
131
|
+
list = @client.list "compute"
|
132
|
+
list.count.should < list_count
|
133
|
+
end
|
134
|
+
|
135
|
+
it "delete /" do
|
136
|
+
response = @client.delete "/"
|
137
|
+
response.should == true
|
138
|
+
@client.last_response_status.should == 200
|
139
|
+
|
140
|
+
list = @client.list "compute"
|
141
|
+
list.count.should == 0
|
142
|
+
end
|
143
|
+
=end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -0,0 +1,292 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'occi'
|
3
|
+
|
4
|
+
module Occi
|
5
|
+
module Api
|
6
|
+
module Client
|
7
|
+
|
8
|
+
describe ClientHttp do
|
9
|
+
|
10
|
+
it "should do something" do
|
11
|
+
|
12
|
+
# TODO: Implement scenarios for client
|
13
|
+
end
|
14
|
+
=begin
|
15
|
+
describe "using media type text/plain" do
|
16
|
+
|
17
|
+
before(:all) do
|
18
|
+
|
19
|
+
|
20
|
+
@client = Occi::Api::Client::ClientHttp.new(
|
21
|
+
'http://141.5.99.69', #141.5.99.69 #141.5.99.82
|
22
|
+
{ :type => "none" },
|
23
|
+
{ :out => "/dev/null",
|
24
|
+
:level => Occi::Log::DEBUG },
|
25
|
+
true,
|
26
|
+
"application/occi+json"#"text/plain,text/occi"
|
27
|
+
)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
#@client = Occi::Api::Client::ClientAmqp.new("http://141.5.99.83/", auth_options = { :type => "none" },
|
34
|
+
# log_options = { :out => STDERR, :level => Occi::Log::WARN, :logger => nil },
|
35
|
+
# media_type = "application/occi+json")
|
36
|
+
end
|
37
|
+
|
38
|
+
after(:each) do
|
39
|
+
@client.logger.close
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "Retrieving all OCCI Categories supported by the OCCI Server" do
|
43
|
+
it "should establish connection" do
|
44
|
+
@client.connected.should be_true
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have HTTP(200) OK response" do
|
48
|
+
@client.last_response.code.should == 200
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should have the same Content Type like the HTTP Accept header" do
|
52
|
+
@client.last_response.content_type.should == @client.media_type
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should contains all supported OCCI Categories" do
|
56
|
+
@client.model.actions.should have_at_least(3).actions
|
57
|
+
@client.model.kinds .should have_at_least(3).kinds
|
58
|
+
@client.model.mixins .should have_at_least(3).mixins
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should contains the basic kinds (entity, resource, link)" do
|
62
|
+
entity = nil
|
63
|
+
@client.model.kinds.each do |kind|
|
64
|
+
if kind.term = "entity"
|
65
|
+
entity = kind
|
66
|
+
break
|
67
|
+
end
|
68
|
+
end
|
69
|
+
entity.should_not == nil
|
70
|
+
|
71
|
+
resource = nil
|
72
|
+
@client.model.kinds.each do |kind|
|
73
|
+
if kind.term = "resource"
|
74
|
+
resource = kind
|
75
|
+
break
|
76
|
+
end
|
77
|
+
end
|
78
|
+
resource.should_not == nil
|
79
|
+
|
80
|
+
link = nil
|
81
|
+
@client.model.kinds.each do |kind|
|
82
|
+
if kind.term = "link"
|
83
|
+
link = kind
|
84
|
+
break
|
85
|
+
end
|
86
|
+
end
|
87
|
+
link.should_not == nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
#TD/OCCI/CORE/DISCOVERY/002
|
92
|
+
describe "Retrieving the OCCI Categories with an OCCI Category filter from the OCCI Server" do
|
93
|
+
it "should establish connection" do
|
94
|
+
@client.connected.should be_true
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
#TD/OCCI/CORE/CREATE/001
|
99
|
+
describe "Create an OCCI Resource" do
|
100
|
+
it "should send a HTTP POST request" do
|
101
|
+
res = Occi::Infrastructure::Compute.new
|
102
|
+
res.title = "MyComputeResource1"
|
103
|
+
#
|
104
|
+
@@uri_new = @client.create res
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should receipt a HTTP 201 (CREATED) response" do
|
108
|
+
@client.last_response.code.should == 201
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should receipt the Location of the created OCCI Resource" do
|
112
|
+
@@uri_new.should include('/compute/')
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
#TD/OCCI/CORE/CREATE/002
|
117
|
+
describe "Create an OCCI Resource with an OCCI Mixin" do
|
118
|
+
it "should send a HTTP POST request" do
|
119
|
+
res = Occi::Infrastructure::Compute.new
|
120
|
+
res.title = "MyComputeResource1"
|
121
|
+
res.mixins << @client.find_mixin('small', "resource_tpl")
|
122
|
+
res.mixins << @client.find_mixin('my_os', "os_tpl")
|
123
|
+
#
|
124
|
+
@@uri_new = @client.create res
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should receipt a HTTP 201 (CREATED) response" do
|
128
|
+
@client.last_response.code.should == 201
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should have the Mixin inside the created Resource after describe these" do
|
132
|
+
@@uri_new.should include('/compute/')
|
133
|
+
res = @client.describe @@uri_new
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
#TD/OCCI/CORE/CREATE/003
|
138
|
+
describe "Create an OCCI Resource with a link to an existing OCCI Resource" do
|
139
|
+
it "should send a HTTP POST request" do
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should receipt a HTTP 201 (CREATED) response" do
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should have the Link to the existing Resource inside the created Resource after describe these" do
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
#TD/OCCI/CORE/READ/001
|
153
|
+
describe "Retrieve the URLs of all OCCI Resources belonging to an OCCI Kind" do
|
154
|
+
it "should send a HTTP GET request" do
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should receipt a HTTP 200 (OK) response" do
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should displays the URLs of the OCCI Resources" do
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
#TD/OCCI/CORE/READ/002
|
168
|
+
describe "Retrieve the URLs of the OCCI Resources belonging to an OCCI Kind and related to an OCCI Category filter" do
|
169
|
+
it "should send a HTTP GET request" do
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should receipt a HTTP 200 (OK) response" do
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should only displays the URLs of the OCCI Resources which are related to the OCCI Kind or OCCI Mixin specified as filter" do
|
178
|
+
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
#TD/OCCI/CORE/READ/003
|
183
|
+
describe "Retrieve the URLs of the OCCI Resources belonging to an OCCI Kind which contain a specific Attribute" do
|
184
|
+
it "should send a HTTP GET request" do
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should receipt a HTTP 200 (OK) response" do
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should only displays the URLs of the OCCI Resources which contain the specified attribute" do
|
193
|
+
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
#TD/OCCI/CORE/READ/004
|
198
|
+
describe "Retrieve the URLs of all OCCI Resources belonging to an OCCI Kind or Mixin" do
|
199
|
+
it "should send a HTTP GET request" do
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should receipt a HTTP 200 (OK) response" do
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should displays the URLs of the OCCI Resources which belong to the OCCI Kind or OCCI Mixin" do
|
208
|
+
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
#TD/OCCI/CORE/READ/005
|
213
|
+
describe "Retrieve the description of an OCCI Resource" do
|
214
|
+
it "should send a HTTP GET request" do
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should receipt a HTTP 200 (OK) response" do
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should displays the description of the OCCI Resource" do
|
223
|
+
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
#TD/OCCI/CORE/READ/006
|
228
|
+
describe "Retrieve the descriptions of the OCCI Resources belonging to an OCCI Kind and related to an OCCI Category filter" do
|
229
|
+
it "should send a HTTP GET request" do
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should receipt a HTTP 200 (OK) response" do
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should only displays the descriptions of the OCCI Resources which are related to the OCCI Kind or OCCI Mixin specified as filter" do
|
238
|
+
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
#TD/OCCI/CORE/READ/007
|
243
|
+
describe "Retrieve the descriptions of the OCCI Resources belonging to an OCCI Kind and containing the Attribute filter" do
|
244
|
+
it "should send a HTTP GET request" do
|
245
|
+
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should receipt a HTTP 200 (OK) response" do
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should only displays the descriptions of the OCCI Resources which contain the specified attribute" do
|
253
|
+
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
#TD/OCCI/CORE/UPDATE/001
|
258
|
+
describe "Full update of a specific OCCI Resource" do
|
259
|
+
it "should send a HTTP PUT request" do
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
it "should displays success of update operation" do
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
it "should replaced the description of the OCCI Resource on the OCCI Server" do
|
268
|
+
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
#TD/OCCI/CORE/DELETE/002
|
273
|
+
describe "Delete all OCCI Resources belonging to an OCCI Kind" do
|
274
|
+
it "should send a HTTP DELETE request" do
|
275
|
+
@client.delete "compute"
|
276
|
+
end
|
277
|
+
|
278
|
+
it "should receipt a HTTP 200 (OK) response" do
|
279
|
+
@client.last_response.code.should == 200
|
280
|
+
end
|
281
|
+
|
282
|
+
it "should has deleted all OCCI Resource belonging to the OCCI Kind" do
|
283
|
+
uri_list = @client.list "compute"
|
284
|
+
uri_list.should be_empty
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
=end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
@@ -0,0 +1,259 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'occi'
|
3
|
+
|
4
|
+
module Occi
|
5
|
+
module Api
|
6
|
+
module Client
|
7
|
+
|
8
|
+
describe ClientHttp do
|
9
|
+
|
10
|
+
describe "using media type text/plain" do
|
11
|
+
|
12
|
+
use_vcr_cassette "client_http_text_plain"
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
@client = Occi::Api::Client::ClientHttp.new(
|
16
|
+
'https://localhost:3300',
|
17
|
+
{ :type => "none" },
|
18
|
+
{ :out => "/dev/null",
|
19
|
+
:level => Occi::Log::DEBUG },
|
20
|
+
true,
|
21
|
+
"text/plain,text/occi"
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
@client.logger.close
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should establish connection" do
|
30
|
+
@client.connected.should be_true
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should create a compute resource" do
|
34
|
+
@client.get_resource "compute"
|
35
|
+
@client.get_resource "http://schemas.ogf.org/occi/infrastructure#compute"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should create a network resource" do
|
39
|
+
@client.get_resource "network"
|
40
|
+
@client.get_resource "http://schemas.ogf.org/occi/infrastructure#network"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should create a storage resource" do
|
44
|
+
@client.get_resource "storage"
|
45
|
+
@client.get_resource "http://schemas.ogf.org/occi/infrastructure#storage"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should list all available resource types" do
|
49
|
+
@client.get_resource_types
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should list all available resource type identifiers" do
|
53
|
+
@client.get_resource_type_identifiers
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should list all available mixin types" do
|
57
|
+
@client.get_mixin_types
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should list all available mixin type identifiers" do
|
61
|
+
@client.get_mixin_type_identifiers
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should list compute resources" do
|
65
|
+
@client.list "compute"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should list network resources" do
|
69
|
+
@client.list "network"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should list storage resources" do
|
73
|
+
@client.list "storage"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should list all available mixins" do
|
77
|
+
@client.get_mixins
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should list os_tpl mixins" do
|
81
|
+
@client.get_mixins "os_tpl"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should list resource_tpl mixins" do
|
85
|
+
@client.get_mixins "resource_tpl"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should describe compute resources" do
|
89
|
+
@client.describe "compute"
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should describe network resources" do
|
93
|
+
@client.describe "network"
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should describe storage resources" do
|
97
|
+
@client.describe "storage"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should describe all available mixins" do
|
101
|
+
@client.get_mixins.each do |mixin|
|
102
|
+
mixin_short = mixin.split("/").last
|
103
|
+
@client.find_mixin mixin_short.split("#").last, mixin_short.split("#").first, true
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should describe os_tpl mixins" do
|
108
|
+
@client.get_mixins("os_tpl").each do |mixin|
|
109
|
+
mixin_short = mixin.split("/").last
|
110
|
+
@client.find_mixin mixin_short.split("#").last, "os_tpl", true
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should describe resource_tpl mixins" do
|
115
|
+
@client.get_mixins("resource_tpl").each do |mixin|
|
116
|
+
mixin_short = mixin.split("/").last
|
117
|
+
@client.find_mixin mixin_short.split("#").last, "resource_tpl", true
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should create a new compute resource" do
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should create a new storage resource" do
|
125
|
+
# TODO
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should create a new network resource" do
|
129
|
+
# TODO
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should deploy an instance based on OVF/OVA file" do
|
133
|
+
# TODO
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should delete a compute resource" do
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should delete a network resource" do
|
140
|
+
# TODO
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should delete a storage resource" do
|
144
|
+
# TODO
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should trigger an action on a compute resource" do
|
148
|
+
# TODO
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should trigger an action on a storage resource" do
|
152
|
+
# TODO
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should trigger an action on a network resource" do
|
156
|
+
# TODO
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should refresh its model" do
|
160
|
+
@client.refresh
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
describe ClientHttp do
|
168
|
+
|
169
|
+
describe "using media type application/occi+json" do
|
170
|
+
|
171
|
+
use_vcr_cassette "client_http_application_occi_json"
|
172
|
+
|
173
|
+
before(:each) do
|
174
|
+
#@client = Occi::Api::ClientHttp.new(
|
175
|
+
# 'https://localhost:3300',
|
176
|
+
# { :type => "none" },
|
177
|
+
# { :out => "/dev/null",
|
178
|
+
# :level => Occi::Log::DEBUG },
|
179
|
+
# true,
|
180
|
+
# "application/occi+json"
|
181
|
+
#)
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should establish connection" do
|
185
|
+
# TODO
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should list compute resources" do
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should list network resources" do
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should list storage resources" do
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should list all available mixins" do
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should list os_tpl mixins" do
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should list resource_tpl mixins" do
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should describe compute resources" do
|
207
|
+
end
|
208
|
+
|
209
|
+
it "should describe network resources" do
|
210
|
+
end
|
211
|
+
|
212
|
+
it "should describe storage resources" do
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should describe all available mixins" do
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should describe os_tpl mixins" do
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should describe resource_tpl mixins" do
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should create a new compute resource" do
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should create a new storage resource" do
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should create a new network resource" do
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should delete a compute resource" do
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should delete a network resource" do
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should delete a storage resource" do
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should trigger an action on a compute resource" do
|
243
|
+
end
|
244
|
+
|
245
|
+
it "should trigger an action on a storage resource" do
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should trigger an action on a network resource" do
|
249
|
+
end
|
250
|
+
|
251
|
+
it "should refresh its model" do
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|