trema 0.2.5 → 0.2.6

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.
Files changed (292) hide show
  1. data/.gitignore +1 -1
  2. data/Doxyfile +1 -1
  3. data/Gemfile +18 -6
  4. data/README.md +112 -5
  5. data/Rakefile +3 -1
  6. data/Rantfile +88 -1
  7. data/bin/trema +248 -0
  8. data/bin/trema-config +59 -0
  9. data/cruise.rb +1 -1
  10. data/features/example.dumper.feature +45 -65
  11. data/features/example.hello_trema.feature +21 -0
  12. data/features/example.learning_switch.feature +26 -28
  13. data/features/example.list_switches.feature +19 -33
  14. data/features/example.message.echo_reply.feature +10 -10
  15. data/features/example.message.echo_request.feature +2 -2
  16. data/features/example.message.features_request.feature +6 -5
  17. data/features/example.message.hello.feature +47 -13
  18. data/features/example.message.set_config.feature +4 -4
  19. data/features/example.message.vendor-action.feature +23 -0
  20. data/features/example.multi_learning_switch.feature +14 -42
  21. data/features/example.packet_in.feature +31 -0
  22. data/features/example.packetin_filter_config.feature +11 -7
  23. data/features/example.patch_panel.feature +29 -0
  24. data/features/example.repeater_hub.feature +43 -40
  25. data/features/example.switch_info.feature +51 -0
  26. data/features/example.switch_monitor.feature +24 -42
  27. data/features/packetin_filter.feature +28 -22
  28. data/features/step_definitions/misc_steps.rb +19 -8
  29. data/features/step_definitions/send_packets_steps.rb +1 -10
  30. data/features/step_definitions/stats_steps.rb +4 -4
  31. data/features/support/env.rb +2 -1
  32. data/features/support/hooks.rb +35 -2
  33. data/features/switch_manager.feature +18 -12
  34. data/features/trema-config.feature +26 -39
  35. data/features/trema.dump_flows.feature +26 -12
  36. data/features/trema.help.feature +26 -0
  37. data/features/trema.kill.feature +39 -41
  38. data/features/trema.killall.feature +23 -23
  39. data/features/trema.reset_stats.feature +50 -10
  40. data/features/trema.run.feature +28 -39
  41. data/features/trema.send_packets.feature +29 -40
  42. data/features/trema.show_stats.feature +30 -33
  43. data/features/trema.up.feature +33 -0
  44. data/features/trema.version.feature +9 -0
  45. data/ruby/extconf.rb +7 -0
  46. data/ruby/trema/aggregate-stats-reply.rb +3 -3
  47. data/ruby/trema/app.rb +5 -1
  48. data/ruby/trema/barrier-request.c +55 -30
  49. data/ruby/trema/cli.rb +8 -8
  50. data/ruby/trema/command.rb +1 -3
  51. data/ruby/trema/command/dump_flows.rb +5 -24
  52. data/ruby/trema/command/kill.rb +31 -36
  53. data/ruby/trema/command/killall.rb +1 -19
  54. data/{features/step_definitions/kill_steps.rb → ruby/trema/command/netns.rb} +13 -5
  55. data/ruby/trema/command/reset_stats.rb +3 -23
  56. data/ruby/trema/command/ruby.rb +2 -19
  57. data/ruby/trema/command/run.rb +6 -27
  58. data/ruby/trema/command/send_packets.rb +6 -90
  59. data/ruby/trema/command/show_stats.rb +21 -40
  60. data/ruby/trema/command/up.rb +5 -26
  61. data/ruby/trema/command/version.rb +1 -5
  62. data/ruby/trema/controller.c +14 -16
  63. data/ruby/trema/custom-switch.rb +56 -0
  64. data/ruby/trema/desc-stats-reply.rb +5 -5
  65. data/ruby/trema/dsl/configuration.rb +4 -0
  66. data/{features/step_definitions/up_steps.rb → ruby/trema/dsl/custom-switch.rb} +18 -4
  67. data/ruby/trema/dsl/netns.rb +78 -0
  68. data/ruby/trema/dsl/parser.rb +2 -0
  69. data/ruby/trema/dsl/runner.rb +8 -0
  70. data/ruby/trema/dsl/syntax.rb +18 -0
  71. data/ruby/trema/echo-reply.h +2 -2
  72. data/ruby/trema/echo-request.c +3 -5
  73. data/ruby/trema/enqueue.rb +2 -2
  74. data/ruby/trema/error.c +3 -3
  75. data/ruby/trema/executables.rb +26 -2
  76. data/ruby/trema/features-request.c +3 -5
  77. data/ruby/trema/flow-removed.c +6 -6
  78. data/ruby/trema/flow-stats-reply.rb +6 -8
  79. data/ruby/trema/flow.rb +12 -1
  80. data/ruby/trema/get-config-request.c +55 -28
  81. data/ruby/trema/hello.c +3 -5
  82. data/ruby/trema/host.rb +8 -0
  83. data/ruby/trema/list-switches-reply.c +1 -1
  84. data/ruby/trema/mac.rb +1 -1
  85. data/ruby/trema/match.c +15 -14
  86. data/ruby/trema/monkey-patch/module/deprecation.rb +0 -2
  87. data/ruby/trema/netns.rb +127 -0
  88. data/ruby/trema/ordered-hash.rb +5 -4
  89. data/ruby/trema/packet-in.c +136 -113
  90. data/ruby/trema/packet-queue.rb +9 -9
  91. data/ruby/trema/packetin-filter.rb +1 -1
  92. data/ruby/trema/phost.rb +16 -7
  93. data/ruby/trema/port-mod.c +6 -5
  94. data/ruby/trema/port-stats-reply.rb +2 -2
  95. data/ruby/trema/process.rb +29 -0
  96. data/ruby/trema/queue-stats-reply.rb +2 -4
  97. data/ruby/trema/send-out-port.rb +5 -3
  98. data/ruby/trema/set-eth-addr.rb +4 -0
  99. data/ruby/trema/set-ip-addr.rb +4 -2
  100. data/ruby/trema/set-ip-dst-addr.rb +2 -1
  101. data/ruby/trema/set-ip-src-addr.rb +2 -1
  102. data/ruby/trema/set-ip-tos.rb +3 -2
  103. data/ruby/trema/set-transport-port.rb +3 -2
  104. data/ruby/trema/set-vlan-priority.rb +3 -2
  105. data/ruby/trema/set-vlan-vid.rb +5 -4
  106. data/ruby/trema/shell/reset_stats.rb +2 -1
  107. data/ruby/trema/shell/run.rb +1 -1
  108. data/ruby/trema/shell/send_packets.rb +1 -1
  109. data/ruby/trema/shell/show_stats.rb +1 -1
  110. data/ruby/trema/stats-helper.rb +3 -3
  111. data/ruby/trema/stats-reply.c +26 -17
  112. data/ruby/trema/stats-request.c +39 -41
  113. data/ruby/trema/switch-daemon.rb +36 -31
  114. data/ruby/trema/switch.c +1 -1
  115. data/ruby/trema/table-stats-reply.rb +1 -1
  116. data/ruby/trema/timers.rb +13 -13
  117. data/ruby/trema/trema.c +3 -3
  118. data/ruby/trema/tremashark.rb +9 -2
  119. data/ruby/trema/util.rb +39 -15
  120. data/ruby/trema/vendor-action.rb +8 -3
  121. data/ruby/trema/vendor-stats-reply.rb +4 -6
  122. data/ruby/trema/vendor.c +1 -1
  123. data/ruby/trema/version.rb +1 -1
  124. data/spec/trema/barrier-request_spec.rb +47 -37
  125. data/spec/trema/controller_spec.rb +1 -0
  126. data/spec/trema/dsl/runner_spec.rb +8 -3
  127. data/spec/trema/dsl/vhost_spec.rb +8 -8
  128. data/spec/trema/echo-request_spec.rb +1 -0
  129. data/spec/trema/features-request_spec.rb +1 -0
  130. data/spec/trema/flow-removed_spec.rb +9 -9
  131. data/spec/trema/get-config-request_spec.rb +51 -39
  132. data/spec/trema/match_spec.rb +1 -1
  133. data/spec/trema/openflow-error_spec.rb +11 -11
  134. data/spec/trema/packet-out_spec.rb +5 -5
  135. data/spec/trema/queue-get-config-reply_spec.rb +1 -1
  136. data/spec/trema/queue-get-config-request_spec.rb +1 -1
  137. data/spec/trema/set-eth-dst-addr_spec.rb +1 -1
  138. data/spec/trema/set-eth-src-addr_spec.rb +1 -1
  139. data/spec/trema/set-ip-dst-addr_spec.rb +1 -0
  140. data/spec/trema/set-ip-src-addr_spec.rb +1 -0
  141. data/spec/trema/set-ip-tos_spec.rb +1 -0
  142. data/spec/trema/set-transport-dst-port_spec.rb +1 -0
  143. data/spec/trema/set-transport-src-port_spec.rb +1 -0
  144. data/spec/trema/set-vlan-priority_spec.rb +1 -0
  145. data/spec/trema/set-vlan-vid_spec.rb +2 -1
  146. data/spec/trema/stats-reply_spec.rb +38 -36
  147. data/spec/trema/stats-request_spec.rb +6 -6
  148. data/spec/trema/strip-vlan-header_spec.rb +1 -0
  149. data/spec/trema/util_spec.rb +3 -2
  150. data/spec/trema/vendor-action_spec.rb +9 -8
  151. data/src/examples/dumper/dumper.c +8 -6
  152. data/src/examples/dumper/dumper.rb +1 -1
  153. data/{features/step_definitions/killall_steps.rb → src/examples/hello_trema/hello-trema.rb} +6 -5
  154. data/src/examples/hello_trema/hello_trema.c +4 -4
  155. data/src/examples/learning_switch/learning_switch.c +1 -1
  156. data/src/examples/list_switches/list_switches.c +2 -2
  157. data/src/examples/match_compare/match-compare.rb +2 -2
  158. data/src/examples/multi_learning_switch/multi-learning-switch.rb +1 -1
  159. data/src/examples/multi_learning_switch/multi_learning_switch.c +3 -3
  160. data/src/examples/openflow_message/README +1 -1
  161. data/src/examples/openflow_message/echo-request.rb +1 -1
  162. data/src/examples/openflow_message/features_request.c +21 -21
  163. data/src/examples/openflow_message/hello.c +1 -3
  164. data/src/examples/openflow_message/hello.rb +9 -24
  165. data/src/examples/{hello_trema/hello_trema.rb → openflow_message/vendor-action.rb} +17 -7
  166. data/src/examples/openflow_message/vendor_action.c +105 -0
  167. data/src/examples/openflow_switch/hello_switch.c +81 -0
  168. data/src/examples/packet_in/packet-in.rb +9 -13
  169. data/src/examples/packetin_filter_config/packetin_filter_config.c +2 -2
  170. data/src/examples/patch_panel/network.conf +14 -0
  171. data/src/examples/patch_panel/patch-panel.conf +1 -0
  172. data/{features/step_definitions/show_stats_steps.rb → src/examples/patch_panel/patch-panel.rb} +29 -13
  173. data/src/examples/switch_info/{switch_info.rb → switch-info.rb} +2 -2
  174. data/src/examples/switch_info/switch_info.c +4 -4
  175. data/src/examples/switch_monitor/switch_monitor.c +3 -3
  176. data/src/examples/traffic_monitor/counter.c +9 -9
  177. data/src/examples/traffic_monitor/fdb.c +9 -9
  178. data/src/lib/arp.h +1 -1
  179. data/src/lib/buffer.c +4 -3
  180. data/src/lib/byteorder.c +31 -5
  181. data/src/lib/byteorder.h +2 -2
  182. data/src/lib/chibach.c +8 -6
  183. data/src/lib/daemon.c +29 -3
  184. data/src/lib/doubly_linked_list.c +6 -1
  185. data/src/lib/ether.c +1 -1
  186. data/src/lib/ether.h +1 -1
  187. data/src/lib/event_handler.c +3 -3
  188. data/src/lib/hash_table.c +1 -1
  189. data/src/lib/linked_list.c +50 -2
  190. data/src/lib/linked_list.h +2 -2
  191. data/src/lib/log.c +122 -22
  192. data/src/lib/log.h +13 -9
  193. data/src/lib/management_interface.c +361 -0
  194. data/src/lib/management_interface.h +42 -0
  195. data/src/lib/management_service_interface.c +104 -0
  196. data/src/lib/management_service_interface.h +136 -0
  197. data/src/lib/match_table.c +5 -5
  198. data/src/lib/message_queue.c +5 -3
  199. data/src/lib/message_queue.h +1 -1
  200. data/src/lib/messenger.c +73 -39
  201. data/src/lib/messenger.h +3 -2
  202. data/src/lib/openflow_application_interface.c +17 -17
  203. data/src/lib/openflow_message.c +175 -23
  204. data/src/lib/openflow_message.h +2 -1
  205. data/src/lib/openflow_switch_interface.c +12 -12
  206. data/src/lib/packet_parser.c +11 -32
  207. data/src/lib/packetin_filter_interface.c +5 -5
  208. data/src/lib/persistent_storage.c +7 -7
  209. data/src/lib/secure_channel.c +6 -6
  210. data/src/lib/secure_channel.h +1 -1
  211. data/src/lib/stat.c +54 -17
  212. data/src/lib/stat.h +9 -0
  213. data/src/lib/timer.c +11 -10
  214. data/src/lib/trema.c +38 -9
  215. data/src/lib/trema.h +1 -0
  216. data/src/lib/trema_private.h +6 -0
  217. data/src/lib/trema_wrapper.c +4 -4
  218. data/src/lib/trema_wrapper.h +10 -10
  219. data/src/lib/utility.c +6 -6
  220. data/src/management/application.c +224 -0
  221. data/src/management/echo.c +185 -0
  222. data/src/management/set_logging_level.c +153 -0
  223. data/src/management/show_stats.c +150 -0
  224. data/src/management/trema_manager +184 -0
  225. data/src/packetin_filter/packetin_filter.c +31 -29
  226. data/src/switch_manager/cookie_table.c +7 -7
  227. data/src/switch_manager/dpid_table.c +3 -3
  228. data/src/switch_manager/dpid_table.h +0 -1
  229. data/src/switch_manager/management_interface.h +0 -1
  230. data/src/switch_manager/ofpmsg_recv.c +3 -3
  231. data/src/switch_manager/ofpmsg_recv.h +0 -1
  232. data/src/switch_manager/ofpmsg_send.c +2 -2
  233. data/src/switch_manager/ofpmsg_send.h +0 -1
  234. data/src/switch_manager/secure_channel_listener.c +2 -2
  235. data/src/switch_manager/secure_channel_receiver.c +2 -2
  236. data/src/switch_manager/secure_channel_receiver.h +0 -1
  237. data/src/switch_manager/secure_channel_sender.c +8 -1
  238. data/src/switch_manager/service_interface.c +5 -4
  239. data/src/switch_manager/switch.c +79 -53
  240. data/src/switch_manager/switch_manager.c +24 -22
  241. data/src/switch_manager/xid_table.c +6 -6
  242. data/src/switch_manager/xid_table.h +0 -1
  243. data/src/tremashark/README +4 -3
  244. data/src/tremashark/packet_capture.c +11 -9
  245. data/src/tremashark/pcap_queue.c +2 -2
  246. data/src/tremashark/pcap_queue.h +2 -2
  247. data/src/tremashark/plugin/packet-trema/Makefile +1 -1
  248. data/src/tremashark/plugin/packet-trema/Makefile.common +1 -1
  249. data/src/tremashark/plugin/packet-trema/packet-trema.c +50 -37
  250. data/src/tremashark/queue.c +5 -4
  251. data/src/tremashark/queue.h +1 -1
  252. data/src/tremashark/stdin_relay.c +10 -8
  253. data/src/tremashark/syslog_relay.c +14 -12
  254. data/src/tremashark/tremashark.c +15 -18
  255. data/trema +2 -96
  256. data/trema-config +2 -52
  257. data/trema.gemspec +12 -1
  258. data/unittests/cmockery_trema.h +14 -13
  259. data/unittests/lib/buffer_test.c +1 -1
  260. data/unittests/lib/byteorder_test.c +108 -25
  261. data/unittests/lib/daemon_test.c +141 -5
  262. data/unittests/lib/doubly_linked_list_test.c +5 -1
  263. data/unittests/lib/ether_test.c +4 -4
  264. data/unittests/lib/hash_table_test.c +5 -3
  265. data/unittests/lib/linked_list_test.c +82 -4
  266. data/unittests/lib/log_test.c +96 -5
  267. data/unittests/lib/management_interface_test.c +240 -0
  268. data/unittests/lib/management_service_interface_test.c +319 -0
  269. data/unittests/lib/message_queue_test.c +6 -2
  270. data/unittests/lib/messenger_test.c +167 -2
  271. data/unittests/lib/openflow_application_interface_test.c +16 -22
  272. data/unittests/lib/openflow_message_test.c +721 -24
  273. data/unittests/lib/packet_info_test.c +2 -2
  274. data/unittests/lib/packet_parser_test.c +15 -16
  275. data/unittests/lib/packetin_filter_interface_test.c +6 -6
  276. data/unittests/lib/persistent_storage_test.c +11 -11
  277. data/unittests/lib/stat_test.c +151 -7
  278. data/unittests/lib/timer_test.c +1 -1
  279. data/unittests/lib/trema_private_test.c +2 -2
  280. data/unittests/lib/trema_test.c +40 -12
  281. data/unittests/lib/utility_test.c +3 -3
  282. data/unittests/lib/wrapper_test.c +3 -3
  283. data/unittests/packetin_filter/packetin_filter_test.c +12 -11
  284. data/unittests/switch_manager/switch_manager_test.c +29 -22
  285. metadata +99 -20
  286. data/features/step_definitions/log_steps.rb +0 -90
  287. data/features/step_definitions/run_steps.rb +0 -91
  288. data/features/trema.feature +0 -27
  289. data/features/tutorial.hello_trema.feature +0 -27
  290. data/features/tutorial.packet_in.feature +0 -47
  291. data/features/tutorial.switch_info.feature +0 -55
  292. data/ruby/trema/command/usage.rb +0 -63
