trema 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Rakefile +2 -0
- data/bin/trema +17 -2
- data/cucumber.yml +7 -0
- data/features/.nav +47 -0
- data/features/{logging.feature → api/logging.feature} +1 -7
- data/features/{send_flow_mod_add.feature → api/send_flow_mod_add.feature} +2 -7
- data/features/handlers/barrier_reply.feature +30 -0
- data/features/{echo_reply_handler.feature → handlers/echo_reply.feature} +14 -13
- data/features/handlers/hello_failed.feature +56 -0
- data/features/handlers/packet_in.feature +32 -0
- data/features/handlers/start.feature +31 -0
- data/features/handlers/switch_disconnected.feature +34 -0
- data/features/handlers/switch_ready.feature +26 -0
- data/features/logger/debug.feature +41 -0
- data/features/logger/error.feature +41 -0
- data/features/logger/fatal.feature +41 -0
- data/features/logger/info.feature +41 -0
- data/features/logger/warn.feature +41 -0
- data/features/step_definitions/README.txt +2 -0
- data/features/step_definitions/dump_flows_steps.rb +13 -0
- data/features/step_definitions/rest_api_steps.rb +40 -0
- data/features/step_definitions/show_stats_steps.rb +31 -4
- data/features/step_definitions/trema_steps.rb +72 -0
- data/features/support/hooks.rb +4 -1
- data/features/trema_delete_link/README.md +5 -0
- data/features/{trema_delete_link.feature → trema_delete_link/delete_link.feature} +9 -13
- data/features/trema_delete_link/socket_dir_option.feature +12 -0
- data/features/trema_killall/README.md +5 -0
- data/features/trema_killall/all_option.feature +20 -0
- data/features/{trema_killall.feature → trema_killall/killall.feature} +10 -28
- data/features/trema_killall/socket_dir_option.feature +38 -0
- data/features/trema_run/README.md +5 -0
- data/features/trema_run/conf_option.feature +66 -0
- data/features/trema_run/daemonize_option.feature +19 -0
- data/features/trema_run/log_dir_option.feature +32 -0
- data/features/trema_run/logging_level_option.feature +30 -0
- data/features/trema_run/openflow13_option.feature +39 -0
- data/features/trema_run/pid_dir_option.feature +32 -0
- data/features/trema_run/port_option.feature +32 -0
- data/features/trema_run/run.feature +83 -0
- data/features/trema_run/socket_dir_option.feature +34 -0
- data/features/trema_start/README.md +5 -0
- data/features/trema_start/socket_dir_option.feature +9 -0
- data/features/{trema_start.feature → trema_start/start.feature} +23 -24
- data/features/trema_stop/README.md +5 -0
- data/features/trema_stop/socket_dir_option.feature +9 -0
- data/features/{trema_stop.feature → trema_stop/stop.feature} +7 -12
- data/lib/trema/command.rb +15 -2
- data/lib/trema/controller.rb +16 -2
- data/lib/trema/switch.rb +25 -26
- data/lib/trema/version.rb +1 -1
- data/trema.gemspec +8 -7
- metadata +73 -26
- data/features/cleanup_on_failure.feature +0 -118
- data/features/step_definitions/README.md +0 -7
- data/features/trema_run.feature +0 -72
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 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-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.13.
|
33
|
+
version: 2.13.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.13.
|
40
|
+
version: 2.13.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: phut
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.6.
|
47
|
+
version: 0.6.9
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.6.
|
54
|
+
version: 0.6.9
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pio
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.26.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.26.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: relish
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.7.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.7.1
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: yard
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,28 +114,28 @@ dependencies:
|
|
100
114
|
requirements:
|
101
115
|
- - ~>
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: 0.9.0
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - ~>
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: 0.9.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: codeclimate-test-reporter
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ~>
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.4.
|
131
|
+
version: 0.4.8
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - ~>
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.4.
|
138
|
+
version: 0.4.8
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: coveralls
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +170,14 @@ dependencies:
|
|
156
170
|
requirements:
|
157
171
|
- - ~>
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: 3.3.1
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - ~>
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
180
|
+
version: 3.3.1
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: rspec
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +212,14 @@ dependencies:
|
|
198
212
|
requirements:
|
199
213
|
- - ~>
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: 0.
|
215
|
+
version: 0.34.0
|
202
216
|
type: :development
|
203
217
|
prerelease: false
|
204
218
|
version_requirements: !ruby/object:Gem::Requirement
|
205
219
|
requirements:
|
206
220
|
- - ~>
|
207
221
|
- !ruby/object:Gem::Version
|
208
|
-
version: 0.
|
222
|
+
version: 0.34.0
|
209
223
|
description: Trema is a full-stack, easy-to-use framework for developing OpenFlow
|
210
224
|
controllers in Ruby.
|
211
225
|
email:
|
@@ -228,27 +242,60 @@ files:
|
|
228
242
|
- Rakefile
|
229
243
|
- bin/.gitignore
|
230
244
|
- bin/trema
|
231
|
-
-
|
232
|
-
- features
|
233
|
-
- features/logging.feature
|
234
|
-
- features/send_flow_mod_add.feature
|
245
|
+
- cucumber.yml
|
246
|
+
- features/.nav
|
247
|
+
- features/api/logging.feature
|
248
|
+
- features/api/send_flow_mod_add.feature
|
249
|
+
- features/handlers/barrier_reply.feature
|
250
|
+
- features/handlers/echo_reply.feature
|
251
|
+
- features/handlers/hello_failed.feature
|
252
|
+
- features/handlers/packet_in.feature
|
253
|
+
- features/handlers/start.feature
|
254
|
+
- features/handlers/switch_disconnected.feature
|
255
|
+
- features/handlers/switch_ready.feature
|
256
|
+
- features/logger/debug.feature
|
257
|
+
- features/logger/error.feature
|
258
|
+
- features/logger/fatal.feature
|
259
|
+
- features/logger/info.feature
|
260
|
+
- features/logger/warn.feature
|
235
261
|
- features/step_definitions/.gitignore
|
236
262
|
- features/step_definitions/.rubocop.yml
|
237
263
|
- features/step_definitions/.travis.yml
|
238
264
|
- features/step_definitions/Gemfile
|
239
265
|
- features/step_definitions/Guardfile
|
240
266
|
- features/step_definitions/LICENSE
|
241
|
-
- features/step_definitions/README.
|
267
|
+
- features/step_definitions/README.txt
|
242
268
|
- features/step_definitions/Rakefile
|
269
|
+
- features/step_definitions/dump_flows_steps.rb
|
270
|
+
- features/step_definitions/rest_api_steps.rb
|
243
271
|
- features/step_definitions/show_stats_steps.rb
|
272
|
+
- features/step_definitions/trema_steps.rb
|
244
273
|
- features/step_definitions/virtual_link_steps.rb
|
245
274
|
- features/support/env.rb
|
246
275
|
- features/support/hooks.rb
|
247
|
-
- features/trema_delete_link.
|
248
|
-
- features/
|
249
|
-
- features/
|
250
|
-
- features/
|
251
|
-
- features/
|
276
|
+
- features/trema_delete_link/README.md
|
277
|
+
- features/trema_delete_link/delete_link.feature
|
278
|
+
- features/trema_delete_link/socket_dir_option.feature
|
279
|
+
- features/trema_killall/README.md
|
280
|
+
- features/trema_killall/all_option.feature
|
281
|
+
- features/trema_killall/killall.feature
|
282
|
+
- features/trema_killall/socket_dir_option.feature
|
283
|
+
- features/trema_run/README.md
|
284
|
+
- features/trema_run/conf_option.feature
|
285
|
+
- features/trema_run/daemonize_option.feature
|
286
|
+
- features/trema_run/log_dir_option.feature
|
287
|
+
- features/trema_run/logging_level_option.feature
|
288
|
+
- features/trema_run/openflow13_option.feature
|
289
|
+
- features/trema_run/pid_dir_option.feature
|
290
|
+
- features/trema_run/port_option.feature
|
291
|
+
- features/trema_run/run.feature
|
292
|
+
- features/trema_run/socket_dir_option.feature
|
293
|
+
- features/trema_start/README.md
|
294
|
+
- features/trema_start/socket_dir_option.feature
|
295
|
+
- features/trema_start/start.feature
|
296
|
+
- features/trema_stop/README.md
|
297
|
+
- features/trema_stop/socket_dir_option.feature
|
298
|
+
- features/trema_stop/stop.feature
|
252
299
|
- lib/trema.rb
|
253
300
|
- lib/trema/command.rb
|
254
301
|
- lib/trema/controller.rb
|
@@ -1,118 +0,0 @@
|
|
1
|
-
Feature: trema run cleanup on failure
|
2
|
-
Background:
|
3
|
-
Given I set the environment variables to:
|
4
|
-
| variable | value |
|
5
|
-
| TREMA_LOG_DIR | . |
|
6
|
-
| TREMA_PID_DIR | . |
|
7
|
-
| TREMA_SOCKET_DIR | . |
|
8
|
-
And a file named "trema.conf" with:
|
9
|
-
"""
|
10
|
-
vswitch { datapath_id 0xabc }
|
11
|
-
|
12
|
-
vhost('host1') { ip '192.168.0.1' }
|
13
|
-
vhost('host2') { ip '192.168.0.2' }
|
14
|
-
|
15
|
-
link '0xabc', 'host1'
|
16
|
-
link '0xabc', 'host2'
|
17
|
-
"""
|
18
|
-
|
19
|
-
@sudo
|
20
|
-
Scenario: NameError in config file
|
21
|
-
Given a file named "invalid_trema.conf" with:
|
22
|
-
"""
|
23
|
-
Foo Bar Baz
|
24
|
-
"""
|
25
|
-
And a file named "null_controller.rb" with:
|
26
|
-
"""
|
27
|
-
class NullController < Trema::Controller; end
|
28
|
-
"""
|
29
|
-
When I run `trema run null_controller.rb -c invalid_trema.conf`
|
30
|
-
Then the output should contain "uninitialized constant Phut::Syntax::Baz (NameError)"
|
31
|
-
And the exit status should not be 0
|
32
|
-
And virtual links should not exist
|
33
|
-
And a file named "NullController.pid" should not exist
|
34
|
-
|
35
|
-
Scenario: SyntaxError in config file
|
36
|
-
Given a file named "invalid_trema.conf" with:
|
37
|
-
"""
|
38
|
-
Today is 19 June 2015
|
39
|
-
"""
|
40
|
-
And a file named "null_controller.rb" with:
|
41
|
-
"""
|
42
|
-
class NullController < Trema::Controller; end
|
43
|
-
"""
|
44
|
-
When I run `trema run null_controller.rb -c invalid_trema.conf`
|
45
|
-
Then the output should contain "(SyntaxError)"
|
46
|
-
And the exit status should not be 0
|
47
|
-
And virtual links should not exist
|
48
|
-
And a file named "NullController.pid" should not exist
|
49
|
-
|
50
|
-
Scenario: SyntaxError when loading controller code
|
51
|
-
Given a file named "invalid_ruby.rb" with:
|
52
|
-
"""
|
53
|
-
Today is 13 March 2015
|
54
|
-
"""
|
55
|
-
When I run `trema run invalid_ruby.rb -c trema.conf`
|
56
|
-
Then the output should contain "(SyntaxError)"
|
57
|
-
And the exit status should not be 0
|
58
|
-
And virtual links should not exist
|
59
|
-
And the following files should not exist:
|
60
|
-
| vhost.host1.pid |
|
61
|
-
| vhost.host2.pid |
|
62
|
-
|
63
|
-
@sudo
|
64
|
-
Scenario: NameError when loading controller code
|
65
|
-
Given a file named "invalid_ruby.rb" with:
|
66
|
-
"""
|
67
|
-
class InvalidRuby < Trema::Controller
|
68
|
-
Foo
|
69
|
-
Bar
|
70
|
-
Baz
|
71
|
-
end
|
72
|
-
"""
|
73
|
-
When I run `trema run invalid_ruby.rb -c trema.conf`
|
74
|
-
Then the output should contain "uninitialized constant InvalidRuby::Foo (NameError)"
|
75
|
-
And the exit status should not be 0
|
76
|
-
And virtual links should not exist
|
77
|
-
And the following files should not exist:
|
78
|
-
| InvalidRuby.pid |
|
79
|
-
| vhost.host1.pid |
|
80
|
-
| vhost.host2.pid |
|
81
|
-
|
82
|
-
@sudo
|
83
|
-
Scenario: RuntimeError in Controller#start
|
84
|
-
Given a file named "start_fail.rb" with:
|
85
|
-
"""
|
86
|
-
class StartFail < Trema::Controller
|
87
|
-
def start(_args)
|
88
|
-
fail 'bang!'
|
89
|
-
end
|
90
|
-
end
|
91
|
-
"""
|
92
|
-
When I run `trema run start_fail.rb -c trema.conf`
|
93
|
-
Then the output should contain "bang! (RuntimeError)"
|
94
|
-
And the exit status should not be 0
|
95
|
-
And virtual links should not exist
|
96
|
-
And the following files should not exist:
|
97
|
-
| StartFail.pid |
|
98
|
-
| vhost.host1.pid |
|
99
|
-
| vhost.host2.pid |
|
100
|
-
|
101
|
-
@sudo
|
102
|
-
Scenario: RuntimeError in handlers
|
103
|
-
Given a file named "switch_ready_fail.rb" with:
|
104
|
-
"""
|
105
|
-
class SwitchReadyFail < Trema::Controller
|
106
|
-
def switch_ready(_dpid)
|
107
|
-
fail 'bang!'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
"""
|
111
|
-
When I run `trema -v run switch_ready_fail.rb -c trema.conf`
|
112
|
-
Then the output should contain "bang! (RuntimeError)"
|
113
|
-
And the exit status should not be 0
|
114
|
-
And virtual links should not exist
|
115
|
-
And the following files should not exist:
|
116
|
-
| SwitchReadyFail.pid |
|
117
|
-
| vhost.host1.pid |
|
118
|
-
| vhost.host2.pid |
|
data/features/trema_run.feature
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
Feature: trema run command
|
2
|
-
Background:
|
3
|
-
Given I set the environment variables to:
|
4
|
-
| variable | value |
|
5
|
-
| TREMA_LOG_DIR | . |
|
6
|
-
| TREMA_PID_DIR | . |
|
7
|
-
| TREMA_SOCKET_DIR | . |
|
8
|
-
|
9
|
-
@sudo
|
10
|
-
Scenario: the default port
|
11
|
-
Given a file named "switch_ready.rb" with:
|
12
|
-
"""
|
13
|
-
class SwitchReady < Trema::Controller
|
14
|
-
def switch_ready(dpid)
|
15
|
-
logger.info format('Hello %s!', dpid.to_hex)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
"""
|
19
|
-
And a file named "trema.conf" with:
|
20
|
-
"""
|
21
|
-
vswitch { datapath_id 0xabc }
|
22
|
-
"""
|
23
|
-
When I successfully run `trema -v run switch_ready.rb -c trema.conf -d`
|
24
|
-
And I run `sleep 5`
|
25
|
-
Then the file "SwitchReady.log" should contain "Hello 0xabc!"
|
26
|
-
|
27
|
-
@sudo
|
28
|
-
Scenario: -p option
|
29
|
-
Given a file named "switch_ready.rb" with:
|
30
|
-
"""
|
31
|
-
class SwitchReady < Trema::Controller
|
32
|
-
def switch_ready(dpid)
|
33
|
-
logger.info format('Hello %s!', dpid.to_hex)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
"""
|
37
|
-
And a file named "trema.conf" with:
|
38
|
-
"""
|
39
|
-
vswitch {
|
40
|
-
datapath_id 0xabc
|
41
|
-
port 1234
|
42
|
-
}
|
43
|
-
"""
|
44
|
-
When I successfully run `trema -v run -p 1234 switch_ready.rb -c trema.conf -d`
|
45
|
-
And I run `sleep 5`
|
46
|
-
Then the file "SwitchReady.log" should contain "Hello 0xabc!"
|
47
|
-
|
48
|
-
@sudo
|
49
|
-
Scenario: trema run with --openflow13 option
|
50
|
-
Given a file named "null_controller.rb" with:
|
51
|
-
"""
|
52
|
-
class NullController < Trema::Controller; end
|
53
|
-
"""
|
54
|
-
And a file named "trema.conf" with:
|
55
|
-
"""
|
56
|
-
vswitch { datapath_id 0xabc }
|
57
|
-
"""
|
58
|
-
When I successfully run `trema -v run null_controller.rb --openflow13 -c trema.conf -d`
|
59
|
-
And I run `sleep 5`
|
60
|
-
Then the output should contain "protocols=OpenFlow13"
|
61
|
-
|
62
|
-
@sudo
|
63
|
-
Scenario: trema run empty file and error
|
64
|
-
Given a file named "empty.rb" with:
|
65
|
-
"""
|
66
|
-
"""
|
67
|
-
When I run `trema -v run empty.rb`
|
68
|
-
Then the exit status should not be 0
|
69
|
-
And the stderr should contain:
|
70
|
-
"""
|
71
|
-
No controller class is defined.
|
72
|
-
"""
|