vcloud-edge_gateway 0.4.0 → 0.5.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 (39) hide show
  1. data/CHANGELOG.md +6 -0
  2. data/README.md +28 -0
  3. data/bin/vcloud-configure-edge +3 -2
  4. data/lib/vcloud/edge_gateway.rb +5 -6
  5. data/lib/vcloud/edge_gateway/configuration_generator/load_balancer_service.rb +14 -10
  6. data/lib/vcloud/edge_gateway/configure.rb +32 -0
  7. data/lib/vcloud/edge_gateway/schema/edge_gateway.rb +18 -0
  8. data/lib/vcloud/edge_gateway/schema/firewall_service.rb +41 -0
  9. data/lib/vcloud/edge_gateway/schema/load_balancer_service.rb +183 -0
  10. data/lib/vcloud/edge_gateway/schema/nat_service.rb +38 -0
  11. data/lib/vcloud/edge_gateway/version.rb +1 -1
  12. data/spec/integration/edge_gateway/data/load_balancer_config.yaml.mustache +4 -0
  13. data/spec/integration/edge_gateway/edge_gateway_services_spec.rb +6 -6
  14. data/spec/integration/edge_gateway/firewall_service_spec.rb +9 -9
  15. data/spec/integration/edge_gateway/load_balancer_service_spec.rb +10 -10
  16. data/spec/integration/edge_gateway/nat_service_spec.rb +10 -10
  17. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_http-input.yaml +1 -1
  18. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_http-output.yaml +2 -2
  19. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_http-tcp-healthcheck-input.yaml +41 -0
  20. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_http-tcp-healthcheck-with-uri-input.yaml +42 -0
  21. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_https-healthcheck-uri-input.yaml +42 -0
  22. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_https-output.yaml +2 -2
  23. data/spec/vcloud/edge_gateway/configuration_generator/data/load_balancer_mixed_complex-output.yaml +3 -3
  24. data/spec/vcloud/edge_gateway/configuration_generator/load_balancer_service_spec.rb +64 -3
  25. data/spec/vcloud/edge_gateway/edge_gateway_configuration_spec.rb +6 -6
  26. data/spec/vcloud/edge_gateway/firewall_schema_validation_spec.rb +2 -2
  27. data/spec/vcloud/edge_gateway/load_balancer_schema_validation_spec.rb +123 -7
  28. data/spec/vcloud/edge_gateway/nat_schema_validation_spec.rb +4 -4
  29. metadata +14 -18
  30. data/lib/vcloud/edge_gateway_services.rb +0 -31
  31. data/lib/vcloud/schema/edge_gateway.rb +0 -16
  32. data/lib/vcloud/schema/firewall_service.rb +0 -39
  33. data/lib/vcloud/schema/load_balancer_service.rb +0 -132
  34. data/lib/vcloud/schema/nat_service.rb +0 -35
  35. data/spec/vcloud/data/basic_preamble_test.erb +0 -8
  36. data/spec/vcloud/data/basic_preamble_test.erb.OUT +0 -8
  37. data/spec/vcloud/data/working.json +0 -21
  38. data/spec/vcloud/data/working.yaml +0 -22
  39. data/spec/vcloud/data/working_with_defaults.yaml +0 -25