@@ -1,14 +1,13 @@
1
1
  Feature: trema dump_flows command
2
2
 
3
- As a Trema user
4
- I want to dump the flow table of OpenFlow switch
5
- So that I can debug my Trema apps
3
+ In order to inspect all flow entries in a Trema virtual switch
4
+ As a developer using Trema
5
+ I want to execute "trema dump_flows" command
6
6
 
7
-
8
- Scenario: run trema dump_flows
9
- When I try trema run "./objects/examples/repeater_hub/repeater_hub" with following configuration (backgrounded):
7
+ Background:
8
+ Given a file named "repeater_hub.conf" with:
10
9
  """
11
- vswitch("repeater_hub") { datapath_id "0xabc" }
10
+ vswitch("repeater_hub") { datapath_id 0xabc }
12
11
 
13
12
  vhost("host1")
14
13
  vhost("host2")
@@ -18,8 +17,23 @@ Feature: trema dump_flows command
18
17
  link "repeater_hub", "host2"
19
18
  link "repeater_hub", "host3"
20
19
  """
21
- And wait until "repeater_hub" is up
22
- And I try to run "./trema send_packets --source host1 --dest host2"
23
- And *** sleep 1 ***
24
- And I try to run "./trema dump_flows repeater_hub" (log = "dump_flows.log")
25
- Then "dump_flows.log" should contain some flow entries
20
+ And I successfully run `trema run ../../objects/examples/repeater_hub/repeater_hub -c repeater_hub.conf -d`
21
+
22
+ @slow_process
23
+ Scenario: dump a flow entry
24
+ Given I run `trema send_packets --source host1 --dest host2`
25
+ When I run `trema dump_flows repeater_hub`
26
+ Then the output should contain "actions=FLOOD"
27
+
28
+ @slow_process
29
+ Scenario: no flow entry
30
+ When I run `trema dump_flows repeater_hub`
31
+ Then the output should not contain "actions="
32
+
33
+ Scenario: no argument
34
+ When I run `trema dump_flows`
35
+ Then the output should contain "switches is required"
36
+
37
+ Scenario: wrong switch name
38
+ When I run `trema dump_flows nosuchswitch`
39
+ Then the output should contain "No switch named `nosuchswitch` found!"
@@ -0,0 +1,26 @@
1
+ Feature: trema help
2
+
3
+ In order to understand how to use Trema
4
+ As a developer using Trema
5
+ I want to read the help message of trema command
6
+
7
+ Scenario: List sub-commands
8
+ When I run `trema help`
9
+ Then the output should contain "dump_flows"
10
+ And the output should contain "help"
11
+ And the output should contain "kill"
12
+ And the output should contain "killall"
13
+ And the output should contain "netns"
14
+ And the output should contain "reset_stats"
15
+ And the output should contain "ruby"
16
+ And the output should contain "run"
17
+ And the output should contain "send_packets"
18
+ And the output should contain "show_stats"
19
+ And the output should contain "up"
20
+ And the output should contain "version"
21
+
22
+ Scenario: List global options
23
+ When I run `trema help`
24
+ Then the output should contain "--help"
25
+ And the output should contain "-v, --verbose"
26
+ And the output should contain "--version"
@@ -1,53 +1,51 @@
1
- Feature: kill a trema process with `trema kill' command
1
+ Feature: trema kill command
2
2
 
3
- As a Trema user
4
- I want to kill a trema processes with `trema kill' command
5
- So that I can emulate failures on switch/host/link
3
+ In order to test event handling or just kill unwanted processes
4
+ As a developer using Trema
5
+ I want to execute "trema kill" command
6
6
 
