Class: OSPFv2::Summary

Inherits:
Summary_Base show all
Defined in:
lib/lsa/summary.rb

Constant Summary

Constants inherited from Lsa

Lsa::AdvertisingRouter, Lsa::LsAge, Lsa::LsId, Lsa::MODX

Constants included from Constant

Constant::DATABASE_DESCRIPTION, Constant::HELLO, Constant::LINK_STATE_ACKNOWLEDGEMENT, Constant::LINK_STATE_REQUEST, Constant::LINK_STATE_UPDATE, Constant::V2, Constant::V3

Instance Attribute Summary

Attributes inherited from Summary_Base

#metric, #mt_metrics, #netmask

Attributes inherited from Lsa

#advertising_router, #ls_age, #ls_id, #options, #sequence_number

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Summary_Base

#encode, new_hash, #parse, #to_hash, #to_s_default, #to_s_junos, #to_s_junos_verbose

Methods included from CommonMetric

#<<, #mt_metrics=

Methods inherited from Lsa

#<=>, #ack, #encode, #encode_header, #encode_request, factory, #find_lsa_from_link, #force_refresh, #header_lsa, #is_acked?, #is_opaque?, #key, #ls_type, #lsdb_link_id, #lsdb_link_id=, #maxage, #maxaged?, #method_missing, new_ntop, #parse, #refresh, #retransmit, #to_hash, #to_s_default, #to_s_junos, #to_s_verbose

Methods included from TO_S

#to_s

Methods included from Common

#ivar_to_klassname, #ivars, #set, #to_hash

Constructor Details

#initialize(arg = {}) ⇒ Summary

Returns a new instance of Summary.



117
118
119
120
121
122
123
# File 'lib/lsa/summary.rb', line 117

def initialize(arg={})
  case arg
  when Hash
    arg = fix_hash(arg).merge!({:ls_type => :summary_lsa,})
  end
  super 3, arg
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class OSPFv2::Lsa

Class Method Details

.base_ip_addr(addr = SUMMARY_BASE_ADDRESS) ⇒ Object



102
103
104
# File 'lib/lsa/summary.rb', line 102

def base_ip_addr(addr=SUMMARY_BASE_ADDRESS)
  @base_addr ||= IPAddr.new(addr)
end

.countObject



89
90
91
# File 'lib/lsa/summary.rb', line 89

def count
  @count ||= 0
end

.incr_countObject



93
94
95
96
# File 'lib/lsa/summary.rb', line 93

def incr_count
  self.count
  @count += 1
end

.networkObject



106
107
108
# File 'lib/lsa/summary.rb', line 106

def network
  @base_addr + count
end

.new_lsdb(arg = {}) ⇒ Object



110
111
112
# File 'lib/lsa/summary.rb', line 110

def new_lsdb(arg={})
  new({:network=> base_ip_addr ^ incr_count}.merge(arg))
end

.resetObject



98
99
100
# File 'lib/lsa/summary.rb', line 98

def reset
  @count = nil
end