Class: Bosh::Director::DeploymentPlan::VipNetwork

Inherits:
Network show all
Includes:
IpUtil
Defined in:
lib/bosh/director/deployment_plan/vip_network.rb

Constant Summary

Constants inherited from Network

Network::VALID_DEFAULTS

Instance Attribute Summary collapse

Attributes inherited from Network

#canonical_name, #name

Instance Method Summary collapse

Methods included from IpUtil

#each_ip, #format_ip, #ip_to_i, #ip_to_netaddr

Methods inherited from Network

#find_az_names_for_ip, #manual?, #supports_azs?, #validate_reference_from_job!

Methods included from ValidationHelper

#safe_property

Constructor Details

#initialize(network_spec, logger) ⇒ VipNetwork

Creates a new network.

Parameters:

  • network_spec (Hash)

    parsed deployment manifest network section

  • logger (Logger)


14
15
16
17
18
19
20
21
# File 'lib/bosh/director/deployment_plan/vip_network.rb', line 14

def initialize(network_spec, logger)
  super(safe_property(network_spec, "name", :class => String), logger)

  @cloud_properties = safe_property(network_spec, "cloud_properties",
    class: Hash, default: {})
  @reserved_ips = Set.new
  @logger = TaggedLogger.new(logger, 'network-configuration')
end

Instance Attribute Details

#cloud_propertiesHash (readonly)

Returns Network cloud properties.

Returns:

  • (Hash)

    Network cloud properties



7
8
9
# File 'lib/bosh/director/deployment_plan/vip_network.rb', line 7

def cloud_properties
  @cloud_properties
end

Instance Method Details

#has_azs?(az_names) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/bosh/director/deployment_plan/vip_network.rb', line 46

def has_azs?(az_names)
  true
end

#ip_type(_) ⇒ Object



42
43
44
# File 'lib/bosh/director/deployment_plan/vip_network.rb', line 42

def ip_type(_)
  :static
end

#network_settings(reservation, default_properties = VALID_DEFAULTS, availability_zone = nil) ⇒ Hash

Returns the network settings for the specific reservation.

Parameters:

Returns:

  • (Hash)

    network settings that will be passed to the BOSH Agent



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bosh/director/deployment_plan/vip_network.rb', line 29

def network_settings(reservation, default_properties = VALID_DEFAULTS, availability_zone = nil)
  if default_properties && !default_properties.empty?
    raise NetworkReservationVipDefaultProvided,
          "Can't provide any defaults since this is a VIP network"
  end

  {
    "type" => "vip",
    "ip" => ip_to_netaddr(reservation.ip).ip,
    "cloud_properties" => @cloud_properties
  }
end