Class: Phut::Syntax
- Inherits:
-
Object
show all
- Defined in:
- lib/phut/syntax.rb,
lib/phut/syntax/directive.rb,
lib/phut/syntax/netns_directive.rb,
lib/phut/syntax/vhost_directive.rb,
lib/phut/syntax/vswitch_directive.rb
Overview
Defined Under Namespace
Classes: Directive, NetnsDirective, VhostDirective, VswitchDirective
Instance Method Summary
collapse
Constructor Details
#initialize(config, logger) ⇒ Syntax
Returns a new instance of Syntax.
11
12
13
14
|
# File 'lib/phut/syntax.rb', line 11
def initialize(config, logger)
@config = config
@logger = logger
end
|
Instance Method Details
#link(name_a, name_b) ⇒ Object
32
33
34
|
# File 'lib/phut/syntax.rb', line 32
def link(name_a, name_b)
VirtualLink.create(name_a, name_b, @logger)
end
|
#netns(name, &block) ⇒ Object
27
28
29
30
|
# File 'lib/phut/syntax.rb', line 27
def netns(name, &block)
attrs = NetnsDirective.new(name, &block)
Netns.create(attrs, attrs[:name], @logger)
end
|
#vhost(alias_name = nil, &block) ⇒ Object
21
22
23
24
25
|
# File 'lib/phut/syntax.rb', line 21
def vhost(alias_name = nil, &block)
attrs = VhostDirective.new(alias_name, &block)
Vhost.create(attrs[:ip], attrs[:mac], attrs[:promisc], attrs[:name],
@logger)
end
|
#vswitch(alias_name = nil, &block) ⇒ Object
16
17
18
19
|
# File 'lib/phut/syntax.rb', line 16
def vswitch(alias_name = nil, &block)
attrs = VswitchDirective.new(alias_name, &block)
OpenVswitch.create(attrs[:dpid], attrs[:port], attrs[:name], @logger)
end
|