Class: Havox::RIB
- Inherits:
-
Object
- Object
- Havox::RIB
- Defined in:
- lib/havox/classes/rib.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ RIB
constructor
A new instance of RIB.
- #network_list(protocol = :bgp) ⇒ Object
- #routes_to(ip, protocol = :bgp) ⇒ Object
Constructor Details
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
3 4 5 |
# File 'lib/havox/classes/rib.rb', line 3 def routes @routes end |
Instance Method Details
#network_list(protocol = :bgp) ⇒ Object
16 17 18 |
# 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) ⇒ Object
10 11 12 13 14 |
# 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 |