icontrol 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +9 -0
- data/README.rdoc +16 -0
- data/lib/icontrol.rb +17 -0
- data/lib/icontrol/attributable.rb +36 -0
- data/lib/icontrol/base.rb +197 -0
- data/lib/icontrol/common.rb +109 -0
- data/lib/icontrol/local_lb/common.rb +47 -0
- data/lib/icontrol/local_lb/monitor.rb +17 -0
- data/lib/icontrol/local_lb/monitor_rule.rb +22 -0
- data/lib/icontrol/local_lb/pool.rb +76 -0
- data/lib/icontrol/local_lb/pool_member.rb +5 -0
- data/lib/icontrol/local_lb/profile_auth.rb +6 -0
- data/lib/icontrol/local_lb/profile_http_class.rb +242 -0
- data/lib/icontrol/local_lb/rate_class.rb +4 -0
- data/lib/icontrol/local_lb/rule.rb +4 -0
- data/lib/icontrol/local_lb/snat_pool.rb +4 -0
- data/lib/icontrol/local_lb/virtual_server.rb +611 -0
- data/lib/icontrol/mappings.rb +62 -0
- data/lib/icontrol/statistic_type.rb +508 -0
- data/spec/fixtures/endpoint_helper.rb +14 -0
- data/spec/fixtures/soap/soap_fixture.rb +14 -0
- data/spec/fixtures/wsdl/wsdl_fixture.rb +15 -0
- data/spec/icontrol_local_lb_pool_spec.rb +119 -0
- data/spec/icontrol_local_lb_profile_http_class_spec.rb +271 -0
- data/spec/icontrol_local_lb_rule_spec.rb +22 -0
- data/spec/icontrol_local_lb_virtual_server_spec.rb +664 -0
- data/spec/icontrol_spec.rb +79 -0
- data/spec/spec_helper.rb +54 -0
- metadata +150 -0
@@ -0,0 +1,664 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe IControl::LocalLB::VirtualServer do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@virtual_server = IControl::LocalLB::VirtualServer.find("test_virtual_server")
|
7
|
+
@virtual_server_nil = IControl::LocalLB::VirtualServer.find("test_virtual_server_nil")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "find method" do
|
11
|
+
|
12
|
+
it "should have a find class method called find" do
|
13
|
+
IControl::LocalLB::VirtualServer.methods.should include(:find)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have retreive an object when find is call with id or nil it the object does not exists" do
|
17
|
+
IControl::LocalLB::VirtualServer.find("test_virtual_server").class.should be(IControl::LocalLB::VirtualServer)
|
18
|
+
IControl::LocalLB::VirtualServer.find("unknown_virtual_server").class.should_not be(IControl::LocalLB::VirtualServer)
|
19
|
+
IControl::LocalLB::VirtualServer.find("unknown_virtual_server").should be(nil)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
describe "defaul_pool method" do
|
25
|
+
|
26
|
+
it "should exist" do
|
27
|
+
default_pool = @virtual_server.default_pool
|
28
|
+
default_pool.should_not be(nil)
|
29
|
+
default_pool.class.should be(IControl::LocalLB::Pool)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "default_pool= method" do
|
35
|
+
it "should have method called default_pool=" do
|
36
|
+
register_conversation(["IControl.LocalLB.VirtualServer.get_default_pool_name_before_pool_change","IControl.LocalLB.VirtualServer.get_default_pool_name_after_change"])
|
37
|
+
|
38
|
+
@virtual_server.default_pool.id.should ==("test_pool1")
|
39
|
+
@virtual_server.default_pool = IControl::LocalLB::Pool.find("pool_test2")
|
40
|
+
@virtual_server.default_pool.id.should ==("pool_test2")
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "destroy method" do
|
46
|
+
it "should delete the virtual server" do
|
47
|
+
register_conversation(["IControl.LocalLB.VirtualServer.get_list_before_delete","IControl.LocalLB.VirtualServer.get_list_after_delete"])
|
48
|
+
virtual_server = IControl::LocalLB::VirtualServer.find("test_virtual_server2")
|
49
|
+
virtual_server.id.should == "test_virtual_server2"
|
50
|
+
lambda { virtual_server.destroy }.should_not raise_exception
|
51
|
+
IControl::LocalLB::VirtualServer.find("test_virtual_server2").should be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "profiles method" do
|
56
|
+
|
57
|
+
it "should have method called profiles" do
|
58
|
+
profiles = @virtual_server.profiles
|
59
|
+
profiles.should_not be(nil)
|
60
|
+
profiles.class.should be(Array)
|
61
|
+
profiles.first.class.should be(IControl::LocalLB::VirtualServer::ProfileAttribute)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "httpclass_profiles method" do
|
67
|
+
|
68
|
+
it "should exist" do
|
69
|
+
@virtual_server.class.should be(IControl::LocalLB::VirtualServer)
|
70
|
+
|
71
|
+
httpclass_profiles = @virtual_server.httpclass_profiles
|
72
|
+
httpclass_profiles.should_not be(nil)
|
73
|
+
httpclass_profiles.class.should be(IControl::LocalLB::VirtualServer::HttpClassProfileEnumerator)
|
74
|
+
httpclass_profiles.first.class.should be(IControl::LocalLB::ProfileHttpClass)
|
75
|
+
httpclass_profiles.first.id.should_not be(nil)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "wildmask method" do
|
80
|
+
it "should exists" do
|
81
|
+
@virtual_server.wildmask.class.should be(String)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "type method" do
|
86
|
+
|
87
|
+
it "shold exists" do
|
88
|
+
lambda { @virtual_server.type }.should_not raise_exception(NoMethodError)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should return a constant child of VirtualServerType" do
|
92
|
+
vs_type = @virtual_server.type
|
93
|
+
vs_type.should_not be(nil)
|
94
|
+
vs_type.ancestors.should include(IControl::LocalLB::VirtualServer::Type)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "type= method" do
|
99
|
+
it "should change the type of the virtual server" do
|
100
|
+
register_conversation(["IControl.LocalLB.VirtualServer.get_type_before_type_change","IControl.LocalLB.VirtualServer.get_type_after_type_change"])
|
101
|
+
@virtual_server_nil.type.should be(IControl::LocalLB::VirtualServer::Type::RESOURCE_TYPE_POOL)
|
102
|
+
lambda { @virtual_server_nil.type = IControl::LocalLB::VirtualServer::Type::RESOURCE_TYPE_IP_FORWARDING }.should raise_exception(Savon::SOAPFault)
|
103
|
+
@virtual_server_nil.type = IControl::LocalLB::VirtualServer::Type::RESOURCE_TYPE_REJECT
|
104
|
+
@virtual_server_nil.type.should be(IControl::LocalLB::VirtualServer::Type::RESOURCE_TYPE_REJECT)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "cmp_enable_mode method" do
|
109
|
+
|
110
|
+
it "should exists" do
|
111
|
+
lambda { @virtual_server.cmp_enable_mode }.should_not raise_exception(NoMethodError)
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should return a constant telling the cmp_enable_mode of the virtual server" do
|
115
|
+
cmp_enable = @virtual_server.cmp_enable_mode
|
116
|
+
cmp_enable.should_not be(nil)
|
117
|
+
cmp_enable.ancestors.should include(IControl::LocalLB::VirtualServer::CMPEnableMode)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "destination method" do
|
122
|
+
it "should exists" do
|
123
|
+
lambda { @virtual_server.destination }.should_not raise_exception(NoMethodError)
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should return an IPPortDefinition instance" do
|
127
|
+
@virtual_server.destination.class.should be(IControl::Common::IPPortDefinition)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe "destination= method" do
|
132
|
+
it "should exists" do
|
133
|
+
@virtual_server.methods.should include(:destination=)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should change the destination of the virtual server" do
|
137
|
+
register_conversation(["IControl.LocalLB.VirtualServer.get_destination_before_change","IControl.LocalLB.VirtualServer.get_destination_after_change"])
|
138
|
+
destination = @virtual_server_nil.destination
|
139
|
+
destination.port.should == "100"
|
140
|
+
destination.port = 101
|
141
|
+
@virtual_server_nil.destination= destination
|
142
|
+
@virtual_server_nil.destination.port.should =="101"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe "protocol method" do
|
147
|
+
it "should exists" do
|
148
|
+
lambda { @virtual_server.protocol }.should_not raise_exception(NoMethodError)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should return an IControl::Common::ProtocolType constant" do
|
152
|
+
@virtual_server.protocol.ancestors.should include(IControl::Common::ProtocolType)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe "enabled_state method" do
|
157
|
+
it "should exists" do
|
158
|
+
lambda { @virtual_server.enabled_state }.should_not raise_exception(NoMethodError)
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should return an IControl::Common::EnabledState constant" do
|
162
|
+
@virtual_server.enabled_state.ancestors.should include(IControl::Common::EnabledState)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe "enabled_state= method" do
|
167
|
+
it "should exist" do
|
168
|
+
@virtual_server.methods.should include(:enabled_state=)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should allow the assingment of an enabled state" do
|
172
|
+
lambda{ @virtual_server_nil.enabled_state = @virtual_server.enabled_state }.should_not raise_exception
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
describe "connection_limit" do
|
178
|
+
it "should exists" do
|
179
|
+
lambda { @virtual_server.connection_limit }.should_not raise_exception(NoMethodError)
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return an IControl::Common::ULong64 instance" do
|
183
|
+
@virtual_server.connection_limit.class.should be(IControl::Common::ULong64)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe "connection_limit= method" do
|
188
|
+
it "should exists" do
|
189
|
+
@virtual_server.methods.should include(:connection_limit=)
|
190
|
+
end
|
191
|
+
it "should allow the assignment of a connection limit" do
|
192
|
+
lambda { @virtual_server.connection_limit= 4194967294 }.should_not raise_exception
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe "rate_class method" do
|
197
|
+
it "should exists" do
|
198
|
+
lambda { @virtual_server.rate_class }.should_not raise_exception(NoMethodError)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should return an IControl::LocalLB::RateClass instance" do
|
202
|
+
@virtual_server.rate_class.class.should be(IControl::LocalLB::RateClass)
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should return nil if there is not a rate class associated with the virtual_server" do
|
206
|
+
@virtual_server_nil.rate_class.should be(nil)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe "rate_class= method" do
|
211
|
+
it "should exists" do
|
212
|
+
@virtual_server.methods.should include(:rate_class=)
|
213
|
+
end
|
214
|
+
it "should allow the assignment of a rate_class" do
|
215
|
+
lambda { @virtual_server_nil.rate_class= "rate_class_test" }.should_not raise_exception
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
describe "connection_mirror_state method" do
|
221
|
+
it "should exists" do
|
222
|
+
lambda { @virtual_server.connection_mirror_state }.should_not raise_exception(NoMethodError)
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should return an IControl::Common::EnabledState constant" do
|
226
|
+
@virtual_server.connection_mirror_state.ancestors.should include(IControl::Common::EnabledState)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
describe "connection_mirror_state= method" do
|
231
|
+
it "should exists" do
|
232
|
+
@virtual_server.methods.should include(:connection_mirror_state=)
|
233
|
+
end
|
234
|
+
it "should allow the assignment of a rate_class" do
|
235
|
+
lambda { @virtual_server_nil.connection_mirror_state= IControl::Common::EnabledState::STATE_DISABLED }.should_not raise_exception
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
describe "translate_port_state method" do
|
241
|
+
it "should exists" do
|
242
|
+
lambda { @virtual_server.translate_port_state }.should_not raise_exception(NoMethodError)
|
243
|
+
end
|
244
|
+
|
245
|
+
it "should return an IControl::Common::EnabledState constant" do
|
246
|
+
@virtual_server.translate_port_state.ancestors.should include(IControl::Common::EnabledState)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
describe "translate_address_state method" do
|
251
|
+
it "should exists" do
|
252
|
+
lambda { @virtual_server.translate_address_state }.should_not raise_exception(NoMethodError)
|
253
|
+
end
|
254
|
+
|
255
|
+
it "should return an IControl::Common::EnabledState constant" do
|
256
|
+
@virtual_server.translate_address_state.ancestors.should include(IControl::Common::EnabledState)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
describe "enable_address_translation! method" do
|
261
|
+
it "should exist" do
|
262
|
+
@virtual_server.methods.should include(:enable_address_translation!)
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should do something" do
|
266
|
+
lambda { @virtual_server.enable_address_translation! }.should_not raise_exception
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
describe "disable_address_translation! method" do
|
271
|
+
it "should exist" do
|
272
|
+
@virtual_server.methods.should include(:disable_address_translation!)
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should do something" do
|
276
|
+
lambda { @virtual_server.disable_address_translation! }.should_not raise_exception
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
describe "sorce_port_behavior method" do
|
281
|
+
it "should exists" do
|
282
|
+
lambda { @virtual_server.source_port_behavior }.should_not raise_exception(NoMethodError)
|
283
|
+
end
|
284
|
+
|
285
|
+
it "should return an IControl::Common::SourcePortBehavior constant" do
|
286
|
+
@virtual_server.source_port_behavior.ancestors.should include(IControl::Common::SourcePortBehavior)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
describe "last_hop_pool method" do
|
291
|
+
it "should exists" do
|
292
|
+
lambda { @virtual_server.last_hop_pool }.should_not raise_exception(NoMethodError)
|
293
|
+
end
|
294
|
+
|
295
|
+
it "should return an IControl::LocalLB::Pool instance" do
|
296
|
+
@virtual_server.last_hop_pool.class.should be(IControl::LocalLB::Pool)
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
describe "actual_hardware_acceleration method" do
|
301
|
+
it "should exists" do
|
302
|
+
lambda { @virtual_server.actual_hardware_acceleration }.should_not raise_exception(NoMethodError)
|
303
|
+
end
|
304
|
+
|
305
|
+
it "should return an IControl::LocalLB::HardwareAccelerationMode instance" do
|
306
|
+
@virtual_server.actual_hardware_acceleration.ancestors.should include(IControl::LocalLB::HardwareAccelerationMode)
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
describe "snat_type method" do
|
312
|
+
it "should exists" do
|
313
|
+
lambda { @virtual_server.snat_type }.should_not raise_exception(NoMethodError)
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should return an IControl::LocalLB::SnatType constant" do
|
317
|
+
@virtual_server.snat_type.ancestors.should include(IControl::LocalLB::SnatType)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
|
322
|
+
describe "snat_type= method" do
|
323
|
+
it "should exists" do
|
324
|
+
@virtual_server.methods.should include(:snat_type=)
|
325
|
+
end
|
326
|
+
|
327
|
+
it "should change the state of the snat_type of an object to automap if IControl::LocalLB::SnatType::SNAT_TYPE_AUTOMAP is specified" do
|
328
|
+
@virtual_server.methods.should include(:snat_type=)
|
329
|
+
register_conversation ["IControl.LocalLB.VirtualServer.get_snat_type_before_automap_change",
|
330
|
+
"IControl.LocalLB.VirtualServer.get_snat_type_after_automap_change"]
|
331
|
+
|
332
|
+
@virtual_server_nil.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
333
|
+
@virtual_server_nil.snat_type= IControl::LocalLB::SnatType::SNAT_TYPE_AUTOMAP
|
334
|
+
@virtual_server_nil.snat_type.should ==IControl::LocalLB::SnatType::SNAT_TYPE_AUTOMAP
|
335
|
+
end
|
336
|
+
|
337
|
+
it "should change the state of the snat_type of an object to none if IControl::LocalLB::SnatType::SNAT_TYPE_NONE is specified" do
|
338
|
+
# @virtual_server.snat_type = IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
339
|
+
# @virtual_server.snat_type.should ==IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
describe "snat_pool method" do
|
344
|
+
it "should exists" do
|
345
|
+
lambda { @virtual_server.snat_pool }.should_not raise_exception(NoMethodError)
|
346
|
+
end
|
347
|
+
|
348
|
+
it "should return nil if none is specified" do
|
349
|
+
@virtual_server_nil.snat_pool.should be nil
|
350
|
+
end
|
351
|
+
|
352
|
+
it "should return a SnatPool" do
|
353
|
+
@virtual_server.snat_pool.class.should be(IControl::LocalLB::SNATPool)
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
describe "fallback_persistence_profile method" do
|
358
|
+
it "should exists" do
|
359
|
+
lambda { @virtual_server.fallback_persistence_profile }.should_not raise_exception(NoMethodError)
|
360
|
+
end
|
361
|
+
|
362
|
+
it "should return an FallBackPersistenceProfile instance" do
|
363
|
+
@virtual_server.fallback_persistence_profile.class.should be(String)
|
364
|
+
end
|
365
|
+
|
366
|
+
it "should return an nil if none is specified" do
|
367
|
+
@virtual_server_nil.fallback_persistence_profile.should be(nil)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
describe "persistence_profile method" do
|
372
|
+
it "should exists" do
|
373
|
+
lambda { @virtual_server.persistence_profile }.should_not raise_exception(NoMethodError)
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should return an VirtualServerPersistence instance" do
|
377
|
+
@virtual_server.persistence_profile.class.should be(IControl::LocalLB::VirtualServer::Persistence)
|
378
|
+
end
|
379
|
+
|
380
|
+
it "should return an nil if none is specified" do
|
381
|
+
@virtual_server_nil.persistence_profile.should be(nil)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
describe "rules method" do
|
386
|
+
|
387
|
+
it "should exists" do
|
388
|
+
lambda { @virtual_server.rules }.should_not raise_exception(NoMethodError)
|
389
|
+
end
|
390
|
+
|
391
|
+
it "should return an list of Rules" do
|
392
|
+
@virtual_server.rules.should_not be_empty
|
393
|
+
@virtual_server.rules.first.class.should be(IControl::LocalLB::VirtualServerRule)
|
394
|
+
end
|
395
|
+
|
396
|
+
it "should return an empty list if no rule is associated with the virtual server" do
|
397
|
+
@virtual_server_nil.rules.should be_empty
|
398
|
+
end
|
399
|
+
|
400
|
+
end
|
401
|
+
|
402
|
+
describe "clone_pool method" do
|
403
|
+
it "should exists" do
|
404
|
+
lambda { @virtual_server.clone_pool }.should_not raise_exception(NoMethodError)
|
405
|
+
end
|
406
|
+
|
407
|
+
it "should return a list of VirtualServerClonePool" do
|
408
|
+
@virtual_server.clone_pool.should_not be_empty
|
409
|
+
@virtual_server.clone_pool.first.class.should be(IControl::LocalLB::VirtualServer::ClonePool)
|
410
|
+
end
|
411
|
+
|
412
|
+
it "should return an empty list if no clone_pool is associated with the virtual server" do
|
413
|
+
@virtual_server_nil.clone_pool.should be_empty
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
describe "statistics method" do
|
418
|
+
it "should exists" do
|
419
|
+
lambda { @virtual_server.statistics }.should_not raise_exception(NoMethodError)
|
420
|
+
end
|
421
|
+
|
422
|
+
it "should return a VirtualServerStatisticEntry" do
|
423
|
+
@virtual_server.statistics.should_not be_empty
|
424
|
+
end
|
425
|
+
|
426
|
+
it "should return a hash of statistics" do
|
427
|
+
@virtual_server.statistics.class.should be(Hash)
|
428
|
+
@virtual_server.statistics.first[0].ancestors.should include(IControl::Common::StatisticType)
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
describe "version method" do
|
433
|
+
it "should exists" do
|
434
|
+
lambda { @virtual_server.version }.should_not raise_exception(NoMethodError)
|
435
|
+
end
|
436
|
+
|
437
|
+
it "should return a String" do
|
438
|
+
@virtual_server.version.class.should be(String)
|
439
|
+
@virtual_server.version.should_not be_empty
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
describe "gtp_score method" do
|
444
|
+
it "should exists" do
|
445
|
+
lambda { @virtual_server.gtm_score }.should_not raise_exception(NoMethodError)
|
446
|
+
end
|
447
|
+
|
448
|
+
it "should return a ULong64" do
|
449
|
+
@virtual_server.gtm_score.class.should be(IControl::Common::ULong64)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
describe "vlan method" do
|
454
|
+
it "should exists" do
|
455
|
+
lambda { @virtual_server.vlan }.should_not raise_exception(NoMethodError)
|
456
|
+
end
|
457
|
+
|
458
|
+
it "should return an instance of a VLANFilterList" do
|
459
|
+
vlan = @virtual_server.vlan
|
460
|
+
vlan.class.should be(IControl::Common::VLANFilterList)
|
461
|
+
@virtual_server_nil.vlan.vlans.class.should be(Array)
|
462
|
+
@virtual_server_nil.vlan.vlans.should be_empty
|
463
|
+
vlan.vlans.should_not be_empty
|
464
|
+
vlan.vlans.class.should be(Array)
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
describe "create method" do
|
469
|
+
it "should create a new virtual_server when correctly called" do
|
470
|
+
virtual_server =
|
471
|
+
IControl::LocalLB::VirtualServer.create(:address => "192.168.145.7",
|
472
|
+
:port => 99,
|
473
|
+
:name => "test_virtual_server",
|
474
|
+
:default_pool => IControl::LocalLB::Pool.find("pool_test1"),
|
475
|
+
:profiles => [{"profile_context" => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL }])
|
476
|
+
virtual_server.id.should == "test_virtual_server"
|
477
|
+
end
|
478
|
+
|
479
|
+
it "should raise an exception if no pool is specified" do
|
480
|
+
lambda do
|
481
|
+
virtual_server =
|
482
|
+
IControl::LocalLB::VirtualServer.create(:address => "192.168.145.7",
|
483
|
+
:port => 99,
|
484
|
+
:name => "test_virtual_server",
|
485
|
+
:default_pool => nil,
|
486
|
+
:profiles => [{"profile_context" => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL,"profile" => IControl::LocalLB::ProfileHttpClass.find("test_profile1")}])
|
487
|
+
virtual_server.id.should == "test_virtual_server"
|
488
|
+
end.should raise_exception(IControl::NoSuchPoolException)
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
describe "add_httpclass_profile" do
|
493
|
+
it "should exist" do
|
494
|
+
@virtual_server.methods.should include(:add_httpclass_profile)
|
495
|
+
end
|
496
|
+
|
497
|
+
it "should allow the addition of a new http class profile by means of a << operator using strings" do
|
498
|
+
@virtual_server_nil.httpclass_profiles.class.should be(IControl::LocalLB::VirtualServer::HttpClassProfileEnumerator)
|
499
|
+
@virtual_server_nil.httpclass_profiles.length.should be 0
|
500
|
+
@virtual_server_nil.httpclass_profiles << IControl::LocalLB::ProfileHttpClass.find("test_profile1")
|
501
|
+
@virtual_server_nil.httpclass_profiles.length.should be 1
|
502
|
+
end
|
503
|
+
|
504
|
+
it "should allow the use of array operator on the httpclass_profile output object" do
|
505
|
+
end
|
506
|
+
|
507
|
+
end
|
508
|
+
|
509
|
+
describe "add_rule" do
|
510
|
+
it "should exist" do
|
511
|
+
@virtual_server.methods.should include(:add_rule)
|
512
|
+
end
|
513
|
+
|
514
|
+
it "should allow the addition of a new rule profile by means of a << operator using rules" do
|
515
|
+
@virtual_server_nil.rules.class.should be(IControl::LocalLB::VirtualServer::RuleEnumerator)
|
516
|
+
@virtual_server_nil.rules.length.should be 0
|
517
|
+
@virtual_server_nil.rules << IControl::LocalLB::Rule.find("irule_test")
|
518
|
+
@virtual_server_nil.rules.length.should be 1
|
519
|
+
end
|
520
|
+
|
521
|
+
it "should allow the use of array operator on the httpclass_profile output object" do
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
525
|
+
describe "object_status method" do
|
526
|
+
it "should exist" do
|
527
|
+
@virtual_server.methods.should include(:object_status)
|
528
|
+
end
|
529
|
+
|
530
|
+
it "should return the status of the virtual server" do
|
531
|
+
@virtual_server.object_status.class.should be(Hash)
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
describe "authentication_profiles method" do
|
536
|
+
it "should exist" do
|
537
|
+
@virtual_server.methods.should include(:authentication_profiles)
|
538
|
+
end
|
539
|
+
|
540
|
+
it "return an array of authentication_profiles" do
|
541
|
+
@virtual_server.authentication_profiles.class.should be(IControl::LocalLB::VirtualServer::AuthProfileEnumerator)
|
542
|
+
@virtual_server.authentication_profiles.first.class.should be(IControl::LocalLB::ProfileAuth)
|
543
|
+
|
544
|
+
end
|
545
|
+
|
546
|
+
it "should allow the adding of a new profile by means of the << operator" do
|
547
|
+
@virtual_server_nil.authentication_profiles.class.should be(IControl::LocalLB::VirtualServer::AuthProfileEnumerator)
|
548
|
+
@virtual_server_nil.authentication_profiles.length.should be 0
|
549
|
+
@virtual_server_nil.authentication_profiles << IControl::LocalLB::ProfileAuth.find("ldap")
|
550
|
+
@virtual_server_nil.authentication_profiles.length.should be 1
|
551
|
+
end
|
552
|
+
end
|
553
|
+
|
554
|
+
describe "self.all_statistics method" do
|
555
|
+
it "should exist" do
|
556
|
+
@virtual_server.class.methods.should include(:all_statistics)
|
557
|
+
end
|
558
|
+
|
559
|
+
it "should return an array with every statistic of the virtual servers" do
|
560
|
+
IControl::LocalLB::VirtualServer.get_all_statistics.class.should be(Array)
|
561
|
+
IControl::LocalLB::VirtualServer.get_all_statistics.first.class.should be(IControl::LocalLB::VirtualServer::StatisticEntry)
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
describe "persistence_record method" do
|
566
|
+
|
567
|
+
it "should exist" do
|
568
|
+
@virtual_server.methods.should include(:persistence_record)
|
569
|
+
end
|
570
|
+
|
571
|
+
end
|
572
|
+
|
573
|
+
describe "version method" do
|
574
|
+
it "should exist" do
|
575
|
+
@virtual_server.methods.should include(:version)
|
576
|
+
end
|
577
|
+
|
578
|
+
it "should return the version of the system" do
|
579
|
+
@virtual_server.version.class.should be(String)
|
580
|
+
@virtual_server.version.length.should > 0
|
581
|
+
end
|
582
|
+
end
|
583
|
+
|
584
|
+
describe "module_score method" do
|
585
|
+
it "should exist" do
|
586
|
+
@virtual_server.methods.should include(:module_score)
|
587
|
+
end
|
588
|
+
|
589
|
+
it "should return nil is none exist" do
|
590
|
+
@virtual_server.module_score.should be_nil
|
591
|
+
end
|
592
|
+
end
|
593
|
+
|
594
|
+
describe "protocol= method" do
|
595
|
+
|
596
|
+
it "should exist" do
|
597
|
+
@virtual_server.methods.should include(:protocol=)
|
598
|
+
end
|
599
|
+
|
600
|
+
it "should change the current protocol value" do
|
601
|
+
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
describe "enable_fallback_persistence_profile! method" do
|
606
|
+
it "should exist" do
|
607
|
+
@virtual_server.methods.should include(:enable_fallback_persistence_profile!)
|
608
|
+
end
|
609
|
+
|
610
|
+
it "should enable the fallback_persistence profile" do
|
611
|
+
lambda { @virtual_server.enable_fallback_persistence_profile! }.should_not raise_exception
|
612
|
+
end
|
613
|
+
end
|
614
|
+
|
615
|
+
describe "disable_fallback_persistence_profile! method" do
|
616
|
+
it "should exist" do
|
617
|
+
@virtual_server.methods.should include(:disable_fallback_persistence_profile!)
|
618
|
+
end
|
619
|
+
|
620
|
+
it "should disable the fallback_persistence profile" do
|
621
|
+
lambda { @virtual_server.disable_fallback_persistence_profile! }.should_not raise_exception
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
describe "enable_cmp!" do
|
626
|
+
it "should exist" do
|
627
|
+
@virtual_server.methods.should include(:enable_cmp!)
|
628
|
+
end
|
629
|
+
|
630
|
+
it "should enable the cmp" do
|
631
|
+
lambda { @virtual_server.enable_cmp! }.should_not raise_exception
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
describe "disable_cmp! method" do
|
636
|
+
it "should exist" do
|
637
|
+
@virtual_server.methods.should include(:disable_cmp!)
|
638
|
+
end
|
639
|
+
|
640
|
+
it "should disable the cmp" do
|
641
|
+
lambda { @virtual_server.disable_cmp! }.should_not raise_exception
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
645
|
+
describe "snat_pool= method" do
|
646
|
+
|
647
|
+
it "should exist" do
|
648
|
+
@virtual_server.methods.should include(:snat_pool=)
|
649
|
+
end
|
650
|
+
|
651
|
+
it "assign a new snat pool" do
|
652
|
+
register_conversation(["IControl.LocalLB.VirtualServer.get_snat_pool_before_snat_pool",
|
653
|
+
"IControl.LocalLB.VirtualServer.get_snat_pool_after_snat_pool"])
|
654
|
+
|
655
|
+
@virtual_server_nil.snat_pool.should be_nil
|
656
|
+
@virtual_server_nil.snat_pool = IControl::LocalLB::SNATPool.find("test_snat")
|
657
|
+
after_snat = @virtual_server_nil.snat_pool
|
658
|
+
after_snat.class.should be(IControl::LocalLB::SNATPool)
|
659
|
+
after_snat.id.should ==("test_snat")
|
660
|
+
end
|
661
|
+
|
662
|
+
end
|
663
|
+
|
664
|
+
end
|