vcloud-edge_gateway 0.0.2 → 0.1.0

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.
Files changed (31) hide show
  1. data/CHANGELOG.md +11 -0
  2. data/jenkins_integration_tests.sh +8 -0
  3. data/lib/vcloud/edge_gateway/configuration_generator/load_balancer_service.rb +1 -7
  4. data/lib/vcloud/edge_gateway/configuration_generator/nat_service.rb +16 -6
  5. data/lib/vcloud/edge_gateway/edge_gateway_configuration.rb +34 -9
  6. data/lib/vcloud/edge_gateway/load_balancer_configuration_differ.rb +28 -0
  7. data/lib/vcloud/edge_gateway/version.rb +1 -1
  8. data/lib/vcloud/edge_gateway.rb +1 -0
  9. data/lib/vcloud/edge_gateway_services.rb +9 -4
  10. data/lib/vcloud/schema/edge_gateway.rb +2 -1
  11. data/lib/vcloud/schema/load_balancer_service.rb +3 -2
  12. data/spec/erb_helper.rb +1 -1
  13. data/spec/integration/edge_gateway/data/load_balancer_config.yaml.erb +24 -0
  14. data/spec/integration/edge_gateway/data/load_balancer_empty.yaml.erb +4 -0
  15. data/spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.erb +15 -0
  16. data/spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.erb +13 -0
  17. data/spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.erb +12 -0
  18. data/spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.erb +54 -0
  19. data/spec/integration/edge_gateway/edge_gateway_services_spec.rb +52 -23
  20. data/spec/integration/edge_gateway/load_balancer_service_spec.rb +204 -0
  21. data/spec/integration/edge_gateway/nat_service_spec.rb +7 -2
  22. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_http-output.yaml +2 -2
  23. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_https-output.yaml +2 -0
  24. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_mixed_complex-output.yaml +1 -0
  25. data/spec/vcloud/edge_gateway/configuration_generator/load_balancer_service_spec.rb +2 -0
  26. data/spec/vcloud/edge_gateway/configuration_generator/nat_service_spec.rb +198 -94
  27. data/spec/vcloud/edge_gateway/edge_gateway_configuration_spec.rb +1043 -88
  28. data/spec/vcloud/edge_gateway/load_balancer_configuration_differ_spec.rb +160 -0
  29. data/spec/vcloud/edge_gateway/load_balancer_schema_validation_spec.rb +4 -6
  30. data/vcloud-edge_gateway.gemspec +1 -1
  31. metadata +24 -5
@@ -4,179 +4,1134 @@ module Vcloud
4
4
  module EdgeGateway
5
5
  describe EdgeGatewayConfiguration do
6
6
 
7
- context "whether update is required" do
7
+ before(:each) do
8
+ @edge_gateway_id = "1111111-7b54-43dd-9eb1-631dd337e5a7"
9
+ @edge_gateway = double(:edge_gateway,
10
+ :vcloud_gateway_interface_by_id => {
11
+ Network: {
12
+ :type => "application/vnd.vmware.admin.network+xml",
13
+ :name => 'ane012345',
14
+ :href => 'https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa'
15
+ }
16
+ })
17
+ Vcloud::Core::EdgeGateway.stub(:get_by_name).with(@edge_gateway_id).and_return(@edge_gateway)
18
+ mock_edge_gateway_interface = double(
19
+ :mock_edge_gateway_interface,
20
+ :network_name => "ane012345",
21
+ :network_id => "01234567-1234-1234-1234-0123456789aa",
22
+ :network_href => 'https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa',
23
+ )
24
+ @edge_gw_interface_list = [ mock_edge_gateway_interface ]
25
+ end
26
+
27
+ context "config object doesn't require methods called in a particular order" do
8
28
 
9
29
  before(:each) do
10
- @edge_gateway_id = "1111111-7b54-43dd-9eb1-631dd337e5a7"
11
- @edge_gateway = double(:edge_gateway,
12
- :vcloud_gateway_interface_by_id => {
13
- Network: {
14
- :name => 'ane012345',
15
- :href => 'https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa'
16
- }
17
- })
18
- Vcloud::Core::EdgeGateway.stub(:get_by_name).with(@edge_gateway_id).and_return(@edge_gateway)
30
+ @test_config = {
31
+ :gateway => @edge_gateway_id,
32
+ :nat_service => test_nat_config,
33
+ :firewall_service => test_firewall_config,
34
+ :load_balancer_service => test_load_balancer_config,
35
+ }
36
+ @remote_config = {
37
+ :FirewallService => different_firewall_config,
38
+ :NatService => different_nat_config,
39
+ :LoadBalancerService => different_load_balancer_config,
40
+ }
41
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
42
+ @test_config,
43
+ @remote_config,
44
+ @edge_gw_interface_list
45
+ )
19
46
  end
20
47
 
21
- it "requires update to both when both configurations are changed" do
22
- test_config = {
23
- :gateway=> @edge_gateway_id,
24
- :nat_service=> test_nat_config,
25
- :firewall_service=> test_firewall_config
26
- }
48
+ it "if `config` is called before `update_required` then config is not empty when it shouldn't be" do
49
+ config = @proposed_config.config
50
+ expect(config.empty?).to be_false
51
+ end
52
+
53
+ end
27
54
 
28
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(test_config)
55
+ context "all configurations are changed" do
29
56
 
30
- remote_config = {
31
- :FirewallService=> different_firewall_config,
32
- :NatService=> different_nat_config
57
+ before(:each) do
58
+ @test_config = {
59
+ :gateway => @edge_gateway_id,
60
+ :nat_service => test_nat_config,
61
+ :firewall_service => test_firewall_config,
62
+ :load_balancer_service => test_load_balancer_config
63
+ }
64
+ @remote_config = {
65
+ :FirewallService => different_firewall_config,
66
+ :NatService => different_nat_config,
67
+ :LoadBalancerService => different_load_balancer_config
33
68
  }
69
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
70
+ @test_config,
71
+ @remote_config,
72
+ @edge_gw_interface_list
73
+ )
74
+ end
34
75
 
35
- expect(proposed_config.update_required?(remote_config)).to be_true
76
+ it "requires update" do
77
+ expect(@proposed_config.update_required?).to be(true)
78
+ end
36
79
 