7
-
8
- Scenario: kill a switch
9
- Given I try trema run "./src/examples/switch_monitor/switch-monitor.rb" with following configuration (backgrounded):
7
+ Background:
8
+ Given a file named "switch_monitor.conf" with:
10
9
  """
11
- vswitch { datapath_id "0x1" }
12
- vswitch { datapath_id "0x2" }
13
- vswitch { datapath_id "0x3" }
10
+ vswitch { datapath_id 0x1 }
11
+ vswitch { datapath_id 0x2 }
12
+ vswitch { datapath_id 0x3 }
13
+
14
+ vhost "host1"
15
+ vhost "host2"
16
+ vhost "host3"
17
+
18
+ link "0x1", "host1"
19
+ link "0x2", "host2"
20
+ link "0x3", "host3"
14
21
  """
15
- And wait until "SwitchMonitor" is up
16
- When I try to run "./trema kill 0x1"
17
- And *** sleep 1 ***
18
- Then vswitch 0x1 is terminated
22
+ And I successfully run `trema run ../../src/examples/switch_monitor/switch-monitor.rb -c switch_monitor.conf -d`
19
23
 
24
+ @slow_process
25
+ Scenario: kill a switch
26
+ When I run `trema kill 0x1`
27
+ Then the vswitch "0x1" is terminated
20
28
 
