Sha256: 5344c0cae330fe9240ad948b1cee33c82b8a25a9c2005112cebb5755e8736c06

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

module OpsManagerUiDrivers
  module Version16
    module Sections
      class Networks
        def initialize(browser:)
          @browser = browser
          @microbosh_form_section = MicroboshFormSection.new(browser, 'network[networks][]')
        end

        def add_single_network(name:, iaas_network_identifier:, subnet:, dns:, gateway:, reserved_ip_ranges:)
          @microbosh_form_section.open_form('network')

          @microbosh_form_section.set_fields(
            'name' => name,
            'iaas_network_identifier' => iaas_network_identifier,
            'subnet' => subnet,
            'dns' => dns,
            'gateway' => gateway,
            'reserved_ip_ranges' => reserved_ip_ranges,
          )
          browser.click_on 'Save'
          flash_errors = browser.all('.flash-message.error ul.message li').to_a
          flash_errors.reject! { |node| node.text =~ /cannot reach gateway/i }

          if (flash_errors.length > 0)
            fail flash_errors.collect(&:text).inspect
          end
        end

        def add_network(name:, iaas_network_identifier:, subnet:, dns:, gateway:, reserved_ip_ranges:)
          @microbosh_form_section.open_form('network')

          browser.click_on 'Add'
          @microbosh_form_section.set_fields(
            'name' => name,
            'iaas_network_identifier' => iaas_network_identifier,
            'subnet' => subnet,
            'dns' => dns,
            'gateway' => gateway,
            'reserved_ip_ranges' => reserved_ip_ranges,
          )
          @microbosh_form_section.save_form
        end

        private

        attr_reader :browser
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ops_manager_ui_drivers-1.2.0 lib/ops_manager_ui_drivers/version16/sections/networks.rb
ops_manager_ui_drivers-1.1.0 lib/ops_manager_ui_drivers/version16/sections/networks.rb