Class: Cisco::MACFIB

Inherits:
Parser show all
Defined in:
lib/netutils/cli/cisco/macfib.rb

Constant Summary collapse

CISCO6500_RE =

XXX

  • 2005 082e.5f24.56a9 dynamic Yes 0 Po19

/^\* +[0-9]+ +[^ ]+ +dynamic +Yes +[0-9]+ +([^ ]+)$/
CISCO4500_RE =

3188 f80f.41d2.e746 dynamic ip,(cut),other TenGigabitEthernet1/1

/^ *[0-9]+ +[^ ]+ +dynamic +ip[^ ]+ +([^ ]+) +$/
CISCO2500_RE =

100 0016.c8c5.35a2 DYNAMIC Po1

/^ *[0-9]+ +[^ ]+ +(?:STATIC|DYNAMIC) +([^ ]+).*$/

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

#initialize(sw) ⇒ MACFIB

Returns a new instance of MACFIB.



21
22
23
24
25
26
# File 'lib/netutils/cli/cisco/macfib.rb', line 21

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

Instance Attribute Details

#portsObject (readonly)

Returns the value of attribute ports.



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

def ports
  @ports
end

Instance Method Details

#cmd(ma, vlan) ⇒ Object



17
18
19
# File 'lib/netutils/cli/cisco/macfib.rb', line 17

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

#init(l, m) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/netutils/cli/cisco/macfib.rb', line 28

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