29
+ @slow_process
21
30
  Scenario: kill a host
22
- Given I try trema run "./src/examples/switch_monitor/switch-monitor.rb" with following configuration (backgrounded):
23
- """
24
- vswitch { datapath_id "0x1" }
25
- vhost "host"
26
- link "0x1", "host"
27
- """
28
- And wait until "SwitchMonitor" is up
29
- When I try to run "./trema kill host"
30
- And *** sleep 1 ***
31
- Then host is terminated
31
+ When I run `trema kill host1`
32
+ Then the vhost "host1" is terminated
32
33
 
34
+ @slow_process
35
+ Scenario: kill hosts
36
+ When I run `trema kill host1 host2`
37
+ Then the vhost "host1" is terminated
38
+ And the vhost "host2" is terminated
33
39
 
40
+ @slow_process
34
41
  Scenario: kill a controller
35
- Given I try trema run "./src/examples/switch_monitor/switch-monitor.rb" with following configuration (backgrounded):
36
- """
37
- vswitch { datapath_id "0x1" }
38
- """
39
- And wait until "SwitchMonitor" is up
40
- When I try to run "./trema kill SwitchMonitor"
41
- And *** sleep 1 ***
42
- Then SwitchMonitor is terminated
42
+ When I run `trema kill SwitchMonitor`
43
+ Then the controller "SwitchMonitor" is terminated
43
44
 
