Class: Cisco::IfSummary

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

Constant Summary

Constants inherited from FSM

FSM::FSM_S_INIT

Instance Method Summary collapse

Methods inherited from Parser

#add, #parse, #regexp

Methods inherited from FSM

#add, #cb, #changeto, #state_name

Constructor Details

#initialize(sw) ⇒ IfSummary

Returns a new instance of IfSummary.



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

def initialize(sw)
	super()
	add('Init',		:init)
	add('Interface',	:interface)
	@sw = sw
end

Instance Method Details

#cmdObject



6
7
8
# File 'lib/netutils/cli/cisco/ifsummary.rb', line 6

def cmd
	'show interfaces summary'
end

#init(l, m) ⇒ Object



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

def init(l, m)
	changeto('Interface') if l =~ /^-+$/
end

#interface(l, m) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/netutils/cli/cisco/ifsummary.rb', line 21

def interface(l, m)
	return unless l =~ /^(.) ([^ ]+) +.*$/
	up = $1
	name = $2
	return if name =~ /Port-channel/
	return if name =~ /Vlan/
	return if ! @sw.ports.exists?(name)
	@sw.ports[name].up = up == '*' ? true : false
end