Class: Alaxala::LLDP

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

#initialize(sw) ⇒ LLDP

Returns a new instance of LLDP.



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/netutils/cli/alaxala/lldp.rb', line 44

def initialize(sw)
	super()
	add('Init',		:init)
	add('Port',		:port)
	add('PortInfo',		:port_info)
	add('ChassisID',	:chassis_id,	/^    Chassis ID: Type=[^\s]+ \s+Info=[0-9a-z.]+$/)
	add('SystemName',	:system_name,	/^\s{4,6}System Name: ([^\s]+)$/)
	add('SystemDescription',:system_description,	/^\s{4,6}System Description: (.*)$/)
	add('PortID',		:port_id)
	add('PortDescription',	:port_description,	/^\s{4,6}Port Description: .*$/)
	add('TagID',		:tag_id)
	@sw = sw
end

Instance Attribute Details

#rswObject (readonly)

Date 2017/10/15 00:06:36 JST Status: Enabled Chassis ID: Type=MAC Info=beef.dad.beef Interval Time: 30 Hold Count: 4 TTL: 121 Draft TTL: 120

System Name: hogehoge System Description: ALAXALA AX8600S AX-8600-S16 [AX8616S] Switching software (including encryption) Ver. 12.7.B [OS-SE] Neighbor Counts=1 Draft Neighbor Counts=0 Port Counts=1 Port 1/ 1(CH: 1)

Link: Up      PortEnabled: TRUE     AdminStatus: enabledRxTx
Neighbor Counts:   1    Draft Neighbor Counts:   0
Port ID: Type=MAC          Info=beef.dead.beef
Port Description: hogehoge
Neighbor 1      TTL: 95   
  Chassis ID: Type=MAC          Info=dead.beef.dead
  System Name: fugafuga
  System Description: ALAXALA AX2530 AX-2530-48T2X-B [AX2530S-48T2X] Switching software Ver. 4.6.A [OS-L2B]
  Port ID: Type=MAC          Info=dead.beef.dead
  Port Description: hogehoge


43
44
45
# File 'lib/netutils/cli/alaxala/lldp.rb', line 43

def rsw
  @rsw
end

Instance Method Details

#cmd(port) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/netutils/cli/alaxala/lldp.rb', line 7

def cmd(port)
	if port
		port = @sw.interface_name_cli(port)
		# XXX: how about stack configuration...
		if @sw.product =~ /^AX3[0-9]{3}/
			numbers = port.split('/')
			if numbers.size != 3
				raise "Invalid port format: #{numbers}"
			end
			port = "#{numbers[1]}/#{numbers[2]}"
		end
		port = "port #{port} "
	end
	return "show lldp #{port}detail"
end