45
+ Scenario: no argument
46
+ When I run `trema kill`
47
+ Then the output should contain "name is required"
44
48
 
45
- Scenario: trema help kill
46
- When I try to run "./trema help kill"
47
- Then the output should be:
48
- """
49
- Usage: trema kill NAME [OPTIONS ...]
50
- -h, --help
51
- -v, --verbose
52
-
53
- """
49
+ Scenario: wrong name
50
+ When I run `trema kill nosuchname`
51
+ Then the output should contain "unknown name: nosuchname"
@@ -1,30 +1,30 @@
1
- Feature: kill all trema processes with `trema killall' command
2
-
3
- As a Trema user
4
- I want to kill all trema processes with `trema killall' command
5
- So that I can close trema sessions cleanly
1
+ Feature: trema killall command
6
2
 
3
+ In order to cleanup the previous trema session
4
+ As a developer using Trema
5
+ I want to execute "trema killall" command
7
6
 
7
+ @slow_process
8
8
  Scenario: trema killall
9
- Given I try trema run "./objects/examples/dumper/dumper" with following configuration (backgrounded):
10
- """
11
- vswitch { datapath_id "0xabc" }
9
+ Given a file named "switch_monitor.conf" with:
12
10
  """
13
- And wait until "dumper" is up
14
- When I try to run "./trema killall"
15
- And *** sleep 1 ***
16
- Then switch_manager is terminated
17
- And switch is terminated
18
- And ovs-openflowd is terminated
19
- And dumper is terminated
11
+ vswitch { datapath_id 0x1 }
12
+ vswitch { datapath_id 0x2 }
13
+ vswitch { datapath_id 0x3 }
20
14
 