37
- proposed_firewall_config = proposed_config.config[:FirewallService]
80
+ it "proposed config contains firewall config in the form expected" do
81
+ proposed_firewall_config = @proposed_config.config[:FirewallService]
38
82
  expect(proposed_firewall_config).to eq(expected_firewall_config)
83
+ end
39
84
 
40
- proposed_nat_config = proposed_config.config[:NatService]
85
+ it "proposed config contains nat config in the form expected" do
86
+ proposed_nat_config = @proposed_config.config[:NatService]
41
87
  expect(proposed_nat_config).to eq(expected_nat_config)
42
88
  end
43
89
 
44
- it "requires update to firewall only when firewall has changed and nat has not" do
45
- test_config = {
46
- :gateway=> @edge_gateway_id,
47
- :nat_service=> test_nat_config,
48
- :firewall_service=> test_firewall_config
90
+ it "proposed config contains load balancer config in the form expected" do
91
+ proposed_load_balancer_config = @proposed_config.config[:LoadBalancerService]
92
+ expect(proposed_load_balancer_config).to eq(expected_load_balancer_config)
93
+ end
94
+
95
+ end
96
+
97
+ context "firewall config has changed and nat has not, load_balancer absent" do
98
+
99
+ before(:each) do
100
+ @test_config = {
101
+ :gateway => @edge_gateway_id,
102
+ :nat_service => test_nat_config,
103
+ :firewall_service => test_firewall_config
104
+ }
105
+ @remote_config = {
106
+ :FirewallService => different_firewall_config,
107
+ :NatService => same_nat_config
49
108
  }
109
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
110
+ @test_config,
111
+ @remote_config,
112
+ @edge_gw_interface_list
113
+ )
114
+ end
50
115
 
51
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(test_config)
116
+ it "requires update" do
117
+ expect(@proposed_config.update_required?).to be(true)
118
+ end
52
119
 
53
- remote_config = {
54
- :FirewallService=> different_firewall_config,
55
- :NatService=> same_nat_config
120
+ it "proposed config contains firewall config in the form expected" do
121
+ proposed_firewall_config = @proposed_config.config[:FirewallService]
122
+ expect(proposed_firewall_config).to eq(expected_firewall_config)
123
+ end
124
+
125
+ it "proposed config does not contain nat config" do
126
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
127
+ end
128
+
129
+ it "proposed config does not contain load_balancer config" do
130
+ expect(@proposed_config.config.key?(:LoadBalancerService)).to be(false)
131
+ end
132
+
133
+ end
134
+
135
+ context "firewall config has changed and nat & load_balancer configs are absent" do
136
+
137
+ before(:each) do
138
+ @test_config = {
139
+ :gateway => @edge_gateway_id,
140
+ :firewall_service => test_firewall_config
141
+ }
142
+ @remote_config = {
143
+ :FirewallService => different_firewall_config,
144
+ :NatService => same_nat_config,
145
+ :LoadBalancerService => same_load_balancer_config,
56
146
  }
147
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
148
+ @test_config,
149
+ @remote_config,
150
+ @edge_gw_interface_list
151
+ )
152
+ end
57
153
 
58
- expect(proposed_config.update_required?(remote_config)).to be_true
154
+ it "requires update" do
155
+ expect(@proposed_config.update_required?).to be(true)
156
+ end
59
157
 
60
- proposed_firewall_config = proposed_config.config[:FirewallService]
158
+ it "proposed config contains firewall config in the form expected" do
159
+ proposed_firewall_config = @proposed_config.config[:FirewallService]
61
160
  expect(proposed_firewall_config).to eq(expected_firewall_config)
161
+ end
162
+
163
+ it "proposed config does not contain nat config" do
164
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
165
+ end
62
166
 
63
- expect(proposed_config.config.key?(:NatService)).to be_false
167
+ it "proposed config does not contain load_balancer config" do
168
+ expect(@proposed_config.config.key?(:LoadBalancerService)).to be(false)
64
169
  end
65
170
 
66
- it "requires update to firewall only when firewall has changed and nat is absent" do
67
- test_config = {
68
- :gateway=> @edge_gateway_id,
69
- :firewall_service=> test_firewall_config
171
+ end
172
+
173
+ context "load_balancer config has changed and firewall & nat have not" do
174
+
175
+ before(:each) do
176
+ @test_config = {
177
+ :gateway => @edge_gateway_id,
178
+ :nat_service => test_nat_config,
179
+ :firewall_service => test_firewall_config,
180
+ :load_balancer_service => test_load_balancer_config,
181
+ }
182
+ @remote_config = {
183
+ :FirewallService => same_firewall_config,
184
+ :NatService => same_nat_config,
185
+ :LoadBalancerService => different_load_balancer_config,
70
186
  }
187
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
188
+ @test_config,
189
+ @remote_config,
190
+ @edge_gw_interface_list
191
+ )
192
+ end
71
193
 
72
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(test_config)
194
+ it "requires update" do
195
+ expect(@proposed_config.update_required?).to be(true)
196
+ end
73
197
 
74
- remote_config = {
75
- :FirewallService=> different_firewall_config,
76
- :NatService=> same_nat_config
198
+ it "proposed config contains load_balancer config in the form expected" do
199
+ proposed_load_balancer_config = @proposed_config.config[:LoadBalancerService]
200
+ expect(proposed_load_balancer_config).to eq(expected_load_balancer_config)
201
+ end
202
+
203
+ it "proposed config does not contain nat config" do
204
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
205
+ end
206
+
207
+ it "proposed config does not contain firewall config" do
208
+ expect(@proposed_config.config.key?(:FirewallService)).to be(false)
209
+ end
210
+
211
+ end
212
+
213
+ context "load_balancer & firewall config have changed and nat has not" do
214
+
215
+ before(:each) do
216
+ @test_config = {
217
+ :gateway => @edge_gateway_id,
218
+ :nat_service => test_nat_config,
219
+ :firewall_service => test_firewall_config,
220
+ :load_balancer_service => test_load_balancer_config,
221
+ }
222
+ @remote_config = {
223
+ :FirewallService => different_firewall_config,
224
+ :NatService => same_nat_config,
225
+ :LoadBalancerService => different_load_balancer_config,
77
226
  }
227
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
228
+ @test_config,
229
+ @remote_config,
230
+ @edge_gw_interface_list
231
+ )
232
+ end
78
233
 
