ops_manager_ui_drivers 0.2.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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +13 -0
- data/README.md +39 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/ci/run_specs.sh +11 -0
- data/lib/ops_manager_ui_drivers.rb +10 -0
- data/lib/ops_manager_ui_drivers/page_helpers.rb +52 -0
- data/lib/ops_manager_ui_drivers/version.rb +3 -0
- data/lib/ops_manager_ui_drivers/version11/api_1_1.rb +40 -0
- data/lib/ops_manager_ui_drivers/version11/available_products.rb +24 -0
- data/lib/ops_manager_ui_drivers/version11/install_progress.rb +24 -0
- data/lib/ops_manager_ui_drivers/version11/login.rb +24 -0
- data/lib/ops_manager_ui_drivers/version11/network_configuration.rb +31 -0
- data/lib/ops_manager_ui_drivers/version11/ntp_servers.rb +28 -0
- data/lib/ops_manager_ui_drivers/version11/ops_manager_director.rb +27 -0
- data/lib/ops_manager_ui_drivers/version11/product_dashboard.rb +73 -0
- data/lib/ops_manager_ui_drivers/version11/vcenter_credentials.rb +31 -0
- data/lib/ops_manager_ui_drivers/version11/vsphere_configuration.rb +31 -0
- data/lib/ops_manager_ui_drivers/version11/web_ui.rb +34 -0
- data/lib/ops_manager_ui_drivers/version12/api_1_2.rb +40 -0
- data/lib/ops_manager_ui_drivers/version12/available_products.rb +24 -0
- data/lib/ops_manager_ui_drivers/version12/install_progress.rb +24 -0
- data/lib/ops_manager_ui_drivers/version12/login.rb +24 -0
- data/lib/ops_manager_ui_drivers/version12/network_configuration.rb +32 -0
- data/lib/ops_manager_ui_drivers/version12/ntp_servers.rb +28 -0
- data/lib/ops_manager_ui_drivers/version12/ops_manager_director.rb +27 -0
- data/lib/ops_manager_ui_drivers/version12/product_dashboard.rb +73 -0
- data/lib/ops_manager_ui_drivers/version12/vcenter_credentials.rb +31 -0
- data/lib/ops_manager_ui_drivers/version12/vsphere_configuration.rb +30 -0
- data/lib/ops_manager_ui_drivers/version12/web_ui.rb +34 -0
- data/lib/ops_manager_ui_drivers/version13/api_1_3.rb +40 -0
- data/lib/ops_manager_ui_drivers/version13/availability_zones.rb +55 -0
- data/lib/ops_manager_ui_drivers/version13/available_products.rb +24 -0
- data/lib/ops_manager_ui_drivers/version13/iaas_configuration.rb +65 -0
- data/lib/ops_manager_ui_drivers/version13/install_progress.rb +43 -0
- data/lib/ops_manager_ui_drivers/version13/job_availability_zone_mapping_helper.rb +70 -0
- data/lib/ops_manager_ui_drivers/version13/job_network_mapping_helper.rb +47 -0
- data/lib/ops_manager_ui_drivers/version13/job_status_helper.rb +17 -0
- data/lib/ops_manager_ui_drivers/version13/networks.rb +83 -0
- data/lib/ops_manager_ui_drivers/version13/ops_manager_director.rb +140 -0
- data/lib/ops_manager_ui_drivers/version13/product_availability_zones.rb +38 -0
- data/lib/ops_manager_ui_drivers/version13/product_dashboard.rb +157 -0
- data/lib/ops_manager_ui_drivers/version13/product_logs.rb +53 -0
- data/lib/ops_manager_ui_drivers/version13/product_resource_configuration.rb +46 -0
- data/lib/ops_manager_ui_drivers/version13/product_status_helper.rb +64 -0
- data/lib/ops_manager_ui_drivers/version13/setup.rb +40 -0
- data/lib/ops_manager_ui_drivers/version13/web_ui.rb +106 -0
- data/lib/ops_manager_ui_drivers/version14/api_1_4.rb +40 -0
- data/lib/ops_manager_ui_drivers/version14/availability_zones.rb +59 -0
- data/lib/ops_manager_ui_drivers/version14/available_products.rb +24 -0
- data/lib/ops_manager_ui_drivers/version14/iaas_configuration.rb +89 -0
- data/lib/ops_manager_ui_drivers/version14/job_availability_zone_mapping_helper.rb +70 -0
- data/lib/ops_manager_ui_drivers/version14/job_network_mapping_helper.rb +47 -0
- data/lib/ops_manager_ui_drivers/version14/job_status_helper.rb +17 -0
- data/lib/ops_manager_ui_drivers/version14/networks.rb +58 -0
- data/lib/ops_manager_ui_drivers/version14/ops_manager_director.rb +252 -0
- data/lib/ops_manager_ui_drivers/version14/product_availability_zones.rb +38 -0
- data/lib/ops_manager_ui_drivers/version14/product_configuration.rb +34 -0
- data/lib/ops_manager_ui_drivers/version14/product_dashboard.rb +175 -0
- data/lib/ops_manager_ui_drivers/version14/product_form.rb +47 -0
- data/lib/ops_manager_ui_drivers/version14/product_logs.rb +38 -0
- data/lib/ops_manager_ui_drivers/version14/product_resource_configuration.rb +46 -0
- data/lib/ops_manager_ui_drivers/version14/product_status_helper.rb +64 -0
- data/lib/ops_manager_ui_drivers/version14/setup.rb +40 -0
- data/lib/ops_manager_ui_drivers/version14/state_change_progress.rb +43 -0
- data/lib/ops_manager_ui_drivers/version14/web_ui.rb +104 -0
- data/lib/ops_manager_ui_drivers/version15/availability_zones.rb +59 -0
- data/lib/ops_manager_ui_drivers/version15/available_products.rb +24 -0
- data/lib/ops_manager_ui_drivers/version15/iaas_configuration.rb +105 -0
- data/lib/ops_manager_ui_drivers/version15/job_availability_zone_mapping_helper.rb +70 -0
- data/lib/ops_manager_ui_drivers/version15/job_network_mapping_helper.rb +47 -0
- data/lib/ops_manager_ui_drivers/version15/job_status_helper.rb +17 -0
- data/lib/ops_manager_ui_drivers/version15/networks.rb +55 -0
- data/lib/ops_manager_ui_drivers/version15/ops_manager_director.rb +261 -0
- data/lib/ops_manager_ui_drivers/version15/product_availability_zones.rb +38 -0
- data/lib/ops_manager_ui_drivers/version15/product_configuration.rb +34 -0
- data/lib/ops_manager_ui_drivers/version15/product_dashboard.rb +176 -0
- data/lib/ops_manager_ui_drivers/version15/product_form.rb +47 -0
- data/lib/ops_manager_ui_drivers/version15/product_logs.rb +38 -0
- data/lib/ops_manager_ui_drivers/version15/product_resource_configuration.rb +63 -0
- data/lib/ops_manager_ui_drivers/version15/product_status_helper.rb +64 -0
- data/lib/ops_manager_ui_drivers/version15/setup.rb +44 -0
- data/lib/ops_manager_ui_drivers/version15/state_change_progress.rb +43 -0
- data/lib/ops_manager_ui_drivers/version15/web_ui.rb +104 -0
- data/lib/ops_manager_ui_drivers/wait_helper.rb +51 -0
- data/ops_manager_ui_drivers.gemspec +29 -0
- metadata +233 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class AvailableProducts
|
|
4
|
+
def initialize(browser:)
|
|
5
|
+
@browser = browser
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def add_product_to_install(product_name)
|
|
9
|
+
browser.visit '/'
|
|
10
|
+
browser.click_on "add-#{product_name}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def product_added?(product_name)
|
|
14
|
+
browser.visit '/'
|
|
15
|
+
browser.all("#show-configure-#{product_name}-action").any?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
attr_reader :browser
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class IaasConfiguration
|
|
4
|
+
def initialize(browser:)
|
|
5
|
+
@browser = browser
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def configure_iaas
|
|
9
|
+
open_form('iaas_configuration')
|
|
10
|
+
|
|
11
|
+
yield
|
|
12
|
+
|
|
13
|
+
save_form
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def set_vsphere_credentials(vcenter_ip:, username:, password:)
|
|
17
|
+
set_field('vcenter_ip', vcenter_ip)
|
|
18
|
+
set_field('vcenter_username', username)
|
|
19
|
+
set_field('vcenter_password', password)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def set_vcloud_credentials(vcd_url:, organization:, user:, password:)
|
|
23
|
+
set_field('vcd_url', vcd_url)
|
|
24
|
+
set_field('organization', organization)
|
|
25
|
+
set_field('vcd_username', user)
|
|
26
|
+
set_field('vcd_password', password)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def set_aws_credentials(access_key_id:, secret_access_key:, vpc_id:, security_group:, key_pair_name:, ssh_private_key:)
|
|
30
|
+
set_field('access_key_id', access_key_id)
|
|
31
|
+
set_field('secret_access_key', secret_access_key)
|
|
32
|
+
set_field('vpc_id', vpc_id)
|
|
33
|
+
set_field('security_group', security_group)
|
|
34
|
+
set_field('key_pair_name', key_pair_name)
|
|
35
|
+
set_field('ssh_private_key', ssh_private_key)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def set_openstack_credentials(
|
|
39
|
+
identity_endpoint:,
|
|
40
|
+
username:,
|
|
41
|
+
password:,
|
|
42
|
+
tenant:,
|
|
43
|
+
security_group_name:,
|
|
44
|
+
key_pair_name:,
|
|
45
|
+
ssh_private_key:
|
|
46
|
+
)
|
|
47
|
+
set_field('identity_endpoint', identity_endpoint)
|
|
48
|
+
set_field('username', username)
|
|
49
|
+
set_field('password', password)
|
|
50
|
+
set_field('tenant', tenant)
|
|
51
|
+
set_field('security_group', security_group_name)
|
|
52
|
+
set_field('key_pair_name', key_pair_name)
|
|
53
|
+
set_field('ssh_private_key', ssh_private_key)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def set_datacenter(datacenter)
|
|
58
|
+
set_field('datacenter', datacenter)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def set_datastores(datastores)
|
|
62
|
+
set_field('datastores_string', datastores)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def set_microbosh_vm_folder(microbosh_vm_folder)
|
|
66
|
+
set_field('microbosh_vm_folder', microbosh_vm_folder)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def set_microbosh_template_folder(microbosh_template_folder)
|
|
70
|
+
set_field('microbosh_template_folder', microbosh_template_folder)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def set_microbosh_disk_path(microbosh_disk_path)
|
|
74
|
+
set_field('microbosh_disk_path', microbosh_disk_path)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def set_storage_profile(storage_profile)
|
|
78
|
+
set_field('storage_profile', storage_profile)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def set_catalog_name(catalog_name)
|
|
82
|
+
set_field('catalog_name', catalog_name)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
private
|
|
86
|
+
|
|
87
|
+
attr_reader :browser
|
|
88
|
+
|
|
89
|
+
def save_form
|
|
90
|
+
browser.click_on 'Save'
|
|
91
|
+
browser.expect(browser.page).to browser.have_css('.flash-message.success')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def open_form(form)
|
|
95
|
+
browser.visit '/'
|
|
96
|
+
browser.click_on 'show-microbosh-configure-action'
|
|
97
|
+
browser.click_on "show-#{form}-action"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def set_field(field, value)
|
|
101
|
+
browser.find_field("iaas_configuration[#{field}]").set(value)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class JobAvailabilityZoneMappingHelper
|
|
4
|
+
def initialize(product_name: nil, browser: nil)
|
|
5
|
+
@product_name = product_name
|
|
6
|
+
@browser = browser
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR = "input[name='product[singleton_availability_zone_reference]']"
|
|
10
|
+
AVAILABILITY_ZONE_INPUT_SELECTOR = "input[name='product[availability_zone_references][]']"
|
|
11
|
+
|
|
12
|
+
def assign_availability_zones!(singleton_availability_zone:, availability_zones:)
|
|
13
|
+
open_form
|
|
14
|
+
|
|
15
|
+
browser.all(AVAILABILITY_ZONE_INPUT_SELECTOR).each do |checkbox|
|
|
16
|
+
checkbox.set(false)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
availability_zones.each do |az_name|
|
|
20
|
+
browser.check("#{az_name}")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
browser.choose("#{singleton_availability_zone}")
|
|
24
|
+
|
|
25
|
+
save_form
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def singleton_availability_zone
|
|
29
|
+
open_form
|
|
30
|
+
|
|
31
|
+
selected_options = browser.all("#{SINGLETON_AVAILABILITY_ZONE_INPUT_SELECTOR}[selected='selected']").map do |radio|
|
|
32
|
+
browser.find("label[for='#{radio[:id]}']").text
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
raise ArgumentError, 'availability_zone not selected' if selected_options.empty?
|
|
36
|
+
selected_options.first
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def availability_zones
|
|
40
|
+
open_form
|
|
41
|
+
|
|
42
|
+
browser.all("#{AVAILABILITY_ZONE_INPUT_SELECTOR}[checked='checked']").map do |checkbox|
|
|
43
|
+
browser.find("label[for='#{checkbox[:id]}']").text
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
attr_reader :browser, :product_name
|
|
50
|
+
|
|
51
|
+
def open_form
|
|
52
|
+
browser.visit '/'
|
|
53
|
+
browser.click_on "show-#{product_name}-configure-action"
|
|
54
|
+
browser.click_on "show-#{product_name}-availability-zone-assignment-action"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def save_form
|
|
58
|
+
browser.click_on 'Save'
|
|
59
|
+
|
|
60
|
+
unless browser.has_css?('.flash-message.success')
|
|
61
|
+
if browser.has_css?('.flash-message.error')
|
|
62
|
+
raise browser.find('.flash-message.error').text
|
|
63
|
+
else
|
|
64
|
+
raise 'unexpected failure'
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class JobNetworkMappingHelper
|
|
4
|
+
PRODUCT_NETWORK_FIELD_NAME = 'product_network_assignment'
|
|
5
|
+
|
|
6
|
+
def initialize(product_name:, browser:)
|
|
7
|
+
@product_name = product_name
|
|
8
|
+
@browser = browser
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def assign_product_to_network(network)
|
|
12
|
+
open_form
|
|
13
|
+
browser.find_field(PRODUCT_NETWORK_FIELD_NAME).find(:option, text: network).select_option
|
|
14
|
+
save_form
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def product_network
|
|
18
|
+
open_form
|
|
19
|
+
selected_options = browser.find_field(PRODUCT_NETWORK_FIELD_NAME).all('option[selected]')
|
|
20
|
+
raise ArgumentError, "#{PRODUCT_NETWORK_FIELD_NAME} not selected" if selected_options.empty?
|
|
21
|
+
selected_options.first.text
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
attr_reader :product_name, :browser
|
|
27
|
+
|
|
28
|
+
def open_form
|
|
29
|
+
browser.visit '/'
|
|
30
|
+
browser.click_on "show-#{product_name}-configure-action"
|
|
31
|
+
browser.click_on "show-#{product_name}-network-assignment-action"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def save_form
|
|
35
|
+
browser.click_on 'Save'
|
|
36
|
+
|
|
37
|
+
unless browser.has_css?('.flash-message.success')
|
|
38
|
+
if browser.has_css?('.flash-message.error')
|
|
39
|
+
raise browser.find('.flash-message.error').text
|
|
40
|
+
else
|
|
41
|
+
raise 'unexpected failure'
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class JobStatusHelper
|
|
4
|
+
def self.from_job_row(job_row)
|
|
5
|
+
ips_string = job_row.find('.actual-ips').text
|
|
6
|
+
ips = ips_string.split(', ')
|
|
7
|
+
new(ips: ips)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def initialize(ips:)
|
|
11
|
+
@ips = ips
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attr_reader :ips
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class Networks
|
|
4
|
+
def initialize(browser:)
|
|
5
|
+
@browser = browser
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def add_network(name:, iaas_network_identifier:, subnet:, dns:, gateway:, reserved_ip_ranges:)
|
|
9
|
+
open_form('network')
|
|
10
|
+
|
|
11
|
+
browser.click_on 'Add'
|
|
12
|
+
set_fields(
|
|
13
|
+
fields: {
|
|
14
|
+
'name' => name,
|
|
15
|
+
'iaas_network_identifier' => iaas_network_identifier,
|
|
16
|
+
'subnet' => subnet,
|
|
17
|
+
'dns' => dns,
|
|
18
|
+
'gateway' => gateway,
|
|
19
|
+
'reserved_ip_ranges' => reserved_ip_ranges,
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
save_form
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
attr_reader :browser
|
|
28
|
+
|
|
29
|
+
def save_form
|
|
30
|
+
browser.click_on 'Save'
|
|
31
|
+
browser.expect(browser.page).to browser.have_css('.flash-message.success')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def open_form(form)
|
|
35
|
+
browser.visit '/'
|
|
36
|
+
browser.click_on 'show-microbosh-configure-action'
|
|
37
|
+
browser.click_on "show-#{form}-action"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def set_fields(fields:)
|
|
41
|
+
fields.each do |field, value|
|
|
42
|
+
set_field(field, value)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def set_field(field, value)
|
|
47
|
+
last_field(field).set(value)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def last_field(field)
|
|
51
|
+
browser.all(:field, "network[networks][][#{field}]").last
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
module OpsManagerUiDrivers
|
|
2
|
+
module Version15
|
|
3
|
+
class OpsManagerDirector
|
|
4
|
+
def initialize(browser:)
|
|
5
|
+
@browser = browser
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def configure_microbosh(test_settings)
|
|
9
|
+
configure_iaas(test_settings)
|
|
10
|
+
|
|
11
|
+
config_director(test_settings.ops_manager)
|
|
12
|
+
|
|
13
|
+
add_azs(test_settings.iaas_type, test_settings.ops_manager.availability_zones)
|
|
14
|
+
|
|
15
|
+
assign_availability_zone(test_settings.iaas_type, test_settings.ops_manager.availability_zones)
|
|
16
|
+
|
|
17
|
+
add_networks(test_settings)
|
|
18
|
+
|
|
19
|
+
assign_networks(test_settings.ops_manager)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def configure_iaas(test_settings)
|
|
23
|
+
case test_settings.iaas_type
|
|
24
|
+
when OpsManagerUiDrivers::VCLOUD_IAAS_TYPE then
|
|
25
|
+
configure_vcloud(
|
|
26
|
+
vcd_url: test_settings.ops_manager.vcloud.creds.url,
|
|
27
|
+
organization: test_settings.ops_manager.vcloud.creds.organization,
|
|
28
|
+
user: test_settings.ops_manager.vcloud.creds.user,
|
|
29
|
+
password: test_settings.ops_manager.vcloud.creds.password,
|
|
30
|
+
datacenter: test_settings.ops_manager.vcloud.vdc.name,
|
|
31
|
+
storage_profile: test_settings.ops_manager.vcloud.vdc.storage_profile,
|
|
32
|
+
catalog_name: test_settings.ops_manager.vcloud.vdc.catalog_name,
|
|
33
|
+
)
|
|
34
|
+
when OpsManagerUiDrivers::VSPHERE_IAAS_TYPE then
|
|
35
|
+
configure_vcenter(
|
|
36
|
+
ip: test_settings.ops_manager.vcenter.creds.ip,
|
|
37
|
+
username: test_settings.ops_manager.vcenter.creds.username,
|
|
38
|
+
password: test_settings.ops_manager.vcenter.creds.password,
|
|
39
|
+
datacenter: test_settings.ops_manager.vcenter.datacenter,
|
|
40
|
+
datastores: test_settings.ops_manager.vcenter.datastore,
|
|
41
|
+
microbosh_vm_folder: test_settings.ops_manager.vcenter.microbosh_vm_folder,
|
|
42
|
+
microbosh_template_folder: test_settings.ops_manager.vcenter.microbosh_template_folder,
|
|
43
|
+
microbosh_disk_path: test_settings.ops_manager.vcenter.microbosh_disk_path,
|
|
44
|
+
)
|
|
45
|
+
when OpsManagerUiDrivers::AWS_IAAS_TYPE then
|
|
46
|
+
configure_aws(
|
|
47
|
+
aws_access_key: test_settings.ops_manager.aws.aws_access_key,
|
|
48
|
+
aws_secret_key: test_settings.ops_manager.aws.aws_secret_key,
|
|
49
|
+
vpc_id: test_settings.ops_manager.aws.vpc_id,
|
|
50
|
+
security_group: test_settings.ops_manager.aws.security_group,
|
|
51
|
+
key_pair_name: test_settings.ops_manager.aws.key_pair_name,
|
|
52
|
+
ssh_private_key: test_settings.ops_manager.aws.ssh_key
|
|
53
|
+
)
|
|
54
|
+
when OpsManagerUiDrivers::OPENSTACK_IAAS_TYPE then
|
|
55
|
+
configure_openstack(
|
|
56
|
+
identity_endpoint: test_settings.ops_manager.openstack.identity_endpoint,
|
|
57
|
+
username: test_settings.ops_manager.openstack.username,
|
|
58
|
+
password: test_settings.ops_manager.openstack.password,
|
|
59
|
+
tenant: test_settings.ops_manager.openstack.tenant,
|
|
60
|
+
security_group_name: test_settings.ops_manager.openstack.security_group_name,
|
|
61
|
+
key_pair_name: test_settings.ops_manager.openstack.key_pair_name,
|
|
62
|
+
ssh_private_key: test_settings.ops_manager.openstack.ssh_private_key
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def add_azs(iaas_type, iaas_availability_zones)
|
|
68
|
+
case iaas_type
|
|
69
|
+
when OpsManagerUiDrivers::AWS_IAAS_TYPE then
|
|
70
|
+
return unless iaas_availability_zones
|
|
71
|
+
availability_zones.add_aws_az(iaas_availability_zones.first['iaas_identifier'])
|
|
72
|
+
else
|
|
73
|
+
iaas_availability_zones && iaas_availability_zones.each do |az|
|
|
74
|
+
availability_zones.add_az(az['name'], az['cluster'], az['resource_pool'])
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def add_networks(test_settings)
|
|
80
|
+
iaas_networks = test_settings.ops_manager.networks
|
|
81
|
+
|
|
82
|
+
case test_settings.iaas_type
|
|
83
|
+
when OpsManagerUiDrivers::AWS_IAAS_TYPE, OpsManagerUiDrivers::OPENSTACK_IAAS_TYPE then
|
|
84
|
+
first_network = iaas_networks.first
|
|
85
|
+
browser.click_on 'show-network-action'
|
|
86
|
+
browser.fill_in 'network[networks][][name]', with: first_network['name']
|
|
87
|
+
browser.fill_in 'network[networks][][iaas_network_identifier]', with: first_network['identifier']
|
|
88
|
+
browser.fill_in 'network[networks][][subnet]', with: first_network['subnet']
|
|
89
|
+
browser.fill_in 'network[networks][][reserved_ip_ranges]', with: first_network['reserved_ips']
|
|
90
|
+
browser.fill_in 'network[networks][][dns]', with: first_network['dns']
|
|
91
|
+
browser.fill_in 'network[networks][][gateway]', with: first_network['gateway']
|
|
92
|
+
browser.click_on 'Save'
|
|
93
|
+
flash_errors = browser.all('.flash-message.error ul.message li').to_a
|
|
94
|
+
flash_errors.reject! { |node| node.text =~ /cannot reach gateway/i }
|
|
95
|
+
|
|
96
|
+
if (flash_errors.length > 0)
|
|
97
|
+
fail flash_errors.collect(&:text).inspect
|
|
98
|
+
end
|
|
99
|
+
else
|
|
100
|
+
iaas_networks && iaas_networks.each do |network|
|
|
101
|
+
networks.add_network(
|
|
102
|
+
name: network['name'],
|
|
103
|
+
iaas_network_identifier: network['identifier'],
|
|
104
|
+
subnet: network['subnet'],
|
|
105
|
+
reserved_ip_ranges: network['reserved_ips'],
|
|
106
|
+
dns: network['dns'],
|
|
107
|
+
gateway: network['gateway'],
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def config_director(ops_manager)
|
|
114
|
+
browser.click_on 'Director Config'
|
|
115
|
+
browser.fill_in('director_configuration[ntp_servers_string]', with: ops_manager.ntp_servers)
|
|
116
|
+
|
|
117
|
+
s3_blobstore = ops_manager.s3_blobstore
|
|
118
|
+
if s3_blobstore
|
|
119
|
+
browser.choose('S3 Compatible Blobstore')
|
|
120
|
+
browser.fill_in('director_configuration[s3_blobstore_options][endpoint]', with: s3_blobstore.endpoint)
|
|
121
|
+
browser.fill_in('director_configuration[s3_blobstore_options][bucket_name]', with: s3_blobstore.bucket_name)
|
|
122
|
+
browser.fill_in('director_configuration[s3_blobstore_options][access_key]', with: s3_blobstore.access_key_id)
|
|
123
|
+
browser.fill_in('director_configuration[s3_blobstore_options][secret_key]', with: s3_blobstore.secret_access_key)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
mysql = ops_manager.mysql
|
|
127
|
+
if mysql
|
|
128
|
+
browser.choose('External MySQL Database')
|
|
129
|
+
browser.fill_in('director_configuration[external_database_options][host]', with: mysql.host)
|
|
130
|
+
browser.fill_in('director_configuration[external_database_options][port]', with: mysql.port)
|
|
131
|
+
browser.fill_in('director_configuration[external_database_options][user]', with: mysql.user)
|
|
132
|
+
browser.fill_in('director_configuration[external_database_options][password]', with: mysql.password)
|
|
133
|
+
browser.fill_in('director_configuration[external_database_options][database]', with: mysql.dbname)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
browser.click_on 'Save'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def assign_availability_zone(iaas_type, iaas_availability_zones)
|
|
140
|
+
return unless iaas_availability_zones
|
|
141
|
+
case iaas_type
|
|
142
|
+
when OpsManagerUiDrivers::AWS_IAAS_TYPE then
|
|
143
|
+
browser.click_on 'Assign Availability Zones'
|
|
144
|
+
browser.select(iaas_availability_zones.first['iaas_identifier'])
|
|
145
|
+
browser.click_on 'Save'
|
|
146
|
+
when OpsManagerUiDrivers::VSPHERE_IAAS_TYPE
|
|
147
|
+
browser.click_on 'Assign Availability Zones'
|
|
148
|
+
browser.select(iaas_availability_zones.first['name'])
|
|
149
|
+
browser.click_on 'Save'
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def assign_networks(ops_manager)
|
|
155
|
+
if ops_manager.vcenter
|
|
156
|
+
deployment_network = ops_manager.networks[0]
|
|
157
|
+
|
|
158
|
+
infrastructure_network =
|
|
159
|
+
ops_manager.networks[1] ? ops_manager.networks[1] : ops_manager.networks[0]
|
|
160
|
+
|
|
161
|
+
assign_networks_vsphere(
|
|
162
|
+
infrastructure_network: infrastructure_network['name'],
|
|
163
|
+
deployment_network: deployment_network['name'],
|
|
164
|
+
)
|
|
165
|
+
else
|
|
166
|
+
assign_network(deployment_network: ops_manager.networks[0]['name'])
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def assign_networks_vsphere(infrastructure_network:, deployment_network:)
|
|
171
|
+
browser.click_on 'Assign Networks'
|
|
172
|
+
|
|
173
|
+
browser.within browser.find '#director_network_assignments_infrastructure_network' do
|
|
174
|
+
browser.select infrastructure_network
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
browser.within browser.find '#director_network_assignments_deployment_network' do
|
|
178
|
+
browser.select deployment_network
|
|
179
|
+
end
|
|
180
|
+
browser.click_on 'Save'
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def assign_network(deployment_network:)
|
|
184
|
+
browser.click_on 'Assign Networks'
|
|
185
|
+
|
|
186
|
+
browser.select(deployment_network, from: 'Network')
|
|
187
|
+
browser.click_on 'Save'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
private
|
|
191
|
+
attr_reader :browser
|
|
192
|
+
|
|
193
|
+
def configure_vcenter(ip:, username:, password:, datacenter:, datastores:, microbosh_vm_folder:, microbosh_template_folder:, microbosh_disk_path:)
|
|
194
|
+
iaas_configuration.configure_iaas do
|
|
195
|
+
iaas_configuration.set_vsphere_credentials(vcenter_ip: ip, username: username, password: password)
|
|
196
|
+
iaas_configuration.set_datacenter(datacenter)
|
|
197
|
+
iaas_configuration.set_datastores(datastores)
|
|
198
|
+
iaas_configuration.set_microbosh_vm_folder(microbosh_vm_folder)
|
|
199
|
+
iaas_configuration.set_microbosh_template_folder(microbosh_template_folder)
|
|
200
|
+
iaas_configuration.set_microbosh_disk_path(microbosh_disk_path)
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def configure_vcloud(vcd_url:, organization:, user:, password:, datacenter:, storage_profile:, catalog_name:)
|
|
205
|
+
iaas_configuration.configure_iaas do
|
|
206
|
+
iaas_configuration.set_vcloud_credentials(vcd_url: vcd_url, organization: organization, user: user, password: password)
|
|
207
|
+
iaas_configuration.set_datacenter(datacenter)
|
|
208
|
+
iaas_configuration.set_storage_profile(storage_profile)
|
|
209
|
+
iaas_configuration.set_catalog_name(catalog_name)
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def configure_aws(aws_access_key:, aws_secret_key:, vpc_id:, security_group:, key_pair_name:, ssh_private_key:)
|
|
214
|
+
iaas_configuration.configure_iaas do
|
|
215
|
+
iaas_configuration.set_aws_credentials(
|
|
216
|
+
access_key_id: aws_access_key,
|
|
217
|
+
secret_access_key: aws_secret_key,
|
|
218
|
+
vpc_id: vpc_id,
|
|
219
|
+
security_group: security_group,
|
|
220
|
+
key_pair_name: key_pair_name,
|
|
221
|
+
ssh_private_key: ssh_private_key
|
|
222
|
+
)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def configure_openstack(
|
|
227
|
+
identity_endpoint:,
|
|
228
|
+
username:,
|
|
229
|
+
password:,
|
|
230
|
+
tenant:,
|
|
231
|
+
security_group_name:,
|
|
232
|
+
key_pair_name:,
|
|
233
|
+
ssh_private_key:
|
|
234
|
+
)
|
|
235
|
+
iaas_configuration.configure_iaas do
|
|
236
|
+
iaas_configuration.set_openstack_credentials(
|
|
237
|
+
identity_endpoint: identity_endpoint,
|
|
238
|
+
username: username,
|
|
239
|
+
password: password,
|
|
240
|
+
tenant: tenant,
|
|
241
|
+
security_group_name: security_group_name,
|
|
242
|
+
key_pair_name: key_pair_name,
|
|
243
|
+
ssh_private_key: ssh_private_key
|
|
244
|
+
)
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def iaas_configuration
|
|
249
|
+
@iaas_configuration ||= Version15::IaasConfiguration.new(browser: browser)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def availability_zones
|
|
253
|
+
@availability_zones ||= Version15::AvailabilityZones.new(browser: browser)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def networks
|
|
257
|
+
@networks ||= Version15::Networks.new(browser: browser)
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|