15
+ vhost "host1"
16
+ vhost "host2"
17
+ vhost "host3"
21
18
 
22
- Scenario: trema help killall
23
- When I try to run "./trema help killall"
24
- Then the output should be:
25
- """
26
- Usage: trema killall [OPTIONS ...]
27
- -h, --help
28
- -v, --verbose
29
-
19
+ link "0x1", "host1"
20
+ link "0x2", "host2"
21
+ link "0x3", "host3"
30
22
  """
23
+ And I successfully run `trema run ../../objects/examples/switch_monitor/switch_monitor -c switch_monitor.conf -d`
24
+ And wait until "switch_monitor" is up
25
+ When I run `trema killall`
26
+ Then switch_manager is terminated
27
+ And switch is terminated
28
+ And phost is terminated
29
+ And ovs-openflowd is terminated
30
+ And switch_monitor is terminated
@@ -1,14 +1,54 @@
1
- Feature: reset network stats with `trema reset_stats' command
1
+ Feature: trema reset_stats command
2
2
 
3
- As a Trema user
4
- I want to reset network stats with `trema reset_stats' command
5
- So that I can easily debug trema applications
3
+ In order to reset the stats of sent/received packets
4
+ As a developer using Trema
5
+ I want to execute "trema reset_stats" command
6
6
 