79
- expect(proposed_config.update_required?(remote_config)).to be_true
234
+ it "requires update" do
235
+ expect(@proposed_config.update_required?).to be(true)
236
+ end
237
+
238
+ it "proposed config contains load_balancer config in the form expected" do
239
+ proposed_load_balancer_config = @proposed_config.config[:LoadBalancerService]
240
+ expect(proposed_load_balancer_config).to eq(expected_load_balancer_config)
241
+ end
80
242
 
81
- proposed_firewall_config = proposed_config.config[:FirewallService]
243
+ it "proposed config does not contain nat config" do
244
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
245
+ end
246
+
247
+ it "proposed config contains firewall config in the form expected" do
248
+ proposed_firewall_config = @proposed_config.config[:FirewallService]
82
249
  expect(proposed_firewall_config).to eq(expected_firewall_config)
250
+ end
251
+
252
+ end
253
+
254
+
255
+ context "load_balancer config has changed and firewall & nat are absent" do
256
+
257
+ before(:each) do
258
+ @test_config = {
259
+ :gateway => @edge_gateway_id,
260
+ :load_balancer_service => test_load_balancer_config,
261
+ }
262
+ @remote_config = {
263
+ :FirewallService => same_firewall_config,
264
+ :NatService => same_nat_config,
265
+ :LoadBalancerService => different_load_balancer_config,
266
+ }
267
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
268
+ @test_config,
269
+ @remote_config,
270
+ @edge_gw_interface_list
271
+ )
272
+ end
273
+
274
+ it "requires update" do
275
+ expect(@proposed_config.update_required?).to be(true)
276
+ end
83
277
 
84
- #expect proposed config not to contain nat config
85
- expect(proposed_config.config.key?(:NatService)).to be_false
278
+ it "proposed config contains load_balancer config in the form expected" do
279
+ proposed_load_balancer_config = @proposed_config.config[:LoadBalancerService]
280
+ expect(proposed_load_balancer_config).to eq(expected_load_balancer_config)
86
281
  end
87
282
 
88
- it "does not require change when both configs are present but have not changed" do
89
- test_config = {
90
- :gateway=> @edge_gateway_id,
91
- :nat_service=> test_nat_config,
92
- :firewall_service=> test_firewall_config
283
+ it "proposed config does not contain nat config" do
284
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
285
+ end
286
+
287
+ it "proposed config does not contain firewall config" do
288
+ expect(@proposed_config.config.key?(:FirewallService)).to be(false)
289
+ end
290
+
291
+ end
292
+
293
+ context "all configs are present but haven't changed" do
294
+
295
+ before(:each) do
296
+ @test_config = {
297
+ :gateway => @edge_gateway_id,
298
+ :nat_service => test_nat_config,
299
+ :firewall_service => test_firewall_config,
300
+ :load_balancer_service => test_load_balancer_config,
301
+ }
302
+ @remote_config = {
303
+ :FirewallService => same_firewall_config,
304
+ :NatService => same_nat_config,
305
+ :LoadBalancerService => same_load_balancer_config,
93
306
  }
307
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
308
+ @test_config,
309
+ @remote_config,
310
+ @edge_gw_interface_list
311
+ )
312
+ end
94
313
 
95
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(test_config)
314
+ it "does not require update" do
315
+ expect(@proposed_config.update_required?).to be(false)
316
+ end
96
317
 
97
- remote_config = {
98
- :FirewallService=> same_firewall_config,
99
- :NatService=> same_nat_config
318
+ it "there is no proposed config" do
319
+ expect(@proposed_config.config.empty?).to be(true)
320
+ end
321
+
322
+ end
323
+
324
+ context "firewall config has not changed and nat & load_balancer config is absent" do
325
+
326
+ before(:each) do
327
+ @test_config = {
328
+ :gateway => @edge_gateway_id,
329
+ :firewall_service => test_firewall_config
100
330
  }
331
+ @remote_config = {
332
+ :FirewallService => same_firewall_config,
333
+ :NatService => different_nat_config,
334
+ :LoadBalancerService => different_load_balancer_config,
335
+ }
336
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
337
+ @test_config,
338
+ @remote_config,
339
+ @edge_gw_interface_list
340
+ )
341
+ end
342
+
343
+ it "does not require update" do
344
+ expect(@proposed_config.update_required?).to be(false)
345
+ end
101
346
 
102
- expect(proposed_config.update_required?(remote_config)).to be_false
103
- expect(proposed_config.config.empty?).to be_true
347
+ it "there is no proposed config" do
348
+ expect(@proposed_config.config.empty?).to be(true)
104
349
  end
105
350
 
106
- it "does not require change when firewall is unchanged and nat is absent" do
107
- test_config = {
108
- :gateway=> @edge_gateway_id,
109
- :firewall_service=> test_firewall_config
351
+ end
352
+
353
+ context "no service config is present" do
354
+
355
+ before(:each) do
356
+ @test_config = {
357
+ :gateway => @edge_gateway_id,
358
+ }
359
+ @remote_config = {
360
+ :FirewallService => different_firewall_config,
361
+ :NatService => different_nat_config,
362
+ :LoadBalancerService => different_load_balancer_config,
110
363
  }
364
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
365
+ @test_config,
366
+ @remote_config,
367
+ @edge_gw_interface_list
368
+ )
369
+ end
111
370
 
112
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(test_config)
371
+ it "does not require update" do
372
+ expect(@proposed_config.update_required?).to be(false)
373
+ end
113
374
 
114
- remote_config = {
115
- :FirewallService=> same_firewall_config,
116
- :NatService=> different_nat_config
375
+ it "there is no proposed config" do
376
+ expect(@proposed_config.config.empty?).to be(true)
377
+ end
378
+
379
+ end
380
+
381
+ context "when there is a missing remote LoadBalancerService, we can still update NatService" do
382
+
383
+ before(:each) do
384
+ @test_config = {
385
+ :gateway => @edge_gateway_id,
386
+ :nat_service => test_nat_config,
387
+ }
388
+ @remote_config = {
389
+ :FirewallService => different_firewall_config,
390
+ :NatService => different_nat_config,
117
391
  }
392
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
393
+ @test_config,
394
+ @remote_config,
395
+ @edge_gw_interface_list
396
+ )
397
+ end
398
+
399
+ it "requires update" do
400
+ expect(@proposed_config.update_required?).to be(true)
401
+ end
402
+
403
+ it "proposed config contains nat config in the form expected" do
404
+ proposed_nat_config = @proposed_config.config[:NatService]
405
+ expect(proposed_nat_config).to eq(expected_nat_config)
406
+ end
407
+
408
+ it "proposed config does not contain load balancer config" do
409
+ expect(@proposed_config.config.key?(:LoadBalancerService)).to be(false)
410
+ end
118
411
 
