Class: Bosh::Director::DeploymentPlan::DynamicNetwork
- Includes:
- Bosh::Director::DnsHelper
- Defined in:
- lib/bosh/director/deployment_plan/dynamic_network.rb
Constant Summary collapse
- DYNAMIC_IP =
NetAddr::CIDR.create("255.255.255.255").to_i
Constants included from Bosh::Director::DnsHelper
Bosh::Director::DnsHelper::SOA, Bosh::Director::DnsHelper::TTL_4H, Bosh::Director::DnsHelper::TTL_5M
Constants inherited from Network
Instance Attribute Summary collapse
-
#cloud_properties ⇒ Hash
Network cloud properties.
-
#dns ⇒ Array
An array of DNS servers.
Attributes inherited from Network
#canonical_name, #deployment, #name
Instance Method Summary collapse
-
#initialize(deployment, network_spec) ⇒ DynamicNetwork
constructor
Creates a new network.
-
#network_settings(reservation, default_properties = VALID_DEFAULTS) ⇒ Hash
Returns the network settings for the specific reservation.
-
#release(reservation) ⇒ void
Releases a previous reservation that had been fulfilled.
-
#reserve(reservation) ⇒ Boolean
Reserves a network resource.
Methods included from Bosh::Director::DnsHelper
#add_default_dns_server, #canonical, #default_dns_server, #delete_dns_records, #delete_empty_domain, #dns_domain_name, #dns_ns_record, #dns_servers, #invalid_dns, #reverse_domain, #reverse_host, #update_dns_a_record, #update_dns_ptr_record
Methods inherited from Network
Methods included from ValidationHelper
Constructor Details
#initialize(deployment, network_spec) ⇒ DynamicNetwork
Creates a new network.
23 24 25 26 27 28 29 |
# File 'lib/bosh/director/deployment_plan/dynamic_network.rb', line 23 def initialize(deployment, network_spec) super @cloud_properties = safe_property(network_spec, "cloud_properties", :class => Hash) @dns = dns_servers(network_spec["name"], network_spec) end |
Instance Attribute Details
#cloud_properties ⇒ Hash
Returns Network cloud properties.
12 13 14 |
# File 'lib/bosh/director/deployment_plan/dynamic_network.rb', line 12 def cloud_properties @cloud_properties end |
#dns ⇒ Array
Returns an array of DNS servers.
16 17 18 |
# File 'lib/bosh/director/deployment_plan/dynamic_network.rb', line 16 def dns @dns end |
Instance Method Details
#network_settings(reservation, default_properties = VALID_DEFAULTS) ⇒ Hash
Returns the network settings for the specific reservation.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/bosh/director/deployment_plan/dynamic_network.rb', line 64 def network_settings(reservation, default_properties = VALID_DEFAULTS) validate_ip(reservation) config = { "type" => "dynamic", "cloud_properties" => @cloud_properties } config["dns"] = @dns if @dns if default_properties config["default"] = default_properties.sort end config end |
#release(reservation) ⇒ void
This method returns an undefined value.
Releases a previous reservation that had been fulfilled.
54 55 56 |
# File 'lib/bosh/director/deployment_plan/dynamic_network.rb', line 54 def release(reservation) validate_ip(reservation) end |
#reserve(reservation) ⇒ Boolean
Reserves a network resource.
This is either an already used reservation being verified or a new one waiting to be fulfilled.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bosh/director/deployment_plan/dynamic_network.rb', line 38 def reserve(reservation) reservation.reserved = false if reservation.static? reservation.error = NetworkReservation::WRONG_TYPE else reservation.ip = DYNAMIC_IP reservation.reserved = true reservation.type = NetworkReservation::DYNAMIC end reservation.reserved? end |