icontrol 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +9 -0
- data/README.rdoc +26 -10
- data/lib/icontrol/base.rb +57 -1
- data/lib/icontrol/base/attributable.rb +0 -21
- data/lib/icontrol/base/mappings.rb +1 -0
- data/lib/icontrol/base/sequence.rb +9 -0
- data/lib/icontrol/base/struct.rb +5 -1
- data/lib/icontrol/base/xml.rb +231 -0
- data/spec/icontrol/local_lb/pool_spec.rb +15 -16
- data/spec/icontrol/local_lb/profile_http_class_spec.rb +157 -75
- data/spec/icontrol/local_lb/virtual_server_spec.rb +1268 -0
- metadata +9 -4
@@ -0,0 +1,1268 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),"..","..",'/spec_helper'))
|
2
|
+
|
3
|
+
describe IControl::LocalLB::VirtualServer do
|
4
|
+
|
5
|
+
use_vcr_cassette "IControl::LocalLB::VirtualServer", :record => :all, :match_requests_on => [:uri, :method, :body] # Change :record => :new_episodes when done
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
# Here you should provide an implementation of the creation of the object that is going to
|
9
|
+
# be used to test the name will be test_virtual_server
|
10
|
+
@test_virtual_server_name = "test_virtual_server"
|
11
|
+
IControl::LocalLB::VirtualServer.create(:definition => {
|
12
|
+
:address => "192.168.99.99",
|
13
|
+
:name => @test_virtual_server_name,
|
14
|
+
:port => "4",
|
15
|
+
:protocol => IControl::Common::ProtocolType::PROTOCOL_TCP
|
16
|
+
},
|
17
|
+
:wildmask => "255.255.255.255",
|
18
|
+
:resource => {
|
19
|
+
:type => IControl::LocalLB::VirtualServer::VirtualServerType::RESOURCE_TYPE_POOL,
|
20
|
+
:default_pool_name => ""
|
21
|
+
},
|
22
|
+
:profiles => [])
|
23
|
+
@virtual_server = IControl::LocalLB::VirtualServer.find(@test_virtual_server_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
after(:each) do
|
27
|
+
@virtual_server.delete_virtual_server
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#add_authentication_profile" do
|
31
|
+
|
32
|
+
before(:each) do
|
33
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
34
|
+
end
|
35
|
+
|
36
|
+
it "Adds/associates authentication profiles to the specified virtual servers." do
|
37
|
+
@virtual_server.authentication_profile.should be_nil
|
38
|
+
@virtual_server.add_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
39
|
+
@virtual_server.authentication_profile.first.profile_name.should == "ldap"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "works this way" do
|
43
|
+
@virtual_server.add_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#add_clone_pool" do
|
48
|
+
|
49
|
+
before(:each) do
|
50
|
+
@test_pool_name="test_pool"
|
51
|
+
IControl::LocalLB::Pool.create(:pool_name => @test_pool_name,
|
52
|
+
:lb_method => IControl::LocalLB::LBMethod::LB_METHOD_ROUND_ROBIN,
|
53
|
+
:members => [{:address => "192.168.50.1",:port => "80"},
|
54
|
+
{:address => "192.168.50.2",:port => "80"}
|
55
|
+
])
|
56
|
+
@test_pool = IControl::LocalLB::Pool.find(@test_pool_name)
|
57
|
+
end
|
58
|
+
|
59
|
+
after(:each) do
|
60
|
+
@virtual_server.remove_all_clone_pools
|
61
|
+
@test_pool.delete_pool
|
62
|
+
end
|
63
|
+
|
64
|
+
it "Adds/associates clone pools to the specified virtual servers." do
|
65
|
+
@virtual_server.clone_pool.should be_nil
|
66
|
+
@virtual_server.add_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}] )
|
67
|
+
@virtual_server.clone_pool.first.pool_name.should == @test_pool_name
|
68
|
+
end
|
69
|
+
|
70
|
+
it "works this way" do
|
71
|
+
@virtual_server.add_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}] )
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#add_httpclass_profile" do
|
76
|
+
|
77
|
+
before(:each) do
|
78
|
+
@profile_http_class_name = "test_profile_http_class"
|
79
|
+
IControl::LocalLB::ProfileHttpClass.create(:profile_name => @profile_http_class_name)
|
80
|
+
@profile_http_class = IControl::LocalLB::ProfileHttpClass.find("test_profile_http_class")
|
81
|
+
end
|
82
|
+
|
83
|
+
after(:each) do
|
84
|
+
@virtual_server.remove_all_httpclass_profiles
|
85
|
+
@profile_http_class.delete_profile
|
86
|
+
end
|
87
|
+
|
88
|
+
it "Adds/associates HTTP class profiles to the specified virtual servers." do
|
89
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
90
|
+
@virtual_server.httpclass_profile.should be_nil
|
91
|
+
@virtual_server.add_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
92
|
+
@virtual_server.httpclass_profile.first.profile_name.should == @profile_http_class_name
|
93
|
+
end
|
94
|
+
|
95
|
+
it "works this way" do
|
96
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
97
|
+
# ^ First we have to set it as an http virtual_server
|
98
|
+
@virtual_server.add_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
99
|
+
# And then we add the profile, note that this rewrites the current information to the array passed
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#add_persistence_profile" do
|
104
|
+
it "Adds/associates persistence profiles to the specified virtual servers." do
|
105
|
+
@virtual_server.persistence_profile.should be_nil
|
106
|
+
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
107
|
+
@virtual_server.persistence_profile.should_not be_nil
|
108
|
+
@virtual_server.persistence_profile.first.profile_name.should == "dest_addr"
|
109
|
+
end
|
110
|
+
|
111
|
+
it "works this way" do
|
112
|
+
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "#add_profile" do
|
117
|
+
it "Adds/associates profiles to the specified virtual servers." do
|
118
|
+
before = @virtual_server.profile.length
|
119
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
120
|
+
@virtual_server.profile.length.should_not == before
|
121
|
+
@virtual_server.profile.first.profile_context.should == IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL
|
122
|
+
end
|
123
|
+
|
124
|
+
it "works this way" do
|
125
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
126
|
+
# This works for any kind of profile if possible
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "#add_rule" do
|
131
|
+
|
132
|
+
before(:each) do
|
133
|
+
@rule_name = "test_rule"
|
134
|
+
IControl::LocalLB::Rule.create(:rule => {:rule_name => @rule_name,:rule_definition => ""})
|
135
|
+
end
|
136
|
+
|
137
|
+
after(:each) do
|
138
|
+
@virtual_server.remove_all_rules
|
139
|
+
IControl::LocalLB::Rule.find(@rule_name).delete_rule
|
140
|
+
end
|
141
|
+
|
142
|
+
it "Adds/associates rules to the specified virtual servers." do
|
143
|
+
@virtual_server.rule.should be_nil
|
144
|
+
@virtual_server.add_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
145
|
+
@virtual_server.rule.should_not be_nil
|
146
|
+
end
|
147
|
+
|
148
|
+
it "works this way" do
|
149
|
+
@virtual_server.add_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "#create" do
|
154
|
+
|
155
|
+
after(:each) do
|
156
|
+
IControl::LocalLB::VirtualServer.find("test_creation").delete_virtual_server
|
157
|
+
end
|
158
|
+
|
159
|
+
it "Creates or updates virtual servers from the specified resources. Takes additional, optional parameters that enable you to override the default optional values." do
|
160
|
+
IControl::LocalLB::VirtualServer.create(:definition => {
|
161
|
+
:address => "192.168.99.99",
|
162
|
+
:name => "test_creation",
|
163
|
+
:port => "5",
|
164
|
+
:protocol => IControl::Common::ProtocolType::PROTOCOL_TCP
|
165
|
+
},
|
166
|
+
:wildmask => "255.255.255.255",
|
167
|
+
:resource => {
|
168
|
+
:type => IControl::LocalLB::VirtualServer::VirtualServerType::RESOURCE_TYPE_POOL,
|
169
|
+
:default_pool_name => ""
|
170
|
+
},
|
171
|
+
:profiles => [])
|
172
|
+
IControl::LocalLB::VirtualServer.find("test_creation").should_not be_nil
|
173
|
+
end
|
174
|
+
|
175
|
+
it "works this way" do
|
176
|
+
IControl::LocalLB::VirtualServer.create(:definition => {
|
177
|
+
:address => "192.168.99.99",
|
178
|
+
:name => "test_creation",
|
179
|
+
:port => "5",
|
180
|
+
:protocol => IControl::Common::ProtocolType::PROTOCOL_TCP
|
181
|
+
},
|
182
|
+
:wildmask => "255.255.255.255",
|
183
|
+
:resource => {
|
184
|
+
:type => IControl::LocalLB::VirtualServer::VirtualServerType::RESOURCE_TYPE_POOL,
|
185
|
+
:default_pool_name => ""
|
186
|
+
},
|
187
|
+
:profiles => [])
|
188
|
+
# This is just an example, note that in the profiles an initial collection of profile can be specified for the virtual_server
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "#delete_persistence_record" do
|
193
|
+
it "Deletes the persistence records based on the specified persistent modes for the specified virtual servers." do
|
194
|
+
@virtual_server.delete_persistence_record(:persistence_mode => IControl::LocalLB::PersistenceMode::PERSISTENCE_MODE_COOKIE)
|
195
|
+
end
|
196
|
+
|
197
|
+
it "works this way" do
|
198
|
+
@virtual_server.delete_persistence_record(:persistence_mode => IControl::LocalLB::PersistenceMode::PERSISTENCE_MODE_COOKIE)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "#delete_virtual_server" do
|
203
|
+
it "Deletes the specified virtual servers." do
|
204
|
+
# It is already tested everytime we call after
|
205
|
+
end
|
206
|
+
|
207
|
+
it "works this way" do
|
208
|
+
# @virtual_server.delete_virtual_server
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe "#actual_hardware_acceleration" do
|
213
|
+
it "should return without raising any exception" do
|
214
|
+
lambda { @virtual_server.actual_hardware_acceleration }.should_not raise_exception
|
215
|
+
end
|
216
|
+
|
217
|
+
it "Gets the actual hardware acceleration modes for the specified virtual servers." do
|
218
|
+
@virtual_server.actual_hardware_acceleration.should_not be_nil
|
219
|
+
end
|
220
|
+
|
221
|
+
it "works this way" do
|
222
|
+
@virtual_server.actual_hardware_acceleration
|
223
|
+
# => :HW_ACCELERATION_MODE_NONE
|
224
|
+
end
|
225
|
+
|
226
|
+
it "returns an instance of HardwareAccelerationMode" do
|
227
|
+
IControl::LocalLB::HardwareAccelerationMode.constants.should include(@virtual_server.actual_hardware_acceleration)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
describe "#all_statistics" do
|
232
|
+
it "should return without raising any exception" do
|
233
|
+
lambda { @virtual_server.all_statistics }.should_not raise_exception
|
234
|
+
end
|
235
|
+
|
236
|
+
it "Gets the statistics for all the virtual servers." do
|
237
|
+
@virtual_server.all_statistics.should_not be_nil
|
238
|
+
end
|
239
|
+
|
240
|
+
it "returns an instance of VirtualServerStatistics" do
|
241
|
+
@virtual_server.all_statistics.class.should == IControl::LocalLB::VirtualServer::VirtualServerStatistics
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe "#authentication_profile" do
|
246
|
+
it "should return without raising any exception" do
|
247
|
+
lambda { @virtual_server.authentication_profile }.should_not raise_exception
|
248
|
+
end
|
249
|
+
|
250
|
+
it "Gets the lists of authentication profiles the specified virtual servers are associated with." do
|
251
|
+
@virtual_server.authentication_profile.should be_nil # It's tested in the the setter method
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
describe "#clone_pool" do
|
256
|
+
it "should return without raising any exception" do
|
257
|
+
lambda { @virtual_server.clone_pool }.should_not raise_exception
|
258
|
+
end
|
259
|
+
|
260
|
+
it "Gets the lists of clone pools the specified virtual servers are associated with." do
|
261
|
+
@virtual_server.clone_pool.should be_nil # It's tested in the the setter method
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
describe "#cmp_enable_mode" do
|
266
|
+
it "should return without raising any exception" do
|
267
|
+
lambda { @virtual_server.cmp_enable_mode }.should_not raise_exception
|
268
|
+
end
|
269
|
+
|
270
|
+
it "Gets the CMP enable modes from the specified virtual servers. This is read-only, as the modes are set according to the system and configuration, and influenced by the desired CMP enabled state." do
|
271
|
+
@virtual_server.cmp_enable_mode.should_not be_nil
|
272
|
+
end
|
273
|
+
|
274
|
+
it "works this way" do
|
275
|
+
@virtual_server.cmp_enable_mode
|
276
|
+
# => :RESOURCE_TYPE_CMP_ENABLE_ALL
|
277
|
+
end
|
278
|
+
|
279
|
+
it "returns an instance of VirtualServerCMPEnableMode" do
|
280
|
+
IControl::LocalLB::VirtualServer::VirtualServerCMPEnableMode.constants.should include(@virtual_server.cmp_enable_mode)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
describe "#cmp_enabled_state" do
|
285
|
+
it "should return without raising any exception" do
|
286
|
+
lambda { @virtual_server.cmp_enabled_state }.should_not raise_exception
|
287
|
+
end
|
288
|
+
|
289
|
+
it "Gets the CMP enabled states for the specified virtual servers. Enables or disables CMP. Note that this setting can influence the CMP enable mode set automatically by the system and configuration. You can not always enable CMP, but you can always disable it." do
|
290
|
+
@virtual_server.cmp_enabled_state.should_not be_nil
|
291
|
+
end
|
292
|
+
|
293
|
+
it "works this way" do
|
294
|
+
@virtual_server.cmp_enabled_state
|
295
|
+
# => :STATE_ENABLED
|
296
|
+
end
|
297
|
+
|
298
|
+
it "returns an instance of EnabledState" do
|
299
|
+
IControl::Common::EnabledState.constants.should include( @virtual_server.cmp_enabled_state)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
describe "#connection_limit" do
|
304
|
+
it "should return without raising any exception" do
|
305
|
+
lambda { @virtual_server.connection_limit }.should_not raise_exception
|
306
|
+
end
|
307
|
+
|
308
|
+
it "Gets the connection limits for the specified virtual servers." do
|
309
|
+
@virtual_server.connection_limit.should_not be_nil
|
310
|
+
end
|
311
|
+
|
312
|
+
it "works this way" do
|
313
|
+
@virtual_server.connection_limit
|
314
|
+
# => #<IControl::Common::ULong64:0xb53bfdc @attributes={:high=>0, :low=>0}>
|
315
|
+
end
|
316
|
+
|
317
|
+
it "returns an instance of ULong64" do
|
318
|
+
@virtual_server.connection_limit.class.should == IControl::Common::ULong64
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
describe "#connection_mirror_state" do
|
323
|
+
it "should return without raising any exception" do
|
324
|
+
lambda { @virtual_server.connection_mirror_state }.should_not raise_exception
|
325
|
+
end
|
326
|
+
|
327
|
+
it "Gets the mirror connection states for the specified virtual servers." do
|
328
|
+
@virtual_server.connection_mirror_state.should_not be_nil
|
329
|
+
end
|
330
|
+
|
331
|
+
it "works this way" do
|
332
|
+
@virtual_server.connection_mirror_state
|
333
|
+
# => :STATE_DISABLED
|
334
|
+
end
|
335
|
+
|
336
|
+
it "returns an instance of EnabledState" do
|
337
|
+
IControl::Common::EnabledState.constants.should include(@virtual_server.connection_mirror_state)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
describe "#default_pool_name" do
|
342
|
+
it "should return without raising any exception" do
|
343
|
+
lambda { @virtual_server.default_pool_name }.should_not raise_exception
|
344
|
+
end
|
345
|
+
|
346
|
+
it "Gets the default pool names for the specified virtual servers." do
|
347
|
+
@virtual_server.default_pool_name.should be_nil
|
348
|
+
end
|
349
|
+
|
350
|
+
it "works this way" do
|
351
|
+
@virtual_server.default_pool_name
|
352
|
+
# => "test_pool"
|
353
|
+
end
|
354
|
+
|
355
|
+
end
|
356
|
+
|
357
|
+
describe "#destination" do
|
358
|
+
it "should return without raising any exception" do
|
359
|
+
lambda { @virtual_server.destination }.should_not raise_exception
|
360
|
+
end
|
361
|
+
|
362
|
+
it "Gets the destination IP and port of the specified virtual servers." do
|
363
|
+
@virtual_server.destination.should_not be_nil
|
364
|
+
end
|
365
|
+
|
366
|
+
it "works this way" do
|
367
|
+
@virtual_server.destination
|
368
|
+
# => #<IControl::Common::IPPortDefinition:0xa7a6a34 @attributes={:address=>"213.73.35.199", :port=>3}>
|
369
|
+
end
|
370
|
+
|
371
|
+
it "returns an instance of IPPortDefinition" do
|
372
|
+
@virtual_server.destination.class.should == IControl::Common::IPPortDefinition
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
describe "#enabled_state" do
|
377
|
+
it "should return without raising any exception" do
|
378
|
+
lambda { @virtual_server.enabled_state }.should_not raise_exception
|
379
|
+
end
|
380
|
+
|
381
|
+
it "Gets the enabled state of the specified virtual server." do
|
382
|
+
@virtual_server.enabled_state.should_not be_nil
|
383
|
+
end
|
384
|
+
|
385
|
+
it "works this way" do
|
386
|
+
@virtual_server.enabled_state
|
387
|
+
# => :STATE_DISABLED
|
388
|
+
end
|
389
|
+
|
390
|
+
it "returns an instance of EnabledState" do
|
391
|
+
IControl::Common::EnabledState.constants.should include(@virtual_server.enabled_state)
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
describe "#fallback_persistence_profile" do
|
396
|
+
it "should return without raising any exception" do
|
397
|
+
lambda { @virtual_server.fallback_persistence_profile }.should_not raise_exception
|
398
|
+
end
|
399
|
+
|
400
|
+
it "Gets the persistence profiles to use for fallback persistence for the specified virtual servers." do
|
401
|
+
@virtual_server.fallback_persistence_profile.should be_nil
|
402
|
+
end
|
403
|
+
|
404
|
+
it "works this way" do
|
405
|
+
@virtual_server.fallback_persistence_profile
|
406
|
+
# => nil if none is set or the name
|
407
|
+
end
|
408
|
+
|
409
|
+
end
|
410
|
+
|
411
|
+
describe "#gtm_score" do
|
412
|
+
it "should return without raising any exception" do
|
413
|
+
lambda { @virtual_server.gtm_score }.should_not raise_exception
|
414
|
+
end
|
415
|
+
|
416
|
+
it "Returns the gtm scores for the specified virtual servers." do
|
417
|
+
@virtual_server.gtm_score.should_not be_nil
|
418
|
+
end
|
419
|
+
|
420
|
+
it "works this way" do
|
421
|
+
@virtual_server.gtm_score
|
422
|
+
# => #<IControl::Common::ULong64:0x97502c0 @attributes={:high=>0, :low=>0}>
|
423
|
+
end
|
424
|
+
|
425
|
+
it "returns an instance of ULong64" do
|
426
|
+
@virtual_server.gtm_score
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
describe "#httpclass_profile" do
|
431
|
+
it "should return without raising any exception" do
|
432
|
+
lambda { @virtual_server.httpclass_profile }.should_not raise_exception
|
433
|
+
end
|
434
|
+
|
435
|
+
it "Gets the lists of HTTP class profiles the specified virtual servers are associated with. If a specified virtual server is not associated with any HTTP class profile, then the list of HTTP class profiles for that virtual server will be empty." do
|
436
|
+
@virtual_server.httpclass_profile.should be_nil
|
437
|
+
end
|
438
|
+
|
439
|
+
it "works this way" do
|
440
|
+
@virtual_server.httpclass_profile
|
441
|
+
# =>
|
442
|
+
end
|
443
|
+
|
444
|
+
it "returns an instance of VirtualServerHttpClass[]" do
|
445
|
+
@virtual_server.httpclass_profile
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
describe "#last_hop_pool" do
|
450
|
+
it "should return without raising any exception" do
|
451
|
+
lambda { @virtual_server.last_hop_pool }.should_not raise_exception
|
452
|
+
end
|
453
|
+
|
454
|
+
it "Gets the last hop pools for the specified virtual servers." do
|
455
|
+
@virtual_server.last_hop_pool.should be_nil
|
456
|
+
end
|
457
|
+
|
458
|
+
it "works this way" do
|
459
|
+
@virtual_server.last_hop_pool
|
460
|
+
end
|
461
|
+
|
462
|
+
end
|
463
|
+
|
464
|
+
describe "#module_score" do
|
465
|
+
it "should return without raising any exception" do
|
466
|
+
lambda { @virtual_server.module_score }.should_not raise_exception
|
467
|
+
end
|
468
|
+
|
469
|
+
it "Returns the module scores for the specified virtual servers." do
|
470
|
+
@virtual_server.module_score.should be_nil
|
471
|
+
end
|
472
|
+
|
473
|
+
it "works this way" do
|
474
|
+
@virtual_server.module_score
|
475
|
+
# =>
|
476
|
+
end
|
477
|
+
|
478
|
+
end
|
479
|
+
|
480
|
+
describe "#object_status" do
|
481
|
+
it "should return without raising any exception" do
|
482
|
+
lambda { @virtual_server.object_status }.should_not raise_exception
|
483
|
+
end
|
484
|
+
|
485
|
+
it "Gets the status of each of the specified virtual servers." do
|
486
|
+
@virtual_server.object_status.should_not be_nil
|
487
|
+
end
|
488
|
+
|
489
|
+
it "works this way" do
|
490
|
+
@virtual_server.object_status
|
491
|
+
# => #<IControl::LocalLB::ObjectStatus:0x9e46598 @attributes={:availability_status=>:AVAILABILITY_STATUS_BLUE,
|
492
|
+
# :enabled_status=>:ENABLED_STATUS_ENABLED,
|
493
|
+
# :status_description=>"The children pool member(s) either don't..}>
|
494
|
+
|
495
|
+
end
|
496
|
+
|
497
|
+
it "returns an instance of ObjectStatus" do
|
498
|
+
@virtual_server.object_status
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
502
|
+
describe "#persistence_profile" do
|
503
|
+
it "should return without raising any exception" do
|
504
|
+
lambda { @virtual_server.persistence_profile }.should_not raise_exception
|
505
|
+
end
|
506
|
+
|
507
|
+
it "Gets the lists of persistence profiles the specified virtual servers are associated with." do
|
508
|
+
@virtual_server.persistence_profile.should be_nil
|
509
|
+
end
|
510
|
+
|
511
|
+
it "works this way" do
|
512
|
+
@virtual_server.persistence_profile
|
513
|
+
# =>
|
514
|
+
end
|
515
|
+
|
516
|
+
end
|
517
|
+
|
518
|
+
describe "#persistence_record" do
|
519
|
+
it "should return without raising any exception" do
|
520
|
+
lambda { @virtual_server.persistence_record(:persistence_mode => IControl::LocalLB::PersistenceMode::PERSISTENCE_MODE_NONE) }.should_not raise_exception
|
521
|
+
end
|
522
|
+
|
523
|
+
it "Gets the persistence records based on the specified persistent modes for the specified virtual servers." do
|
524
|
+
@virtual_server.persistence_record(:persistence_mode => IControl::LocalLB::PersistenceMode::PERSISTENCE_MODE_NONE).should be_nil
|
525
|
+
end
|
526
|
+
|
527
|
+
it "works this way" do
|
528
|
+
@virtual_server.persistence_record(:persistence_mode => IControl::LocalLB::PersistenceMode::PERSISTENCE_MODE_NONE)
|
529
|
+
# =>
|
530
|
+
end
|
531
|
+
|
532
|
+
end
|
533
|
+
|
534
|
+
describe "#profile" do
|
535
|
+
it "should return without raising any exception" do
|
536
|
+
lambda { @virtual_server.profile }.should_not raise_exception
|
537
|
+
end
|
538
|
+
|
539
|
+
it "Gets the lists of profiles the specified virtual servers are associated with." do
|
540
|
+
@virtual_server.profile.should_not be_nil
|
541
|
+
end
|
542
|
+
|
543
|
+
it "works this way" do
|
544
|
+
@virtual_server.profile
|
545
|
+
# => [#<IControl::LocalLB::VirtualServer::VirtualServerProfileAttribute:0x97d1e74 @attributes={:profile_type=>:PROFILE_TYPE_TCP, :profile_context=>:PROFILE_CONTEXT_TYPE_ALL, :profile_name=>"tcp"}>]
|
546
|
+
end
|
547
|
+
|
548
|
+
it "returns an instance of VirtualServerProfileAttribute[]" do
|
549
|
+
IControl::LocalLB::VirtualServer::VirtualServerProfileAttribute.should == @virtual_server.profile.first.class
|
550
|
+
end
|
551
|
+
end
|
552
|
+
|
553
|
+
describe "#protocol" do
|
554
|
+
it "should return without raising any exception" do
|
555
|
+
lambda { @virtual_server.protocol }.should_not raise_exception
|
556
|
+
end
|
557
|
+
|
558
|
+
it "Gets the protocols supported by the specified virtual servers." do
|
559
|
+
@virtual_server.protocol.should_not be_nil
|
560
|
+
end
|
561
|
+
|
562
|
+
it "works this way" do
|
563
|
+
@virtual_server.protocol
|
564
|
+
# => :PROTOCOL_TCP
|
565
|
+
end
|
566
|
+
|
567
|
+
it "returns an instance of ProtocolType" do
|
568
|
+
IControl::Common::ProtocolType.constants.should include(@virtual_server.protocol)
|
569
|
+
end
|
570
|
+
end
|
571
|
+
|
572
|
+
describe "#rate_class" do
|
573
|
+
it "should return without raising any exception" do
|
574
|
+
lambda { @virtual_server.rate_class }.should_not raise_exception
|
575
|
+
end
|
576
|
+
|
577
|
+
it "Gets the rate classes that will be used to rate limit the traffic." do
|
578
|
+
@virtual_server.rate_class.should be_nil
|
579
|
+
end
|
580
|
+
|
581
|
+
end
|
582
|
+
|
583
|
+
describe "#rule" do
|
584
|
+
it "should return without raising any exception" do
|
585
|
+
lambda { @virtual_server.rule }.should_not raise_exception
|
586
|
+
end
|
587
|
+
|
588
|
+
it "Gets the lists of rules the specified virtual servers are associated with. If a specified virtual server is not associated with any rule, then the list of rules for that virtual server will be empty." do
|
589
|
+
@virtual_server.rule.should be_nil
|
590
|
+
end
|
591
|
+
end
|
592
|
+
|
593
|
+
describe "#snat_pool" do
|
594
|
+
it "should return without raising any exception" do
|
595
|
+
lambda { @virtual_server.snat_pool }.should_not raise_exception
|
596
|
+
end
|
597
|
+
|
598
|
+
it "Gets the SNAT pools to be used in iSNAT configurations for the specified virtual servers." do
|
599
|
+
@virtual_server.snat_pool.should be_nil
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
describe "#snat_type" do
|
604
|
+
it "should return without raising any exception" do
|
605
|
+
lambda { @virtual_server.snat_type }.should_not raise_exception
|
606
|
+
end
|
607
|
+
|
608
|
+
it "Gets the SNAT type for the specified virtual servers." do
|
609
|
+
@virtual_server.snat_type.should_not be_nil
|
610
|
+
end
|
611
|
+
|
612
|
+
it "works this way" do
|
613
|
+
@virtual_server.snat_type
|
614
|
+
# => :SNAT_TYPE_NONE
|
615
|
+
end
|
616
|
+
|
617
|
+
it "returns an instance of SnatType" do
|
618
|
+
IControl::LocalLB::SnatType.constants.should include(@virtual_server.snat_type)
|
619
|
+
end
|
620
|
+
end
|
621
|
+
|
622
|
+
describe "#source_port_behavior" do
|
623
|
+
it "should return without raising any exception" do
|
624
|
+
lambda { @virtual_server.source_port_behavior }.should_not raise_exception
|
625
|
+
end
|
626
|
+
|
627
|
+
it "Gets the source port behavior for the specified virtual servers." do
|
628
|
+
@virtual_server.source_port_behavior.should_not be_nil
|
629
|
+
end
|
630
|
+
|
631
|
+
it "works this way" do
|
632
|
+
@virtual_server.source_port_behavior
|
633
|
+
# => :SOURCE_PORT_PRESERVE
|
634
|
+
end
|
635
|
+
|
636
|
+
it "returns an instance of SourcePortBehavior" do
|
637
|
+
IControl::Common::SourcePortBehavior.constants.should include(@virtual_server.source_port_behavior)
|
638
|
+
end
|
639
|
+
end
|
640
|
+
|
641
|
+
describe "#statistics" do
|
642
|
+
it "should return without raising any exception" do
|
643
|
+
lambda { @virtual_server.statistics }.should_not raise_exception
|
644
|
+
end
|
645
|
+
|
646
|
+
it "Gets the statistics for the specified virtual servers." do
|
647
|
+
@virtual_server.statistics.should_not be_nil
|
648
|
+
end
|
649
|
+
|
650
|
+
it "works this way" do
|
651
|
+
@virtual_server.statistics
|
652
|
+
# => #<IControl::LocalLB::VirtualServer::VirtualServerStatistics:0xb68eca4 @attributes={:statistics=>#<IControl::LocalLB::Virtu...
|
653
|
+
end
|
654
|
+
|
655
|
+
it "returns an instance of VirtualServerStatistics" do
|
656
|
+
IControl::LocalLB::VirtualServer::VirtualServerStatistics.should == @virtual_server.statistics.class
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
describe "#translate_address_state" do
|
661
|
+
it "should return without raising any exception" do
|
662
|
+
lambda { @virtual_server.translate_address_state }.should_not raise_exception
|
663
|
+
end
|
664
|
+
|
665
|
+
it "Gets the address translation states for the specified virtual servers. Enables or disables address translation." do
|
666
|
+
@virtual_server.translate_address_state.should_not be_nil
|
667
|
+
end
|
668
|
+
|
669
|
+
it "works this way" do
|
670
|
+
@virtual_server.translate_address_state
|
671
|
+
# => :STATE_ENABLED
|
672
|
+
end
|
673
|
+
|
674
|
+
it "returns an instance of EnabledState" do
|
675
|
+
IControl::Common::EnabledState.constants.should include(@virtual_server.translate_address_state)
|
676
|
+
end
|
677
|
+
end
|
678
|
+
|
679
|
+
describe "#translate_port_state" do
|
680
|
+
it "should return without raising any exception" do
|
681
|
+
lambda { @virtual_server.translate_port_state }.should_not raise_exception
|
682
|
+
end
|
683
|
+
|
684
|
+
it "Gets the port translation states for the specified virtual servers. Enables or disables port translation." do
|
685
|
+
@virtual_server.translate_port_state.should_not be_nil
|
686
|
+
end
|
687
|
+
|
688
|
+
it "works this way" do
|
689
|
+
@virtual_server.translate_port_state
|
690
|
+
# => :STATE_ENABLED
|
691
|
+
end
|
692
|
+
|
693
|
+
it "returns an instance of EnabledState" do
|
694
|
+
IControl::Common::EnabledState.constants.should include(@virtual_server.translate_port_state)
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
698
|
+
describe "#type" do
|
699
|
+
it "should return without raising any exception" do
|
700
|
+
lambda { @virtual_server.type }.should_not raise_exception
|
701
|
+
end
|
702
|
+
|
703
|
+
it "Gets the types of the specified virtual servers." do
|
704
|
+
@virtual_server.type.should_not be_nil
|
705
|
+
end
|
706
|
+
|
707
|
+
it "works this way" do
|
708
|
+
@virtual_server.type
|
709
|
+
# => >:RESOURCE_TYPE_POOL
|
710
|
+
end
|
711
|
+
|
712
|
+
it "returns an instance of VirtualServerType" do
|
713
|
+
IControl::LocalLB::VirtualServer::VirtualServerType.constants.should include(@virtual_server.type)
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
describe "#version" do
|
718
|
+
it "should return without raising any exception" do
|
719
|
+
lambda { @virtual_server.version }.should_not raise_exception
|
720
|
+
end
|
721
|
+
|
722
|
+
it "Gets the version information for this interface." do
|
723
|
+
@virtual_server.version.should_not be_nil
|
724
|
+
end
|
725
|
+
|
726
|
+
it "works this way" do
|
727
|
+
@virtual_server.version
|
728
|
+
# => BIG-IP_v10.0.1
|
729
|
+
end
|
730
|
+
end
|
731
|
+
|
732
|
+
describe "#vlan" do
|
733
|
+
it "should return without raising any exception" do
|
734
|
+
lambda { @virtual_server.vlan }.should_not raise_exception
|
735
|
+
end
|
736
|
+
|
737
|
+
it "Gets the lists of VLANs on which access to the specified Virtual Servers are enabled/disabled." do
|
738
|
+
@virtual_server.vlan.should_not be_nil
|
739
|
+
end
|
740
|
+
|
741
|
+
it "works this way" do
|
742
|
+
@virtual_server.vlan
|
743
|
+
# => #<IControl::Common::VLANFilterList:0xa476904 @attributes={:state=>:STATE_ENABLED, :vlans=>["test_vlan1", "test_vlan2"]}>
|
744
|
+
end
|
745
|
+
end
|
746
|
+
|
747
|
+
describe "#wildmask" do
|
748
|
+
it "should return without raising any exception" do
|
749
|
+
lambda { @virtual_server.wildmask }.should_not raise_exception
|
750
|
+
end
|
751
|
+
|
752
|
+
it "Gets the wildmasks for the specified virtual servers." do
|
753
|
+
@virtual_server.wildmask.should_not be_nil
|
754
|
+
end
|
755
|
+
|
756
|
+
it "works this way" do
|
757
|
+
@virtual_server.wildmask
|
758
|
+
# => "255.255.255.255"
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
describe "#reset_statistics" do
|
763
|
+
it "Resets the statistics for the specified virtual servers." do
|
764
|
+
lambda { @virtual_server.reset_statistics }.should_not raise_exception
|
765
|
+
end
|
766
|
+
end
|
767
|
+
|
768
|
+
describe "#set_cmp_enabled_state" do
|
769
|
+
it "Sets the CMP enabled states for the specified virtual servers. Enables or disables CMP. Note that this setting can influence the CMP enable mode set automatically by the system and configuration. You can not always enable CMP, but you can always disable it." do
|
770
|
+
cmp_enabled_state_before = @virtual_server.cmp_enabled_state
|
771
|
+
@virtual_server.set_cmp_enabled_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
772
|
+
@virtual_server.cmp_enabled_state.should_not == cmp_enabled_state_before
|
773
|
+
end
|
774
|
+
|
775
|
+
it "works this way" do
|
776
|
+
@virtual_server.set_cmp_enabled_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
777
|
+
end
|
778
|
+
end
|
779
|
+
|
780
|
+
describe "#set_connection_limit" do
|
781
|
+
it "Sets the connection limits of the specified virtual servers." do
|
782
|
+
connection_limit_before = @virtual_server.connection_limit
|
783
|
+
@virtual_server.set_connection_limit(:limit => {:high => 1,:low => 0})
|
784
|
+
@virtual_server.connection_limit.should_not == connection_limit_before
|
785
|
+
end
|
786
|
+
|
787
|
+
it "works this way" do
|
788
|
+
@virtual_server.set_connection_limit(:limit => {:high => 1,:low => 0})
|
789
|
+
end
|
790
|
+
end
|
791
|
+
|
792
|
+
describe "#set_connection_mirror_state" do
|
793
|
+
it "Sets the mirror connection states for the specified virtual servers." do
|
794
|
+
connection_mirror_state_before = @virtual_server.connection_mirror_state
|
795
|
+
@virtual_server.set_connection_mirror_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
796
|
+
@virtual_server.connection_mirror_state.should_not == connection_mirror_state_before
|
797
|
+
end
|
798
|
+
|
799
|
+
it "works this way" do
|
800
|
+
@virtual_server.set_connection_mirror_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
801
|
+
end
|
802
|
+
end
|
803
|
+
|
804
|
+
describe "#set_default_pool_name" do
|
805
|
+
before(:each) do
|
806
|
+
@test_pool_name="test_pool"
|
807
|
+
IControl::LocalLB::Pool.create(:pool_name => @test_pool_name,
|
808
|
+
:lb_method => IControl::LocalLB::LBMethod::LB_METHOD_ROUND_ROBIN,
|
809
|
+
:members => [{:address => "192.168.50.1",:port => "80"},
|
810
|
+
{:address => "192.168.50.2",:port => "80"}
|
811
|
+
])
|
812
|
+
@test_pool = IControl::LocalLB::Pool.find(@test_pool_name)
|
813
|
+
end
|
814
|
+
|
815
|
+
after(:each) do
|
816
|
+
@virtual_server.set_default_pool_name(:default_pool => "")
|
817
|
+
@test_pool.delete_pool
|
818
|
+
end
|
819
|
+
|
820
|
+
|
821
|
+
it "Sets the default pool names for the specified virtual servers." do
|
822
|
+
default_pool_before = @virtual_server.default_pool_name
|
823
|
+
@virtual_server.set_default_pool_name(:default_pool => @test_pool_name)
|
824
|
+
end
|
825
|
+
|
826
|
+
it "works this way" do
|
827
|
+
@virtual_server.set_default_pool_name(:default_pool => @test_pool_name)
|
828
|
+
# To set it
|
829
|
+
@virtual_server.set_default_pool_name(:default_pool => "")
|
830
|
+
# To unset it
|
831
|
+
end
|
832
|
+
end
|
833
|
+
|
834
|
+
describe "#set_destination" do
|
835
|
+
it "Sets the destination IP and port for the specified virtual servers." do
|
836
|
+
destination_before = @virtual_server.destination
|
837
|
+
@virtual_server.set_destination(:destination => {:address => "192.168.99.99" ,:port => 7})
|
838
|
+
@virtual_server.destination.should_not == destination_before
|
839
|
+
end
|
840
|
+
|
841
|
+
it "works this way" do
|
842
|
+
@virtual_server.set_destination(:destination => {:address => "192.168.99.99" ,:port => 7})
|
843
|
+
end
|
844
|
+
end
|
845
|
+
|
846
|
+
describe "#set_enabled_state" do
|
847
|
+
it "Sets the enabled state of the specified virtual servers." do
|
848
|
+
enabled_state_before = @virtual_server.enabled_state
|
849
|
+
@virtual_server.set_enabled_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
850
|
+
@virtual_server.enabled_state.should_not == enabled_state_before
|
851
|
+
end
|
852
|
+
|
853
|
+
it "works this way" do
|
854
|
+
@virtual_server.set_enabled_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
855
|
+
end
|
856
|
+
end
|
857
|
+
|
858
|
+
describe "#set_fallback_persistence_profile" do
|
859
|
+
|
860
|
+
before(:each) do
|
861
|
+
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "source_addr",:default_profile => false}] )
|
862
|
+
end
|
863
|
+
|
864
|
+
it "Sets the persistence profiles to use for fallback persistence for the specified virtual servers." do
|
865
|
+
fallback_persistence_profile_before = @virtual_server.fallback_persistence_profile
|
866
|
+
@virtual_server.set_fallback_persistence_profile(:profile_name => "dest_addr")
|
867
|
+
@virtual_server.fallback_persistence_profile.should_not == fallback_persistence_profile_before
|
868
|
+
end
|
869
|
+
|
870
|
+
it "works this way" do
|
871
|
+
@virtual_server.set_fallback_persistence_profile(:profile_name => "dest_addr")
|
872
|
+
end
|
873
|
+
end
|
874
|
+
|
875
|
+
describe "#set_gtm_score" do
|
876
|
+
it "Sets the gtm score for the specified virtual servers." do
|
877
|
+
gtm_score_before = @virtual_server.gtm_score
|
878
|
+
@virtual_server.set_gtm_score(:score => {:high => 1,:low => 0})
|
879
|
+
@virtual_server.gtm_score.should_not == gtm_score_before
|
880
|
+
end
|
881
|
+
|
882
|
+
it "works this way" do
|
883
|
+
@virtual_server.set_gtm_score(:score => {:high => 1,:low => 0})
|
884
|
+
end
|
885
|
+
end
|
886
|
+
|
887
|
+
describe "#set_last_hop_pool" do
|
888
|
+
|
889
|
+
before(:each) do
|
890
|
+
@test_pool_name="test_pool"
|
891
|
+
IControl::LocalLB::Pool.create(:pool_name => @test_pool_name,
|
892
|
+
:lb_method => IControl::LocalLB::LBMethod::LB_METHOD_ROUND_ROBIN,
|
893
|
+
:members => [{:address => "192.168.50.1",:port => "80"},
|
894
|
+
{:address => "192.168.50.2",:port => "80"}
|
895
|
+
])
|
896
|
+
@test_pool = IControl::LocalLB::Pool.find(@test_pool_name)
|
897
|
+
end
|
898
|
+
|
899
|
+
after(:each) do
|
900
|
+
@virtual_server.set_last_hop_pool(:last_hop_pool =>"")
|
901
|
+
@test_pool.delete_pool
|
902
|
+
end
|
903
|
+
|
904
|
+
|
905
|
+
it "Sets the last hop pools for the specified virtual servers." do
|
906
|
+
last_hop_pool_before = @virtual_server.last_hop_pool
|
907
|
+
@virtual_server.set_last_hop_pool(:last_hop_pool => @test_pool_name)
|
908
|
+
@virtual_server.last_hop_pool.should_not == last_hop_pool_before
|
909
|
+
end
|
910
|
+
|
911
|
+
it "works this way" do
|
912
|
+
# To set it
|
913
|
+
@virtual_server.set_last_hop_pool(:last_hop_pool => @test_pool_name)
|
914
|
+
# To unset it
|
915
|
+
@virtual_server.set_last_hop_pool(:last_hop_pool =>"")
|
916
|
+
end
|
917
|
+
end
|
918
|
+
|
919
|
+
describe "#set_protocol" do
|
920
|
+
it "Sets the protocols supported by the specified virtual servers, one of IP, TCP or UDP." do
|
921
|
+
protocol_before = @virtual_server.protocol
|
922
|
+
@virtual_server.set_protocol(:protocol => IControl::Common::ProtocolType::PROTOCOL_TCP)
|
923
|
+
@virtual_server.protocol.should == protocol_before
|
924
|
+
end
|
925
|
+
|
926
|
+
it "works this way" do
|
927
|
+
@virtual_server.set_protocol(:protocol => IControl::Common::ProtocolType::PROTOCOL_TCP)
|
928
|
+
end
|
929
|
+
end
|
930
|
+
|
931
|
+
describe "#set_rate_class" do
|
932
|
+
|
933
|
+
before(:each) do
|
934
|
+
@rate_class_name = "test_rate_class"
|
935
|
+
IControl::LocalLB::RateClass.create(:rate_class => @rate_class_name,:base_rates => {:rate => 1,:unit => IControl::LocalLB::RateClass::UnitType::UNIT_BPS})
|
936
|
+
@rate_class = IControl::LocalLB::RateClass.find(@rate_class_name)
|
937
|
+
end
|
938
|
+
|
939
|
+
after(:each) do
|
940
|
+
@virtual_server.set_rate_class(:rate_class => "")
|
941
|
+
@rate_class.delete_rate_class
|
942
|
+
end
|
943
|
+
|
944
|
+
it "Sets the rate classes that will be used to rate limit the traffic." do
|
945
|
+
rate_class_before = @virtual_server.rate_class
|
946
|
+
@virtual_server.set_rate_class(:rate_class => @rate_class_name)
|
947
|
+
@virtual_server.rate_class.should_not == rate_class_before
|
948
|
+
end
|
949
|
+
|
950
|
+
it "works this way" do
|
951
|
+
# To set the rate_class
|
952
|
+
@virtual_server.set_rate_class(:rate_class => @rate_class_name)
|
953
|
+
# To unset the rate class
|
954
|
+
@virtual_server.set_rate_class(:rate_class => "")
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
describe "#set_snat_automap" do
|
959
|
+
it "Sets the SNAT automap state for the specified virtual servers." do
|
960
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
961
|
+
@virtual_server.set_snat_automap
|
962
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_AUTOMAP
|
963
|
+
end
|
964
|
+
|
965
|
+
end
|
966
|
+
|
967
|
+
describe "#set_snat_none" do
|
968
|
+
it "Sets the state to use no SNATs for the specified virtual servers." do
|
969
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
970
|
+
@virtual_server.set_snat_automap
|
971
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_AUTOMAP
|
972
|
+
@virtual_server.set_snat_none
|
973
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
974
|
+
end
|
975
|
+
|
976
|
+
end
|
977
|
+
|
978
|
+
describe "#set_snat_pool" do
|
979
|
+
|
980
|
+
before(:each) do
|
981
|
+
@snat_pool_name = "test_snat_pool"
|
982
|
+
IControl::LocalLB::SNATPool.create(:snat_pool => @snat_pool_name,:translation_addresses => ["192.168.99.98"])
|
983
|
+
end
|
984
|
+
|
985
|
+
after(:each) do
|
986
|
+
@virtual_server.set_snat_none
|
987
|
+
IControl::LocalLB::SNATPool.find(@snat_pool_name).delete_snat_pool
|
988
|
+
end
|
989
|
+
|
990
|
+
it "Sets the SNAT pools to be used in iSNAT configurations for the specified virtual servers." do
|
991
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_NONE
|
992
|
+
@virtual_server.set_snat_pool(:snatpool => @snat_pool_name)
|
993
|
+
@virtual_server.snat_type.should == IControl::LocalLB::SnatType::SNAT_TYPE_SNATPOOL
|
994
|
+
end
|
995
|
+
|
996
|
+
it "works this way" do
|
997
|
+
@virtual_server.set_snat_pool(:snatpool => @snat_pool_name)
|
998
|
+
end
|
999
|
+
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
describe "#set_source_port_behavior" do
|
1003
|
+
it "Sets the source port behavior for the specified virtual servers." do
|
1004
|
+
source_port_behavior_before = @virtual_server.source_port_behavior
|
1005
|
+
@virtual_server.set_source_port_behavior(:source_port_behavior => IControl::Common::SourcePortBehavior::SOURCE_PORT_CHANGE)
|
1006
|
+
@virtual_server.source_port_behavior.should_not == source_port_behavior_before
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
it "works this way" do
|
1010
|
+
@virtual_server.set_source_port_behavior(:source_port_behavior => IControl::Common::SourcePortBehavior::SOURCE_PORT_CHANGE)
|
1011
|
+
end
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
describe "#set_translate_address_state" do
|
1015
|
+
it "Sets the address translation states for the specified virtual servers. Enables or disables address translation." do
|
1016
|
+
translate_address_state_before = @virtual_server.translate_address_state
|
1017
|
+
@virtual_server.set_translate_address_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
1018
|
+
@virtual_server.translate_address_state.should_not == translate_address_state_before
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
it "works this way" do
|
1022
|
+
@virtual_server.set_translate_address_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
describe "#set_translate_port_state" do
|
1027
|
+
it "Sets the port translation states for the specified virtual servers. Enables or disables port translation." do
|
1028
|
+
translate_port_state_before = @virtual_server.translate_port_state
|
1029
|
+
@virtual_server.set_translate_port_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
1030
|
+
@virtual_server.translate_port_state.should_not == translate_port_state_before
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
it "works this way" do
|
1034
|
+
@virtual_server.set_translate_port_state(:state => IControl::Common::EnabledState::STATE_DISABLED)
|
1035
|
+
end
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
describe "#set_type" do
|
1039
|
+
it "Sets the types for the specified virtual servers." do
|
1040
|
+
type_before = @virtual_server.type
|
1041
|
+
@virtual_server.set_type(:type => IControl::LocalLB::VirtualServer::VirtualServerType::RESOURCE_TYPE_REJECT)
|
1042
|
+
@virtual_server.type.should_not == type_before
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
it "works this way" do
|
1046
|
+
@virtual_server.set_type(:type => IControl::LocalLB::VirtualServer::VirtualServerType::RESOURCE_TYPE_REJECT)
|
1047
|
+
end
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
describe "#set_vlan" do
|
1051
|
+
|
1052
|
+
before(:each) do
|
1053
|
+
@vlan_name = "vlan_test"
|
1054
|
+
IControl::Networking::VLAN.create(:vlan => @vlan_name,
|
1055
|
+
:vlan_ids => 199,
|
1056
|
+
:members => [],
|
1057
|
+
:timeout => 20,
|
1058
|
+
:mac_masquerade_address => "",
|
1059
|
+
:failsafe_states => IControl::Common::EnabledState::STATE_DISABLED)
|
1060
|
+
@vlan = IControl::Networking::VLAN.find(@vlan_name)
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
after(:each) do
|
1064
|
+
@virtual_server.set_vlan(:vlan => {:vlans => [],:state => IControl::Common::EnabledState::STATE_ENABLED})
|
1065
|
+
@vlan.delete_vlan
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
it "Sets VLANs to the list of VLANs on which access to the specified Virtual Servers are enabled/disabled." do
|
1069
|
+
@virtual_server.vlan.vlans.should be_nil
|
1070
|
+
@virtual_server.set_vlan(:vlan => {:vlans => [@vlan_name],:state => IControl::Common::EnabledState::STATE_ENABLED})
|
1071
|
+
@virtual_server.vlan.vlans.should_not be_nil
|
1072
|
+
@virtual_server.vlan.vlans.should include(@vlan_name)
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
it "works this way" do
|
1076
|
+
@virtual_server.set_vlan(:vlan => {:vlans => ["vlan_test"],:state => IControl::Common::EnabledState::STATE_ENABLED})
|
1077
|
+
end
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
describe "#set_wildmask" do
|
1081
|
+
it "Sets the wildmasks for the specified virtual servers." do
|
1082
|
+
wildmask_before = @virtual_server.wildmask
|
1083
|
+
@virtual_server.set_wildmask(:wildmask => "255.255.255.255")
|
1084
|
+
@virtual_server.wildmask.should == wildmask_before
|
1085
|
+
end
|
1086
|
+
|
1087
|
+
it "works this way" do
|
1088
|
+
@virtual_server.set_wildmask(:wildmask => "255.255.255.255")
|
1089
|
+
end
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
describe "#remove_all_authentication_profiles" do
|
1093
|
+
it "Removes all authentication profiles from the specified virtual servers." do
|
1094
|
+
lambda { @virtual_server.remove_all_authentication_profiles }.should_not raise_exception
|
1095
|
+
end
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
describe "#remove_all_clone_pools" do
|
1099
|
+
it "Removes all clone pools from the specified virtual servers." do
|
1100
|
+
lambda { @virtual_server.remove_all_clone_pools }.should_not raise_exception
|
1101
|
+
end
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
describe "#remove_all_httpclass_profiles" do
|
1105
|
+
it "Removes all HTTP class profiles from the specified virtual servers." do
|
1106
|
+
lambda { @virtual_server.remove_all_httpclass_profiles }.should_not raise_exception
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
describe "#remove_all_persistence_profiles" do
|
1111
|
+
it "Removes all persistence profiles from the specified virtual servers." do
|
1112
|
+
lambda { @virtual_server.remove_all_persistence_profiles }.should_not raise_exception
|
1113
|
+
end
|
1114
|
+
end
|
1115
|
+
|
1116
|
+
describe "#remove_all_profiles" do
|
1117
|
+
it "Removes all profiles from the specified virtual servers." do
|
1118
|
+
lambda { @virtual_server.remove_all_profiles }.should_not raise_exception
|
1119
|
+
end
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
describe "#remove_all_rules" do
|
1123
|
+
it "Removes all rules from the specified virtual servers." do
|
1124
|
+
lambda { @virtual_server.remove_all_rules }.should_not raise_exception
|
1125
|
+
end
|
1126
|
+
end
|
1127
|
+
|
1128
|
+
describe "#remove_authentication_profile" do
|
1129
|
+
|
1130
|
+
before(:each) do
|
1131
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
it "Removes authentication profiles to the specified virtual servers." do
|
1135
|
+
@virtual_server.authentication_profile.should be_nil
|
1136
|
+
@virtual_server.add_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
1137
|
+
@virtual_server.authentication_profile.first.profile_name.should == "ldap"
|
1138
|
+
@virtual_server.remove_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
1139
|
+
@virtual_server.authentication_profile.should be_nil
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
it "works this way" do
|
1143
|
+
@virtual_server.add_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
1144
|
+
@virtual_server.remove_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
1145
|
+
end
|
1146
|
+
end
|
1147
|
+
|
1148
|
+
describe "#remove_clone_pool" do
|
1149
|
+
|
1150
|
+
before(:each) do
|
1151
|
+
@test_pool_name="test_pool"
|
1152
|
+
IControl::LocalLB::Pool.create(:pool_name => @test_pool_name,
|
1153
|
+
:lb_method => IControl::LocalLB::LBMethod::LB_METHOD_ROUND_ROBIN,
|
1154
|
+
:members => [{:address => "192.168.50.1",:port => "80"},
|
1155
|
+
{:address => "192.168.50.2",:port => "80"}
|
1156
|
+
])
|
1157
|
+
@test_pool = IControl::LocalLB::Pool.find(@test_pool_name)
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
after(:each) do
|
1161
|
+
@virtual_server.remove_all_clone_pools
|
1162
|
+
@test_pool.delete_pool
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
it " Removes clone pools to the specified virtual servers." do
|
1166
|
+
@virtual_server.clone_pool.should be_nil
|
1167
|
+
@virtual_server.add_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}])
|
1168
|
+
@virtual_server.clone_pool.first.pool_name.should == @test_pool_name
|
1169
|
+
@virtual_server.remove_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,
|
1170
|
+
:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}])
|
1171
|
+
@virtual_server.clone_pool.should be_nil
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
it "works this way" do
|
1175
|
+
@virtual_server.add_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}] )
|
1176
|
+
@virtual_server.remove_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,
|
1177
|
+
:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}])
|
1178
|
+
end
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
describe "#remove_httpclass_profile" do
|
1182
|
+
|
1183
|
+
before(:each) do
|
1184
|
+
@profile_http_class_name = "test_profile_http_class"
|
1185
|
+
IControl::LocalLB::ProfileHttpClass.create(:profile_name => @profile_http_class_name)
|
1186
|
+
@profile_http_class = IControl::LocalLB::ProfileHttpClass.find("test_profile_http_class")
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
after(:each) do
|
1190
|
+
@virtual_server.remove_all_httpclass_profiles
|
1191
|
+
@profile_http_class.delete_profile
|
1192
|
+
end
|
1193
|
+
|
1194
|
+
it "Removes HTTP class profiles to the specified virtual servers." do
|
1195
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1196
|
+
@virtual_server.httpclass_profile.should be_nil
|
1197
|
+
@virtual_server.add_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
1198
|
+
@virtual_server.httpclass_profile.first.profile_name.should == @profile_http_class_name
|
1199
|
+
@virtual_server.remove_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
1200
|
+
@virtual_server.httpclass_profile.should be_nil
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
it "works this way" do
|
1204
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1205
|
+
@virtual_server.add_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
1206
|
+
@virtual_server.remove_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
1207
|
+
end
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
describe "#remove_persistence_profile" do
|
1211
|
+
it "Removes persistence profiles to the specified virtual servers." do
|
1212
|
+
@virtual_server.persistence_profile.should be_nil
|
1213
|
+
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
1214
|
+
@virtual_server.persistence_profile.should_not be_nil
|
1215
|
+
@virtual_server.persistence_profile.first.profile_name.should == "dest_addr"
|
1216
|
+
@virtual_server.remove_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
1217
|
+
@virtual_server.persistence_profile.should be_nil
|
1218
|
+
end
|
1219
|
+
|
1220
|
+
it "works this way" do
|
1221
|
+
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
1222
|
+
end
|
1223
|
+
end
|
1224
|
+
|
1225
|
+
describe "#remove_profile" do
|
1226
|
+
it "Removes profiles to the specified virtual servers." do
|
1227
|
+
before = @virtual_server.profile.length
|
1228
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1229
|
+
@virtual_server.profile.length.should_not == before
|
1230
|
+
@virtual_server.profile.first.profile_context.should == IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL
|
1231
|
+
@virtual_server.remove_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1232
|
+
@virtual_server.profile.length.should == before
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
it "works this way" do
|
1236
|
+
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1237
|
+
@virtual_server.remove_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1238
|
+
end
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
describe "#remove_rule" do
|
1242
|
+
|
1243
|
+
before(:each) do
|
1244
|
+
@rule_name = "test_rule"
|
1245
|
+
IControl::LocalLB::Rule.create(:rule => {:rule_name => @rule_name,:rule_definition => ""})
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
after(:each) do
|
1249
|
+
@virtual_server.remove_all_rules
|
1250
|
+
IControl::LocalLB::Rule.find(@rule_name).delete_rule
|
1251
|
+
end
|
1252
|
+
|
1253
|
+
it "Removes/associates rules to the specified virtual servers." do
|
1254
|
+
@virtual_server.rule.should be_nil
|
1255
|
+
@virtual_server.add_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
1256
|
+
@virtual_server.rule.should_not be_nil
|
1257
|
+
@virtual_server.remove_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
1258
|
+
@virtual_server.rule.should be_nil
|
1259
|
+
end
|
1260
|
+
|
1261
|
+
it "works this way" do
|
1262
|
+
@virtual_server.add_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
1263
|
+
@virtual_server.remove_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
1264
|
+
end
|
1265
|
+
end
|
1266
|
+
|
1267
|
+
|
1268
|
+
end
|