@@ -1,31 +0,0 @@
1
- require 'hashdiff'
2
-
3
- module Vcloud
4
- class EdgeGatewayServices
5
-
6
- def initialize
7
- @config_loader = Vcloud::Core::ConfigLoader.new
8
- end
9
-
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
-
13
- edge_gateway = Core::EdgeGateway.get_by_name local_config[:gateway]
14
- remote_config = edge_gateway.vcloud_attributes[:Configuration][:EdgeGatewayServiceConfiguration]
15
- edge_gateway_interface_list = edge_gateway.interfaces
16
-
17
- proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
18
- local_config,
19
- remote_config,
20
- edge_gateway_interface_list
21
- )
22
-
23
- if proposed_config.update_required?
24
- edge_gateway.update_configuration proposed_config.config
25
- else
26
- Vcloud::Core.logger.info("EdgeGatewayServices.update: Configuration is already up to date. Skipping.")
27
- end
28
- end
29
-
30
- end
31
- end
@@ -1,16 +0,0 @@
1
- module Vcloud
2
- module Schema
3
-
4
- EDGE_GATEWAY_SERVICES = {
5
- type: 'hash',
6
- allowed_empty: false,
7
- internals: {
8
- gateway: { type: 'string' },
9
- firewall_service: FIREWALL_SERVICE,
10
- nat_service: NAT_SERVICE,
11
- load_balancer_service: LOAD_BALANCER_SERVICE,
12
- }
13
- }
14
-
15
- end
16
- end
@@ -1,39 +0,0 @@
1
- module Vcloud
2
- module Schema
3
-
4
- FIREWALL_RULE = {
5
- type: Hash,
6
- internals: {
7
- id: { type: 'string_or_number', required: false},
8
- enabled: { type: 'boolean', required: false},
9
- match_on_translate: { type: 'boolean', required: false},
10
- description: { type: 'string', required: false, allowed_empty: true},
11
- policy: { type: 'enum', required: false, acceptable_values: ['allow', 'drop'] },
12
- source_ip: { type: 'ip_address_range', required: true },
13
- destination_ip: { type: 'ip_address_range', required: true },
14
- source_port_range: { type: 'string', required: false },
15
- destination_port_range: { type: 'string', required: false },
16
- enable_logging: { type: 'boolean', required: false },
17
- protocols: { type: 'enum', required: false, acceptable_values: ['tcp', 'udp', 'icmp', 'tcp+udp', 'any']},
18
- }
19
- }
20
-
21
- FIREWALL_SERVICE = {
22
- type: Hash,
23
- allowed_empty: true,
24
- required: false,
25
- internals: {
26
- enabled: { type: 'boolean', required: false},
27
- policy: { type: 'enum', required: false, acceptable_values: ['allow', 'drop'] },
28
- log_default_action: { type: 'boolean', required: false},
29
- firewall_rules: {
30
- type: Array,
31
- required: false,
32
- allowed_empty: true,
33
- each_element_is: FIREWALL_RULE
34
- }
35
- }
36
- }
37
-
38
- end
39
- end
@@ -1,132 +0,0 @@
1
- module Vcloud
2
- module Schema
3
-
4
- POOL_MEMBER_SERVICE_PORT_ENTRY = {
5
- type: Hash,
6
- required: false,
7
- internals: {
8
- port: { type: 'string_or_number', required: false },
9
- health_check_port: { type: 'string_or_number', required: false },
10
- }
11
- }
12
-
13
- LOAD_BALANCER_MEMBER_ENTRY = {
14
- type: Hash,
15
- internals: {
16
- ip_address: { type: 'ip_address', required: true },
17
- weight: { type: 'string_or_number', required: false },
18
- service_port: {
19
- type: 'hash',
20
- required: false,
21
- internals: {
22
- http: POOL_MEMBER_SERVICE_PORT_ENTRY,
23
- https: POOL_MEMBER_SERVICE_PORT_ENTRY,
24
- tcp: POOL_MEMBER_SERVICE_PORT_ENTRY,
25
- },
26
- },
27
- },
28
- }
29
-
30
- POOL_SERVICE_SECTION = {
31
- type: Hash,
32
- required: false,
33
- allowed_empty: true,
34
- internals: {
35
- enabled: { type: 'boolean', required: false },
36
- port: { type: 'string_or_number', required: false },
37
- algorithm: { type: 'enum', required: false,
38
- acceptable_values: [ 'ROUND_ROBIN', 'IP_HASH', 'URI', 'LEAST_CONNECTED' ]},
39
- health_check: {
40
- type: 'hash',
41
- required: false,
42
- internals: {
43
- port: { type: 'string_or_number', required: false },
44
- uri: { type: 'string', required: false },
45
- protocol: { type: 'enum', required: false,
46
- acceptable_values: [ 'HTTP', 'SSL', 'TCP' ] },
47
- health_threshold: { type: 'string_or_number', required: false },
48
- unhealth_threshold: { type: 'string_or_number', required: false },
49
- interval: { type: 'string_or_number', required: false },
50
- timeout: { type: 'string_or_number', required: false },
51
- },
52
- },
53
- }
54
- }
55
-
56
- LOAD_BALANCER_POOL_ENTRY = {
57
- type: Hash,
58
- internals: {
59
- name: { type: 'string', required: true },
60
- description: { type: 'string', required: false },
61
- service: {
62
- type: 'hash',
63
- required: false,
64
- internals: {
65
- http: POOL_SERVICE_SECTION,
66
- https: POOL_SERVICE_SECTION,
67
- tcp: POOL_SERVICE_SECTION,
68
- }
69
- },
70
- members: {
71
- type: Array,
72
- required: true,
73
- allowed_empty: false,
74
- each_element_is: LOAD_BALANCER_MEMBER_ENTRY,
75
- }
76
- }
77
- }
78
-
79
- VIRTUAL_SERVER_SERVICE_PROFILE_ENTRY = {
80
- type: Hash,
81
- required: false,
82
- allowed_empty: true,
83
- internals: {
84
- enabled: { type: 'boolean', required: false },
85
- port: { type: 'string_or_number', required: false },
86
- }
87
- }
88
-
89
- LOAD_BALANCER_VIRTUAL_SERVER_ENTRY = {
90
- type: Hash,
91
- internals: {
92
- enabled: { type: 'boolean', required: false },
93
- name: { type: 'string', required: true },
94
- description: { type: 'string', required: false },
95
- ip_address: { type: 'ip_address', required: true },
96
- network: { type: 'string', required: true },
97
- pool: { type: 'string', required: true },
98
- logging: { type: 'boolean', required: false },
99
- service_profiles: {
100
- type: 'hash',
101
- required: false,
102
- internals: {
103
- http: VIRTUAL_SERVER_SERVICE_PROFILE_ENTRY,
104
- https: VIRTUAL_SERVER_SERVICE_PROFILE_ENTRY,
105
- tcp: VIRTUAL_SERVER_SERVICE_PROFILE_ENTRY,
106
- },
107
- },
108
- }
109
- }
110
-
111
- LOAD_BALANCER_SERVICE = {
112
- type: Hash,
113
- allowed_empty: true,
114
- required: false,
115
- internals: {
116
- enabled: { type: 'boolean', required: false },
117
- pools: {
118
- type: Array,
119
- required: false,
120
- allowed_empty: true,
121
- each_element_is: LOAD_BALANCER_POOL_ENTRY,
122
- },
123
- virtual_servers: {
124
- type: Array,
125
- required: false,
126
- allowed_empty: true,
127
- each_element_is: LOAD_BALANCER_VIRTUAL_SERVER_ENTRY,
128
- },
129
- }
130
- }
131
- end
132
- end
@@ -1,35 +0,0 @@
1
- module Vcloud
2
- module Schema
3
-
4
- NAT_RULE = {
5
- type: Hash,
6
- internals: {
7
- id: {type: 'string_or_number', required: false},
8
- enabled: {type: 'boolean', required: false},
9
- rule_type: { type: 'enum', required: true, acceptable_values: ['SNAT', 'DNAT' ]},
10
- description: {type: 'string', required: false, allowed_empty: true},
11
- network_id: {type: 'string', required: true},
12
- original_ip: {type: 'ip_address_range', required: true},
13
- original_port: {type: 'string', required: false},
14
- translated_ip: {type: 'ip_address_range', required: true},
15
- translated_port: {type: 'string', required: false},
16
- protocol: {type: 'enum', required: false, acceptable_values: ['tcp', 'udp', 'icmp', 'tcp+udp', 'any']},
17
- }
18
- }
19
-
20
- NAT_SERVICE = {
21
- type: Hash,
22
- allowed_empty: true,
23
- required: false,
24
- internals: {
25
- enabled: {type: 'boolean', required: false},
26
- nat_rules: {
27
- type: Array,
28
- required: false,
29
- allowed_empty: true,
30
- each_element_is: NAT_RULE
31
- }
32
- }
33
- }
34
- end
35
- end
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Default preamble
4
-
5
- (
6
- echo "in $*"
7
- echo "message: <%= vars[:message] -%>"
8
- ) >> /PREAMBLE_OUTPUT
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Default preamble
4
-
5
- (
6
- echo "in $*"
7
- echo "message: hello world"
8
- ) >> /PREAMBLE_OUTPUT
@@ -1,21 +0,0 @@
1
- {
2
- "vapps":[{
3
- "name":"vapp-vcloud-tools-tests",
4
- "vdc_name":"VDC_NAME",
5
- "catalog":"CATALOG_NAME",
6
- "catalog_item":"CATALOG_ITEM",
7
- "vm":{
8
- "hardware_config":{"memory":"4096", "cpu":"2"},
9
- "extra_disks":[{"size":"8192"}],
10
- "network_connections":[
11
- {"name":"Default",
12
- "ip_address":"192.168.2.10"},
13
- {"name":"NetworkTest2",
14
- "ip_address":"192.168.1.10"}
15
- ],
16
- "bootstrap":{"script_path":"spec/data/basic_preamble_test.erb",
17
- "vars":{"message":"hello world"}},
18
- "metadata":{}
19
- }
20
- }]
21
- }
@@ -1,22 +0,0 @@
1
- ---
2
- vapps:
3
- - name: vapp-vcloud-tools-tests
4
- vdc_name: VDC_NAME
5
- catalog: CATALOG_NAME
6
- catalog_item: CATALOG_ITEM
7
- vm:
8
- hardware_config:
9
- memory: '4096'
10
- cpu: '2'
11
- extra_disks:
12
- - size: '8192'
13
- network_connections:
14
- - name: Default
15
- ip_address: 192.168.2.10
16
- - name: NetworkTest2
17
- ip_address: 192.168.1.10
18
- bootstrap:
19
- script_path: 'spec/data/basic_preamble_test.erb'
20
- vars:
21
- message: 'hello world'
22
- metadata: {}
@@ -1,25 +0,0 @@
1
- ---
2
- anchors:
3
- - &VDC_NAME dcs-dev
4
-
5
- vapps:
6
- - name: vapp-vcloud-tools-tests
7
- vdc_name: *VDC_NAME
8
- catalog: CATALOG_NAME
9
- catalog_item: CATALOG_ITEM
10
- vm:
11
- hardware_config:
12
- memory: '4096'
13
- cpu: '2'
14
- extra_disks:
15
- - size: '8192'
16
- network_connections:
17
- - name: Default
18
- ip_address: 192.168.2.10
19
- - name: NetworkTest2
20
- ip_address: 192.168.1.10
21
- bootstrap:
22
- script_path: 'spec/data/basic_preamble_test.erb'
23
- vars:
24
- message: 'hello world'
25
- metadata: {}