7
- Scenario: trema help reset_stats
8
- When I try to run "./trema help reset_stats"
9
- Then the output should be:
7
+ Background:
8
+ Given a file named "learning_switch.conf" with:
10
9
  """
11
- Usage: trema reset_stats [OPTIONS ...]
12
- -h, --help
13
- -v, --verbose
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"
14
17
  """
18
+ And I run `trema run ../../src/examples/learning_switch/learning-switch.rb -c learning_switch.conf -d`
19
+ And I run `trema send_packets --source host1 --dest host2`
20
+
21
+ @slow_process
22
+ Scenario: reset_stats host1
23
+ When I run `trema reset_stats host1`
24
+ And I run `trema show_stats host1`
25
+ Then the output should contain exactly "Sent packets:\n\nReceived packets:\n\n"
26
+
27
+ @slow_process
28
+ Scenario: reset_stats host1 host2
29
+ When I run `trema reset_stats host1 host2`
30
+ And I run `trema show_stats host1`
31
+ Then the output should contain exactly "Sent packets:\n\nReceived packets:\n\n"
32
+
33
+ @slow_process
34
+ Scenario: reset_stats host1 host2
35
+ When I run `trema reset_stats host1 host2`
36
+ And I run `trema show_stats host2`
37
+ Then the output should contain exactly "Sent packets:\n\nReceived packets:\n\n"
38
+
39
+ @slow_process
40
+ Scenario: no argument
41
+ When I run `trema reset_stats`
42
+ And I run `trema show_stats host1`
43
+ Then the output should contain exactly "Sent packets:\n\nReceived packets:\n\n"
44
+
45
+ @slow_process
46
+ Scenario: no argument
47
+ When I run `trema reset_stats`
48
+ And I run `trema show_stats host2`
49
+ Then the output should contain exactly "Sent packets:\n\nReceived packets:\n\n"
50
+
51
+ @slow_process
52
+ Scenario: wrong name
53
+ When I run `trema reset_stats nosuchhost`
54
+ Then the output should contain "unknown host: nosuchhost"
@@ -1,47 +1,36 @@
1
- Feature: run trema application with `trema run' command
1
+ Feature: trema run command
2
2
 
3
- As a Trema user
4
- I want to launch trema applications with `trema run' command
5
- So that I don't have to mind the details of Trema
3
+ In order to launch trema applications
4
+ As a developer using Trema
5
+ I want to use `trema run` command
6
6
 
7
-
8
- Scenario: trema run launches switch_manager and an application
9
- When I try trema run "./objects/examples/dumper/dumper" with following configuration (backgrounded):
7
+ Background:
8
+ Given a file named "network.conf" with:
10
9
  """
11
- vswitch { datapath_id "0xabc" }
10
+ vswitch { datapath_id 0xabc }
12
11
  """
13
- And wait until "dumper" is up
14
- Then switch_manager is started
15
- And dumper is started
16
12
 
13
+ @slow_process
14
+ Scenario: trema run launches switch_manager and an application
15
+ When I run `trema run ../../objects/examples/dumper/dumper -c network.conf -d`
16
+ And wait until "dumper" is up
17
+ Then switch_manager is started
18
+ And dumper is started
17
19
 
20
+ @slow_process
18
21
  Scenario: trema run launches switch_manager and an application with proper options
19
- When I try trema run "./objects/examples/learning_switch/learning_switch -i 0xabc" with following configuration (backgrounded, verbose):
20
- """
21
- vswitch { datapath_id "0xabc" }
22
- """
23
- And wait until "learning_switch" is up
24
- Then "switch_manager" should be executed with option = "--daemonize --port=6633 -- port_status::learning_switch packet_in::learning_switch state_notify::learning_switch"
25
- And "learning_switch" should be executed with option = "--name learning_switch -i 0xabc"
26
-
27
-
22
+ When I run `trema -v run ../../objects/examples/learning_switch/learning_switch -c network.conf -d`
23
+ And wait until "learning_switch" is up
24
+ Then the output should contain:
25
+ """
26
+ switch_manager --daemonize --port=6633 -- port_status::learning_switch packet_in::learning_switch state_notify::learning_switch vendor::learning_switch
27
+ """
28
+ And the output should contain:
29
+ """
30
+ learning_switch --name learning_switch -d
31
+ """
32
+
33
+ @slow_process
28
34
  Scenario: switch_manager is killed when trema session is closed
