Class: OSPFv2::AsExternal

Inherits:
External_Base show all
Defined in:
lib/lsa/external.rb

Constant Summary collapse

ExternalRoute =
Class.new(OSPFv2::ExternalRoute)

Constants inherited from External_Base

External_Base::Netmask

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 External_Base

#external_route, #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 External_Base

#<<, #encode, #forwarding_address=, #metric=, #parse, #tag=, #to_hash, #to_s_default, #to_s_junos, #to_s_junos_verbose, #type=

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 = {}) ⇒ AsExternal

Returns a new instance of AsExternal.



314
315
316
317
# File 'lib/lsa/external.rb', line 314

def initialize(arg={})
  arg = fix_hash(arg) if arg.is_a?(Hash)
  super 5, 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 = EXTERNAL_BASE_ADDRESS) ⇒ Object



300
301
302
# File 'lib/lsa/external.rb', line 300

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

.countObject



287
288
289
# File 'lib/lsa/external.rb', line 287

def count
  @count ||= 0
end

.incr_countObject



291
292
293
294
# File 'lib/lsa/external.rb', line 291

def incr_count
  self.count
  @count += 1
end

.networkObject



304
305
306
# File 'lib/lsa/external.rb', line 304

def network
  @base_addr + count
end

.new_hash(h) ⇒ Object



343
344
345
# File 'lib/lsa/external.rb', line 343

def AsExternal.new_hash(h)
  new(h)
end

.new_lsdb(arg = {}) ⇒ Object



308
309
310
# File 'lib/lsa/external.rb', line 308

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

.resetObject



296
297
298
# File 'lib/lsa/external.rb', line 296

def reset
  @count = nil
end