Class: OpsManagerUiDrivers::Version17::BoshProductSections::Subnet

Inherits:
Object
  • Object
show all
Defined in:
lib/ops_manager_ui_drivers/version17/bosh_product_sections/subnet.rb

Constant Summary collapse

FLASH_MESSAGE_CLASS =
'.flash-message'.freeze
FLASH_MESSAGE_ERRORS =
'.flash-message.error ul.message li'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(browser:, network_form:, subnet_index:) ⇒ Subnet

Returns a new instance of Subnet.



8
9
10
11
12
13
# File 'lib/ops_manager_ui_drivers/version17/bosh_product_sections/subnet.rb', line 8

def initialize(browser:, network_form:, subnet_index:)
  @browser                   = browser
  @subnet_index = subnet_index
  @subnet_form_section =
    BoshProductFormSection.new(@browser, "#{network_form.field_prefix}[subnets][#{subnet_index}]")
end

Instance Method Details

#add_subnet(identifier:, cidr:, dns:, gateway:, reserved_ips:, availability_zones:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ops_manager_ui_drivers/version17/bosh_product_sections/subnet.rb', line 15

def add_subnet(identifier:, cidr:, dns:, gateway:, reserved_ips:, availability_zones:)
  @browser.all('a', text: 'Add Subnet').last.click if @subnet_index > 0

  @subnet_form_section.set_fields(
    'iaas_identifier'    => identifier,
    'cidr'               => cidr,
    'dns'                => dns,
    'gateway'            => gateway,
    'reserved_ip_ranges' => reserved_ips,
  )

  availability_zones.each do |availability_zone|
    @browser.
      find(:xpath, %Q{//label/input[contains(@name, "#{@subnet_form_section.field_prefix}[availability_zone_references]")]/..}, text: availability_zone).click
  end
end