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

Inherits:
Base
  • Object
show all
Defined in:
lib/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



375
376
377
# File 'lib/fog/ecloud/mock_data_classes.rb', line 375

def address
  subnet_ips.first
end

#broadcastObject



379
380
381
# File 'lib/fog/ecloud/mock_data_classes.rb', line 379

def broadcast
  subnet_ips.last
end

#dnsObject



344
345
346
# File 'lib/fog/ecloud/mock_data_classes.rb', line 344

def dns
  "8.8.8.8"
end

#extensionsObject



358
359
360
# File 'lib/fog/ecloud/mock_data_classes.rb', line 358

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

#featuresObject



348
349
350
351
352
# File 'lib/fog/ecloud/mock_data_classes.rb', line 348

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

#gatewayObject



336
337
338
# File 'lib/fog/ecloud/mock_data_classes.rb', line 336

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

#ip_collectionObject



354
355
356
# File 'lib/fog/ecloud/mock_data_classes.rb', line 354

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

#nameObject



328
329
330
# File 'lib/fog/ecloud/mock_data_classes.rb', line 328

def name
  self[:name] || subnet
end

#netmaskObject



340
341
342
# File 'lib/fog/ecloud/mock_data_classes.rb', line 340

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

#random_ipObject



362
363
364
# File 'lib/fog/ecloud/mock_data_classes.rb', line 362

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

#rnatObject

for TM eCloud. should probably be a subclass



367
368
369
# File 'lib/fog/ecloud/mock_data_classes.rb', line 367

def rnat
  self[:rnat]
end

#subnetObject



332
333
334
# File 'lib/fog/ecloud/mock_data_classes.rb', line 332

def subnet
  self[:subnet]
end

#usable_subnet_ipsObject



371
372
373
# File 'lib/fog/ecloud/mock_data_classes.rb', line 371

def usable_subnet_ips
  subnet_ips[3..-2]
end