Class: OVSImager::LinuxBridge

Inherits:
Object
  • Object
show all
Defined in:
lib/ovsimager/linuxbridge.rb

Instance Method Summary collapse

Constructor Details

#initialize(ns = []) ⇒ LinuxBridge

Returns a new instance of LinuxBridge.



5
6
7
8
9
10
11
12
# File 'lib/ovsimager/linuxbridge.rb', line 5

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

Instance Method Details

#exec_brtcl(ns = nil) ⇒ Object



18
19
20
21
# File 'lib/ovsimager/linuxbridge.rb', line 18

def exec_brtcl(ns=nil)
  ns_prefix = ns ? "ip netns exec #{ns} " : ''
  Utils.execute(ns_prefix + 'brctl show', !!ns)
end

#to_hashObject



14
15
16
# File 'lib/ovsimager/linuxbridge.rb', line 14

def to_hash()
  return @br
end