Class: Cisco::ShowARP

Inherits:
Parser show all
Defined in:
lib/netutils/cli/cisco/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

#initializeShowARP

Returns a new instance of ShowARP.



9
10
11
12
13
14
15
16
# File 'lib/netutils/cli/cisco/showarp.rb', line 9

def initialize
	@arps = ARPTable.new
	super()
	add('Init',	:init)
	# Protocol  Address          Age (min)  Hardware Addr   Type   Interface
	# Internet  192.168.0.1             3   dead.beef.dead  ARPA   Vlan9999
	add('Entry',	:entry, /^Internet +([^ ]+) +([0-9]+|-) +([^ ]+) +ARPA+ +([^ ]+)$/)
end

Instance Attribute Details

#arpsObject (readonly)

Returns the value of attribute arps.



7
8
9
# File 'lib/netutils/cli/cisco/showarp.rb', line 7

def arps
  @arps
end

Instance Method Details

#entry(l, m) ⇒ Object



22
23
24
# File 'lib/netutils/cli/cisco/showarp.rb', line 22

def entry(l, m)
	@arps.add(m[1], m[3], m[4], m[2] === '-')
end

#init(l, m) ⇒ Object



18
19
20
# File 'lib/netutils/cli/cisco/showarp.rb', line 18

def init(l, m)
	changeto('Entry') if l =~ /^Protocol/
end