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

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, #ls_type, #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 inherited from Lsa

#<=>, #ack, #encode, #encode_header, #encode_request, factory, #find_lsa_from_link, #force_refresh, #header_lsa, #is_acked?, #key, #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.



123
124
125
126
127
128
# File 'lib/lsa/summary.rb', line 123

def initialize(arg={})
  if arg.is_a?(Hash)
    arg = fix_hash(arg).merge!({:ls_type => :summary_lsa,}) 
  end
  super
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



108
109
110
# File 'lib/lsa/summary.rb', line 108

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

.countObject



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

def count
  @count ||= 0
end

.incr_countObject



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

def incr_count
  self.count
  @count += 1
end

.networkObject



112
113
114
# File 'lib/lsa/summary.rb', line 112

def network
  @base_addr + count
end

.new_lsdb(arg = {}) ⇒ Object



116
117
118
# File 'lib/lsa/summary.rb', line 116

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

.resetObject



104
105
106
# File 'lib/lsa/summary.rb', line 104

def reset
  @count = nil
end