29
- When I try trema run "/bin/true" with following configuration (verbose):
30
- """
31
- vswitch { datapath_id "0xabc" }
32
- """
33
- Then switch_manager should be killed
34
-
35
-
36
- Scenario: trema help run
37
- When I try to run "./trema help run"
38
- Then the output should be:
39
- """
40
- Usage: ./trema run [OPTIONS ...]
41
- -c, --conf FILE
42
- -d, --daemonize
43
- -s, --tremashark
44
-
45
- -h, --help
46
- -v, --verbose
47
- """
35
+ When I run `trema -v run /bin/true -c network.conf`
36
+ Then the output should contain "Shutting down switch_manager..."
@@ -1,56 +1,45 @@
1
- Feature: send packets with `trema send_packets' command
2
-
3
- As a Trema user
4
- I want to send network packets with `trema send_packets' command
5
- So that I can easily debug trema applications
1
+ Feature: trema send_packets command
6
2
 
3
+ In order to send/receive packets between virtual hosts
4
+ As a developer using Trema
5
+ I want to execute "trema send_packets" command
7
6
 
8
7
  Background:
9
- Given I try trema run "learning_switch" example with following configuration (backgrounded):
8
+ Given a file named "learning_switch.conf" with:
10
9
  """
11
- vswitch { datapath_id "0xabc" }
10
+ vswitch("learning") { datapath_id 0xabc }
12
11
 
13
12
  vhost("host1") { ip "192.168.0.1" }
14
13
  vhost("host2") { ip "192.168.0.2" }
15
14
 
16
- link "0xabc", "host1"
17
- link "0xabc", "host2"
15
+ link "learning", "host1"
16
+ link "learning", "host2"
18
17
  """
18
+ And I run `trema run ../../src/examples/learning_switch/learning-switch.rb -c learning_switch.conf -d`
19
19
 
20
+ @slow_process
21
+ Scenario: Sending packets
22
+ When I run `trema send_packets --source host1 --dest host2 --n_pkts=2`
23
+ And I run `trema send_packets --source host2 --dest host1 --n_pkts=1`
24
+ Then the total number of tx packets should be:
25
+ | host1 | host2 |
26
+ | 2 | 1 |
27
+ And the total number of rx packets should be:
28
+ | host1 | host2 |
29
+ | 1 | 2 |
20
30
 
21
- Scenario: send_packets error (--source)
22
- Then "./trema send_packets --source NO_SUCH_HOST --dest host2" exits abnormally with an error message:
31
+ @slow_process
32
+ Scenario: unknown host error (--source)
33
+ When I run `trema send_packets --source NO_SUCH_HOST --dest host2`
34
+ Then the output should contain:
23
35
  """
24
- Unknown host: NO_SUCH_HOST
36
+ unknown host: NO_SUCH_HOST
25
37
  """
26
38
 
27
-
28
- Scenario: send_packets error (--dest)
29
- Then "./trema send_packets --dest host1 --dest NO_SUCH_HOST" exits abnormally with an error message:
39
+ @slow_process
40
+ Scenario: unknown host error (--dest)
41
+ When I run `trema send_packets --source host1 --dest NO_SUCH_HOST`
42
+ Then the output should contain:
30
43
  """
31
- Unknown host: NO_SUCH_HOST
32
- """
33
-
34
-
35
- Scenario: trema help send_packets
36
- When I try to run "./trema help send_packets"
37
- Then the output should be:
38
- """
39
- Usage: ./trema send_packets --source HOSTNAME --dest HOSTNAME [OPTIONS ...]
40
- -s, --source HOSTNAME
41
- --inc_ip_src [NUMBER]
42
- -d, --dest HOSTNAME
43
- --inc_ip_dst [NUMBER]
44
- --tp_src NUMBER
45
- --inc_tp_src [NUMBER]
46
- --tp_dst NUMBER
47
- --inc_tp_dst [NUMBER]
48
- --pps NUMBER
49
- --n_pkts NUMBER
50
- --duration NUMBER
51
- --length NUMBER
52
- --inc_payload [NUMBER]
53
-
54
- -h, --help
55
- -v, --verbose
44
+ unknown host: NO_SUCH_HOST
56
45
  """