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, #opaque_id, #opaque_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_ios_verbose, #to_s_junos, #to_s_junos_verbose, #to_s_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, #refresh2, #retransmit, #to_hash, #to_s, #to_s_ios, #to_s_ios_verbose, #to_s_junos, #to_s_junos_verbose, #to_s_verbose

Methods included from Common

#ivar_to_klassname, #ivars, #set, #to_hash

Constructor Details

#initialize(arg = {}) ⇒ Summary

Returns a new instance of Summary.



130
131
132
133
134
135
136
# File 'lib/lsa/summary.rb', line 130

def initialize(arg={})
  case arg
  when Hash
    arg = fix_hash(arg).merge!({:ls_type => :summary,})
  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



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

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

.countObject



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

def count
  @count ||= 0
end

.incr_countObject



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

def incr_count
  self.count
  @count += 1
end

.networkObject



119
120
121
# File 'lib/lsa/summary.rb', line 119

def network
  @base_addr + count
end

.new_lsdb(arg = {}) ⇒ Object



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

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

.resetObject



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

def reset
  @count = nil
end