icontrol 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/icontrol/base.rb
CHANGED
@@ -3,15 +3,15 @@ module IControl
|
|
3
3
|
class ULong64 < IControl::Base::Struct
|
4
4
|
def to_f
|
5
5
|
retVal = 0.0
|
6
|
-
if
|
7
|
-
retVal =
|
6
|
+
if high >=0
|
7
|
+
retVal = high << 32 & 0xffff0000
|
8
8
|
else
|
9
|
-
retVal = ((
|
9
|
+
retVal = ((high & 0x7fffffff) << 32) + (0x80000000 << 32)
|
10
10
|
end
|
11
|
-
if
|
12
|
-
retVal +=
|
11
|
+
if low >=0
|
12
|
+
retVal += low
|
13
13
|
else
|
14
|
-
retVal += ((
|
14
|
+
retVal += ((low & 0x7fffffff) + 0x7fffffff)
|
15
15
|
end
|
16
16
|
return retVal;
|
17
17
|
end
|
@@ -5,9 +5,10 @@ class BasicSequence
|
|
5
5
|
@conversion_method = conversion_method
|
6
6
|
end
|
7
7
|
def from_soap(xml)
|
8
|
-
|
9
|
-
return
|
10
|
-
return
|
8
|
+
return_value = [*xml[:item]].map { |i| i.send(@conversion_method) }
|
9
|
+
return return_value.first if return_value.length == 1
|
10
|
+
return nil if return_value.length == 0
|
11
|
+
return return_value
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
@@ -71,7 +72,7 @@ module IControl
|
|
71
72
|
else
|
72
73
|
if aux.length == 1
|
73
74
|
# If is just 1 element we return the element
|
74
|
-
return aux
|
75
|
+
return aux.first
|
75
76
|
else
|
76
77
|
#otherwise is empty so we return a nil
|
77
78
|
nil
|
@@ -82,11 +83,9 @@ module IControl
|
|
82
83
|
|
83
84
|
class SequenceSequence
|
84
85
|
def self.from_soap(xml)
|
85
|
-
return
|
86
|
+
return [] unless xml[:item]
|
86
87
|
xml[:item][:type] = "A:Array"
|
87
|
-
|
88
|
-
return nil if object.compact.length == 0
|
89
|
-
return object
|
88
|
+
return [*Mappings.map_object(xml[:item])].compact
|
90
89
|
end
|
91
90
|
end
|
92
91
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),"..","..",'/spec_helper'))
|
2
|
+
|
3
|
+
describe IControl::Base::Sequence do
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
describe "#from_soap" do
|
8
|
+
|
9
|
+
EMPTY_SEQUENCE =<<END
|
10
|
+
<E:Envelope
|
11
|
+
xmlns:E="http://schemas.xmlsoap.org/soap/envelope/"
|
12
|
+
xmlns:A="http://schemas.xmlsoap.org/soap/encoding/"
|
13
|
+
xmlns:s="http://www.w3.org/2001/XMLSchema-instance"
|
14
|
+
xmlns:y="http://www.w3.org/2001/XMLSchema"
|
15
|
+
xmlns:iControl="urn:iControl"
|
16
|
+
E:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
17
|
+
<E:Body>
|
18
|
+
<m:get_httpclass_profileResponse
|
19
|
+
xmlns:m="urn:iControl:LocalLB/VirtualServer">
|
20
|
+
<return
|
21
|
+
s:type="A:Array"
|
22
|
+
A:arrayType="iControl:LocalLB.VirtualServer.VirtualServerHttpClass[][1]">
|
23
|
+
<item
|
24
|
+
A:arrayType="iControl:LocalLB.VirtualServer.VirtualServerHttpClass[0]"></item>
|
25
|
+
</return>
|
26
|
+
</m:get_httpclass_profileResponse>
|
27
|
+
</E:Body>
|
28
|
+
</E:Envelope>
|
29
|
+
END
|
30
|
+
it "should allow to be loaded from soap" do
|
31
|
+
IControl::Base.map_response(EMPTY_SEQUENCE).should == []
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -34,7 +34,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "Adds/associates authentication profiles to the specified virtual servers." do
|
37
|
-
@virtual_server.authentication_profile.should
|
37
|
+
@virtual_server.authentication_profile.should == []
|
38
38
|
@virtual_server.add_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
39
39
|
@virtual_server.authentication_profile.first.profile_name.should == "ldap"
|
40
40
|
end
|
@@ -62,7 +62,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "Adds/associates clone pools to the specified virtual servers." do
|
65
|
-
@virtual_server.clone_pool.should
|
65
|
+
@virtual_server.clone_pool.should == []
|
66
66
|
@virtual_server.add_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}] )
|
67
67
|
@virtual_server.clone_pool.first.pool_name.should == @test_pool_name
|
68
68
|
end
|
@@ -87,7 +87,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
87
87
|
|
88
88
|
it "Adds/associates HTTP class profiles to the specified virtual servers." do
|
89
89
|
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
90
|
-
@virtual_server.httpclass_profile.should
|
90
|
+
@virtual_server.httpclass_profile.should == []
|
91
91
|
@virtual_server.add_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
92
92
|
@virtual_server.httpclass_profile.first.profile_name.should == @profile_http_class_name
|
93
93
|
end
|
@@ -102,7 +102,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
102
102
|
|
103
103
|
describe "#add_persistence_profile" do
|
104
104
|
it "Adds/associates persistence profiles to the specified virtual servers." do
|
105
|
-
@virtual_server.persistence_profile.should
|
105
|
+
@virtual_server.persistence_profile.should == []
|
106
106
|
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
107
107
|
@virtual_server.persistence_profile.should_not be_nil
|
108
108
|
@virtual_server.persistence_profile.first.profile_name.should == "dest_addr"
|
@@ -140,7 +140,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it "Adds/associates rules to the specified virtual servers." do
|
143
|
-
@virtual_server.rule.should
|
143
|
+
@virtual_server.rule.should == []
|
144
144
|
@virtual_server.add_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
145
145
|
@virtual_server.rule.should_not be_nil
|
146
146
|
end
|
@@ -248,7 +248,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
248
248
|
end
|
249
249
|
|
250
250
|
it "Gets the lists of authentication profiles the specified virtual servers are associated with." do
|
251
|
-
@virtual_server.authentication_profile.should
|
251
|
+
@virtual_server.authentication_profile.should == [] # It's tested in the the setter method
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
@@ -258,7 +258,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
258
258
|
end
|
259
259
|
|
260
260
|
it "Gets the lists of clone pools the specified virtual servers are associated with." do
|
261
|
-
@virtual_server.clone_pool.should
|
261
|
+
@virtual_server.clone_pool.should == [] # It's tested in the the setter method
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
@@ -433,7 +433,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
433
433
|
end
|
434
434
|
|
435
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
|
436
|
+
@virtual_server.httpclass_profile.should == []
|
437
437
|
end
|
438
438
|
|
439
439
|
it "works this way" do
|
@@ -467,7 +467,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
467
467
|
end
|
468
468
|
|
469
469
|
it "Returns the module scores for the specified virtual servers." do
|
470
|
-
@virtual_server.module_score.should
|
470
|
+
@virtual_server.module_score.should == []
|
471
471
|
end
|
472
472
|
|
473
473
|
it "works this way" do
|
@@ -505,7 +505,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
505
505
|
end
|
506
506
|
|
507
507
|
it "Gets the lists of persistence profiles the specified virtual servers are associated with." do
|
508
|
-
@virtual_server.persistence_profile.should
|
508
|
+
@virtual_server.persistence_profile.should == []
|
509
509
|
end
|
510
510
|
|
511
511
|
it "works this way" do
|
@@ -521,7 +521,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
521
521
|
end
|
522
522
|
|
523
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
|
524
|
+
@virtual_server.persistence_record(:persistence_mode => IControl::LocalLB::PersistenceMode::PERSISTENCE_MODE_NONE).should == []
|
525
525
|
end
|
526
526
|
|
527
527
|
it "works this way" do
|
@@ -586,7 +586,7 @@ describe IControl::LocalLB::VirtualServer do
|
|
586
586
|
end
|
587
587
|
|
588
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
|
589
|
+
@virtual_server.rule.should == []
|
590
590
|
end
|
591
591
|
end
|
592
592
|
|
@@ -1132,11 +1132,11 @@ describe IControl::LocalLB::VirtualServer do
|
|
1132
1132
|
end
|
1133
1133
|
|
1134
1134
|
it "Removes authentication profiles to the specified virtual servers." do
|
1135
|
-
@virtual_server.authentication_profile.should
|
1135
|
+
@virtual_server.authentication_profile.should == []
|
1136
1136
|
@virtual_server.add_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
1137
1137
|
@virtual_server.authentication_profile.first.profile_name.should == "ldap"
|
1138
1138
|
@virtual_server.remove_authentication_profile(:profiles => [{:profile_name => "ldap",:priority => 1}] )
|
1139
|
-
@virtual_server.authentication_profile.should
|
1139
|
+
@virtual_server.authentication_profile.should == []
|
1140
1140
|
end
|
1141
1141
|
|
1142
1142
|
it "works this way" do
|
@@ -1163,12 +1163,12 @@ describe IControl::LocalLB::VirtualServer do
|
|
1163
1163
|
end
|
1164
1164
|
|
1165
1165
|
it " Removes clone pools to the specified virtual servers." do
|
1166
|
-
@virtual_server.clone_pool.should
|
1166
|
+
@virtual_server.clone_pool.should == []
|
1167
1167
|
@virtual_server.add_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}])
|
1168
1168
|
@virtual_server.clone_pool.first.pool_name.should == @test_pool_name
|
1169
1169
|
@virtual_server.remove_clone_pool(:clone_pools => [{:pool_name => @test_pool_name,
|
1170
1170
|
:type => IControl::LocalLB::ClonePoolType::CLONE_POOL_TYPE_CLIENTSIDE}])
|
1171
|
-
@virtual_server.clone_pool.should
|
1171
|
+
@virtual_server.clone_pool.should == []
|
1172
1172
|
end
|
1173
1173
|
|
1174
1174
|
it "works this way" do
|
@@ -1193,11 +1193,11 @@ describe IControl::LocalLB::VirtualServer do
|
|
1193
1193
|
|
1194
1194
|
it "Removes HTTP class profiles to the specified virtual servers." do
|
1195
1195
|
@virtual_server.add_profile(:profiles => [{:profile_name => "http",:profile_context => IControl::LocalLB::ProfileContextType::PROFILE_CONTEXT_TYPE_ALL}])
|
1196
|
-
@virtual_server.httpclass_profile.should
|
1196
|
+
@virtual_server.httpclass_profile.should == []
|
1197
1197
|
@virtual_server.add_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
1198
1198
|
@virtual_server.httpclass_profile.first.profile_name.should == @profile_http_class_name
|
1199
1199
|
@virtual_server.remove_httpclass_profile(:profiles => [{:profile_name => @profile_http_class_name,:priority => 1}])
|
1200
|
-
@virtual_server.httpclass_profile.should
|
1200
|
+
@virtual_server.httpclass_profile.should == []
|
1201
1201
|
end
|
1202
1202
|
|
1203
1203
|
it "works this way" do
|
@@ -1209,12 +1209,12 @@ describe IControl::LocalLB::VirtualServer do
|
|
1209
1209
|
|
1210
1210
|
describe "#remove_persistence_profile" do
|
1211
1211
|
it "Removes persistence profiles to the specified virtual servers." do
|
1212
|
-
@virtual_server.persistence_profile.should
|
1212
|
+
@virtual_server.persistence_profile.should == []
|
1213
1213
|
@virtual_server.add_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
1214
1214
|
@virtual_server.persistence_profile.should_not be_nil
|
1215
1215
|
@virtual_server.persistence_profile.first.profile_name.should == "dest_addr"
|
1216
1216
|
@virtual_server.remove_persistence_profile(:profiles => [{:profile_name => "dest_addr",:default_profile => false}] )
|
1217
|
-
@virtual_server.persistence_profile.should
|
1217
|
+
@virtual_server.persistence_profile.should == []
|
1218
1218
|
end
|
1219
1219
|
|
1220
1220
|
it "works this way" do
|
@@ -1251,11 +1251,11 @@ describe IControl::LocalLB::VirtualServer do
|
|
1251
1251
|
end
|
1252
1252
|
|
1253
1253
|
it "Removes/associates rules to the specified virtual servers." do
|
1254
|
-
@virtual_server.rule.should
|
1254
|
+
@virtual_server.rule.should == []
|
1255
1255
|
@virtual_server.add_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
1256
1256
|
@virtual_server.rule.should_not be_nil
|
1257
1257
|
@virtual_server.remove_rule(:rules => [{:rule_name => @rule_name ,:priority => 1}])
|
1258
|
-
@virtual_server.rule.should
|
1258
|
+
@virtual_server.rule.should == []
|
1259
1259
|
end
|
1260
1260
|
|
1261
1261
|
it "works this way" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 7
|
9
|
+
version: 0.3.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jose Fernandez (magec)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-02-15 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -360,6 +360,7 @@ files:
|
|
360
360
|
- .yardopts
|
361
361
|
- LICENSE
|
362
362
|
- README.rdoc
|
363
|
+
- spec/icontrol/base/sequence_spec.rb
|
363
364
|
- spec/icontrol/base/struct_spec.rb
|
364
365
|
- spec/icontrol/common_spec.rb
|
365
366
|
- spec/icontrol/local_lb/pool_member_spec.rb
|
@@ -381,7 +382,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
381
382
|
requirements:
|
382
383
|
- - ">="
|
383
384
|
- !ruby/object:Gem::Version
|
384
|
-
hash: -
|
385
|
+
hash: -374151087
|
385
386
|
segments:
|
386
387
|
- 0
|
387
388
|
version: "0"
|
@@ -401,6 +402,7 @@ signing_key:
|
|
401
402
|
specification_version: 3
|
402
403
|
summary: A ruby client to the BigIP F5
|
403
404
|
test_files:
|
405
|
+
- spec/icontrol/base/sequence_spec.rb
|
404
406
|
- spec/icontrol/base/struct_spec.rb
|
405
407
|
- spec/icontrol/common_spec.rb
|
406
408
|
- spec/icontrol/local_lb/pool_member_spec.rb
|