Class: Sloe::Expectations::Junos::HaveAllOspfNeighborsAs

Inherits:
Object
  • Object
show all
Defined in:
lib/sloe/expectations.rb

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ HaveAllOspfNeighborsAs

Returns a new instance of HaveAllOspfNeighborsAs.



73
74
75
# File 'lib/sloe/expectations.rb', line 73

def initialize(state)
  @state = state
end

Instance Method Details

#failure_messageObject



88
89
90
# File 'lib/sloe/expectations.rb', line 88

def failure_message
  @no_match
end

#match(actual) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/sloe/expectations.rb', line 77

def match(actual)
  data = XmlSimple.xml_in(actual.to_xml)
  @no_match = data['ospf-neighbor'].select do |neighbor|
    if neighbor['ospf-neighbor-state'][0] != @state
      "#{neighbor['neighbor-address'][0]} state is #{neighbor['os
      pf-neighbor-state'][0]}"
    end
  end
  @no_match.size == 0
end