Sha256: 3939ac5869f1052978a39bace9c0a0e59cb53db70410567ebc1aedf36b4d72e9
Contents?: true
Size: 809 Bytes
Versions: 3
Compression:
Stored size: 809 Bytes
Contents
require_relative 'utils' module OVSImager class LinuxBridge def initialize(ns=[]) brctl_out = exec_brtcl @br = parse brctl_out ns.each do |n| brctl_out = exec_brtcl(n) @br = @br.merge parse(brctl_out, ns) end end def to_hash() return @br end def exec_brtcl(ns=nil) ns_prefix = ns ? "ip netns exec #{ns} " : '' Utils.execute(ns_prefix + 'brctl show', !!ns) end private def parse(str, ns=:root) 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], :ns => ns, } end params end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ovsimager-0.0.6 | lib/ovsimager/linuxbridge.rb |
ovsimager-0.0.5 | lib/ovsimager/linuxbridge.rb |
ovsimager-0.0.4 | lib/ovsimager/linuxbridge.rb |