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, #opaque_id, #opaque_type, #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, #to_s_ios, #to_s_ios_verbose, #to_s_junos, #to_s_junos_verbose, #to_s_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, #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 = {}) ⇒ AsExternal

Returns a new instance of AsExternal.



347
348
349
350
# File 'lib/lsa/external.rb', line 347

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



333
334
335
# File 'lib/lsa/external.rb', line 333

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

.countObject



320
321
322
# File 'lib/lsa/external.rb', line 320

def count
  @count ||= 0
end

.incr_countObject



324
325
326
327
# File 'lib/lsa/external.rb', line 324

def incr_count
  self.count
  @count += 1
end

.networkObject



337
338
339
# File 'lib/lsa/external.rb', line 337

def network
  @base_addr + count
end

.new_hash(h) ⇒ Object



376
377
378
# File 'lib/lsa/external.rb', line 376

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

.new_lsdb(arg = {}) ⇒ Object



341
342
343
# File 'lib/lsa/external.rb', line 341

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

.resetObject



329
330
331
# File 'lib/lsa/external.rb', line 329

def reset
  @count = nil
end