Class: Fog::Ecloud::MockDataClasses::MockNetwork

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/ecloud/compute.rb

Instance Method Summary collapse

Methods inherited from Base

#_parent, base_url, #base_url, base_url=, #first, #href, #initialize, #inspect, #last

Constructor Details

This class inherits a constructor from Fog::Ecloud::MockDataClasses::Base

Instance Method Details

#addressObject



404
405
406
# File 'lib/fog/ecloud/compute.rb', line 404

def address
  subnet_ips.first
end

#broadcastObject



408
409
410
# File 'lib/fog/ecloud/compute.rb', line 408

def broadcast
  subnet_ips.last
end

#dnsObject



373
374
375
# File 'lib/fog/ecloud/compute.rb', line 373

def dns
  "8.8.8.8"
end

#extensionsObject



387
388
389
# File 'lib/fog/ecloud/compute.rb', line 387

def extensions
  @extensions ||= MockNetworkExtensions.new({}, self)
end

#featuresObject



377
378
379
380
381
# File 'lib/fog/ecloud/compute.rb', line 377

def features
  [
   { :type => :FenceMode, :value => "isolated" }
  ]
end

#gatewayObject



365
366
367
# File 'lib/fog/ecloud/compute.rb', line 365

def gateway
  self[:gateway] || subnet_ips[1]
end

#ip_collectionObject



383
384
385
# File 'lib/fog/ecloud/compute.rb', line 383

def ip_collection
  @ip_collection ||= MockNetworkIps.new({}, self)
end

#nameObject



357
358
359
# File 'lib/fog/ecloud/compute.rb', line 357

def name
  self[:name] || subnet
end

#netmaskObject



369
370
371
# File 'lib/fog/ecloud/compute.rb', line 369

def netmask
  self[:netmask] || subnet_ipaddr.mask
end

#random_ipObject



391
392
393
# File 'lib/fog/ecloud/compute.rb', line 391

def random_ip
  usable_subnet_ips[rand(usable_subnet_ips.length)]
end

#rnatObject

for TM eCloud. should probably be a subclass



396
397
398
# File 'lib/fog/ecloud/compute.rb', line 396

def rnat
  self[:rnat]
end

#subnetObject



361
362
363
# File 'lib/fog/ecloud/compute.rb', line 361

def subnet
  self[:subnet]
end

#usable_subnet_ipsObject



400
401
402
# File 'lib/fog/ecloud/compute.rb', line 400

def usable_subnet_ips
  subnet_ips[3..-2]
end