trema 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a54d5f3f28b9407ad3aed3e47fa43e8621461d
|
4
|
+
data.tar.gz: 0332b19bd8cc1398160035511eb9dffb6db6e851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c3a5b57a185fac024176c8de07cc62c1a0cf5aeb3e3d67b9a77d7ab0682fc50d9888013f49ab5f02cb14b50867f881e7f5c9140a846ecc38a831f16b3d2987
|
7
|
+
data.tar.gz: 336e7e1f50e16562713547e4e2c43bd9b7d23219125e49e171aae0c630d8eac9134873dd23623c69bf84a6aa30f020803496b5d8b8945e38bb49b2735ffbafd0
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
## develop (unreleased)
|
4
4
|
|
5
5
|
|
6
|
+
## 0.6.0 (9/9/2015)
|
7
|
+
### New features
|
8
|
+
* [#398](https://github.com/trema/trema/pull/398): Add `Trema::Controller#barrier_reply` handler.
|
9
|
+
* [#400](https://github.com/trema/trema/pull/400): Add `Trema::Controller#hello_failed` handler.
|
10
|
+
* [#404](https://github.com/trema/trema/pull/404): Add `--logging_level` option to trema run command.
|
11
|
+
|
12
|
+
|
6
13
|
## 0.5.1 (8/4/2015)
|
7
14
|
### Bugs fixed
|
8
15
|
* [#396](https://github.com/trema/trema/issues/396): `send_flow_mod_add` doesn't allow `:idle_timeout` and `:hard_timeout` options.
|
data/Rakefile
CHANGED
data/bin/trema
CHANGED
@@ -8,8 +8,6 @@ require 'pio'
|
|
8
8
|
require 'rake'
|
9
9
|
require 'trema'
|
10
10
|
|
11
|
-
ENV['GLI_DEBUG'] = 'true'
|
12
|
-
|
13
11
|
# OpenFlow controller framework.
|
14
12
|
module Trema
|
15
13
|
# trema command.
|
@@ -37,6 +35,9 @@ module Trema
|
|
37
35
|
c.desc 'Overrides the default openflow channel port'
|
38
36
|
c.flag [:p, :port]
|
39
37
|
|
38
|
+
c.desc 'Set logging level'
|
39
|
+
c.flag [:l, :logging_level], default_value: :info
|
40
|
+
|
40
41
|
c.desc 'Location to put pid files'
|
41
42
|
c.flag [:P, :pid_dir], default_value: Trema::DEFAULT_PID_DIR
|
42
43
|
c.desc 'Location to put log files'
|
@@ -234,6 +235,20 @@ module Trema
|
|
234
235
|
|
235
236
|
default_command :help
|
236
237
|
|
238
|
+
on_error do |e|
|
239
|
+
case e
|
240
|
+
when OptionParser::ParseError,
|
241
|
+
Trema::NoControllerDefined,
|
242
|
+
Trema::InvalidLoggingLevel,
|
243
|
+
Phut::OpenVswitch::AlreadyRunning,
|
244
|
+
GLI::UnknownCommandArgument
|
245
|
+
true
|
246
|
+
else
|
247
|
+
# show backtrace
|
248
|
+
fail e
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
237
252
|
exit run(ARGV)
|
238
253
|
end
|
239
254
|
end
|
data/cucumber.yml
ADDED
data/features/.nav
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
- trema_run (trema run command):
|
2
|
+
- run.feature (basic usage)
|
3
|
+
- log_dir_option.feature
|
4
|
+
- pid_dir_option.feature
|
5
|
+
- socket_dir_option.feature
|
6
|
+
- conf_option.feature
|
7
|
+
- daemonize_option.feature
|
8
|
+
- logging_level_option.feature
|
9
|
+
- openflow13_option.feature
|
10
|
+
- port_option.feature
|
11
|
+
|
12
|
+
- trema_killall (trema killall command):
|
13
|
+
- killall.feature (basic usage)
|
14
|
+
- all_option.feature
|
15
|
+
- socket_dir_option.feature
|
16
|
+
|
17
|
+
- trema_start (trema start command):
|
18
|
+
- start.feature (basic usage)
|
19
|
+
- socket_dir_option.feature
|
20
|
+
|
21
|
+
- trema_stop (trema stop command):
|
22
|
+
- stop.feature (basic usage)
|
23
|
+
- socket_dir_option.feature
|
24
|
+
|
25
|
+
- trema_delete_link (trema delete_link command):
|
26
|
+
- delete_link.feature (basic usage)
|
27
|
+
- socket_dir_option.feature
|
28
|
+
|
29
|
+
- logger:
|
30
|
+
- debug.feature
|
31
|
+
- info.feature
|
32
|
+
- warn.feature
|
33
|
+
- error.feature
|
34
|
+
- fatal.feature
|
35
|
+
|
36
|
+
- api (controller API):
|
37
|
+
- logging.feature
|
38
|
+
- send_flow_mod_add.feature
|
39
|
+
|
40
|
+
- handlers:
|
41
|
+
- start.feature
|
42
|
+
- echo_reply.feature
|
43
|
+
- switch_ready.feature
|
44
|
+
- switch_disconnected.feature
|
45
|
+
- packet_in.feature
|
46
|
+
- barrier_reply.feature
|
47
|
+
- hello_failed.feature
|
@@ -1,11 +1,4 @@
|
|
1
1
|
Feature: logging
|
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
2
|
@sudo
|
10
3
|
Scenario: controller, vhost and vswitch creates log files
|
11
4
|
Given a file named "hello.rb" with:
|
@@ -48,6 +41,7 @@ Feature: logging
|
|
48
41
|
| NullController.log |
|
49
42
|
| vhost.host1.log |
|
50
43
|
|
44
|
+
@sudo
|
51
45
|
Scenario: run multiple controllers, and each have its own log file
|
52
46
|
Given a file named "two_controllers.rb" with:
|
53
47
|
"""
|
@@ -1,11 +1,6 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: send_flow_mod_add
|
2
2
|
Background:
|
3
|
-
Given
|
4
|
-
| variable | value |
|
5
|
-
| TREMA_LOG_DIR | . |
|
6
|
-
| TREMA_PID_DIR | . |
|
7
|
-
| TREMA_SOCKET_DIR | . |
|
8
|
-
And a file named "trema.conf" with:
|
3
|
+
Given a file named "trema.conf" with:
|
9
4
|
"""
|
10
5
|
vswitch { datapath_id 0xabc }
|
11
6
|
"""
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: barrier_reply handler
|
2
|
+
Background:
|
3
|
+
Given a file named "barrier_reply.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class BarrierReply < Trema::Controller
|
6
|
+
def switch_ready(dpid)
|
7
|
+
send_message dpid, Barrier::Request.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def barrier_reply(dpid, message)
|
11
|
+
logger.info 'barrier_reply handler is invoked'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
And a file named "trema.conf" with:
|
16
|
+
"""ruby
|
17
|
+
vswitch { datapath_id 0xabc }
|
18
|
+
"""
|
19
|
+
|
20
|
+
@sudo
|
21
|
+
Scenario: invoke barrier_reply handler
|
22
|
+
Given I use OpenFlow 1.0
|
23
|
+
When I trema run "barrier_reply.rb" with the configuration "trema.conf"
|
24
|
+
Then the file "BarrierReply.log" should contain "barrier_reply handler is invoked"
|
25
|
+
|
26
|
+
@sudo @wip
|
27
|
+
Scenario: invoke barrier_reply handler
|
28
|
+
Given I use OpenFlow 1.3
|
29
|
+
When I trema run "barrier_reply.rb" with the configuration "trema.conf"
|
30
|
+
Then the file "BarrierReply.log" should contain "barrier_reply handler is invoked"
|
@@ -1,15 +1,7 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: echo_reply handler
|
2
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
3
|
Given a file named "echo_reply.rb" with:
|
12
|
-
"""
|
4
|
+
"""ruby
|
13
5
|
class EchoReply < Trema::Controller
|
14
6
|
def switch_ready(dpid)
|
15
7
|
send_message dpid, Echo::Request.new
|
@@ -21,9 +13,18 @@ Feature: Trema::Controller#echo_reply handler
|
|
21
13
|
end
|
22
14
|
"""
|
23
15
|
And a file named "trema.conf" with:
|
24
|
-
"""
|
16
|
+
"""ruby
|
25
17
|
vswitch { datapath_id 0xabc }
|
26
18
|
"""
|
27
|
-
|
28
|
-
|
19
|
+
|
20
|
+
@sudo
|
21
|
+
Scenario: invoke echo_reply handler
|
22
|
+
Given I use OpenFlow 1.0
|
23
|
+
When I trema run "echo_reply.rb" with the configuration "trema.conf"
|
24
|
+
Then the file "EchoReply.log" should contain "echo_reply handler is invoked"
|
25
|
+
|
26
|
+
@sudo
|
27
|
+
Scenario: invoke echo_reply handler (OpenFlow 1.3)
|
28
|
+
Given I use OpenFlow 1.3
|
29
|
+
When I trema run "echo_reply.rb" with the configuration "trema.conf"
|
29
30
|
Then the file "EchoReply.log" should contain "echo_reply handler is invoked"
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Feature: hello_failed handler
|
2
|
+
Background:
|
3
|
+
Given a file named "hello_fails.rb" with:
|
4
|
+
"""ruby
|
5
|
+
require 'version_mismatch'
|
6
|
+
|
7
|
+
class HelloFails < Trema::Controller
|
8
|
+
def hello_failed(message)
|
9
|
+
logger.info 'Hello failed.'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
"""
|
13
|
+
And a file named "trema.conf" with:
|
14
|
+
"""ruby
|
15
|
+
vswitch { datapath_id 0xabc }
|
16
|
+
"""
|
17
|
+
|
18
|
+
@sudo
|
19
|
+
Scenario: invoke hello_failed handler
|
20
|
+
Given I use OpenFlow 1.0
|
21
|
+
And a file named "version_mismatch.rb" with:
|
22
|
+
"""ruby
|
23
|
+
module Trema
|
24
|
+
class Switch
|
25
|
+
private
|
26
|
+
|
27
|
+
# force trema to send Hello1.3 on startup.
|
28
|
+
def exchange_hello_messages
|
29
|
+
write Pio::OpenFlow13::Hello.new
|
30
|
+
expect_receiving Hello
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
"""
|
35
|
+
When I trema run "hello_fails.rb" with the configuration "trema.conf"
|
36
|
+
Then the file "HelloFails.log" should contain "Hello failed."
|
37
|
+
|
38
|
+
@sudo
|
39
|
+
Scenario: invoke hello_failed handler (OpenFlow 1.3)
|
40
|
+
Given I use OpenFlow 1.3
|
41
|
+
And a file named "version_mismatch.rb" with:
|
42
|
+
"""ruby
|
43
|
+
module Trema
|
44
|
+
class Switch
|
45
|
+
private
|
46
|
+
|
47
|
+
# force trema to send Hello1.0 on startup.
|
48
|
+
def exchange_hello_messages
|
49
|
+
write Pio::OpenFlow10::Hello.new
|
50
|
+
expect_receiving Hello
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
"""
|
55
|
+
When I trema run "hello_fails.rb" with the configuration "trema.conf"
|
56
|
+
Then the file "HelloFails.log" should contain "Hello failed."
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Feature: packet_in handler
|
2
|
+
Background:
|
3
|
+
Given a file named "packet_in_controller.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class PacketInController < Trema::Controller
|
6
|
+
def packet_in(dpid, message)
|
7
|
+
logger.info "new packet_in (dpid = #{dpid.to_hex})"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
And a file named "trema.conf" with:
|
12
|
+
"""ruby
|
13
|
+
vswitch { datapath_id 0xabc }
|
14
|
+
vhost('host1') { ip '192.168.0.1' }
|
15
|
+
vhost('host2') { ip '192.168.0.2' }
|
16
|
+
link '0xabc', 'host1'
|
17
|
+
link '0xabc', 'host2'
|
18
|
+
"""
|
19
|
+
|
20
|
+
@sudo
|
21
|
+
Scenario: invoke packet_in handler
|
22
|
+
Given I successfully run `trema run packet_in_controller.rb -c trema.conf -d`
|
23
|
+
And I successfully run `sleep 3`
|
24
|
+
When I successfully run `trema send_packets --source host1 --dest host2`
|
25
|
+
Then the file "PacketInController.log" should contain "new packet_in (dpid = 0xabc)"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: invoke packet_in handler (OpenFlow 1.3)
|
29
|
+
Given I successfully run `trema run packet_in_controller.rb -c trema.conf --openflow13 -d`
|
30
|
+
And I successfully run `sleep 3`
|
31
|
+
When I successfully run `trema send_packets --source host1 --dest host2`
|
32
|
+
Then the file "PacketInController.log" should contain "new packet_in (dpid = 0xabc)"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: start handler
|
2
|
+
Background:
|
3
|
+
Given a file named "hello.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class Hello < Trema::Controller
|
6
|
+
def start(args)
|
7
|
+
logger.info "args = [#{args.join(', ')}]"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
|
12
|
+
@sudo
|
13
|
+
Scenario: invoke start handler
|
14
|
+
When I successfully run `trema run hello.rb -d`
|
15
|
+
Then the file "Hello.log" should contain "args = []"
|
16
|
+
|
17
|
+
@sudo
|
18
|
+
Scenario: invoke start handler with args
|
19
|
+
When I successfully run `trema run hello.rb -d -- arg0 arg1 arg2`
|
20
|
+
Then the file "Hello.log" should contain "args = [arg0, arg1, arg2]"
|
21
|
+
|
22
|
+
@sudo
|
23
|
+
Scenario: invoke start handler (OpenFlow 1.3)
|
24
|
+
When I successfully run `trema run hello.rb --openflow13 -d`
|
25
|
+
Then the file "Hello.log" should contain "args = []"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: invoke start handler with args (OpenFlow 1.3)
|
29
|
+
When I successfully run `trema run hello.rb --openflow13 -d -- arg0 arg1 arg2`
|
30
|
+
Then the file "Hello.log" should contain "args = [arg0, arg1, arg2]"
|
31
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Feature: switch_disconnected handler
|
2
|
+
Background:
|
3
|
+
Given a file named "switch_disconnected.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class SwitchDisconnected < Trema::Controller
|
6
|
+
def switch_disconnected(dpid)
|
7
|
+
logger.info "Switch #{dpid.to_hex} is disconnected."
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
And a file named "trema.conf" with:
|
12
|
+
"""ruby
|
13
|
+
vswitch { datapath_id 0xabc }
|
14
|
+
"""
|
15
|
+
|
16
|
+
@sudo
|
17
|
+
Scenario: invoke switch_disconnected handler
|
18
|
+
Given I use OpenFlow 1.0
|
19
|
+
And I trema run "switch_disconnected.rb" with the configuration "trema.conf"
|
20
|
+
When I successfully run `trema stop 0xabc`
|
21
|
+
Then the file "SwitchDisconnected.log" should contain:
|
22
|
+
"""
|
23
|
+
Switch 0xabc is disconnected.
|
24
|
+
"""
|
25
|
+
|
26
|
+
@sudo
|
27
|
+
Scenario: invoke switch_disconnected handler (OpenFlow 1.3)
|
28
|
+
Given I use OpenFlow 1.3
|
29
|
+
And I trema run "switch_disconnected.rb" with the configuration "trema.conf"
|
30
|
+
When I successfully run `trema stop 0xabc`
|
31
|
+
Then the file "SwitchDisconnected.log" should contain:
|
32
|
+
"""
|
33
|
+
Switch 0xabc is disconnected.
|
34
|
+
"""
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Feature: switch_ready handler
|
2
|
+
Background:
|
3
|
+
Given a file named "switch_ready.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class SwitchReady < Trema::Controller
|
6
|
+
def switch_ready(dpid)
|
7
|
+
logger.info format('Hello %s!', dpid.to_hex)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
And a file named "trema.conf" with:
|
12
|
+
"""ruby
|
13
|
+
vswitch { datapath_id 0xabc }
|
14
|
+
"""
|
15
|
+
|
16
|
+
@sudo
|
17
|
+
Scenario: invoke switch_ready handler
|
18
|
+
Given I use OpenFlow 1.0
|
19
|
+
When I trema run "switch_ready.rb" with the configuration "trema.conf"
|
20
|
+
Then the file "SwitchReady.log" should contain "Hello 0xabc!"
|
21
|
+
|
22
|
+
@sudo
|
23
|
+
Scenario: invoke switch_ready handler (OpenFlow 1.3)
|
24
|
+
Given I use OpenFlow 1.3
|
25
|
+
When I trema run "switch_ready.rb" with the configuration "trema.conf"
|
26
|
+
Then the file "SwitchReady.log" should contain "Hello 0xabc!"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Trema::Controller#logger.debug
|
2
|
+
Background:
|
3
|
+
Given a file named "hello.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class Hello < Trema::Controller
|
6
|
+
def start(_args)
|
7
|
+
logger.debug 'Konnichi Wa'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
|
12
|
+
@sudo
|
13
|
+
Scenario: the default logging level
|
14
|
+
When I trema run "hello.rb" interactively
|
15
|
+
And I trema killall "Hello"
|
16
|
+
Then the output should not contain "Konnichi Wa"
|
17
|
+
And the file "Hello.log" should not contain "DEBUG -- : Konnichi Wa"
|
18
|
+
|
19
|
+
@sudo
|
20
|
+
Scenario: --logging_level debug
|
21
|
+
When I run `trema run hello.rb --logging_level debug` interactively
|
22
|
+
And I run `sleep 3`
|
23
|
+
And I trema killall "Hello"
|
24
|
+
Then the output should contain "Konnichi Wa"
|
25
|
+
And the file "Hello.log" should contain "DEBUG -- : Konnichi Wa"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: -v
|
29
|
+
When I run `trema -v run hello.rb` interactively
|
30
|
+
And I run `sleep 3`
|
31
|
+
And I trema killall "Hello"
|
32
|
+
Then the output should contain "Konnichi Wa"
|
33
|
+
And the file "Hello.log" should contain "DEBUG -- : Konnichi Wa"
|
34
|
+
|
35
|
+
@sudo
|
36
|
+
Scenario: --verbose
|
37
|
+
When I run `trema --verbose run hello.rb` interactively
|
38
|
+
And I run `sleep 3`
|
39
|
+
And I trema killall "Hello"
|
40
|
+
Then the output should contain "Konnichi Wa"
|
41
|
+
And the file "Hello.log" should contain "DEBUG -- : Konnichi Wa"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Trema::Controller#logger.error
|
2
|
+
Background:
|
3
|
+
Given a file named "hello.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class Hello < Trema::Controller
|
6
|
+
def start(_args)
|
7
|
+
logger.error 'Konnichi Wa'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
|
12
|
+
@sudo
|
13
|
+
Scenario: the default logging level
|
14
|
+
When I trema run "hello.rb" interactively
|
15
|
+
And I trema killall "Hello"
|
16
|
+
Then the output should contain "Konnichi Wa"
|
17
|
+
And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
|
18
|
+
|
19
|
+
@sudo
|
20
|
+
Scenario: --logging_level error
|
21
|
+
When I run `trema run hello.rb --logging_level error` interactively
|
22
|
+
And I run `sleep 3`
|
23
|
+
And I trema killall "Hello"
|
24
|
+
Then the output should contain "Konnichi Wa"
|
25
|
+
And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: -v
|
29
|
+
When I run `trema -v run hello.rb` interactively
|
30
|
+
And I run `sleep 3`
|
31
|
+
And I trema killall "Hello"
|
32
|
+
Then the output should contain "Konnichi Wa"
|
33
|
+
And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
|
34
|
+
|
35
|
+
@sudo
|
36
|
+
Scenario: --verbose
|
37
|
+
When I run `trema --verbose run hello.rb` interactively
|
38
|
+
And I run `sleep 3`
|
39
|
+
And I trema killall "Hello"
|
40
|
+
Then the output should contain "Konnichi Wa"
|
41
|
+
And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Trema::Controller#logger.fatal
|
2
|
+
Background:
|
3
|
+
Given a file named "hello.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class Hello < Trema::Controller
|
6
|
+
def start(_args)
|
7
|
+
logger.fatal 'Konnichi Wa'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
|
12
|
+
@sudo
|
13
|
+
Scenario: the default logging level
|
14
|
+
When I trema run "hello.rb" interactively
|
15
|
+
And I trema killall "Hello"
|
16
|
+
Then the output should contain "Konnichi Wa"
|
17
|
+
And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
|
18
|
+
|
19
|
+
@sudo
|
20
|
+
Scenario: --logging_level fatal
|
21
|
+
When I run `trema run hello.rb --logging_level fatal` interactively
|
22
|
+
And I run `sleep 3`
|
23
|
+
And I trema killall "Hello"
|
24
|
+
Then the output should contain "Konnichi Wa"
|
25
|
+
And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: -v
|
29
|
+
When I run `trema -v run hello.rb` interactively
|
30
|
+
And I run `sleep 3`
|
31
|
+
And I trema killall "Hello"
|
32
|
+
Then the output should contain "Konnichi Wa"
|
33
|
+
And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
|
34
|
+
|
35
|
+
@sudo
|
36
|
+
Scenario: --verbose
|
37
|
+
When I run `trema --verbose run hello.rb` interactively
|
38
|
+
And I run `sleep 3`
|
39
|
+
And I trema killall "Hello"
|
40
|
+
Then the output should contain "Konnichi Wa"
|
41
|
+
And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Trema::Controller#logger.info
|
2
|
+
Background:
|
3
|
+
Given a file named "hello.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class Hello < Trema::Controller
|
6
|
+
def start(_args)
|
7
|
+
logger.info 'Konnichi Wa'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
|
12
|
+
@sudo
|
13
|
+
Scenario: the default logging level
|
14
|
+
When I trema run "hello.rb" interactively
|
15
|
+
And I trema killall "Hello"
|
16
|
+
Then the output should contain "Konnichi Wa"
|
17
|
+
And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
|
18
|
+
|
19
|
+
@sudo
|
20
|
+
Scenario: --logging_level info
|
21
|
+
When I run `trema run hello.rb --logging_level info` interactively
|
22
|
+
And I run `sleep 3`
|
23
|
+
And I trema killall "Hello"
|
24
|
+
Then the output should contain "Konnichi Wa"
|
25
|
+
And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: -v
|
29
|
+
When I run `trema -v run hello.rb` interactively
|
30
|
+
And I run `sleep 3`
|
31
|
+
And I trema killall "Hello"
|
32
|
+
Then the output should contain "Konnichi Wa"
|
33
|
+
And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
|
34
|
+
|
35
|
+
@sudo
|
36
|
+
Scenario: --verbose
|
37
|
+
When I run `trema --verbose run hello.rb` interactively
|
38
|
+
And I run `sleep 3`
|
39
|
+
And I trema killall "Hello"
|
40
|
+
Then the output should contain "Konnichi Wa"
|
41
|
+
And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Trema::Controller#logger.warn
|
2
|
+
Background:
|
3
|
+
Given a file named "hello.rb" with:
|
4
|
+
"""ruby
|
5
|
+
class Hello < Trema::Controller
|
6
|
+
def start(_args)
|
7
|
+
logger.warn 'Konnichi Wa'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
|
12
|
+
@sudo
|
13
|
+
Scenario: the default logging level
|
14
|
+
When I trema run "hello.rb" interactively
|
15
|
+
And I trema killall "Hello"
|
16
|
+
Then the output should contain "Konnichi Wa"
|
17
|
+
And the file "Hello.log" should contain "WARN -- : Konnichi Wa"
|
18
|
+
|
19
|
+
@sudo
|
20
|
+
Scenario: --logging_level warn
|
21
|
+
When I run `trema run hello.rb --logging_level warn` interactively
|
22
|
+
And I run `sleep 3`
|
23
|
+
And I trema killall "Hello"
|
24
|
+
Then the output should contain "Konnichi Wa"
|
25
|
+
And the file "Hello.log" should contain "WARN -- : Konnichi Wa"
|
26
|
+
|
27
|
+
@sudo
|
28
|
+
Scenario: -v
|
29
|
+
When I run `trema -v run hello.rb` interactively
|
30
|
+
And I run `sleep 3`
|
31
|
+
And I trema killall "Hello"
|
32
|
+
Then the output should contain "Konnichi Wa"
|
33
|
+
And the file "Hello.log" should contain "WARN -- : Konnichi Wa"
|
34
|
+
|
35
|
+
@sudo
|
36
|
+
Scenario: --verbose
|
37
|
+
When I run `trema --verbose run hello.rb` interactively
|
38
|
+
And I run `sleep 3`
|
39
|
+
And I trema killall "Hello"
|
40
|
+
Then the output should contain "Konnichi Wa"
|
41
|
+
And the file "Hello.log" should contain "WARN -- : Konnichi Wa"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# rubocop:disable LineLength
|
2
|
+
|
3
|
+
Then(/^the switch "(.*?)" has (\d+) flow entr(?:y|ies)$/) do |switch, num_entries|
|
4
|
+
command = "trema dump_flows #{switch} -S."
|
5
|
+
step "I run `#{command}`"
|
6
|
+
expect(output_from(command).split("\n").size - 1).to eq(num_entries.to_i)
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^the switch "(.*?)" has no flow entry$/) do |switch|
|
10
|
+
step %(the switch "#{switch}" has 0 flow entry)
|
11
|
+
end
|
12
|
+
|
13
|
+
# rubocop:enable LineLength
|