trema 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +6 -0
  4. data/bin/trema +12 -4
  5. data/features/.nav +6 -0
  6. data/features/api/logging.feature +10 -3
  7. data/features/api/send_flow_mod_add.feature +8 -3
  8. data/features/handlers/barrier_reply.feature +6 -1
  9. data/features/handlers/description_stats_reply.feature +6 -1
  10. data/features/handlers/echo_reply.feature +6 -1
  11. data/features/handlers/hello_failed.feature +6 -1
  12. data/features/handlers/packet_in.feature +8 -3
  13. data/features/handlers/start.feature +6 -1
  14. data/features/handlers/switch_disconnected.feature +6 -1
  15. data/features/handlers/switch_ready.feature +6 -1
  16. data/features/logger/debug.feature +10 -4
  17. data/features/logger/error.feature +10 -4
  18. data/features/logger/fatal.feature +10 -4
  19. data/features/logger/info.feature +10 -4
  20. data/features/logger/warn.feature +10 -4
  21. data/features/step_definitions/dump_flows_steps.rb +6 -8
  22. data/features/step_definitions/rest_api_steps.rb +3 -3
  23. data/features/step_definitions/show_stats_steps.rb +3 -1
  24. data/features/step_definitions/trema_steps.rb +17 -8
  25. data/features/support/hooks.rb +3 -6
  26. data/features/trema_delete_link/delete_link.feature +7 -0
  27. data/features/trema_dump_flows/dump_flows.feature +49 -0
  28. data/features/trema_killall/all_option.feature +6 -1
  29. data/features/trema_killall/killall.feature +6 -1
  30. data/features/trema_killall/socket_dir_option.feature +7 -0
  31. data/features/trema_netns/README.md +5 -0
  32. data/features/trema_netns/netns.feature +55 -0
  33. data/features/trema_run/conf_option.feature +8 -3
  34. data/features/trema_run/daemonize_option.feature +6 -1
  35. data/features/trema_run/log_dir_option.feature +7 -3
  36. data/features/trema_run/logging_level_option.feature +7 -2
  37. data/features/trema_run/openflow13_option.feature +9 -4
  38. data/features/trema_run/pid_dir_option.feature +7 -3
  39. data/features/trema_run/port_option.feature +8 -3
  40. data/features/trema_run/run.feature +7 -0
  41. data/features/trema_run/socket_dir_option.feature +13 -11
  42. data/features/trema_start/start.feature +10 -5
  43. data/features/trema_stop/stop.feature +8 -3
  44. data/lib/trema/version.rb +1 -1
  45. data/spec/spec_helper.rb +1 -1
  46. data/trema.gemspec +8 -8
  47. metadata +21 -19
  48. data/.ruby-version +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac18a035f00fe07ae6418554199541a9d94732a1
4
- data.tar.gz: 121fe33ddf699232dae17036c5b3440a8d330381
3
+ metadata.gz: dab9ad5e8073729f235b8255bf9f22c9bdd41ec1
4
+ data.tar.gz: e7171cd9de212debc0c72c9bb111d06afdcfa07b
5
5
  SHA512:
6
- metadata.gz: 2f3c2455b0416bf25b637d5fb3b1109ca240ef4c458d486eb5b903d6fde14a2b2f622a94a05a46f45175f71d7722c16673d25b7bb0daf5772e87de53e4bee6d1
7
- data.tar.gz: 3d7fabeb8f28bca2a1e3ef46713add659f96bbfdeead929dbbbacecf8bc424fc4cac63f93c230d5093dc68998730bafe5ac151304668480fbec3057458107021
6
+ metadata.gz: 3cab3c7b79b83d0cfb210dbd05cc4a905fe646ee2c878a7a4f7e0f58753d000da4bff0abfc8826def84e469c67c781f6894bcd4395b0b552f8e3627611ad2e18
7
+ data.tar.gz: df6da3aa3099902242749ddeceaccc21eef3a948cd2f0dd754e15b3d39b6f66a5ff48ab17669961bf4641485df25f2d55fb8e9c885f0d42dba277e6a244dc5e2
@@ -3,6 +3,12 @@
3
3
  ## develop (unreleased)
4
4
 
5
5
 
