Sha256: 83aaaa47caa379c0738d1eb3c5af965413dea5c0885c8b5417103a396573d738

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require 'netutils/parser'
require 'netutils/macaddr'

module Cisco

class MACFIB < Parser
	attr_reader :ports

	# XXX
	# * 2005  082e.5f24.56a9   dynamic  Yes          0   Po19
	CISCO6500_RE = /^\* +[0-9]+ +[^ ]+ +dynamic +Yes +[0-9]+ +([^ ]+)$/
	# 3188    f80f.41d2.e746   dynamic ip,(cut),other TenGigabitEthernet1/1 
	CISCO4500_RE = /^ *[0-9]+ +[^ ]+ +dynamic +ip[^ ]+ +([^ ]+) +$/
	#  100    0016.c8c5.35a2    DYNAMIC     Po1
	CISCO2500_RE = /^ *[0-9]+ +[^ ]+ +(?:STATIC|DYNAMIC) +([^ ]+).*$/

	def cmd(ma, vlan)
		return "show mac address-table address #{ma.to_s} vlan #{vlan}"
	end

	def initialize(sw)
		@ports = {}
		super()
		add('Init',	:init)
		@sw = sw
	end

	def init(l, m)
		case l
		# XXX: other switches...
		when CISCO6500_RE, CISCO4500_RE, CISCO2500_RE
			name = @sw.ports.key($1)
			@ports[name] = name
		end
	end
end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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