class Havox::RIB

Attributes

routes[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/havox/classes/rib.rb, line 5
def initialize(opts = {})
  @opts = opts
  @routes = Havox::RouteFlow.ribs(vm_names, @opts)
end

Public Instance Methods

network_list(protocol = :bgp) click to toggle source
# File lib/havox/classes/rib.rb, line 16
def network_list(protocol = :bgp)
  @routes.select { |r| r.protocol.eql?(protocol) }.map(&:network).uniq
end
routes_to(ip, protocol = :bgp) click to toggle source
# File lib/havox/classes/rib.rb, line 10
def routes_to(ip, protocol = :bgp)
  @routes.select do |r|
    r.protocol.eql?(protocol) && IPAddr.new(r.network).include?(ip)
  end
end

Private Instance Methods

vm_names() click to toggle source
# File lib/havox/classes/rib.rb, line 22
def vm_names
  case @opts[:vm_names]
  when Array then @opts[:vm_names]
  when String then @opts[:vm_names].split(',').map(&:strip)
  else Havox.configuration.rf_lxc_names
  end
end