Class: Copian::Collector::Hp

Inherits:
Generic
  • Object
show all
Defined in:
lib/copian/collector/hp.rb

Instance Method Summary collapse

Methods inherited from Generic

#bandwidth, #descriptions, #initialize, #inspect, #port_stats

Constructor Details

This class inherits a constructor from Copian::Collector::Generic

Instance Method Details

#portsObject

:yields: ifindex, ifname, addresses_array



16
17
18
19
20
21
22
# File 'lib/copian/collector/hp.rb', line 16

def ports # :yields: ifindex, ifname, addresses_array
  load_ifnames

  ports_collector.collect do |port_ifindex, port_addresses|
    yield port_ifindex, @ifnames[port_ifindex], port_addresses
  end
end

#vlansObject

:yields: id, ifindex, name



7
8
9
10
11
12
13
14
15
# File 'lib/copian/collector/hp.rb', line 7

def vlans # :yields: id, ifindex, name
  load_ifnames

  vlans_collector.collect do |vlan_id, vlan_index|
    vlan_name = @ifnames[vlan_index]
    vlan_id = vlan_name.gsub(/[^0-9]/, '').to_i
    yield vlan_id, vlan_index, vlan_name
  end
end