119
- expect(proposed_config.update_required?(remote_config)).to be_false
120
- expect(proposed_config.config.empty?).to be_true
412
+ it "proposed config does not contain firewall config" do
413
+ expect(@proposed_config.config.key?(:FirewallService)).to be(false)
121
414
  end
122
415
 
123
- it "does not require change when both are absent" do
124
- test_config = {
125
- :gateway=> @edge_gateway_id,
416
+ end
417
+
418
+ context "there is no remote FirewallService config, but we are trying to update it" do
419
+
420
+ before(:each) do
421
+ @test_config = {
422
+ :gateway => @edge_gateway_id,
423
+ :firewall_service => test_firewall_config,
424
+ }
425
+ @remote_config = {
426
+ :NatService => different_nat_config,
427
+ :LoadBalancerService => different_load_balancer_config,
126
428
  }
429
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
430
+ @test_config,
431
+ @remote_config,
432
+ @edge_gw_interface_list
433
+ )
434
+ end
127
435
 
128
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(test_config)
436
+ it "requires update" do
437
+ expect(@proposed_config.update_required?).to be(true)
438
+ end
129
439
 
130
- remote_config = {
131
- :FirewallService=> different_firewall_config,
132
- :NatService=> different_nat_config
440
+ it "proposed config contains firewall config in the form expected" do
441
+ proposed_firewall_config = @proposed_config.config[:FirewallService]
442
+ expect(proposed_firewall_config).to eq(expected_firewall_config)
443
+ end
444
+
445
+ it "proposed config does not contain load balancer config" do
446
+ expect(@proposed_config.config.key?(:LoadBalancerService)).to be(false)
447
+ end
448
+
449
+ it "proposed config does not contain nat config" do
450
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
451
+ end
452
+
453
+ end
454
+
455
+ context "there is no remote NatService config, but we are trying to update it" do
456
+
457
+ before(:each) do
458
+ @test_config = {
459
+ :gateway => @edge_gateway_id,
460
+ :nat_service => test_nat_config,
133
461
  }
462
+ @remote_config = {
463
+ :FirewallService => different_firewall_config,
464
+ :LoadBalancerService => different_load_balancer_config,
465
+ }
466
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
467
+ @test_config,
468
+ @remote_config,
469
+ @edge_gw_interface_list
470
+ )
471
+ end
134
472
 
135
- expect(proposed_config.update_required?(remote_config)).to be_false
136
- expect(proposed_config.config.empty?).to be_true
473
+ it "requires update" do
474
+ expect(@proposed_config.update_required?).to be(true)
137
475
  end
138
476
 
139
- it "does not require change if local configuration is in unexpected format" do
477
+ it "proposed config contains nat config in the form expected" do
478
+ proposed_nat_config = @proposed_config.config[:NatService]
479
+ expect(proposed_nat_config).to eq(expected_nat_config)
480
+ end
481
+
482
+ it "proposed config does not contain load balancer config" do
483
+ expect(@proposed_config.config.key?(:LoadBalancerService)).to be(false)
484
+ end
140
485
 
486
+ it "proposed config does not contain firewall config" do
487
+ expect(@proposed_config.config.key?(:FirewallService)).to be(false)
141
488
  end
142
489
 
143
- it "does not require change if remote configuration is in unexpected format" do
490
+ end
491
+
492
+ context "there is no remote LoadBalancer config, but we are trying to update it" do
144
493
 
494
+ before(:each) do
495
+ @test_config = {
496
+ :gateway => @edge_gateway_id,
497
+ :load_balancer_service => test_load_balancer_config,
498
+ }
499
+ @remote_config = {
500
+ :FirewallService => different_firewall_config,
501
+ :NatService => different_nat_config,
502
+ }
503
+ @proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
504
+ @test_config,
505
+ @remote_config,
506
+ @edge_gw_interface_list
507
+ )
145
508
  end
146
509
 
147
- end
510
+ it "requires update" do
511
+ expect(@proposed_config.update_required?).to be(true)
512
+ end
513
+
514
+ it "proposed config contains load_balancer config in the form expected" do
515
+ proposed_load_balancer_config = @proposed_config.config[:LoadBalancerService]
516
+ expect(proposed_load_balancer_config).to eq(expected_load_balancer_config)
517
+ end
518
+
519
+ it "proposed config does not contain nat config" do
520
+ expect(@proposed_config.config.key?(:NatService)).to be(false)
521
+ end
522
+
523
+ it "proposed config does not contain firewall config" do
524
+ expect(@proposed_config.config.key?(:FirewallService)).to be(false)
525
+ end
526
+
527
+ end
148
528
 
149
529
  def test_firewall_config
150
- {:policy=>"drop", :log_default_action=>true, :firewall_rules=>[{:enabled=>true, :description=>"A rule", :policy=>"allow", :protocols=>"tcp", :destination_port_range=>"Any", :destination_ip=>"10.10.1.2", :source_port_range=>"Any", :source_ip=>"192.0.2.2"}, {:enabled=>true, :destination_ip=>"10.10.1.3-10.10.1.5", :source_ip=>"192.0.2.2/24"}]}
530
+ {
531
+ :policy => "drop",
532
+ :log_default_action => true,
533
+ :firewall_rules => [{
534
+ :enabled => true,
535
+ :description => "A rule",
536
+ :policy => "allow",
537
+ :protocols => "tcp",
538
+ :destination_port_range => "Any",
539
+ :destination_ip => "10.10.1.2",
540
+ :source_port_range => "Any",
541
+ :source_ip => "192.0.2.2"
542
+ }, {
543
+ :enabled => true,
544
+ :destination_ip => "10.10.1.3-10.10.1.5",
545
+ :source_ip => "192.0.2.2/24"
546
+ }]
547
+ }
151
548
  end
152
549
 
153
550
  def test_nat_config
