Class: OSPFv2::TrafficEngineering
- Includes:
- Tlv
- Defined in:
- lib/lsa/traffic_engineering.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
Class Attribute Summary collapse
-
._opaque_id ⇒ Object
Returns the value of attribute _opaque_id.
Instance Attribute Summary collapse
-
#opaque_id ⇒ Object
Returns the value of attribute opaque_id.
-
#top_lvl_tlv ⇒ Object
Returns the value of attribute top_lvl_tlv.
Attributes inherited from Lsa
#advertising_router, #ls_age, #ls_id, #opaque_type, #options, #sequence_number
Class Method Summary collapse
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(_arg = {}) ⇒ TrafficEngineering
constructor
A new instance of TrafficEngineering.
- #parse(s) ⇒ Object
- #set(h) ⇒ Object
- #to_s_ios ⇒ Object
- #to_s_ios_verbose ⇒ Object
- #to_s_verbose ⇒ Object
Methods included from Tlv
Methods inherited from Lsa
#<=>, #ack, #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, #refresh, #refresh2, #retransmit, #to_hash, #to_s, #to_s_junos, #to_s_junos_verbose
Methods included from Common
#ivar_to_klassname, #ivars, #to_hash
Constructor Details
#initialize(_arg = {}) ⇒ TrafficEngineering
Returns a new instance of TrafficEngineering.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lsa/traffic_engineering.rb', line 38 def initialize(_arg={}) arg = _arg.dup @ls_type = LsType.new(:area) case arg when Hash super() set arg when String parse arg end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OSPFv2::Lsa
Class Attribute Details
._opaque_id ⇒ Object
Returns the value of attribute _opaque_id.
23 24 25 |
# File 'lib/lsa/traffic_engineering.rb', line 23 def _opaque_id @_opaque_id end |
Instance Attribute Details
#opaque_id ⇒ Object
Returns the value of attribute opaque_id.
36 37 38 |
# File 'lib/lsa/traffic_engineering.rb', line 36 def opaque_id @opaque_id end |
#top_lvl_tlv ⇒ Object
Returns the value of attribute top_lvl_tlv.
36 37 38 |
# File 'lib/lsa/traffic_engineering.rb', line 36 def top_lvl_tlv @top_lvl_tlv end |
Class Method Details
.new_hash(h) ⇒ Object
30 31 32 33 |
# File 'lib/lsa/traffic_engineering.rb', line 30 def new_hash(h) r = new(h.dup) r end |
.opaque_id ⇒ Object
24 25 26 |
# File 'lib/lsa/traffic_engineering.rb', line 24 def opaque_id @_opaque_id +=1 end |
.reset_opaque_id ⇒ Object
27 28 29 |
# File 'lib/lsa/traffic_engineering.rb', line 27 def reset_opaque_id @_opaque_id=0 end |
Instance Method Details
#encode ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/lsa/traffic_engineering.rb', line 66 def encode if top_lvl_tlv super top_lvl_tlv.encode else super end end |
#parse(s) ⇒ Object
89 90 91 |
# File 'lib/lsa/traffic_engineering.rb', line 89 def parse(s) @top_lvl_tlv = Tlv.factory(super(s)) end |
#set(h) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/lsa/traffic_engineering.rb', line 50 def set(h) return if h.empty? if h.has_key?(:top_lvl_tlv) tlv = h.delete(:top_lvl_tlv) case tlv when Hash @top_lvl_tlv = OSPFv2::Tlv.factory(tlv) when Tlv @top_lvl_tlv = tlv else raise end end super end |
#to_s_ios ⇒ Object
74 75 76 |
# File 'lib/lsa/traffic_engineering.rb', line 74 def to_s_ios super + @opaque_id.to_i.to_s end |
#to_s_ios_verbose ⇒ Object
78 79 80 |
# File 'lib/lsa/traffic_engineering.rb', line 78 def to_s_ios_verbose to_s_verbose # for now end |
#to_s_verbose ⇒ Object
82 83 84 85 86 87 |
# File 'lib/lsa/traffic_engineering.rb', line 82 def to_s_verbose s = [] s << super s << top_lvl_tlv.to_s(:ident=>5) s.join("\n ") end |