vcloud-edge_gateway 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/.travis.yml +9 -0
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +15 -0
  4. data/bin/vcloud-configure-edge +9 -3
  5. data/examples/{firewall-rules.yaml → vcloud-configure-edge/firewall-rules.yaml} +0 -0
  6. data/examples/{loadbalancer-rules.yaml → vcloud-configure-edge/loadbalancer-rules.yaml} +0 -0
  7. data/examples/{nat-rules.yaml → vcloud-configure-edge/nat-rules.yaml} +0 -0
  8. data/examples/vcloud-configure-edge/template-nat-rules.yaml.mustache +20 -0
  9. data/examples/vcloud-configure-edge/template-vars-env1.yaml +4 -0
  10. data/examples/vcloud-configure-edge/template-vars-env2.yaml +4 -0
  11. data/lib/vcloud/edge_gateway/version.rb +1 -1
  12. data/lib/vcloud/edge_gateway_services.rb +2 -2
  13. data/spec/integration/edge_gateway/data/{firewall_config.yaml.erb → firewall_config.yaml.mustache} +1 -1
  14. data/spec/integration/edge_gateway/data/{firewall_config_updated_rule.yaml.erb → firewall_config_updated_rule.yaml.mustache} +1 -1
  15. data/spec/integration/edge_gateway/data/{firewall_rule_order_test.yaml.erb → firewall_rule_order_test.yaml.mustache} +1 -1
  16. data/spec/integration/edge_gateway/data/{hairpin_nat_config.yaml.erb → hairpin_nat_config.yaml.mustache} +3 -3
  17. data/spec/integration/edge_gateway/data/{load_balancer_config.yaml.erb → load_balancer_config.yaml.mustache} +3 -3
  18. data/spec/integration/edge_gateway/data/{load_balancer_empty.yaml.erb → load_balancer_empty.yaml.mustache} +1 -1
  19. data/spec/integration/edge_gateway/data/{load_balancer_single_pool.yaml.erb → load_balancer_single_pool.yaml.mustache} +1 -1
  20. data/spec/integration/edge_gateway/data/{load_balancer_single_virtual_server_invalid_pool.yaml.erb → load_balancer_single_virtual_server_invalid_pool.yaml.mustache} +3 -3
  21. data/spec/integration/edge_gateway/data/{load_balancer_single_virtual_server_missing_pool.yaml.erb → load_balancer_single_virtual_server_missing_pool.yaml.mustache} +3 -3
  22. data/spec/integration/edge_gateway/data/{nat_and_firewall_config.yaml.erb → nat_and_firewall_config.yaml.mustache} +5 -5
  23. data/spec/integration/edge_gateway/data/{nat_and_firewall_plus_load_balancer_config.yaml.erb → nat_and_firewall_plus_load_balancer_config.yaml.mustache} +7 -7
  24. data/spec/integration/edge_gateway/data/{nat_config.yaml.erb → nat_config.yaml.mustache} +5 -5
  25. data/spec/integration/edge_gateway/edge_gateway_services_spec.rb +20 -37
  26. data/spec/integration/edge_gateway/firewall_service_spec.rb +31 -35
  27. data/spec/integration/edge_gateway/load_balancer_service_spec.rb +27 -50
  28. data/spec/integration/edge_gateway/nat_service_spec.rb +35 -42
  29. data/spec/spec_helper.rb +1 -1
  30. data/spec/support/integration_helper.rb +29 -0
  31. metadata +36 -32
  32. data/spec/erb_helper.rb +0 -11
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+ branches:
6
+ except:
7
+ - master
8
+ notifications:
9
+ email: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.4.0 (2014-05-12)
2
+
3
+ Features:
4
+
5
+ - Allow config files to be rendered from [Mustache](http://mustache.github.io/)
6
+ templates so that common configs can be re-used across environments with
7
+ differences represented as variables.
8
+
1
9
  ## 0.3.0 (2014-05-01)
2
10
 
3
11
  Features:
data/README.md CHANGED
@@ -25,6 +25,11 @@ To configure an Edge Gateway:
25
25
 
26
26
  $ vcloud-configure-edge input.yaml
27
27
 
28
+ To use [mustache](http://mustache.github.io) templates so that rulesets can
29
+ be re-used between environments:
30
+
31
+ $ vcloud-configure-edge --template-vars vars.yaml input.yaml.mustache
32
+
28
33
  ## Credentials
29
34
 
30
35
  vCloud Edge Gateway is based around [fog](http://fog.io/). To use it you'll need to give it
@@ -410,6 +415,16 @@ If you want to be sure you are pinning to 5.1, or use 5.5, you can set the API v
410
415
 
411
416
  `export DEBUG=true` - this will show you the stack trace when there is an exception instead of just the message.
412
417
 
418
+ ## Testing
419
+
420
+ Run the default suite of tests (e.g. lint, unit, features):
421
+
422
+ bundle exec rake
423
+
424
+ Run the integration tests (slower and requires a real environment):
425
+
426
+ bundle exec rake integration
427
+
413
428
  ### References
414
429
 
415
430
  * [vCloud Director Edge Gateway documentation](http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.admin.doc_51/GUID-ADE1DCAB-874F-45A9-9337-1E971DAC0F7D.html)
@@ -8,13 +8,19 @@ class App
8
8
  include Methadone::CLILogging
9
9
 
10
10
  main do |config_file|
11
- Vcloud::EdgeGatewayServices.new.update(config_file)
11
+ if options['template-vars']
12
+ Vcloud::EdgeGatewayServices.new.update(config_file, options['template-vars'])
13
+ else
14
+ Vcloud::EdgeGatewayServices.new.update(config_file)
15
+ end
12
16
  end
13
17
 
14
- arg :resource
18
+ arg :config_file
19
+ on('--template-vars FILE', 'Enable templating with variables from this file')
15
20
 
16
21
  description '
17
- vcloud-edge_gateway allows you to configure an EdgeGateway with an input file
22
+ vcloud-edge_gateway allows you to configure an EdgeGateway with an input
23
+ file which may optionally be a Mustache template.
18
24
 
19
25
  See https://github.com/alphagov/vcloud-edge_gateway for more info'
20
26
 
@@ -0,0 +1,20 @@
1
+ # Example of using templating to re-use the same ruleset for two different
2
+ # environments which have very slightly different attributes. See the files:
3
+ #
4
+ # - template-vars-env1.yaml
5
+ # - template-vars-env2.yaml
6
+ #
7
+ ---
8
+ gateway: "{{ gateway_name }}"
9
+ nat_service:
10
+ enabled: true
11
+ nat_rules:
12
+ - :id: '65537'
13
+ :enabled: true
14
+ :rule_type: 'DNAT'
15
+ :network_id: '{{ network_id }}'
16
+ :original_ip: '{{ original_ip }}'
17
+ :original_port: '22'
18
+ :translated_ip: '10.20.30.40'
19
+ :translated_port: '22'
20
+ :protocol: 'tcp'
@@ -0,0 +1,4 @@
1
+ ---
2
+ gateway_name: 'VSE Environment One'
3
+ network_id: '4E4D3012-9049-4E94-9D40-C90B9B2BFECB'
4
+ original_ip: '172.16.0.100'
@@ -0,0 +1,4 @@
1
+ ---
2
+ gateway_name: 'VSE Environment Two'
3
+ network_id: '222F3C67-27A1-4F71-AE4B-6F8281175741'
4
+ original_ip: '172.16.0.200'
@@ -1,6 +1,6 @@
1
1
  module Vcloud
2
2
  module EdgeGateway
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
6
6
 
@@ -7,8 +7,8 @@ module Vcloud
7
7
  @config_loader = Vcloud::Core::ConfigLoader.new
8
8
  end
9
9
 
10
- def update(config_file = nil)
11
- local_config = @config_loader.load_config(config_file, Vcloud::Schema::EDGE_GATEWAY_SERVICES)
10
+ def update(config_file = nil, vars_file = nil)
11
+ local_config = @config_loader.load_config(config_file, Vcloud::Schema::EDGE_GATEWAY_SERVICES, vars_file)
12
12
 
13
13
  edge_gateway = Core::EdgeGateway.get_by_name local_config[:gateway]
14
14
  remote_config = edge_gateway.vcloud_attributes[:Configuration][:EdgeGatewayServiceConfiguration]
@@ -1,5 +1,5 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  firewall_service:
4
4
  policy: drop
5
5
  log_default_action: true
@@ -1,5 +1,5 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  firewall_service:
4
4
  policy: drop
5
5
  log_default_action: true
@@ -1,5 +1,5 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  firewall_service:
4
4
  firewall_rules:
5
5
  - description: 'First Input Rule'
@@ -1,13 +1,13 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  nat_service:
4
4
  nat_rules:
5
5
  - enabled: true
6
6
  description: 'A DNAT rule'
7
- network_id: <%= org_vdc_network_id %>
7
+ network_id: {{ org_vdc_network_id }}
8
8
  rule_type: 'DNAT'
9
9
  translated_ip: '10.10.1.2'
10
10
  translated_port: '3412'
11
- original_ip: <%= original_ip %>
11
+ original_ip: {{ original_ip }}
12
12
  original_port: '3412'
13
13
  protocol: 'tcp'
@@ -1,5 +1,5 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  load_balancer_service:
4
4
  enabled: true
5
5
  pools:
@@ -16,8 +16,8 @@ load_balancer_service:
16
16
  virtual_servers:
17
17
  - name: 'integration-test-vs-1'
18
18
  description: 'A virtual server'
19
- ip_address: <%= edge_gateway_ext_network_ip %>
20
- network: <%= edge_gateway_ext_network_id %>
19
+ ip_address: {{ edge_gateway_ext_network_ip }}
20
+ network: {{ edge_gateway_ext_network_id }}
21
21
  pool: 'integration-test-pool-1'
22
22
  service_profiles:
23
23
  http:
@@ -1,4 +1,4 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  load_balancer_service:
4
4
  enabled: true
@@ -1,5 +1,5 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  load_balancer_service:
4
4
  enabled: true
5
5
  pools:
@@ -1,12 +1,12 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  load_balancer_service:
4
4
  enabled: true
5
5
  virtual_servers:
6
6
  - name: 'integration-test-vs-1'
7
7
  description: 'A virtual server'
8
- ip_address: <%= edge_gateway_ext_network_ip %>
9
- network: <%= edge_gateway_ext_network_id %>
8
+ ip_address: {{ edge_gateway_ext_network_ip }}
9
+ network: {{ edge_gateway_ext_network_id }}
10
10
  pool: 'unconfigured-test-pool-1'
11
11
  service_profiles:
12
12
  http:
@@ -1,12 +1,12 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  load_balancer_service:
4
4
  enabled: true
5
5
  virtual_servers:
6
6
  - name: 'integration-test-vs-1'
7
7
  description: 'A virtual server'
8
- ip_address: <%= edge_gateway_ext_network_ip %>
9
- network: <%= edge_gateway_ext_network_id %>
8
+ ip_address: {{ edge_gateway_ext_network_ip }}
9
+ network: {{ edge_gateway_ext_network_id }}
10
10
  service_profiles:
11
11
  http:
12
12
  port: 8080
@@ -1,19 +1,19 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  nat_service:
4
4
  nat_rules:
5
5
  - enabled: true
6
- network_id: <%= network_id %>
6
+ network_id: {{ network_id }}
7
7
  rule_type: 'DNAT'
8
8
  translated_ip: '10.10.1.2-10.10.1.3'
9
9
  translated_port: '3412'
10
- original_ip: <%= original_ip %>
10
+ original_ip: {{ original_ip }}
11
11
  original_port: '3412'
12
12
  protocol: 'tcp'
13
13
  - enabled: true
14
- network_id: <%= network_id %>
14
+ network_id: {{ network_id }}
15
15
  rule_type: 'SNAT'
16
- translated_ip: <%= original_ip %>
16
+ translated_ip: {{ original_ip }}
17
17
  original_ip: '10.10.1.2-10.10.1.3'
18
18
  firewall_service:
19
19
  policy: drop
@@ -1,19 +1,19 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  nat_service:
4
4
  nat_rules:
5
5
  - enabled: true
6
- network_id: <%= network_id %>
6
+ network_id: {{ network_id }}
7
7
  rule_type: 'DNAT'
8
8
  translated_ip: '10.10.1.2-10.10.1.3'
9
9
  translated_port: '3412'
10
- original_ip: <%= original_ip %>
10
+ original_ip: {{ original_ip }}
11
11
  original_port: '3412'
12
12
  protocol: 'tcp'
13
13
  - enabled: true
14
- network_id: <%= network_id %>
14
+ network_id: {{ network_id }}
15
15
  rule_type: 'SNAT'
16
- translated_ip: <%= original_ip %>
16
+ translated_ip: {{ original_ip }}
17
17
  original_ip: '10.10.1.2-10.10.1.3'
18
18
  firewall_service:
19
19
  policy: drop
@@ -46,8 +46,8 @@ load_balancer_service:
46
46
  virtual_servers:
47
47
  - name: 'integration-test-vs-1'
48
48
  description: 'A virtual server'
49
- ip_address: <%= edge_gateway_ext_network_ip %>
50
- network: <%= edge_gateway_ext_network_id %>
49
+ ip_address: {{ edge_gateway_ext_network_ip }}
50
+ network: {{ edge_gateway_ext_network_id }}
51
51
  pool: 'integration-test-pool-1'
52
52
  service_profiles:
53
53
  http:
@@ -1,17 +1,17 @@
1
1
  ---
2
- gateway: <%= edge_gateway_name %>
2
+ gateway: {{ edge_gateway_name }}
3
3
  nat_service:
4
4
  nat_rules:
5
5
  - enabled: true
6
- network_id: <%= network_id %>
6
+ network_id: {{ network_id }}
7
7
  rule_type: 'DNAT'
8
8
  translated_ip: '10.10.1.2-10.10.1.3'
9
9
  translated_port: '3412'
10
- original_ip: <%= original_ip %>
10
+ original_ip: {{ original_ip }}
11
11
  original_port: '3412'
12
12
  protocol: 'tcp'
13
13
  - enabled: true
14
- network_id: <%= network_id %>
14
+ network_id: {{ network_id }}
15
15
  rule_type: 'SNAT'
16
- translated_ip: <%= original_ip %>
16
+ translated_ip: {{ original_ip }}
17
17
  original_ip: '10.10.1.2-10.10.1.3'
@@ -1,27 +1,11 @@
1
1
  require 'spec_helper'
2
+ require 'tempfile'
2
3
 
3
4
  module Vcloud
4
5
  describe EdgeGatewayServices do
5
6
 
6
- required_env = {
7
- 'VCLOUD_EDGE_GATEWAY' => 'to name of VSE',
8
- 'VCLOUD_PROVIDER_NETWORK_ID' => 'to ID of VSE external network',
9
- 'VCLOUD_PROVIDER_NETWORK_IP' => 'to an available IP on VSE external network',
10
- 'VCLOUD_NETWORK1_ID' => 'to the ID of a VSE internal network',
11
- 'VCLOUD_NETWORK1_NAME' => 'to the name of the VSE internal network',
12
- 'VCLOUD_NETWORK1_IP' => 'to an ID on the VSE internal network',
13
- }
14
-
15
- error = false
16
- required_env.each do |var,message|
17
- unless ENV[var]
18
- puts "Must set #{var} #{message}" unless ENV[var]
19
- error = true
20
- end
21
- end
22
- Kernel.exit(2) if error
23
-
24
7
  before(:all) do
8
+ IntegrationHelper.verify_env_vars
25
9
  @edge_name = ENV['VCLOUD_EDGE_GATEWAY']
26
10
  @ext_net_id = ENV['VCLOUD_PROVIDER_NETWORK_ID']
27
11
  @ext_net_ip = ENV['VCLOUD_PROVIDER_NETWORK_IP']
@@ -36,14 +20,9 @@ module Vcloud
36
20
 
37
21
  before(:all) do
38
22
  reset_edge_gateway
39
- @initial_config_file = generate_input_config_file(
40
- 'nat_and_firewall_config.yaml.erb',
41
- edge_gateway_erb_input
42
- )
43
- @adding_load_balancer_config_file = generate_input_config_file(
44
- 'nat_and_firewall_plus_load_balancer_config.yaml.erb',
45
- edge_gateway_erb_input
46
- )
23
+ @vars_config_file = generate_vars_file(edge_gateway_vars_hash)
24
+ @initial_config_file = IntegrationHelper.fixture_file('nat_and_firewall_config.yaml.mustache')
25
+ @adding_load_balancer_config_file = IntegrationHelper.fixture_file('nat_and_firewall_plus_load_balancer_config.yaml.mustache')
47
26
  @edge_gateway = Vcloud::Core::EdgeGateway.get_by_name(@edge_name)
48
27
  end
49
28
 
@@ -60,7 +39,7 @@ module Vcloud
60
39
  it "should only create one edgeGateway update task when updating the configuration" do
61
40
  start_time = Time.now.getutc
62
41
  task_list_before_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
63
- EdgeGatewayServices.new.update(@initial_config_file)
42
+ EdgeGatewayServices.new.update(@initial_config_file, @vars_config_file)
64
43
  task_list_after_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
65
44
  expect(task_list_after_update.size - task_list_before_update.size).to be(1)
66
45
  end
@@ -76,7 +55,7 @@ module Vcloud
76
55
  it "should not update the EdgeGateway again if the config hasn't changed" do
77
56
  start_time = Time.now.getutc
78
57
  task_list_before_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
79
- EdgeGatewayServices.new.update(@initial_config_file)
58
+ EdgeGatewayServices.new.update(@initial_config_file, @vars_config_file)
80
59
  task_list_after_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
81
60
  expect(task_list_after_update.size - task_list_before_update.size).to be(0)
82
61
  end
@@ -84,7 +63,7 @@ module Vcloud
84
63
  it "should only create one additional edgeGateway update task when adding the LoadBalancer config" do
85
64
  start_time = Time.now.getutc
86
65
  task_list_before_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
87
- EdgeGatewayServices.new.update(@adding_load_balancer_config_file)
66
+ EdgeGatewayServices.new.update(@adding_load_balancer_config_file, @vars_config_file)
88
67
  task_list_after_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
89
68
  expect(task_list_after_update.size - task_list_before_update.size).to be(1)
90
69
  end
@@ -92,7 +71,7 @@ module Vcloud
92
71
  it "should not update the EdgeGateway again if we reapply the 'adding load balancer' config" do
93
72
  start_time = Time.now.getutc
94
73
  task_list_before_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
95
- EdgeGatewayServices.new.update(@adding_load_balancer_config_file)
74
+ EdgeGatewayServices.new.update(@adding_load_balancer_config_file, @vars_config_file)
96
75
  task_list_after_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
97
76
  expect(task_list_after_update.size - task_list_before_update.size).to be(0)
98
77
  end
@@ -105,7 +84,9 @@ module Vcloud
105
84
  end
106
85
 
107
86
  def remove_temp_config_files
108
- FileUtils.rm(@files_to_delete)
87
+ @files_to_delete.each { |f|
88
+ f.unlink
89
+ }
109
90
  end
110
91
 
111
92
  def reset_edge_gateway
@@ -121,14 +102,16 @@ module Vcloud
121
102
  })
122
103
  end
123
104
 
124
- def generate_input_config_file(data_file, erb_input)
125
- config_erb = File.expand_path("data/#{data_file}", File.dirname(__FILE__))
126
- output_file = ErbHelper.convert_erb_template_to_yaml(erb_input, config_erb)
127
- @files_to_delete << output_file
128
- output_file
105
+ def generate_vars_file(vars_hash)
106
+ file = Tempfile.new('vars_file')
107
+ file.write(vars_hash.to_yaml)
108
+ file.close
109
+ @files_to_delete << file
110
+
111
+ file.path
129
112
  end
130
113
 
131
- def edge_gateway_erb_input
114
+ def edge_gateway_vars_hash
132
115
  {
133
116
  edge_gateway_name: @edge_name,
134
117
  network_id: @ext_net_id,
@@ -1,27 +1,11 @@
1
1
  require 'spec_helper'
2
+ require 'tempfile'
2
3
 
3
4
  module Vcloud
4
5
  describe EdgeGatewayServices do
5
6
 
6
- required_env = {
7
- 'VCLOUD_EDGE_GATEWAY' => 'to name of VSE',
8
- 'VCLOUD_PROVIDER_NETWORK_ID' => 'to ID of VSE external network',
9
- 'VCLOUD_PROVIDER_NETWORK_IP' => 'to an available IP on VSE external network',
10
- 'VCLOUD_NETWORK1_ID' => 'to the ID of a VSE internal network',
11
- 'VCLOUD_NETWORK1_NAME' => 'to the name of the VSE internal network',
12
- 'VCLOUD_NETWORK1_IP' => 'to an ID on the VSE internal network',
13
- }
14
-
15
- error = false
16
- required_env.each do |var,message|
17
- unless ENV[var]
18
- puts "Must set #{var} #{message}" unless ENV[var]
19
- error = true
20
- end
21
- end
22
- Kernel.exit(2) if error
23
-
24
7
  before(:all) do
8
+ IntegrationHelper.verify_env_vars
25
9
  @edge_name = ENV['VCLOUD_EDGE_GATEWAY']
26
10
  @ext_net_id = ENV['VCLOUD_PROVIDER_NETWORK_ID']
27
11
  @ext_net_ip = ENV['VCLOUD_PROVIDER_NETWORK_IP']
@@ -36,7 +20,8 @@ module Vcloud
36
20
 
37
21
  before(:all) do
38
22
  reset_edge_gateway
39
- @initial_firewall_config_file = generate_input_config_file('firewall_config.yaml.erb', edge_gateway_erb_input)
23
+ @vars_config_file = generate_vars_file(edge_gateway_vars_hash)
24
+ @initial_firewall_config_file = IntegrationHelper.fixture_file('firewall_config.yaml.mustache')
40
25
  @edge_gateway = Vcloud::Core::EdgeGateway.get_by_name(@edge_name)
41
26
  @firewall_service = {}
42
27
  end
@@ -44,7 +29,11 @@ module Vcloud
44
29
  context "Check update is functional" do
45
30
 
46
31
  before(:all) do
47
- local_config = Core::ConfigLoader.new.load_config(@initial_firewall_config_file, Vcloud::Schema::EDGE_GATEWAY_SERVICES)
32
+ local_config = Core::ConfigLoader.new.load_config(
33
+ @initial_firewall_config_file,
34
+ Vcloud::Schema::EDGE_GATEWAY_SERVICES,
35
+ @vars_config_file
36
+ )
48
37
  @local_vcloud_config = EdgeGateway::ConfigurationGenerator::FirewallService.new.generate_fog_config(local_config[:firewall_service])
49
38
  end
50
39
 
@@ -55,7 +44,7 @@ module Vcloud
55
44
 
56
45
  it "should only need to make one call to Core::EdgeGateway.update_configuration" do
57
46
  expect_any_instance_of(Core::EdgeGateway).to receive(:update_configuration).exactly(1).times.and_call_original
58
- EdgeGatewayServices.new.update(@initial_firewall_config_file)
47
+ EdgeGatewayServices.new.update(@initial_firewall_config_file, @vars_config_file)
59
48
  end
60
49
 
61
50
  it "should have configured at least one firewall rule" do
@@ -71,7 +60,7 @@ module Vcloud
71
60
 
72
61
  it "and then should not configure the firewall service if updated again with the same configuration (idempotency)" do
73
62
  expect(Vcloud::Core.logger).to receive(:info).with('EdgeGatewayServices.update: Configuration is already up to date. Skipping.')
74
- EdgeGatewayServices.new.update(@initial_firewall_config_file)
63
+ EdgeGatewayServices.new.update(@initial_firewall_config_file, @vars_config_file)
75
64
  end
76
65
 
77
66
  it "ConfigurationDiffer should return empty if local and remote firewall configs match" do
@@ -82,9 +71,11 @@ module Vcloud
82
71
  end
83
72
 
84
73
  it "should highlight a difference if local firewall config has been updated" do
85
- input_config_file = generate_input_config_file('firewall_config_updated_rule.yaml.erb', edge_gateway_erb_input)
86
-
87
- local_config = Core::ConfigLoader.new.load_config(input_config_file, Vcloud::Schema::EDGE_GATEWAY_SERVICES)
74
+ local_config = Core::ConfigLoader.new.load_config(
75
+ IntegrationHelper.fixture_file('firewall_config_updated_rule.yaml.mustache'),
76
+ Vcloud::Schema::EDGE_GATEWAY_SERVICES,
77
+ @vars_config_file
78
+ )
88
79
  local_firewall_config = EdgeGateway::ConfigurationGenerator::FirewallService.new.generate_fog_config(local_config[:firewall_service])
89
80
 
90
81
  edge_gateway = Core::EdgeGateway.get_by_name local_config[:gateway]
@@ -141,8 +132,10 @@ module Vcloud
141
132
  context "Specific FirewallService update tests" do
142
133
 
143
134
  it "should have the same rule order as the input rule order" do
144
- input_config_file = generate_input_config_file('firewall_rule_order_test.yaml.erb', edge_gateway_erb_input)
145
- EdgeGatewayServices.new.update(input_config_file)
135
+ EdgeGatewayServices.new.update(
136
+ IntegrationHelper.fixture_file('firewall_rule_order_test.yaml.mustache'),
137
+ @vars_config_file
138
+ )
146
139
  remote_rules = @edge_gateway.vcloud_attributes[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule]
147
140
  remote_descriptions_list = remote_rules.map {|rule| rule[:Description]}
148
141
  expect(remote_descriptions_list).
@@ -157,10 +150,11 @@ module Vcloud
157
150
 
158
151
  end
159
152
 
160
-
161
153
  after(:all) do
162
154
  reset_edge_gateway unless ENV['VCLOUD_NO_RESET_VSE_AFTER']
163
- FileUtils.rm(@files_to_delete)
155
+ @files_to_delete.each { |f|
156
+ f.unlink
157
+ }
164
158
  end
165
159
 
166
160
  def reset_edge_gateway
@@ -170,14 +164,16 @@ module Vcloud
170
164
  })