154
- {:nat_rules=>[{:enabled=>true, :network_id=>"01234567-1234-1234-1234-0123456789ab", :rule_type=>"DNAT", :translated_ip=>"10.10.1.2-10.10.1.3", :translated_port=>"3412", :original_ip=>"192.0.2.58", :original_port=>"3412", :protocol=>"tcp"}]}
551
+ {
552
+ :nat_rules => [{
553
+ :enabled => true,
554
+ :network_id => "01234567-1234-1234-1234-0123456789aa",
555
+ :rule_type => "DNAT",
556
+ :translated_ip => "10.10.1.2-10.10.1.3",
557
+ :translated_port => "3412",
558
+ :original_ip => "192.0.2.58",
559
+ :original_port => "3412",
560
+ :protocol =>"tcp"
561
+ }]
562
+ }
563
+ end
564
+
565
+ def test_load_balancer_config
566
+ {
567
+ enabled: 'true',
568
+ pools: [{
569
+ name: 'unit-test-pool-1',
570
+ description: 'A pool',
571
+ service: {
572
+ http: {
573
+ enabled: true,
574
+ port: 8080,
575
+ algorithm: 'ROUND_ROBIN',
576
+ }
577
+ },
578
+ members: [
579
+ { ip_address: '10.0.2.55' },
580
+ { ip_address: '10.0.2.56' },
581
+ ],
582
+ }],
583
+ virtual_servers: [{
584
+ name: 'unit-test-vs-1',
585
+ description: 'A virtual server',
586
+ ip_address: '192.0.2.88',
587
+ network: '01234567-1234-1234-1234-0123456789aa',
588
+ pool: 'unit-test-pool-1',
589
+ service_profiles: {
590
+ http: {
591
+ port: 8080
592
+ },
593
+ }
594
+ }]
595
+ }
155
596
  end
156
597
 
157
598
  def different_firewall_config
158
- {:IsEnabled=>"true", :DefaultAction=>"drop", :LogDefaultAction=>"false", :FirewallRule=>[{:Id=>"1", :IsEnabled=>"true", :MatchOnTranslate=>"false", :Description=>"A rule", :Policy=>"allow", :Protocols=>{:Tcp=>"true"}, :Port=>"-1", :DestinationPortRange=>"Any", :DestinationIp=>"10.10.1.2", :SourcePort=>"-1", :SourcePortRange=>"Any", :SourceIp=>"192.0.2.2", :EnableLogging=>"false"}]}
599
+ {
600
+ :IsEnabled => "true",
601
+ :DefaultAction => "drop",
602
+ :LogDefaultAction => "false",
603
+ :FirewallRule => [{
604
+ :Id => "1",
605
+ :IsEnabled => "true",
606
+ :MatchOnTranslate => "false",
607
+ :Description => "A rule",
608
+ :Policy => "allow",
609
+ :Protocols => {
610
+ :Tcp => "true"
611
+ },
612
+ :Port => "-1",
613
+ :DestinationPortRange => "Any",
614
+ :DestinationIp => "10.10.1.2",
615
+ :SourcePort => "-1",
616
+ :SourcePortRange => "Any",
617
+ :SourceIp => "192.0.2.2",
618
+ :EnableLogging =>"false"
619
+ }]
620
+ }
159
621
  end
160
622
 
161
623
  def different_nat_config
162
- {:IsEnabled=>"true", :NatRule=>[{:RuleType=>"SNAT", :IsEnabled=>"true", :Id=>"65538", :GatewayNatRule=>{:Interface=>{:type=>"application/vnd.vmware.admin.network+xml", :name=>"RemoteVSE", :href=>"https://api.vmware.example.com/api/admin/network/01234567-1234-1234-1234-012345678912"}, :OriginalIp=>"10.10.1.2-10.10.1.3", :TranslatedIp=>"192.0.2.40"}}]}
624
+ {
625
+ :IsEnabled => "true",
626
+ :NatRule => [{
627
+ :RuleType => "SNAT",
628
+ :IsEnabled => "true",
629
+ :Id => "65538",
630
+ :GatewayNatRule => {
631
+ :Interface => {
632
+ :type => "application/vnd.vmware.admin.network+xml",
633
+ :name => "RemoteVSE",
634
+ :href =>"https://api.vmware.example.com/api/admin/network/01234567-1234-1234-1234-012345678912"
635
+ },
636
+ :OriginalIp => "10.10.1.2-10.10.1.3",
637
+ :TranslatedIp => "192.0.2.40"
638
+ }
639
+ }]
640
+ }
641
+ end
642
+
643
+ def different_load_balancer_config
644
+ {
645
+ :IsEnabled=>"true",
646
+ :Pool=>[{
647
+ :Name=>"unit-test-pool-1",
648
+ :Description=>"A pool that has been updated",
649
+ :ServicePort=>[{
650
+ :IsEnabled=>"true",
651
+ :Protocol=>"HTTP",
652
+ :Algorithm=>"ROUND_ROBIN",
653
+ :Port=>"8081",
654
+ :HealthCheckPort=>"",
655
+ :HealthCheck=>{
656
+ :Mode=>"HTTP",
657
+ :Uri=>"",
658
+ :HealthThreshold=>"2",
659
+ :UnhealthThreshold=>"3",
660
+ :Interval=>"5",
661
+ :Timeout=>"15"
662
+ }
663
+ }, {
664
+ :IsEnabled=>"false",
665
+ :Protocol=>"HTTPS",
666
+ :Algorithm=>"ROUND_ROBIN",
667
+ :Port=>"443",
668
+ :HealthCheckPort=>"",
669
+ :HealthCheck=>{
670
+ :Mode=>"SSL",
671
+ :Uri=>"",
672
+ :HealthThreshold=>"2",
673
+ :UnhealthThreshold=>"3",
674
+ :Interval=>"5",
675
+ :Timeout=>"15"
676
+ }
677
+ }, {
678
+ :IsEnabled=>"false",
679
+ :Protocol=>"TCP",
680
+ :Algorithm =>"ROUND_ROBIN",
681
+ :Port=>"",
682
+ :HealthCheckPort=>"",
683
+ :HealthCheck=>{
684
+ :Mode=>"TCP",
685
+ :Uri=>"",
686
+ :HealthThreshold=>"2",
687
+ :UnhealthThreshold=>"3",
688
+ :Interval=>"5",
689
+ :Timeout=>"15"
690
+ }
691
+ }],
692
+ :Member=>[{
693
+ :IpAddress=>"10.0.2.55",
694
+ :Weight=>"1",
695
+ :ServicePort=>[{
696
+ :Protocol=>"HTTP",
697
+ :Port=>"",
698
+ :HealthCheckPort=>""
699
+ }, {
700
+ :Protocol=>"HTTPS",
701
+ :Port=>"",
702
+ :HealthCheckPort=>""
703
+ }, {
704
+ :Protocol=>"TCP",
705
+ :Port=>"",
706
+ :HealthCheckPort=>""
707
+ }]
708
+ }, {
709
+ :IpAddress=>"10.0.2.56",
710
+ :Weight=>"1",
711
+ :ServicePort=>[{
712
+ :Protocol=>"HTTP",
713
+ :Port=>"",
714
+ :HealthCheckPort=>""
715
+ }, {
716
+ :Protocol=>"HTTPS",
717
+ :Port=>"",
718
+ :HealthCheckPort=>""
719
+ }, {
720
+ :Protocol=>"TCP",
721
+ :Port=>"",
722
+ :HealthCheckPort=>""
723
+ }]
724
+ }]
725
+ }],
726
+ :VirtualServer=>[{
727
+ :IsEnabled=>"true",
728
+ :Name=>"unit-test-vs-1",
729
+ :Description=>"A virtual server that has been updated",
730
+ :Interface=>{
731
+ :type => "application/vnd.vmware.admin.network+xml",
732
+ :name => "RemoteVSE",
733
+ :href =>"https://api.vmware.example.com/api/admin/network/01234567-1234-1234-1234-012345678912"
734
+ },
735
+ :IpAddress=>"192.0.2.199",
736
+ :ServiceProfile=>[{
737
+ :IsEnabled=>"true",
738
+ :Protocol=>"HTTP",
739
+ :Port=>"8080",
740
+ :Persistence=>{
741
+ :Method =>""
742
+ }
743
+ }, {
744
+ :IsEnabled=>"false",
745
+ :Protocol=>"HTTPS",
746
+ :Port=>"443",
747
+ :Persistence=>{
748
+ :Method=>""
749
+ }
750
+ }, {
751
+ :IsEnabled=>"false",
752
+ :Protocol=>"TCP",
753
+ :Port=>"",
754
+ :Persistence=>{
755
+ :Method=>""
756
+ }
757
+ }],
758
+ :Logging=>"false",
759
+ :Pool=>"unit-test-pool-1"
760
+ }]
761
+ }
163
762
  end
