Class: Alaxala::ShowVRF
- Defined in:
- lib/netutils/cli/alaxala/showvrf.rb
Constant Summary collapse
- DUMMY_RD =
XXX: Alaxala do not have RD…
'0:0'
Constants inherited from FSM
Instance Attribute Summary collapse
-
#vrfs ⇒ Object
readonly
Returns the value of attribute vrfs.
Instance Method Summary collapse
- #cmd ⇒ Object
- #init(l, m) ⇒ Object
-
#initialize ⇒ ShowVRF
constructor
A new instance of ShowVRF.
- #title(l, m) ⇒ Object
- #vrf(l, m) ⇒ Object
Methods inherited from Parser
Methods inherited from FSM
#add, #cb, #changeto, #state_name
Constructor Details
#initialize ⇒ ShowVRF
Returns a new instance of ShowVRF.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/netutils/cli/alaxala/showvrf.rb', line 16 def initialize super @vrfs = VRFTable.new # Date 2017/10/05 21:11:51 JST add('Init', :init, /^Date/) # VRF Routes ARP add('Title', :title, /^VRF/) # global 7/- 0/- # 1 235/- 949/- add('VRF', :vrf) end |
Instance Attribute Details
#vrfs ⇒ Object (readonly)
Returns the value of attribute vrfs.
7 8 9 |
# File 'lib/netutils/cli/alaxala/showvrf.rb', line 7 def vrfs @vrfs end |
Instance Method Details
#cmd ⇒ Object
11 12 13 14 |
# File 'lib/netutils/cli/alaxala/showvrf.rb', line 11 def cmd # XXX: we do not use interfaces for now... return 'show ip vrf all' end |
#init(l, m) ⇒ Object
28 29 30 |
# File 'lib/netutils/cli/alaxala/showvrf.rb', line 28 def init(l, m) changeto('Title') end |
#title(l, m) ⇒ Object
32 33 34 |
# File 'lib/netutils/cli/alaxala/showvrf.rb', line 32 def title(l, m) changeto('VRF') end |
#vrf(l, m) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/netutils/cli/alaxala/showvrf.rb', line 36 def vrf(l, m) if l !~ /^(global|[0-9]+)\s+.*$/ raise(ArgumentError, "Invalid line: \"#{l}\"") end name = $1 name = 'default' if name === 'global' @vrf = vrfs.add(name, DUMMY_RD) end |