171
165
  end
172
166
 
173
- def generate_input_config_file(data_file, erb_input)
174
- config_erb = File.expand_path("data/#{data_file}", File.dirname(__FILE__))
175
- output_file = ErbHelper.convert_erb_template_to_yaml(erb_input, config_erb)
176
- @files_to_delete << output_file
177
- output_file
167
+ def generate_vars_file(vars_hash)
168
+ file = Tempfile.new('vars_file')
169
+ file.write(vars_hash.to_yaml)
170
+ file.close
171
+ @files_to_delete << file
172
+
173
+ file.path
178
174
  end
179
175
 
180
- def edge_gateway_erb_input
176
+ def edge_gateway_vars_hash
181
177
  {
182
178
  :edge_gateway_name => @edge_name,
183
179
  :edge_gateway_ext_network_id => @ext_net_id,
@@ -1,27 +1,11 @@
1
1
  require 'spec_helper'
2
+ require 'tempfile'
2
3
 
3
4
  module Vcloud
4
5
  describe EdgeGatewayServices do
5
6
 
6
- required_env = {
7
- 'VCLOUD_EDGE_GATEWAY' => 'to name of VSE',
8
- 'VCLOUD_PROVIDER_NETWORK_ID' => 'to ID of VSE external network',
9
- 'VCLOUD_PROVIDER_NETWORK_IP' => 'to an available IP on VSE external network',
10
- 'VCLOUD_NETWORK1_ID' => 'to the ID of a VSE internal network',
11
- 'VCLOUD_NETWORK1_NAME' => 'to the name of the VSE internal network',
12
- 'VCLOUD_NETWORK1_IP' => 'to an ID on the VSE internal network',
13
- }
14
-
15
- error = false
16
- required_env.each do |var,message|
17
- unless ENV[var]
18
- puts "Must set #{var} #{message}" unless ENV[var]
19
- error = true
20
- end
21
- end
22
- Kernel.exit(2) if error
23
-
24
7
  before(:all) do
8
+ IntegrationHelper.verify_env_vars
25
9
  @edge_name = ENV['VCLOUD_EDGE_GATEWAY']
26
10
  @ext_net_id = ENV['VCLOUD_PROVIDER_NETWORK_ID']
27
11
  @ext_net_ip = ENV['VCLOUD_PROVIDER_NETWORK_IP']
@@ -36,8 +20,8 @@ module Vcloud
36
20
 
37
21
  before(:all) do
38
22
  reset_edge_gateway
39
- @initial_load_balancer_config_file =
40
- generate_input_config_file('load_balancer_config.yaml.erb', edge_gateway_erb_input)
23
+ @vars_config_file = generate_vars_file(edge_gateway_vars_hash)
24
+ @initial_load_balancer_config_file = IntegrationHelper.fixture_file('load_balancer_config.yaml.mustache')
41
25
  @edge_gateway = Vcloud::Core::EdgeGateway.get_by_name(@edge_name)
42
26
  end
43
27
 
@@ -46,7 +30,8 @@ module Vcloud
46
30
  before(:all) do
47
31
  local_config = Core::ConfigLoader.new.load_config(
48
32
  @initial_load_balancer_config_file,
49
- Vcloud::Schema::EDGE_GATEWAY_SERVICES
33
+ Vcloud::Schema::EDGE_GATEWAY_SERVICES,
34
+ @vars_config_file
50
35
  )
51
36
  @local_vcloud_config = EdgeGateway::ConfigurationGenerator::LoadBalancerService.new(
52
37
  @edge_gateway.interfaces
@@ -63,7 +48,7 @@ module Vcloud
63
48
  it "should only make one EdgeGateway update task, to minimise EdgeGateway reload events" do
64
49
  start_time = Time.now.getutc
65
50
  task_list_before_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
66
- EdgeGatewayServices.new.update(@initial_load_balancer_config_file)
51
+ EdgeGatewayServices.new.update(@initial_load_balancer_config_file, @vars_config_file)
67
52
  task_list_after_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
68
53
  expect(task_list_after_update.size - task_list_before_update.size).to be(1)
69
54
  end
@@ -105,7 +90,7 @@ module Vcloud
105
90
  it "should not then configure the LoadBalancerService if updated again with the same configuration" do
106
91
  expect(Vcloud::Core.logger).
107
92
  to receive(:info).with('EdgeGatewayServices.update: Configuration is already up to date. Skipping.')
108
- EdgeGatewayServices.new.update(@initial_load_balancer_config_file)
93
+ EdgeGatewayServices.new.update(@initial_load_balancer_config_file, @vars_config_file)
109
94
  end
110
95
 
111
96
  end
@@ -113,11 +98,8 @@ module Vcloud
113
98
  context "Check specific LoadBalancerService update cases" do
114
99
 
115
100
  it "should be able to configure with no pools and virtual_servers" do
116
- config_file = generate_input_config_file(
117
- 'load_balancer_empty.yaml.erb',
118
- edge_gateway_erb_input
119
- )
120
- EdgeGatewayServices.new.update(config_file)
101
+ config_file = IntegrationHelper.fixture_file('load_balancer_empty.yaml.mustache')
102
+ EdgeGatewayServices.new.update(config_file, @vars_config_file)
121
103
  edge_config = @edge_gateway.vcloud_attributes[:Configuration]
122
104
  remote_vcloud_config = edge_config[:EdgeGatewayServiceConfiguration][:LoadBalancerService]
123
105
  expect(remote_vcloud_config[:Pool].size).to be == 0
@@ -125,31 +107,22 @@ module Vcloud
125
107
  end
126
108
 
127
109
  it "should be able to configure with a single Pool and no VirtualServers" do
128
- config_file = generate_input_config_file(
129
- 'load_balancer_single_pool.yaml.erb',
130
- edge_gateway_erb_input
131
- )
132
- EdgeGatewayServices.new.update(config_file)
110
+ config_file = IntegrationHelper.fixture_file('load_balancer_single_pool.yaml.mustache')
111
+ EdgeGatewayServices.new.update(config_file, @vars_config_file)
133
112
  edge_config = @edge_gateway.vcloud_attributes[:Configuration]
134
113
  remote_vcloud_config = edge_config[:EdgeGatewayServiceConfiguration][:LoadBalancerService]
135
114
  expect(remote_vcloud_config[:Pool].size).to be == 1
136
115
  end
137
116
 
138
117
  it "should raise an error when trying configure with a single VirtualServer, and no pool mentioned" do
139
- config_file = generate_input_config_file(
140
- 'load_balancer_single_virtual_server_missing_pool.yaml.erb',
141
- edge_gateway_erb_input
142
- )
143
- expect { EdgeGatewayServices.new.update(config_file) }.
118
+ config_file = IntegrationHelper.fixture_file('load_balancer_single_virtual_server_missing_pool.yaml.mustache')
119
+ expect { EdgeGatewayServices.new.update(config_file, @vars_config_file) }.
144
120
  to raise_error('Supplied configuration does not match supplied schema')
145
121
  end
146
122
 
147
123
  it "should raise an error when trying configure with a single VirtualServer, with an unconfigured pool" do
148
- config_file = generate_input_config_file(
149
- 'load_balancer_single_virtual_server_invalid_pool.yaml.erb',
150
- edge_gateway_erb_input
151
- )
152
- expect { EdgeGatewayServices.new.update(config_file) }.
124
+ config_file = IntegrationHelper.fixture_file('load_balancer_single_virtual_server_invalid_pool.yaml.mustache')
125
+ expect { EdgeGatewayServices.new.update(config_file, @vars_config_file) }.
153
126
  to raise_error(
154
127
  'Load balancer virtual server integration-test-vs-1 does not have a valid backing pool.'
155
128
  )
@@ -159,7 +132,9 @@ module Vcloud
159
132
 
160
133
  after(:all) do
161
134
  reset_edge_gateway unless ENV['VCLOUD_NO_RESET_VSE_AFTER']
162
- FileUtils.rm(@files_to_delete)
135
+ @files_to_delete.each { |f|
136
+ f.unlink
137
+ }
163
138
  end
164
139
 
165
140
  def reset_edge_gateway
@@ -173,14 +148,16 @@ module Vcloud
173
148
  })
