module ManageIQ::NetworkDiscovery

Constants

VERSION

Public Class Methods

scanHost(sInfo) click to toggle source

Probing with Traceroute

1. temporarySet = random addresses in domain that end in ".1"
2. initialize cumulativeAnds and cumulativeOrs hashtables to null
3. foreach node in temporarySet do
  a. ping(this_node)
  b. if (this_node is alive) then add this_node to permanentSet else continue
  c. use Heuristic3 to add more addresses to temporarySet
  d. traceroute(node)
  e. this_router = penultimate hop in traceroute
  f. find all IP addresses of this_router with a DNS lookup
  g. this_gateway = address such that number of '1' bits in IP(this_router) XOR this_node is minimized
  h. oldSubnet = cumulativeAnds[this_gateway]
  i. cumulativeAnds[this_gateway] = this_node AND cumulativeAnds[this_gateway]
  j. cumulativeOrs[this_gateway] = this_node OR cumulativeOrs[this_gateway]
  k. newSubnet = cumulativeAnds[this_gateway]
  l. newSubnetMask = NOT (cumulativeAnds[this_gateway] XOR cumulativeOrs[this_gateway])
  m. store node in newSubnet
  n. if necessary, move hosts in permanent set's oldSubnet to newSubnet
# File lib/manageiq/network_discovery.rb, line 73
def self.scanHost(sInfo)
  require 'net/ping'
  sInfo.os = []
  sInfo.hypervisor = []

  # If the usePing flag is set we try to ping the box first
  # and skip scanning if the ping fails.
  pingOk = true
  begin
      pingOk = Net::Ping::External.new(sInfo.ipaddr).ping if sInfo.usePing
    rescue Timeout::Error
      pingOk = false
    end
  DiscoverProbe.getProductMod(sInfo) if pingOk
end

Private Instance Methods

getDefaultRouter() click to toggle source
# File lib/manageiq/network_discovery.rb, line 91
def getDefaultRouter
end
heuristic1() click to toggle source

Given an IP address, determine the length of the address mask associated with that address

for masklen = 31 to 7 do

a. assume network mask is of length masklen
b. construct the '0' and '255' directed broadcast addresses for that address and masklen
c. ping these directed broadcast addresses
d. if more than two hosts reply to both pings then return masaklen else continue
# File lib/manageiq/network_discovery.rb, line 101
def heuristic1
end
heuristic3() click to toggle source

A way to choose 32-bit values that, with good probability, lie within a choen subnet's address space

foreach address successfully pinged

add the next N consecutive addreses to temporarySet
if (address ends in 1, 63, 129, or 193) // a router: may have other hosts in this space
  add N random addresses with the same prefix to temporarySet
# File lib/manageiq/network_discovery.rb, line 110
def heuristic3
end