Sha256: 3ff7df85ae6dc21730963e0f57f3afe1854073f80552b40c59c7f7bfd943056e

Contents?: true

Size: 552 Bytes

Versions: 2

Compression:

Stored size: 552 Bytes

Contents

require 'netutils/parser'
require 'netutils/arp'

module Cisco

class ShowARP < Parser
	attr_reader :arps

	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

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

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
netutils-0.1.2 lib/netutils/cli/cisco/showarp.rb
netutils-0.1.1 lib/netutils/cli/cisco/showarp.rb