6
+ ## 0.9.0 (12/17/2015)
7
+ ### New features
8
+ * [#415](https://github.com/trema/trema/pull/415): Add `trema netns [command]` command.
9
+ * [#416](https://github.com/trema/trema/pull/416): dump_flows supports OpenFlow 1.3
10
+
11
+
6
12
  ## 0.8.4 (11/30/2015)
7
13
  ### Bugs fixed
8
14
  * Fix NoMethodError.
data/README.md CHANGED
@@ -29,6 +29,12 @@ Prerequisites
29
29
  [openvswitch]: https://openvswitch.org/
30
30
 
31
31
 
32
+ Documentation
33
+ -------------
34
+
35
+ See https://relishapp.com/trema/trema/docs for links to documentation for all APIs.
36
+
37
+
32
38
  Sample Code
33
39
  -----------
34
40
 
data/bin/trema CHANGED
@@ -59,9 +59,10 @@ module Trema
59
59
  arg_name 'switches...'
60
60
  command :dump_flows do |c|
61
61
  c.desc 'Location to put socket files'
62
- c.flag [:S, :socket_dir], default_value: Phut.socket_dir
62
+ c.flag [:S, :socket_dir], default_value: Trema::DEFAULT_SOCKET_DIR
63
63
 
64
64
  c.action do |_global_options, options, args|
65
+ Phut.socket_dir = options[:socket_dir]
65
66
  args.each do |each|
66
67
  puts Trema.fetch(each, options.fetch(:socket_dir)).dump_flows
67
68
  end
@@ -233,11 +234,16 @@ module Trema
233
234
  end
234
235
  end
235
236
 
236
- desc 'Opens a new shell in the specified network namespace'
237
- arg_name 'name'
237
+ desc 'Opens a new shell or runs a command in the specified network namespace'
238
+ arg_name 'name [command]'
238
239
  command :netns do |c|
239
240
  c.action do |global_options, options, args|
240
- system "sudo ip netns exec #{args[0]} #{ENV['SHELL']}"
241
+ command_args = args[1..-1]
242
+ if command_args && command_args.size > 0
243
+ system "sudo ip netns exec #{args[0]} #{command_args.join(' ')}"
244
+ else
245
+ system "sudo ip netns exec #{args[0]} #{ENV['SHELL']}"
246
+ end
241
247
  end
242
248
  end
243
249
 
@@ -251,6 +257,8 @@ module Trema
251
257
  Phut::OpenVswitch::AlreadyRunning,
252
258
  GLI::UnknownCommandArgument
253
259
  true
260
+ when Interrupt
261
+ exit false
254
262
  else
255
263
  # show backtrace
256
264
  fail e
@@ -9,6 +9,9 @@
9
9
  - openflow13_option.feature
10
10
  - port_option.feature
11
11
 
12
+ - trema_dump_flows (trema dump_flows command):
13
+ - dump_flows.feature
14
+
12
15
  - trema_killall (trema killall command):
13
16
  - killall.feature (basic usage)
14
17
  - all_option.feature
@@ -26,6 +29,9 @@
26
29
  - delete_link.feature (basic usage)
27
30
  - socket_dir_option.feature
28
31
 
32
+ - trema_netns (trema netns command):
33
+ - netns.feature (basic usage)
34
+
29
35
  - logger:
30
36
  - debug.feature
31
37
  - info.feature
@@ -1,4 +1,11 @@
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
+
2
9
  @sudo
3
10
  Scenario: controller, vhost and vswitch creates log files
4
11
  Given a file named "hello.rb" with:
@@ -16,7 +23,7 @@ Feature: logging
16
23
  link '0xabc', '192.168.0.1'
17
24
  """
18
25
  When I successfully run `trema run hello.rb -c trema.conf -d`
19
- And I run `sleep 5`
26
+ And sleep 5
20
27
  Then the following files should exist:
21
28
  | Hello.log |
22
29
  | vhost.192.168.0.1.log |
@@ -36,7 +43,7 @@ Feature: logging
36
43
  link '0xabc', 'host1'
37
44
  """
38
45
  When I successfully run `trema run null_controller.rb -c trema.conf -d`
39
- And I run `sleep 5`
46
+ And sleep 5
40
47
  Then the following files should exist:
41
48
  | NullController.log |
42
49
  | vhost.host1.log |
@@ -59,7 +66,7 @@ Feature: logging
59
66
  end
60
67
  """
61
68
  When I successfully run `trema run two_controllers.rb -d`
62
- And I run `sleep 3`
69
+ And sleep 3
63
70
  Then the following files should exist:
64
71
  | ParentController.log |
65
72
  | ChildController.log |
@@ -1,6 +1,11 @@
1
1
  Feature: send_flow_mod_add
2
2
  Background:
3
- Given a file named "trema.conf" with:
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:
4
9
  """
5
10
  vswitch { datapath_id 0xabc }
6
11
  """
@@ -29,7 +34,7 @@ Feature: send_flow_mod_add
29
34
  end
30
35
  """
31
36
  When I successfully run `trema run flow_mod_controller10.rb -c trema.conf -d`
32
- And I run `sleep 5`
37
+ And sleep 5
33
38
  Then the file "FlowModController10.log" should contain "Sent a FlowMod successfully"
34
39
 
35
40
  @sudo
@@ -57,6 +62,6 @@ Feature: send_flow_mod_add
57
62
  end
58
63
  """
59
64
  When I successfully run `trema run flow_mod_controller13.rb --openflow13 -c trema.conf -d`
60
- And I run `sleep 5`
65
+ And sleep 5
61
66
  Then the file "FlowModController13.log" should contain "Sent a FlowMod successfully"
62
67
 
@@ -1,6 +1,11 @@
1
1
  Feature: barrier_reply handler
2
2
  Background:
3
- Given a file named "barrier_reply.rb" with:
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 "barrier_reply.rb" with:
4
9
  """ruby
5
10
  class BarrierReply < Trema::Controller
6
11
  def switch_ready(dpid)
@@ -1,6 +1,11 @@
1
1
  Feature: description_stats_reply handler
2
2
  Background:
3
- Given a file named "description_stats_reply.rb" with:
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 "description_stats_reply.rb" with:
4
9
  """ruby
5
10
  class DescriptionStatsReply < Trema::Controller
6
11
  def switch_ready(dpid)
@@ -1,6 +1,11 @@
1
1
  Feature: echo_reply handler
2
2
  Background:
3
- Given a file named "echo_reply.rb" with:
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 "echo_reply.rb" with:
4
9
  """ruby
5
10
  class EchoReply < Trema::Controller
6
11
  def switch_ready(dpid)
@@ -1,6 +1,11 @@
1
1
  Feature: hello_failed handler
2
2
  Background:
3
- Given a file named "hello_fails.rb" with:
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 "hello_fails.rb" with:
4
9
  """ruby
5
10
  require 'version_mismatch'
6
11
 
@@ -1,6 +1,11 @@
1
1
  Feature: packet_in handler
2
2
  Background:
3
- Given a file named "trema.conf" with:
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:
4
9
  """ruby
5
10
  vswitch { datapath_id 0xabc }
6
11
  vhost('host1') { ip '192.168.0.1' }
@@ -21,7 +26,7 @@ Feature: packet_in handler
21
26
  """
22
27
 
23
28
  And I successfully run `trema run packet_in_controller.rb -c trema.conf -d`
24
- And I successfully run `sleep 3`
29
+ And sleep 3
25
30
  When I successfully run `trema send_packets --source host1 --dest host2`
26
31
  Then the file "PacketInController.log" should contain "new packet_in (dpid = 0xabc)"
27
32
 
@@ -44,6 +49,6 @@ Feature: packet_in handler
44
49
  end
45
50
  """
46
51
  And I successfully run `trema run packet_in_controller.rb -c trema.conf --openflow13 -d`
47
- And I successfully run `sleep 3`
52
+ And sleep 3
48
53
  When I successfully run `trema send_packets --source host1 --dest host2`
49
54
  Then the file "PacketInController.log" should contain "new packet_in (dpid = 0xabc)"
@@ -1,6 +1,11 @@
1
1
  Feature: start handler
2
2
  Background:
3
- Given a file named "hello.rb" with:
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 "hello.rb" with:
4
9
  """ruby
5
10
  class Hello < Trema::Controller
6
11
  def start(args)
@@ -1,6 +1,11 @@
1
1
  Feature: switch_disconnected handler
2
2
  Background:
3
- Given a file named "switch_disconnected.rb" with:
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 "switch_disconnected.rb" with:
4
9
  """ruby
5
10
  class SwitchDisconnected < Trema::Controller
6
11
  def switch_disconnected(dpid)
@@ -1,6 +1,11 @@
1
1
  Feature: switch_ready handler
2
2
  Background:
3
- Given a file named "switch_ready.rb" with:
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 "switch_ready.rb" with:
4
9
  """ruby
5
10
  class SwitchReady < Trema::Controller
6
11
  def switch_ready(dpid)
@@ -1,6 +1,11 @@
1
1
  Feature: Trema::Controller#logger.debug
2
2
  Background:
3
- Given a file named "hello.rb" with:
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 "hello.rb" with:
4
9
  """ruby
5
10
  class Hello < Trema::Controller
6
11
  def start(_args)
@@ -12,6 +17,7 @@ Feature: Trema::Controller#logger.debug
12
17
  @sudo
13
18
  Scenario: the default logging level
14
19
  When I trema run "hello.rb" interactively
20
+ And sleep 2
15
21
  And I trema killall "Hello"
16
22
  Then the output should not contain "Konnichi Wa"
17
23
  And the file "Hello.log" should not contain "DEBUG -- : Konnichi Wa"
@@ -19,7 +25,7 @@ Feature: Trema::Controller#logger.debug
19
25
  @sudo
20
26
  Scenario: --logging_level debug
21
27
  When I run `trema run hello.rb --logging_level debug` interactively
22
- And I run `sleep 3`
28
+ And sleep 2
23
29
  And I trema killall "Hello"
24
30
  Then the output should contain "Konnichi Wa"
25
31
  And the file "Hello.log" should contain "DEBUG -- : Konnichi Wa"
@@ -27,7 +33,7 @@ Feature: Trema::Controller#logger.debug
27
33
  @sudo
28
34
  Scenario: -v
29
35
  When I run `trema -v run hello.rb` interactively
30
- And I run `sleep 3`
36
+ And sleep 2
31
37
  And I trema killall "Hello"
32
38
  Then the output should contain "Konnichi Wa"
33
39
  And the file "Hello.log" should contain "DEBUG -- : Konnichi Wa"
@@ -35,7 +41,7 @@ Feature: Trema::Controller#logger.debug
35
41
  @sudo
36
42
  Scenario: --verbose
37
43
  When I run `trema --verbose run hello.rb` interactively
38
- And I run `sleep 3`
44
+ And sleep 2
39
45
  And I trema killall "Hello"
40
46
  Then the output should contain "Konnichi Wa"
41
47
  And the file "Hello.log" should contain "DEBUG -- : Konnichi Wa"
@@ -1,6 +1,11 @@
1
1
  Feature: Trema::Controller#logger.error
2
2
  Background:
3
- Given a file named "hello.rb" with:
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 "hello.rb" with:
4
9
  """ruby
5
10
  class Hello < Trema::Controller
6
11
  def start(_args)
@@ -12,6 +17,7 @@ Feature: Trema::Controller#logger.error
12
17
  @sudo
13
18
  Scenario: the default logging level
14
19
  When I trema run "hello.rb" interactively
20
+ And sleep 2
15
21
  And I trema killall "Hello"
16
22
  Then the output should contain "Konnichi Wa"
17
23
  And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
@@ -19,7 +25,7 @@ Feature: Trema::Controller#logger.error
19
25
  @sudo
20
26
  Scenario: --logging_level error
21
27
  When I run `trema run hello.rb --logging_level error` interactively
22
- And I run `sleep 3`
28
+ And sleep 2
23
29
  And I trema killall "Hello"
24
30
  Then the output should contain "Konnichi Wa"
25
31
  And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
@@ -27,7 +33,7 @@ Feature: Trema::Controller#logger.error
27
33
  @sudo
28
34
  Scenario: -v
29
35
  When I run `trema -v run hello.rb` interactively
30
- And I run `sleep 3`
36
+ And sleep 2
31
37
  And I trema killall "Hello"
32
38
  Then the output should contain "Konnichi Wa"
33
39
  And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
@@ -35,7 +41,7 @@ Feature: Trema::Controller#logger.error
35
41
  @sudo
36
42
  Scenario: --verbose
37
43
  When I run `trema --verbose run hello.rb` interactively
38
- And I run `sleep 3`
44
+ And sleep 2
39
45
  And I trema killall "Hello"
40
46
  Then the output should contain "Konnichi Wa"
41
47
  And the file "Hello.log" should contain "ERROR -- : Konnichi Wa"
@@ -1,6 +1,11 @@
1
1
  Feature: Trema::Controller#logger.fatal
2
2
  Background:
3
- Given a file named "hello.rb" with:
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 "hello.rb" with:
4
9
  """ruby
5
10
  class Hello < Trema::Controller
6
11
  def start(_args)
@@ -12,6 +17,7 @@ Feature: Trema::Controller#logger.fatal
12
17
  @sudo
13
18
  Scenario: the default logging level
14
19
  When I trema run "hello.rb" interactively
20
+ And sleep 2
15
21
  And I trema killall "Hello"
16
22
  Then the output should contain "Konnichi Wa"
17
23
  And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
@@ -19,7 +25,7 @@ Feature: Trema::Controller#logger.fatal
19
25
  @sudo
20
26
  Scenario: --logging_level fatal
21
27
  When I run `trema run hello.rb --logging_level fatal` interactively
22
- And I run `sleep 3`
28
+ And sleep 2
23
29
  And I trema killall "Hello"
24
30
  Then the output should contain "Konnichi Wa"
25
31
  And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
@@ -27,7 +33,7 @@ Feature: Trema::Controller#logger.fatal
27
33
  @sudo
28
34
  Scenario: -v
29
35
  When I run `trema -v run hello.rb` interactively
30
- And I run `sleep 3`
36
+ And sleep 2
31
37
  And I trema killall "Hello"
32
38
  Then the output should contain "Konnichi Wa"
33
39
  And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
@@ -35,7 +41,7 @@ Feature: Trema::Controller#logger.fatal
35
41
  @sudo
36
42
  Scenario: --verbose
37
43
  When I run `trema --verbose run hello.rb` interactively
38
- And I run `sleep 3`
44
+ And sleep 2
39
45
  And I trema killall "Hello"
40
46
  Then the output should contain "Konnichi Wa"
41
47
  And the file "Hello.log" should contain "FATAL -- : Konnichi Wa"
@@ -1,6 +1,11 @@
1
1
  Feature: Trema::Controller#logger.info
2
2
  Background:
3
- Given a file named "hello.rb" with:
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 "hello.rb" with:
4
9
  """ruby
5
10
  class Hello < Trema::Controller
6
11
  def start(_args)
@@ -12,6 +17,7 @@ Feature: Trema::Controller#logger.info
12
17
  @sudo
13
18
  Scenario: the default logging level
14
19
  When I trema run "hello.rb" interactively
20
+ And sleep 2
15
21
  And I trema killall "Hello"
16
22
  Then the output should contain "Konnichi Wa"
17
23
  And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
@@ -19,7 +25,7 @@ Feature: Trema::Controller#logger.info
19
25
  @sudo
20
26
  Scenario: --logging_level info
21
27
  When I run `trema run hello.rb --logging_level info` interactively
22
- And I run `sleep 3`
28
+ And sleep 2
23
29
  And I trema killall "Hello"
24
30
  Then the output should contain "Konnichi Wa"
25
31
  And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
@@ -27,7 +33,7 @@ Feature: Trema::Controller#logger.info
27
33
  @sudo
28
34
  Scenario: -v
29
35
  When I run `trema -v run hello.rb` interactively
30
- And I run `sleep 3`
36
+ And sleep 2
31
37
  And I trema killall "Hello"
32
38
  Then the output should contain "Konnichi Wa"
33
39
  And the file "Hello.log" should contain "INFO -- : Konnichi Wa"
@@ -35,7 +41,7 @@ Feature: Trema::Controller#logger.info
35
41
  @sudo
36
42
  Scenario: --verbose
37
43
  When I run `trema --verbose run hello.rb` interactively
38
- And I run `sleep 3`
44
+ And sleep 2
39
45
  And I trema killall "Hello"
40
46
  Then the output should contain "Konnichi Wa"
41
47
  And the file "Hello.log" should contain "INFO -- : Konnichi Wa"