174
149
  end
175
150
 
176
- def generate_input_config_file(data_file, erb_input)
177
- config_erb = File.expand_path("data/#{data_file}", File.dirname(__FILE__))
178
- output_file = ErbHelper.convert_erb_template_to_yaml(erb_input, config_erb)
179
- @files_to_delete << output_file
180
- output_file
151
+ def generate_vars_file(vars_hash)
152
+ file = Tempfile.new('vars_file')
153
+ file.write(vars_hash.to_yaml)
154
+ file.close
155
+ @files_to_delete << file
156
+
157
+ file.path
181
158
  end
182
159
 
183
- def edge_gateway_erb_input
160
+ def edge_gateway_vars_hash
184
161
  {
185
162
  :edge_gateway_name => @edge_name,
186
163
  :edge_gateway_ext_network_id => @ext_net_id,
@@ -1,27 +1,11 @@
1
1
  require 'spec_helper'
2
+ require 'tempfile'
2
3
 
3
4
  module Vcloud
4
5
  describe EdgeGatewayServices do
5
6
 
6
- required_env = {
7
- 'VCLOUD_EDGE_GATEWAY' => 'to name of VSE',
8
- 'VCLOUD_PROVIDER_NETWORK_ID' => 'to ID of VSE external network',
9
- 'VCLOUD_PROVIDER_NETWORK_IP' => 'to an available IP on VSE external network',
10
- 'VCLOUD_NETWORK1_ID' => 'to the ID of a VSE internal network',
11
- 'VCLOUD_NETWORK1_NAME' => 'to the name of the VSE internal network',
12
- 'VCLOUD_NETWORK1_IP' => 'to an ID on the VSE internal network',
13
- }
14
-
15
- error = false
16
- required_env.each do |var,message|
17
- unless ENV[var]
18
- puts "Must set #{var} #{message}" unless ENV[var]
19
- error = true
20
- end
21
- end
22
- Kernel.exit(2) if error
23
-
24
7
  before(:all) do
8
+ IntegrationHelper.verify_env_vars
25
9
  @edge_name = ENV['VCLOUD_EDGE_GATEWAY']
26
10
  @ext_net_id = ENV['VCLOUD_PROVIDER_NETWORK_ID']
27
11
  @ext_net_ip = ENV['VCLOUD_PROVIDER_NETWORK_IP']
@@ -36,13 +20,8 @@ module Vcloud
36
20
 
37
21
  before(:all) do
38
22
  reset_edge_gateway
39
- @initial_nat_config_file = generate_input_config_file(
40
- 'nat_config.yaml.erb', {
41
- edge_gateway_name: @edge_name,
42
- network_id: @ext_net_id,
43
- original_ip: @ext_net_ip,
44
- }
45
- )
23
+ @vars_config_file = generate_vars_file(edge_gateway_vars_hash)
24
+ @initial_nat_config_file = IntegrationHelper.fixture_file('nat_config.yaml.mustache')
46
25
  @edge_gateway = Vcloud::Core::EdgeGateway.get_by_name(@edge_name)
47
26
  end
48
27
 
@@ -50,7 +29,9 @@ module Vcloud
50
29
 
51
30
  before(:all) do
52
31
  local_config = Core::ConfigLoader.new.load_config(
53
- @initial_nat_config_file, Vcloud::Schema::EDGE_GATEWAY_SERVICES
32
+ @initial_nat_config_file,
33
+ Vcloud::Schema::EDGE_GATEWAY_SERVICES,
34
+ @vars_config_file
54
35
  )
55
36
  @local_vcloud_config = EdgeGateway::ConfigurationGenerator::NatService.new(
56
37
  local_config[:nat_service],
@@ -66,7 +47,7 @@ module Vcloud
66
47
  it "should only make one EdgeGateway update task, to minimise EdgeGateway reload events" do
67
48
  start_time = Time.now.getutc
68
49
  task_list_before_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
69
- EdgeGatewayServices.new.update(@initial_nat_config_file)
50
+ EdgeGatewayServices.new.update(@initial_nat_config_file, @vars_config_file)
70
51
  task_list_after_update = get_all_edge_gateway_update_tasks_ordered_by_start_date_since_time(start_time)
71
52
  expect(task_list_after_update.size - task_list_before_update.size).to be(1)
72
53
  end
@@ -91,7 +72,7 @@ module Vcloud
91
72
 
92
73
  it "and then should not configure the firewall service if updated again with the same configuration (idempotency)" do
93
74
  expect(Vcloud::Core.logger).to receive(:info).with('EdgeGatewayServices.update: Configuration is already up to date. Skipping.')
94
- EdgeGatewayServices.new.update(@initial_nat_config_file)
75
+ EdgeGatewayServices.new.update(@initial_nat_config_file, @vars_config_file)
95
76
  end
96
77
 
97
78
  end
@@ -131,13 +112,16 @@ module Vcloud
131
112
  context "ensure hairpin NAT rules are specifiable" do
132
113
 
133
114
  it "and then should configure hairpin NATting with orgVdcNetwork" do
134
- input_config_file = generate_input_config_file('hairpin_nat_config.yaml.erb', {
115
+ vars_file = generate_vars_file({
135
116
  edge_gateway_name: @edge_name,
136
117
  org_vdc_network_id: @int_net_id,
137
118
  original_ip: @int_net_ip,
138
119
  })
139
120
 
140
- EdgeGatewayServices.new.update(input_config_file)
121
+ EdgeGatewayServices.new.update(
122
+ IntegrationHelper.fixture_file('hairpin_nat_config.yaml.mustache'),
123
+ vars_file
124
+ )
141
125
 
142
126
  edge_gateway = Vcloud::Core::EdgeGateway.get_by_name(@edge_name)
143
127
  nat_service = edge_gateway.vcloud_attributes[:Configuration][:EdgeGatewayServiceConfiguration][:NatService]
@@ -157,13 +141,18 @@ module Vcloud
157
141
 
158
142
  it "should raise error if network provided in rule does not exist" do
159
143
  random_network_id = SecureRandom.uuid
160
- input_config_file = generate_input_config_file('nat_config.yaml.erb', {
144
+ vars_file = generate_vars_file({
161
145
  edge_gateway_name: @edge_name,
162
146
  network_id: random_network_id,
163
147
  original_ip: @int_net_ip,
164
148
  })
165
- expect{EdgeGatewayServices.new.update(input_config_file)}.
166
- to raise_error("unable to find gateway network interface with id #{random_network_id}")
149
+
150
+ expect {
151
+ EdgeGatewayServices.new.update(
152
+ IntegrationHelper.fixture_file('nat_config.yaml.mustache'),
153
+ vars_file
154
+ )
155
+ }.to raise_error("unable to find gateway network interface with id #{random_network_id}")
167
156
  end
168
157
  end
169
158
 
@@ -173,7 +162,9 @@ module Vcloud
173
162
  end
174
163
 
175
164
  def remove_temp_config_files
176
- FileUtils.rm(@files_to_delete)
165
+ @files_to_delete.each { |f|
166
+ f.unlink
167
+ }
177
168
  end
178
169
 
179
170
  def reset_edge_gateway
@@ -183,18 +174,20 @@ module Vcloud
183
174
  })
184
175
  end
185
176
 
186
- def generate_input_config_file(data_file, erb_input)
187
- config_erb = File.expand_path("data/#{data_file}", File.dirname(__FILE__))
188
- output_file = ErbHelper.convert_erb_template_to_yaml(erb_input, config_erb)
189
- @files_to_delete << output_file
190
- output_file
177
+ def generate_vars_file(vars_hash)
178
+ file = Tempfile.new('vars_file')
179
+ file.write(vars_hash.to_yaml)
180
+ file.close
181
+ @files_to_delete << file
182
+
183
+ file.path
191
184
  end
192
185
 
193
- def edge_gateway_erb_input
186
+ def edge_gateway_vars_hash
194
187
  {
195
188
  :edge_gateway_name => @edge_name,
196
- :edge_gateway_ext_network_id => @ext_net_id,
197
- :edge_gateway_ext_network_ip => @ext_net_ip,
189
+ :network_id => @ext_net_id,
190
+ :original_ip => @ext_net_ip,
198
191
  }
199
192
  end
200
193
 
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'simplecov'
2
- require 'erb_helper'
2
+ require 'support/integration_helper'
3
3
 
4
4
  SimpleCov.profiles.define 'gem' do
5
5
  add_filter '/spec/'
@@ -0,0 +1,29 @@
1
+ module IntegrationHelper
2
+ REQUIRED_ENV = {
3
+ 'VCLOUD_EDGE_GATEWAY' => 'to name of VSE',
4
+ 'VCLOUD_PROVIDER_NETWORK_ID' => 'to ID of VSE external network',
5
+ 'VCLOUD_PROVIDER_NETWORK_IP' => 'to an available IP on VSE external network',
6
+ 'VCLOUD_NETWORK1_ID' => 'to the ID of a VSE internal network',
7
+ 'VCLOUD_NETWORK1_NAME' => 'to the name of the VSE internal network',
8
+ 'VCLOUD_NETWORK1_IP' => 'to an ID on the VSE internal network',
9
+ }
10
+
11
+ def self.verify_env_vars
12
+ error = false
13
+ REQUIRED_ENV.each do |var,message|
14
+ unless ENV[var]
15
+ puts "Must set #{var} #{message}" unless ENV[var]
16
+ error = true
17
+ end
18
+ end
19
+ Kernel.exit(2) if error
20
+ end
21
+
22
+ def self.fixture_path
23
+ File.expand_path("../integration/edge_gateway/data", File.dirname(__FILE__))
24
+ end
25
+
26
+ def self.fixture_file(path)
27
+ File.join(self.fixture_path, path)
28
+ end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcloud-edge_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-06 00:00:00.000000000 Z
12
+ date: 2014-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -148,15 +148,19 @@ extensions: []
148
148
  extra_rdoc_files: []
149
149
  files:
150
150
  - .gitignore
151
+ - .travis.yml
151
152
  - CHANGELOG.md
152
153
  - Gemfile
153
154
  - LICENSE.txt
154
155
  - README.md
155
156
  - Rakefile
156
157
  - bin/vcloud-configure-edge
157
- - examples/firewall-rules.yaml
158
- - examples/loadbalancer-rules.yaml
159
- - examples/nat-rules.yaml
158
+ - examples/vcloud-configure-edge/firewall-rules.yaml
159
+ - examples/vcloud-configure-edge/loadbalancer-rules.yaml
160
+ - examples/vcloud-configure-edge/nat-rules.yaml
161
+ - examples/vcloud-configure-edge/template-nat-rules.yaml.mustache
162
+ - examples/vcloud-configure-edge/template-vars-env1.yaml
163
+ - examples/vcloud-configure-edge/template-vars-env2.yaml
160
164
  - jenkins.sh
161
165
  - jenkins_integration_tests.sh
162
166
  - lib/vcloud/edge_gateway.rb
@@ -175,25 +179,25 @@ files:
175
179
  - lib/vcloud/schema/firewall_service.rb
176
180
  - lib/vcloud/schema/load_balancer_service.rb
177
181
  - lib/vcloud/schema/nat_service.rb
178
- - spec/erb_helper.rb
179
- - spec/integration/edge_gateway/data/firewall_config.yaml.erb
180
- - spec/integration/edge_gateway/data/firewall_config_updated_rule.yaml.erb
181
- - spec/integration/edge_gateway/data/firewall_rule_order_test.yaml.erb
182
- - spec/integration/edge_gateway/data/hairpin_nat_config.yaml.erb
182
+ - spec/integration/edge_gateway/data/firewall_config.yaml.mustache
183
+ - spec/integration/edge_gateway/data/firewall_config_updated_rule.yaml.mustache
184
+ - spec/integration/edge_gateway/data/firewall_rule_order_test.yaml.mustache
185
+ - spec/integration/edge_gateway/data/hairpin_nat_config.yaml.mustache
183
186
  - spec/integration/edge_gateway/data/incorrect_firewall_config.yaml
184
- - spec/integration/edge_gateway/data/load_balancer_config.yaml.erb
185
- - spec/integration/edge_gateway/data/load_balancer_empty.yaml.erb
186
- - spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.erb
187
- - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.erb
188
- - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.erb
189
- - spec/integration/edge_gateway/data/nat_and_firewall_config.yaml.erb
190
- - spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.erb
191
- - spec/integration/edge_gateway/data/nat_config.yaml.erb
187
+ - spec/integration/edge_gateway/data/load_balancer_config.yaml.mustache
188
+ - spec/integration/edge_gateway/data/load_balancer_empty.yaml.mustache
189
+ - spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.mustache
190
+ - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.mustache
191
+ - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.mustache
192
+ - spec/integration/edge_gateway/data/nat_and_firewall_config.yaml.mustache
193
+ - spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.mustache
194
+ - spec/integration/edge_gateway/data/nat_config.yaml.mustache
192
195
  - spec/integration/edge_gateway/edge_gateway_services_spec.rb
193
196
  - spec/integration/edge_gateway/firewall_service_spec.rb
194
197
  - spec/integration/edge_gateway/load_balancer_service_spec.rb
195
198
  - spec/integration/edge_gateway/nat_service_spec.rb
196
199
  - spec/spec_helper.rb
200
+ - spec/support/integration_helper.rb
197
201
  - spec/vcloud/data/basic_preamble_test.erb
198
202
  - spec/vcloud/data/basic_preamble_test.erb.OUT
199
203
  - spec/vcloud/data/working.json
@@ -240,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
244
  version: '0'
241
245
  segments:
242
246
  - 0
243
- hash: 1568405041543007530
247
+ hash: 2640084330965865907
244
248
  requirements: []
245
249
  rubyforge_project:
246
250
  rubygems_version: 1.8.23
@@ -248,25 +252,25 @@ signing_key:
248
252
  specification_version: 3
249
253
  summary: Tool to configure a VMware vCloud Edge Gateway
250
254
  test_files:
251
- - spec/erb_helper.rb
252
- - spec/integration/edge_gateway/data/firewall_config.yaml.erb
253
- - spec/integration/edge_gateway/data/firewall_config_updated_rule.yaml.erb
254
- - spec/integration/edge_gateway/data/firewall_rule_order_test.yaml.erb
255
- - spec/integration/edge_gateway/data/hairpin_nat_config.yaml.erb
255
+ - spec/integration/edge_gateway/data/firewall_config.yaml.mustache
256
+ - spec/integration/edge_gateway/data/firewall_config_updated_rule.yaml.mustache
257
+ - spec/integration/edge_gateway/data/firewall_rule_order_test.yaml.mustache
258
+ - spec/integration/edge_gateway/data/hairpin_nat_config.yaml.mustache
256
259
  - spec/integration/edge_gateway/data/incorrect_firewall_config.yaml
257
- - spec/integration/edge_gateway/data/load_balancer_config.yaml.erb
258
- - spec/integration/edge_gateway/data/load_balancer_empty.yaml.erb
259
- - spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.erb
260
- - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.erb
261
- - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.erb
262
- - spec/integration/edge_gateway/data/nat_and_firewall_config.yaml.erb
263
- - spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.erb
264
- - spec/integration/edge_gateway/data/nat_config.yaml.erb
260
+ - spec/integration/edge_gateway/data/load_balancer_config.yaml.mustache
261
+ - spec/integration/edge_gateway/data/load_balancer_empty.yaml.mustache
262
+ - spec/integration/edge_gateway/data/load_balancer_single_pool.yaml.mustache
263
+ - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_invalid_pool.yaml.mustache
264
+ - spec/integration/edge_gateway/data/load_balancer_single_virtual_server_missing_pool.yaml.mustache
265
+ - spec/integration/edge_gateway/data/nat_and_firewall_config.yaml.mustache
266
+ - spec/integration/edge_gateway/data/nat_and_firewall_plus_load_balancer_config.yaml.mustache
267
+ - spec/integration/edge_gateway/data/nat_config.yaml.mustache
265
268
  - spec/integration/edge_gateway/edge_gateway_services_spec.rb
266
269
  - spec/integration/edge_gateway/firewall_service_spec.rb
267
270
  - spec/integration/edge_gateway/load_balancer_service_spec.rb
268
271
  - spec/integration/edge_gateway/nat_service_spec.rb
269
272
  - spec/spec_helper.rb
273
+ - spec/support/integration_helper.rb
270
274
  - spec/vcloud/data/basic_preamble_test.erb
271
275
  - spec/vcloud/data/basic_preamble_test.erb.OUT
272
276
  - spec/vcloud/data/working.json
data/spec/erb_helper.rb DELETED
@@ -1,11 +0,0 @@
1
- class ErbHelper
2
- def self.convert_erb_template_to_yaml test_namespace, input_erb_config
3
- input_erb_config = input_erb_config
4
- e = ERB.new(File.open(input_erb_config).read)
5
- output_yaml_config = File.join(File.dirname(input_erb_config), "output_#{Time.now.strftime('%s.%6N')}.yaml")
6
- File.open(output_yaml_config, 'w') { |f|
7
- f.write e.result(OpenStruct.new(test_namespace).instance_eval { binding })
8
- }
9
- output_yaml_config
10
- end
11
- end