Sha256: a1086d713a3a440cd92600c5b50cf1e257ecfb06a9df9b0871b7dd0997ce5c33

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

require_relative 'utils'

module OVSImager
  class LinuxBridge
    def initialize()
      brctl_out = exec_brtcl
      @br = parse brctl_out
    end

    def to_hash()
      return @br
    end

    def exec_brtcl()
      Utils.execute('brctl show')
    end

    private
    def parse(str)
      params = {}
      str.split(/\n(?=\S)/)[1..-1].map do |br|
        data = br.split
        params[data[0]] = {
          :name => data[0],
          :id => data[1],
          :stp => data[2],
          :interfaces => [data[0]] + data[3..-1],
        }
      end
      params
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ovsimager-0.0.3 lib/ovsimager/linuxbridge.rb
ovsimager-0.0.2 lib/ovsimager/linuxbridge.rb