164
763
 
165
764
  def same_firewall_config
166
- {:IsEnabled=>"true", :DefaultAction=>"drop", :LogDefaultAction=>"true", :FirewallRule=>[{:Id=>"1", :IsEnabled=>"true", :MatchOnTranslate=>"false", :Description=>"A rule", :Policy=>"allow", :Protocols=>{:Tcp=>"true"}, :DestinationPortRange=>"Any", :Port=>"-1", :DestinationIp=>"10.10.1.2", :SourcePortRange=>"Any", :SourcePort=>"-1", :SourceIp=>"192.0.2.2", :EnableLogging=>"false"}, {:Id=>"2", :IsEnabled=>"true", :MatchOnTranslate=>"false", :Description=>"", :Policy=>"allow", :Protocols=>{:Tcp=>"true"}, :DestinationPortRange=>"Any", :Port=>"-1", :DestinationIp=>"10.10.1.3-10.10.1.5", :SourcePortRange=>"Any", :SourcePort=>"-1", :SourceIp=>"192.0.2.2/24", :EnableLogging=>"false"}]}
765
+ {
766
+ :IsEnabled => "true",
767
+ :DefaultAction => "drop",
768
+ :LogDefaultAction => "true",
769
+ :FirewallRule => [{
770
+ :Id => "1",
771
+ :IsEnabled => "true",
772
+ :MatchOnTranslate => "false",
773
+ :Description => "A rule",
774
+ :Policy => "allow",
775
+ :Protocols => {
776
+ :Tcp => "true"
777
+ },
778
+ :DestinationPortRange => "Any",
779
+ :Port => "-1",
780
+ :DestinationIp => "10.10.1.2",
781
+ :SourcePortRange => "Any",
782
+ :SourcePort => "-1",
783
+ :SourceIp => "192.0.2.2",
784
+ :EnableLogging => "false"
785
+ }, {
786
+ :Id => "2",
787
+ :IsEnabled => "true",
788
+ :MatchOnTranslate => "false",
789
+ :Description => "",
790
+ :Policy => "allow",
791
+ :Protocols => {
792
+ :Tcp => "true"
793
+ },
794
+ :DestinationPortRange => "Any",
795
+ :Port => "-1",
796
+ :DestinationIp => "10.10.1.3-10.10.1.5",
797
+ :SourcePortRange => "Any",
798
+ :SourcePort => "-1",
799
+ :SourceIp => "192.0.2.2/24",
800
+ :EnableLogging =>"false"
801
+ }]
802
+ }
167
803
  end
168
804
 
169
805
  def same_nat_config
