Module: Cow::ACS::Server

Included in:
Cow::ACS::SSH::Server, Telnet::Server
Defined in:
lib/cow/plugins/acs.rb

Instance Method Summary collapse

Instance Method Details

#get_portsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cow/plugins/acs.rb', line 18

def get_ports
  ret = []
  snmp do |s|
    s.walk(OID_DESCRIPTION_LIST) do |x|
      next if x.name.last.zero?
      next unless (/^[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}P[0-9]{2}$/ =~ x.value.to_s).nil?
      port = x.name.last
      name = x.value.to_s
      tcp_port = snmp { |s| break s.get_value(OID_TCPPORT_LIST + ".#{port}") }

      ret << Cow::ACS::Port.new(port, name, tcp_port)
    end
  end

  ret
end

#port(_port) ⇒ Object



13
14
15
16
# File 'lib/cow/plugins/acs.rb', line 13

def port(_port)
  return _port if _port.class == Cow::ACS::Port
  super
end