phut 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e6e236d2b8034b01009ef0c8fd37e105117c33c
4
- data.tar.gz: d2557b337615017c4bac9a19f1c52965b114b8cc
3
+ metadata.gz: 0ef918284af69d747340059b8a92a410fd291856
4
+ data.tar.gz: 4c2ae440238a04ba768123ed7091f9fb1fed9955
5
5
  SHA512:
6
- metadata.gz: a9951dde073ebe00310e93d2102ee7ee070fceff3af82962ac3d76beb70d09b77a78ea25707396d45ef3587d792764cb98b7b80b8078f4280d0ef0b3dcaae7ee
7
- data.tar.gz: 63519f2963d5ca9d16778982ac62aa41f6f660f8c96b06815112b6f289610e22434ec1e1370616e43e1c9f9537992e2ad9d383dd7742fbf1fdfd3bd48f9f7133
6
+ metadata.gz: 581acfd2cff43bc01d6cb4d2aff4a4b87bc018cb0e1b85f43cd2af7d3b8e6f669e58c18fe7ba3b919223da07908cb7c7e974490749dd3a2ab1dc2bb8da3474c7
7
+ data.tar.gz: 3df8308962938c722d63dcc1fb17b1a58727b390d3f346a4b3cf221644b77076ea18be7bdc2c3a0b60a18b687c2103d63561be9023d1f369e45918b3421f1031
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  ## develop (unreleased)
4
4
 
5
5
 