170
- {:IsEnabled=>"true", :NatRule=>[{:Id=>"65537", :IsEnabled=>"true", :RuleType=>"DNAT", :GatewayNatRule=>{:Interface=>{:name=>"ane012345", :href=>"https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa"}, :OriginalIp=>"192.0.2.58", :TranslatedIp=>"10.10.1.2-10.10.1.3", :OriginalPort=>"3412", :TranslatedPort=>"3412", :Protocol=>"tcp"}}]}
806
+ {
807
+ :IsEnabled => "true",
808
+ :NatRule => [{
809
+ :Id => "65537",
810
+ :IsEnabled => "true",
811
+ :RuleType => "DNAT",
812
+ :GatewayNatRule => {
813
+ :Interface => {
814
+ :type => "application/vnd.vmware.admin.network+xml",
815
+ :name => "ane012345",
816
+ :href =>"https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa"
817
+ },
818
+ :OriginalIp => "192.0.2.58",
819
+ :TranslatedIp => "10.10.1.2-10.10.1.3",
820
+ :OriginalPort => "3412",
821
+ :TranslatedPort => "3412",
822
+ :Protocol => "tcp"
823
+ }
824
+ }]
825
+ }
826
+ end
827
+
828
+ def same_load_balancer_config
829
+ {
830
+ :IsEnabled=>"true",
831
+ :Pool=>[{
832
+ :Name=>"unit-test-pool-1",
833
+ :Description=>"A pool",
834
+ :ServicePort=>[{
835
+ :IsEnabled=>"true",
836
+ :Protocol=>"HTTP",
837
+ :Algorithm=>"ROUND_ROBIN",
838
+ :Port=>"8080",
839
+ :HealthCheckPort=>"",
840
+ :HealthCheck=>{
841
+ :Mode=>"HTTP",
842
+ :Uri=>"",
843
+ :HealthThreshold=>"2",
844
+ :UnhealthThreshold=>"3",
845
+ :Interval=>"5",
846
+ :Timeout=>"15"
847
+ }
848
+ }, {
849
+ :IsEnabled=>"false",
850
+ :Protocol=>"HTTPS",
851
+ :Algorithm=>"ROUND_ROBIN",
852
+ :Port=>"443",
853
+ :HealthCheckPort=>"",
854
+ :HealthCheck=>{
855
+ :Mode=>"SSL",
856
+ :Uri=>"",
857
+ :HealthThreshold=>"2",
858
+ :UnhealthThreshold=>"3",
859
+ :Interval=>"5",
860
+ :Timeout=>"15"
861
+ }
862
+ }, {
863
+ :IsEnabled=>"false",
864
+ :Protocol=>"TCP",
865
+ :Algorithm =>"ROUND_ROBIN",
866
+ :Port=>"",
867
+ :HealthCheckPort=>"",
868
+ :HealthCheck=>{
869
+ :Mode=>"TCP",
870
+ :Uri=>"",
871
+ :HealthThreshold=>"2",
872
+ :UnhealthThreshold=>"3",
873
+ :Interval=>"5",
874
+ :Timeout=>"15"
875
+ }
876
+ }],
877
+ :Member=>[{
878
+ :IpAddress=>"10.0.2.55",
879
+ :Weight=>"1",
880
+ :ServicePort=>[{
881
+ :Protocol=>"HTTP",
882
+ :Port=>"",
883
+ :HealthCheckPort=>""
884
+ }, {
885
+ :Protocol=>"HTTPS",
886
+ :Port=>"",
887
+ :HealthCheckPort=>""
888
+ }, {
889
+ :Protocol=>"TCP",
890
+ :Port=>"",
891
+ :HealthCheckPort=>""
892
+ }]
893
+ }, {
894
+ :IpAddress=>"10.0.2.56",
895
+ :Weight=>"1",
896
+ :ServicePort=>[{
897
+ :Protocol=>"HTTP",
898
+ :Port=>"",
899
+ :HealthCheckPort=>""
900
+ }, {
901
+ :Protocol=>"HTTPS",
902
+ :Port=>"",
903
+ :HealthCheckPort=>""
904
+ }, {
905
+ :Protocol=>"TCP",
906
+ :Port=>"",
907
+ :HealthCheckPort=>""
908
+ }]
909
+ }]
910
+ }],
911
+ :VirtualServer=>[{
912
+ :IsEnabled=>"true",
913
+ :Name=>"unit-test-vs-1",
914
+ :Description=>"A virtual server",
915
+ :Interface=>{
916
+ :type=>"application/vnd.vmware.vcloud.orgVdcNetwork+xml",
917
+ :name=>"ane012345",
918
+ :href=>"https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa"
919
+ },
920
+ :IpAddress=>"192.0.2.88",
921
+ :ServiceProfile=>[{
922
+ :IsEnabled=>"true",
923
+ :Protocol=>"HTTP",
924
+ :Port=>"8080",
925
+ :Persistence=>{
926
+ :Method =>""
927
+ }
928
+ }, {
929
+ :IsEnabled=>"false",
930
+ :Protocol=>"HTTPS",
931
+ :Port=>"443",
932
+ :Persistence=>{
933
+ :Method=>""
934
+ }
935
+ }, {
936
+ :IsEnabled=>"false",
937
+ :Protocol=>"TCP",
938
+ :Port=>"",
939
+ :Persistence=>{
940
+ :Method=>""
941
+ }
942
+ }],
943
+ :Logging=>"false",
944
+ :Pool=>"unit-test-pool-1"
945
+ }]
946
+ }
171
947
  end
172
948
 
173
949
  def expected_firewall_config
174
- {:IsEnabled=>"true", :DefaultAction=>"drop", :LogDefaultAction=>"true", :FirewallRule=>[{:Id=>"1", :IsEnabled=>"true", :MatchOnTranslate=>"false", :Description=>"A rule", :Policy=>"allow", :Protocols=>{:Tcp=>"true"}, :DestinationPortRange=>"Any", :Port=>"-1", :DestinationIp=>"10.10.1.2", :SourcePortRange=>"Any", :SourcePort=>"-1", :SourceIp=>"192.0.2.2", :EnableLogging=>"false"}, {:Id=>"2", :IsEnabled=>"true", :MatchOnTranslate=>"false", :Description=>"", :Policy=>"allow", :Protocols=>{:Tcp=>"true"}, :DestinationPortRange=>"Any", :Port=>"-1", :DestinationIp=>"10.10.1.3-10.10.1.5", :SourcePortRange=>"Any", :SourcePort=>"-1", :SourceIp=>"192.0.2.2/24", :EnableLogging=>"false"}]}
950
+ {
951
+ :IsEnabled => "true",
952
+ :DefaultAction => "drop",
953
+ :LogDefaultAction => "true",
954
+ :FirewallRule => [{
955
+ :Id => "1",
956
+ :IsEnabled => "true",
957
+ :MatchOnTranslate => "false",
958
+ :Description => "A rule",
959
+ :Policy =>"allow",
960
+ :Protocols => {
961
+ :Tcp => "true"
962
+ },
963
+ :DestinationPortRange => "Any",
964
+ :Port => "-1",
965
+ :DestinationIp => "10.10.1.2",
966
+ :SourcePortRange => "Any",
967
+ :SourcePort => "-1",
968
+ :SourceIp => "192.0.2.2",
969
+ :EnableLogging => "false"
970
+ },
971
+ {
972
+ :Id => "2",
973
+ :IsEnabled => "true",
974
+ :MatchOnTranslate => "false",
975
+ :Description => "",
976
+ :Policy => "allow",
977
+ :Protocols => {
978
+ :Tcp => "true"
979
+ },
980
+ :DestinationPortRange => "Any",
981
+ :Port => "-1",
982
+ :DestinationIp => "10.10.1.3-10.10.1.5",
983
+ :SourcePortRange => "Any",
984
+ :SourcePort => "-1",
985
+ :SourceIp => "192.0.2.2/24",
986
+ :EnableLogging => "false"
987
+ }]
988
+ }
175
989
  end
