Class: Alaxala::ShowARP
- Inherits:
-
Parser
show all
- Defined in:
- lib/netutils/cli/alaxala/showarp.rb
Constant Summary
Constants inherited
from FSM
FSM::FSM_S_INIT
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Parser
#add, #parse, #regexp
Methods inherited from FSM
#add, #cb, #changeto, #state_name
Constructor Details
Returns a new instance of ShowARP.
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/netutils/cli/alaxala/showarp.rb', line 9
def initialize
@arps = ARPTable.new
super
add('Init', :init, /^Date/)
add('VRF', :vrf, /^VRF/)
add('Title', :title, /^(?: IP Address Linklayer Address Netif Expire Type|There is no ARP entry.)/)
add('Entry', :entry, /^\s+([0-9\.]+)\s+([0-9a-f\.]+|\(incomplete\))\s+([^\s]+)\s+([^\s]+).*$/)
end
|
Instance Attribute Details
#arps ⇒ Object
Returns the value of attribute arps.
7
8
9
|
# File 'lib/netutils/cli/alaxala/showarp.rb', line 7
def arps
@arps
end
|
Instance Method Details
#entry(l, m) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/netutils/cli/alaxala/showarp.rb', line 36
def entry(l, m)
if m[3] =~ /^([^0-9]+)0+([0-9]+)$/
interface = "#{$1}#{$2}"
else
interface = m[3]
end
return if m[2] === '(incomplete)'
@arps.add(m[1], m[2].downcase, interface, m[4] === 'Static')
end
|
#init(l, m) ⇒ Object
22
23
24
25
26
|
# File 'lib/netutils/cli/alaxala/showarp.rb', line 22
def init(l, m)
changeto('Title')
end
|
#title(l, m) ⇒ Object
32
33
34
|
# File 'lib/netutils/cli/alaxala/showarp.rb', line 32
def title(l, m)
changeto('Entry')
end
|
#vrf(l, m) ⇒ Object
28
29
30
|
# File 'lib/netutils/cli/alaxala/showarp.rb', line 28
def vrf(l, m)
changeto('Title')
end
|