Class: Bosh::Director::NetworkReservation

Inherits:
Object
  • Object
show all
Includes:
IpUtil
Defined in:
lib/bosh/director/network_reservation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IpUtil

#each_ip, #format_ip, #ip_to_i, #ip_to_netaddr

Constructor Details

#initialize(instance_model, network) ⇒ NetworkReservation

Returns a new instance of NetworkReservation.



7
8
9
10
11
12
# File 'lib/bosh/director/network_reservation.rb', line 7

def initialize(instance_model, network)
  @instance_model = instance_model
  @network = network
  @ip = nil
  @reserved = false
end

Instance Attribute Details

#instance_modelObject (readonly)

Returns the value of attribute instance_model.



5
6
7
# File 'lib/bosh/director/network_reservation.rb', line 5

def instance_model
  @instance_model
end

#ipObject (readonly)

Returns the value of attribute ip.



5
6
7
# File 'lib/bosh/director/network_reservation.rb', line 5

def ip
  @ip
end

#networkObject (readonly)

Returns the value of attribute network.



5
6
7
# File 'lib/bosh/director/network_reservation.rb', line 5

def network
  @network
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/bosh/director/network_reservation.rb', line 5

def type
  @type
end

Instance Method Details

#dynamic?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/bosh/director/network_reservation.rb', line 30

def dynamic?
  type == :dynamic
end

#mark_reservedObject



22
23
24
# File 'lib/bosh/director/network_reservation.rb', line 22

def mark_reserved
  @reserved = true
end

#reserved?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/bosh/director/network_reservation.rb', line 18

def reserved?
  @reserved
end

#resolve_network(network) ⇒ Object



14
15
16
# File 'lib/bosh/director/network_reservation.rb', line 14

def resolve_network(network)
  @network = network
end

#static?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/bosh/director/network_reservation.rb', line 26

def static?
  type == :static
end