Class: Phut::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/phut/parser.rb

Overview

Configuration DSL parser.

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Parser

Returns a new instance of Parser.



11
12
13
14
# File 'lib/phut/parser.rb', line 11

def initialize(file)
  @file = file
  @netns = []
end

Instance Method Details

#parseObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/phut/parser.rb', line 16

def parse
  Syntax.new(@netns).instance_eval IO.read(@file), @file
  Link.all.each do |link|
    Vswitch.all.each do |vswitch|
      device = link.device(vswitch.name)
      vswitch.add_port device if device
    end
  end
  Vhost.all.each(&:set_default_arp_table)
  Vhost.connect_link
  update_netns_interfaces
end