Sha256: 5af36a76a393ae03fe2bf1b4d3d17575895e70ff74169cfc0cc244860e339535

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

module Copian
  module Collector
    class DellVlansCollector < AbstractCollector # :nodoc:
      # ---
      # Dell switches assign VLANs ifIndex values equal to
      # the VLAN ID + 100000.
      # +++
      def collect
        oid = SNMP::ObjectID.new('1.3.6.1.2.1.2.2.1.3')
        @manager.walk(oid) do |r|
          r.each do |varbind|
            next unless varbind.value.to_i == 53  # propVirtual type
            vlan_index = varbind.name.index(oid).to_s.to_i
            vlan_id = vlan_index - 100000
            vlan_id = 1 if vlan_id == 0

            yield vlan_id, vlan_index
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
copian-1.3.3 lib/copian/collector/dell/vlans.rb
copian-1.3.2 lib/copian/collector/dell/vlans.rb