6
+ ## 0.6.0 (6/1/2015)
7
+ ### Changes
8
+ * [#21](https://github.com/trema/phut/pull/21): Use IANA-assigned port number 6653.
9
+ * [#21](https://github.com/trema/phut/pull/21): Add `port` attribute to `vswitch` directive.
10
+
11
+
6
12
  ## 0.5.0 (4/22/2015)
7
13
  ### Misc
8
14
  * Pio 0.20.0 (preliminary support of OpenFlow 1.3).
@@ -1,6 +1,6 @@
1
+ @sudo
1
2
  Feature: The vswitch DSL directive.
2
- @sudo
3
- Scenario: phut run with "vswitch { dpid STRING }"
3
+ Scenario: vswitch { dpid STRING }
4
4
  Given a file named "network.conf" with:
5
5
  """
6
6
  vswitch { dpid '0xabc' }
@@ -8,8 +8,7 @@ Feature: The vswitch DSL directive.
8
8
  When I do phut run "network.conf"
9
9
  Then a vswitch named "0xabc" should be running
10
10
 
11
- @sudo
12
- Scenario: phut run with "vswitch { dpid NUMBER }"
11
+ Scenario: vswitch { dpid NUMBER }
13
12
  Given a file named "network.conf" with:
14
13
  """
15
14
  vswitch { dpid 0xabc }
@@ -17,8 +16,7 @@ Feature: The vswitch DSL directive.
17
16
  When I do phut run "network.conf"
18
17
  Then a vswitch named "0xabc" should be running
19
18
 
20
- @sudo
21
- Scenario: phut run with "vswitch { datapath_id STRING }"
19
+ Scenario: vswitch { datapath_id STRING }
22
20
  Given a file named "network.conf" with:
23
21
  """
24
22
  vswitch { datapath_id '0xabc' }
@@ -26,8 +24,7 @@ Feature: The vswitch DSL directive.
26
24
  When I do phut run "network.conf"
27
25
  Then a vswitch named "0xabc" should be running
28
26
 
29
- @sudo
30
- Scenario: phut run with "vswitch { datapath_id NUMBER }"
27
+ Scenario: vswitch { datapath_id NUMBER }
31
28
  Given a file named "network.conf" with:
32
29
  """
33
30
  vswitch { datapath_id 0xabc }
@@ -35,8 +32,18 @@ Feature: The vswitch DSL directive.
35
32
  When I do phut run "network.conf"
36
33
  Then a vswitch named "0xabc" should be running
37
34
 
38
- @sudo
39
- Scenario: phut run with "vswitch(alias) { ... }"
35
+ Scenario: vswitch { dpid ...; port NUMBER }
36
+ Given a file named "network.conf" with:
37
+ """
38
+ vswitch {
39
+ datapath_id 0xabc
40
+ port 1234
41
+ }
42
+ """
43
+ When I do phut run "network.conf"
44
+ Then a vswitch named "0xabc" (controller port = 1234) should be running
45
+
46
+ Scenario: vswitch(alias) { ... }
40
47
  Given a file named "network.conf" with:
41
48
  """
42
49
  vswitch('my_switch') { datapath_id '0xabc' }
@@ -10,6 +10,13 @@ Then(/^a vswitch named "(.*?)" should be running$/) do |name|
10
10
  expect(system("sudo ovs-vsctl br-exists br#{name}")).to be_truthy
11
11
  end
12
12
 
13
+ # rubocop:disable LineLength
14
+ Then(/^a vswitch named "([^"]*)" \(controller port = (\d+)\) should be running$/) do |name, port_number|
15
+ step %(a vswitch named "#{name}" should be running)
16
+ step %(the output should contain "ovs-vsctl set-controller br#{name} tcp:127.0.0.1:#{port_number}")
17
+ end
18
+ # rubocop:enable LineLength
19
+
13
20
  Then(/^a vswitch named "(.*?)" should not be running$/) do |name|
14
21
  expect(system("sudo ovs-vsctl br-exists br#{name}")).to be_falsey
15
22
  end
@@ -58,7 +58,8 @@ module Phut
58
58
 
59
59
  def add_vswitch(name, attrs)
60
60
  check_name_conflict name
61
- @all[name] = OpenVswitch.new(attrs[:dpid], name, @logger)
61
+ @all[name] =
62
+ OpenVswitch.new(attrs[:dpid], attrs[:port_number], name, @logger)
62
63
  end
63
64
 
64
65
  def add_vhost(name, attrs)
@@ -11,8 +11,10 @@ module Phut
11
11
  alias_method :datapath_id, :dpid
12
12
  attr_reader :network_devices
13
13
 
14
- def initialize(dpid, name = nil, logger = NullLogger.new)
14
+ def initialize(dpid, port_number = 6653,
15
+ name = nil, logger = NullLogger.new)
15
16
  @dpid = dpid
17
+ @port_number = port_number
16
18
  @name = name
17
19
  @network_devices = []
18
20
  @logger = logger
@@ -37,8 +39,9 @@ module Phut
37
39
  sh "sudo ovs-vsctl set bridge #{bridge_name}" \
38
40
  " protocols=#{open_flow_protocol}" \
39
41
  " other-config:datapath-id=#{dpid_zero_filled}"
40
- sh "sudo ovs-vsctl set-controller #{bridge_name} tcp:127.0.0.1:6633"\
41
- " -- set controller #{bridge_name} connection-mode=out-of-band"
42
+ sh "sudo ovs-vsctl set-controller #{bridge_name} "\
43
+ "tcp:127.0.0.1:#{@port_number} "\
44
+ "-- set controller #{bridge_name} connection-mode=out-of-band"
42
45
  sh "sudo ovs-vsctl set-fail-mode #{bridge_name} secure"
43
46
  rescue
44
47
  raise "Open vSwitch (dpid = #{@dpid}) is already running!"
data/lib/phut/syntax.rb CHANGED
@@ -22,6 +22,10 @@ module Phut
22
22
  end
23
23
  alias_method :datapath_id, :dpid
24
24
 
25
+ def port(port_no)
26
+ @attributes[:port_number] = port_no
27
+ end
28
+
25
29
  def [](key)
26
30
  @attributes[key]
27
31
  end
data/lib/phut/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Base module.
2
2
  module Phut
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
4
4
  end
data/phut.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.name = 'phut'
7
7
  gem.version = Phut::VERSION
8
8
  gem.summary = 'Virtual network in seconds.'
9
- gem.description = 'A simple ruby network emulator '\
9
+ gem.description = 'A simple network emulator '\
10
10
  'with capabilities similar to mininet.'
11
11
 
12
12
  gem.license = 'GPL3'
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.required_ruby_version = '>= 2.0.0'
25
25
 
26
- gem.add_dependency 'gli', '~> 2.13.0'
26
+ gem.add_dependency 'gli', '~> 2.13.1'
27
27
  gem.add_dependency 'pio', '~> 0.20.0'
28
28
  gem.add_dependency 'pry', '~> 0.10.1'
29
29
 
@@ -32,11 +32,11 @@ Gem::Specification.new do |gem|
32
32
  gem.add_development_dependency 'yard', '~> 0.8.7.6'
33
33
 
34
34
  # Development
35
- gem.add_development_dependency 'byebug', '~> 4.0.5'
35
+ gem.add_development_dependency 'byebug', '~> 5.0.0'
36
36
  gem.add_development_dependency 'guard', '~> 2.12.5'
37
37
  gem.add_development_dependency 'guard-bundler', '~> 2.1.0'
38
38
  gem.add_development_dependency 'guard-cucumber', '~> 1.6.0'
39
- gem.add_development_dependency 'guard-rspec', '~> 4.5.0'
39
+ gem.add_development_dependency 'guard-rspec', '~> 4.5.1'
40
40
  gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'
41
41
 
42
42
  # Test
@@ -47,8 +47,8 @@ Gem::Specification.new do |gem|
47
47
  gem.add_development_dependency 'flay', '~> 2.6.1'
48
48
  gem.add_development_dependency 'flog', '~> 4.3.2'
49
49
  gem.add_development_dependency 'rake'
50
- gem.add_development_dependency 'reek', '~> 2.1.0'
50
+ gem.add_development_dependency 'reek', '~> 2.2.1'
51
51
  gem.add_development_dependency 'rspec', '~> 3.2.0'
52
52
  gem.add_development_dependency 'rspec-given', '~> 3.7.0'
53
- gem.add_development_dependency 'rubocop', '~> 0.30.0'
53
+ gem.add_development_dependency 'rubocop', '~> 0.31.0'
54
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-22 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 2.13.0
19
+ version: 2.13.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 2.13.0
26
+ version: 2.13.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pio
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 4.0.5
89
+ version: 5.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: 4.0.5
96
+ version: 5.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: guard
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - ~>
144
144
  - !ruby/object:Gem::Version
145
- version: 4.5.0
145
+ version: 4.5.1
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ~>
151
151
  - !ruby/object:Gem::Version
152
- version: 4.5.0
152
+ version: 4.5.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: guard-rubocop
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -268,14 +268,14 @@ dependencies:
268
268
  requirements:
269
269
  - - ~>
270
270
  - !ruby/object:Gem::Version
271
- version: 2.1.0
271
+ version: 2.2.1
272
272
  type: :development
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - ~>
277
277
  - !ruby/object:Gem::Version
278
- version: 2.1.0
278
+ version: 2.2.1
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: rspec
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -310,15 +310,15 @@ dependencies:
310
310
  requirements:
311
311
  - - ~>
312
312
  - !ruby/object:Gem::Version
313
- version: 0.30.0
313
+ version: 0.31.0
314
314
  type: :development
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - ~>
319
319
  - !ruby/object:Gem::Version
320
- version: 0.30.0
321
- description: A simple ruby network emulator with capabilities similar to mininet.
320
+ version: 0.31.0
321
+ description: A simple network emulator with capabilities similar to mininet.
322
322
  email:
323
323
  - yasuhito@gmail.com
324
324
  executables:
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
402
402
  version: '0'
403
403
  requirements: []
404
404
  rubyforge_project:
405
- rubygems_version: 2.4.3
405
+ rubygems_version: 2.4.7
406
406
  signing_key:
407
407
  specification_version: 4
408
408
  summary: Virtual network in seconds.