Class: Fog::Vcloud::MockDataClasses::MockNetwork

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/vcloud/mock_data_classes.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::Vcloud::MockDataClasses::Base

Instance Method Details

#addressObject



376
377
378
# File 'lib/fog/vcloud/mock_data_classes.rb', line 376

def address
  subnet_ips.first
end

#broadcastObject



380
381
382
# File 'lib/fog/vcloud/mock_data_classes.rb', line 380

def broadcast
  subnet_ips.last
end

#dnsObject



345
346
347
# File 'lib/fog/vcloud/mock_data_classes.rb', line 345

def dns
  "8.8.8.8"
end

#extensionsObject



359
360
361
# File 'lib/fog/vcloud/mock_data_classes.rb', line 359

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

#featuresObject



349
350
351
352
353
# File 'lib/fog/vcloud/mock_data_classes.rb', line 349

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

#gatewayObject



337
338
339
# File 'lib/fog/vcloud/mock_data_classes.rb', line 337

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

#ip_collectionObject



355
356
357
# File 'lib/fog/vcloud/mock_data_classes.rb', line 355

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

#nameObject



329
330
331
# File 'lib/fog/vcloud/mock_data_classes.rb', line 329

def name
  self[:name] || subnet
end

#netmaskObject



341
342
343
# File 'lib/fog/vcloud/mock_data_classes.rb', line 341

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

#random_ipObject



363
364
365
# File 'lib/fog/vcloud/mock_data_classes.rb', line 363

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

#rnatObject

for TM eCloud. should probably be a subclass



368
369
370
# File 'lib/fog/vcloud/mock_data_classes.rb', line 368

def rnat
  self[:rnat]
end

#subnetObject



333
334
335
# File 'lib/fog/vcloud/mock_data_classes.rb', line 333

def subnet
  self[:subnet]
end

#usable_subnet_ipsObject



372
373
374
# File 'lib/fog/vcloud/mock_data_classes.rb', line 372

def usable_subnet_ips
  subnet_ips[3..-2]
end