19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/cow/plugins/acs6000.rb', line 19
def get_ports
ret = []
snmp do |s|
port_profile_tables = {}
s.walk(OID_PORT_TABLE_PROFILE_LIST) do |x|
port_profile_tables[x.name.last.to_s] = x.value.to_i
end
s.walk(OID_DESCRIPTION_LIST) do |x|
next if x.name.last.zero?
next if x.value.to_s.length == 0
next if port_profile_tables[x.name.last.to_s] != 1
next unless (/^[0-9a-f]{2}-[0-9a-f]{2}-[0-9a-f]{2}-p-[0-9]+$/ =~ x.value.to_s).nil?
port = x.name.last
name = x.value.to_s
tcp_port = TCP_PORT_OFFSET + port.to_i
ret << Cow::ACS6000::Port.new(port, name, tcp_port)
end
end
ret
end
|