176
990
 
177
991
  def expected_nat_config
178
- {:IsEnabled=>"true", :NatRule=>[{:Id=>"65537", :IsEnabled=>"true", :RuleType=>"DNAT", :GatewayNatRule=>{:Interface=>{:name=>"ane012345", :href=>"https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa"}, :OriginalIp=>"192.0.2.58", :TranslatedIp=>"10.10.1.2-10.10.1.3", :OriginalPort=>"3412", :TranslatedPort=>"3412", :Protocol=>"tcp"}}]}
992
+ {
993
+ :IsEnabled => "true",
994
+ :NatRule => [{
995
+ :Id => "65537",
996
+ :IsEnabled => "true",
997
+ :RuleType => "DNAT",
998
+ :GatewayNatRule => {
999
+ :Interface => {
1000
+ :type => "application/vnd.vmware.admin.network+xml",
1001
+ :name => "ane012345",
1002
+ :href => "https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa"
1003
+ },
1004
+ :OriginalIp => "192.0.2.58",
1005
+ :TranslatedIp => "10.10.1.2-10.10.1.3",
1006
+ :OriginalPort => "3412",
1007
+ :TranslatedPort => "3412",
1008
+ :Protocol => "tcp"
1009
+ }
1010
+ }]
1011
+ }
179
1012
  end
1013
+
1014
+ def expected_load_balancer_config
1015
+ {
1016
+ :IsEnabled=>"true",
1017
+ :Pool=>[{
1018
+ :Name=>"unit-test-pool-1",
1019
+ :Description=>"A pool",
1020
+ :ServicePort=>[{
1021
+ :IsEnabled=>"true",
1022
+ :Protocol=>"HTTP",
1023
+ :Algorithm=>"ROUND_ROBIN",
1024
+ :Port=>"8080",
1025
+ :HealthCheckPort=>"",
1026
+ :HealthCheck=>{
1027
+ :Mode=>"HTTP",
1028
+ :Uri=>"",
1029
+ :HealthThreshold=>"2",
1030
+ :UnhealthThreshold=>"3",
1031
+ :Interval=>"5",
1032
+ :Timeout=>"15"
1033
+ }
1034
+ }, {
1035
+ :IsEnabled=>"false",
1036
+ :Protocol=>"HTTPS",
1037
+ :Algorithm=>"ROUND_ROBIN",
1038
+ :Port=>"443",
1039
+ :HealthCheckPort=>"",
1040
+ :HealthCheck=>{
1041
+ :Mode=>"SSL",
1042
+ :Uri=>"",
1043
+ :HealthThreshold=>"2",
1044
+ :UnhealthThreshold=>"3",
1045
+ :Interval=>"5",
1046
+ :Timeout=>"15"
1047
+ }
1048
+ }, {
1049
+ :IsEnabled=>"false",
1050
+ :Protocol=>"TCP",
1051
+ :Algorithm =>"ROUND_ROBIN",
1052
+ :Port=>"",
1053
+ :HealthCheckPort=>"",
1054
+ :HealthCheck=>{
1055
+ :Mode=>"TCP",
1056
+ :Uri=>"",
1057
+ :HealthThreshold=>"2",
1058
+ :UnhealthThreshold=>"3",
1059
+ :Interval=>"5",
1060
+ :Timeout=>"15"
1061
+ }
1062
+ }],
1063
+ :Member=>[{
1064
+ :IpAddress=>"10.0.2.55",
1065
+ :Weight=>"1",
1066
+ :ServicePort=>[{
1067
+ :Protocol=>"HTTP",
1068
+ :Port=>"",
1069
+ :HealthCheckPort=>""
1070
+ }, {
1071
+ :Protocol=>"HTTPS",
1072
+ :Port=>"",
1073
+ :HealthCheckPort=>""
1074
+ }, {
1075
+ :Protocol=>"TCP",
1076
+ :Port=>"",
1077
+ :HealthCheckPort=>""
1078
+ }]
1079
+ }, {
1080
+ :IpAddress=>"10.0.2.56",
1081
+ :Weight=>"1",
1082
+ :ServicePort=>[{
1083
+ :Protocol=>"HTTP",
1084
+ :Port=>"",
1085
+ :HealthCheckPort=>""
1086
+ }, {
1087
+ :Protocol=>"HTTPS",
1088
+ :Port=>"",
1089
+ :HealthCheckPort=>""
1090
+ }, {
1091
+ :Protocol=>"TCP",
1092
+ :Port=>"",
1093
+ :HealthCheckPort=>""
1094
+ }]
1095
+ }]
1096
+ }],
1097
+ :VirtualServer=>[{
1098
+ :IsEnabled=>"true",
1099
+ :Name=>"unit-test-vs-1",
1100
+ :Description=>"A virtual server",
1101
+ :Interface=>{
1102
+ :type=>"application/vnd.vmware.vcloud.orgVdcNetwork+xml",
1103
+ :name=>"ane012345",
1104
+ :href=>"https://vmware.example.com/api/admin/network/01234567-1234-1234-1234-0123456789aa"
1105
+ },
1106
+ :IpAddress=>"192.0.2.88",
1107
+ :ServiceProfile=>[{
1108
+ :IsEnabled=>"true",
1109
+ :Protocol=>"HTTP",
1110
+ :Port=>"8080",
1111
+ :Persistence=>{
1112
+ :Method =>""
1113
+ }
1114
+ }, {
1115
+ :IsEnabled=>"false",
1116
+ :Protocol=>"HTTPS",
1117
+ :Port=>"443",
1118
+ :Persistence=>{
1119
+ :Method=>""
1120
+ }
1121
+ }, {
1122
+ :IsEnabled=>"false",
1123
+ :Protocol=>"TCP",
1124
+ :Port=>"",
1125
+ :Persistence=>{
1126
+ :Method=>""
1127
+ }
1128
+ }],
1129
+ :Logging=>"false",
1130
+ :Pool=>"unit-test-pool-1"
1131
+ }]
1132
+ }
1133
+ end
1134
+
180
1135
  end
181
1136
  end
182
1137
  end