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

Inherits:
Base
  • Object
show all
Defined in:
lib/rackspace-fog/ecloud/mock_data_classes.rb

Instance Method Summary collapse

Methods inherited from Base

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

Methods inherited from Hash

#symbolize_keys!

Constructor Details

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

Instance Method Details

#addressObject



377
378
379
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 377

def address
  subnet_ips.first
end

#broadcastObject



381
382
383
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 381

def broadcast
  subnet_ips.last
end

#dnsObject



346
347
348
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 346

def dns
  "8.8.8.8"
end

#extensionsObject



360
361
362
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 360

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

#featuresObject



350
351
352
353
354
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 350

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

#gatewayObject



338
339
340
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 338

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

#ip_collectionObject



356
357
358
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 356

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

#nameObject



330
331
332
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 330

def name
  self[:name] || subnet
end

#netmaskObject



342
343
344
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 342

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

#random_ipObject



364
365
366
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 364

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

#rnatObject

for TM eCloud. should probably be a subclass



369
370
371
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 369

def rnat
  self[:rnat]
end

#subnetObject



334
335
336
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 334

def subnet
  self[:subnet]
end

#usable_subnet_ipsObject



373
374
375
# File 'lib/rackspace-fog/ecloud/mock_data_classes.rb', line 373

def usable_subnet_ips
  subnet_ips[3..-2]
end