trema 0.2.2.1 → 0.2.3

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 (250) hide show
  1. data/.gitmodules +3 -0
  2. data/.travis.yml +13 -0
  3. data/.yardopts +4 -0
  4. data/Gemfile +2 -3
  5. data/README.md +43 -97
  6. data/Rakefile +60 -4
  7. data/Rantfile +11 -10
  8. data/cruise.rb +4 -6
  9. data/features/example.packetin_filter_config.feature +10 -10
  10. data/features/example.switch_monitor.feature +14 -2
  11. data/features/step_definitions/kill_steps.rb +2 -2
  12. data/features/step_definitions/{off_steps.rb → killall_steps.rb} +2 -2
  13. data/features/step_definitions/misc_steps.rb +1 -1
  14. data/features/step_definitions/up_steps.rb +30 -0
  15. data/features/trema.feature +1 -0
  16. data/features/trema.run.feature +1 -0
  17. data/locale/README.ja.md +19 -0
  18. data/locale/ja/yard.po +3762 -0
  19. data/locale/yard.pot +3740 -0
  20. data/ruby/extconf.rb +4 -1
  21. data/ruby/trema/action-common.c +3 -17
  22. data/ruby/trema/action-common.h +3 -7
  23. data/ruby/trema/action.rb +33 -0
  24. data/ruby/trema/app.rb +1 -1
  25. data/ruby/trema/barrier-request.c +1 -0
  26. data/ruby/trema/command/run.rb +13 -9
  27. data/ruby/trema/command/usage.rb +1 -0
  28. data/ruby/trema/command/version.rb +1 -1
  29. data/ruby/trema/controller.c +133 -50
  30. data/ruby/trema/controller.rb +2 -2
  31. data/ruby/trema/desc-stats-reply.rb +77 -0
  32. data/ruby/trema/dsl/configuration.rb +3 -14
  33. data/ruby/trema/dsl/rswitch.rb +47 -0
  34. data/ruby/trema/dsl/runner.rb +4 -1
  35. data/ruby/trema/dsl/syntax.rb +11 -8
  36. data/ruby/trema/echo-reply.c +59 -45
  37. data/ruby/trema/echo-reply.h +1 -3
  38. data/ruby/trema/echo-request.c +49 -71
  39. data/ruby/trema/echo-request.h +0 -2
  40. data/ruby/trema/echo.c +99 -0
  41. data/ruby/trema/{action-enqueue.h → echo.h} +6 -7
  42. data/ruby/trema/enqueue.rb +87 -0
  43. data/ruby/trema/error.c +109 -104
  44. data/ruby/trema/error.h +0 -2
  45. data/ruby/trema/features-reply.c +89 -35
  46. data/ruby/trema/features-reply.h +0 -6
  47. data/ruby/trema/features-request.c +63 -37
  48. data/ruby/trema/features-request.h +0 -2
  49. data/ruby/trema/flow-mod.c +149 -0
  50. data/ruby/trema/{action-output.h → flow-mod.h} +6 -6
  51. data/ruby/trema/get-config-request.c +1 -0
  52. data/ruby/trema/hardware-switch.rb +88 -0
  53. data/ruby/trema/hello.c +55 -31
  54. data/ruby/trema/hello.h +0 -2
  55. data/ruby/trema/ip.rb +12 -2
  56. data/ruby/trema/logger.rb +29 -0
  57. data/ruby/trema/mac.rb +57 -36
  58. data/ruby/trema/match.c +7 -9
  59. data/ruby/trema/monkey-patch/integer/ranges.rb +0 -2
  60. data/ruby/trema/network-component.rb +1 -1
  61. data/ruby/trema/open-vswitch.rb +2 -2
  62. data/ruby/trema/openflow-switch.rb +3 -54
  63. data/ruby/trema/{packet_in.c → packet-in.c} +262 -175
  64. data/ruby/trema/{packet_in.h → packet-in.h} +0 -2
  65. data/ruby/trema/packet-queue.rb +4 -3
  66. data/ruby/trema/port-mod.c +8 -9
  67. data/ruby/trema/port-status-add.rb +60 -0
  68. data/ruby/trema/port-status-delete.rb +60 -0
  69. data/ruby/trema/port-status-modify.rb +60 -0
  70. data/ruby/trema/port-status.c +48 -15
  71. data/ruby/trema/port-status.h +6 -8
  72. data/ruby/trema/port.c +63 -8
  73. data/ruby/trema/queue-get-config-request.c +1 -0
  74. data/ruby/trema/ruby-switch.rb +62 -0
  75. data/ruby/trema/send-out-port.rb +97 -0
  76. data/ruby/trema/set-config.c +1 -0
  77. data/ruby/trema/set-eth-addr.rb +45 -0
  78. data/ruby/trema/set-eth-dst-addr.rb +54 -0
  79. data/ruby/trema/set-eth-src-addr.rb +54 -0
  80. data/ruby/trema/set-ip-addr.rb +47 -0
  81. data/ruby/trema/set-ip-dst-addr.rb +53 -0
  82. data/ruby/trema/set-ip-src-addr.rb +52 -0
  83. data/ruby/trema/set-ip-tos.rb +63 -0
  84. data/ruby/trema/set-transport-dst-port.rb +53 -0
  85. data/ruby/trema/set-transport-port.rb +52 -0
  86. data/ruby/trema/set-transport-src-port.rb +54 -0
  87. data/ruby/trema/set-vlan-priority.rb +65 -0
  88. data/ruby/trema/set-vlan-vid.rb +64 -0
  89. data/ruby/trema/shell/down.rb +1 -1
  90. data/ruby/trema/shell/link.rb +4 -4
  91. data/ruby/trema/shell/run.rb +8 -6
  92. data/ruby/trema/shell/up.rb +3 -3
  93. data/ruby/trema/stats-reply.c +27 -2
  94. data/ruby/trema/stats-request.c +64 -23
  95. data/ruby/trema/strip-vlan-header.rb +41 -0
  96. data/ruby/trema/switch.c +196 -0
  97. data/ruby/trema/{action-vendor.h → switch.h} +5 -7
  98. data/ruby/trema/switch.rb +28 -9
  99. data/ruby/trema/trema-ruby-utils.c +66 -0
  100. data/ruby/trema/{action-set-dl-src.h → trema-ruby-utils.h} +9 -11
  101. data/ruby/trema/trema.c +61 -61
  102. data/ruby/trema/vendor-action.rb +73 -0
  103. data/ruby/trema/vendor.c +121 -52
  104. data/ruby/trema/vendor.h +6 -10
  105. data/ruby/trema/version.rb +1 -1
  106. data/spec/spec_helper.rb +1 -1
  107. data/spec/support/action.rb +52 -0
  108. data/spec/support/mandatory-option.rb +56 -0
  109. data/spec/support/openflow-message.rb +91 -7
  110. data/spec/support/port-status.rb +38 -0
  111. data/spec/trema/controller_spec.rb +0 -26
  112. data/spec/trema/dsl/configuration_spec.rb +3 -3
  113. data/spec/trema/dsl/runner_spec.rb +12 -32
  114. data/spec/trema/dsl/syntax_spec.rb +2 -11
  115. data/spec/trema/echo-reply_spec.rb +49 -14
  116. data/spec/trema/echo-request_spec.rb +86 -34
  117. data/spec/trema/enqueue_spec.rb +76 -0
  118. data/spec/trema/error_spec.rb +43 -58
  119. data/spec/trema/features-reply_spec.rb +58 -24
  120. data/spec/trema/features-request_spec.rb +54 -28
  121. data/spec/trema/flow-mod_spec.rb +99 -0
  122. data/spec/trema/{openflow-switch_spec.rb → hardware-switch_spec.rb} +3 -3
  123. data/spec/trema/hello_spec.rb +28 -14
  124. data/spec/trema/ip_spec.rb +54 -0
  125. data/spec/trema/mac_spec.rb +49 -64
  126. data/spec/trema/match_spec.rb +1 -1
  127. data/spec/trema/open-vswitch_spec.rb +7 -7
  128. data/spec/trema/packet-in_spec.rb +73 -16
  129. data/spec/trema/port-status-add_spec.rb +32 -0
  130. data/spec/trema/port-status-delete_spec.rb +32 -0
  131. data/spec/trema/port-status-modify_spec.rb +71 -0
  132. data/spec/trema/port-status_spec.rb +5 -76
  133. data/spec/trema/{action-output_spec.rb → send-out-port_spec.rb} +20 -47
  134. data/spec/trema/set-eth-dst-addr_spec.rb +75 -0
  135. data/spec/trema/set-eth-src-addr_spec.rb +72 -0
  136. data/spec/trema/set-ip-dst-addr_spec.rb +58 -0
  137. data/spec/trema/set-ip-src-addr_spec.rb +58 -0
  138. data/spec/trema/set-ip-tos_spec.rb +65 -0
  139. data/spec/trema/set-transport-dst-port_spec.rb +65 -0
  140. data/spec/trema/set-transport-src-port_spec.rb +65 -0
  141. data/spec/trema/set-vlan-priority_spec.rb +65 -0
  142. data/spec/trema/set-vlan-vid_spec.rb +65 -0
  143. data/spec/trema/shell/vhost_spec.rb +4 -1
  144. data/spec/trema/shell/vswitch_spec.rb +11 -11
  145. data/spec/trema/stats-reply_spec.rb +59 -13
  146. data/spec/trema/stats-request_spec.rb +6 -0
  147. data/spec/trema/{action-strip-vlan_spec.rb → strip-vlan-header_spec.rb} +3 -17
  148. data/spec/trema/switch-daemon_spec.rb +39 -0
  149. data/spec/trema/vendor-action_spec.rb +81 -0
  150. data/spec/trema/vendor_spec.rb +76 -0
  151. data/spec/trema_spec.rb +56 -0
  152. data/src/examples/dumper/dumper.c +0 -8
  153. data/src/examples/dumper/dumper.rb +52 -52
  154. data/src/examples/hello_trema/hello_trema.c +0 -2
  155. data/src/examples/learning_switch/learning-switch.rb +3 -3
  156. data/src/examples/multi_learning_switch/multi-learning-switch.rb +3 -3
  157. data/src/examples/openflow_message/features-request.rb +3 -3
  158. data/src/examples/packetin_filter_config/utils.c +4 -4
  159. data/src/examples/repeater_hub/repeater-hub.rb +3 -3
  160. data/src/examples/switch_info/switch_info.rb +2 -2
  161. data/src/examples/switch_monitor/switch_monitor.c +1 -1
  162. data/src/examples/traffic_monitor/traffic-monitor.rb +3 -3
  163. data/src/lib/arp.h +4 -1
  164. data/src/lib/chibach.c +391 -0
  165. data/src/lib/chibach.h +71 -0
  166. data/src/lib/chibach_private.c +170 -0
  167. data/src/lib/chibach_private.h +52 -0
  168. data/src/lib/ether.c +2 -1
  169. data/src/lib/ether.h +0 -1
  170. data/src/lib/ipv4.h +13 -14
  171. data/{ruby/trema/action-set-nw-src.h → src/lib/ipv6.h} +13 -9
  172. data/src/lib/log.c +161 -58
  173. data/src/lib/log.h +11 -16
  174. data/src/lib/messenger.c +36 -1
  175. data/src/lib/messenger.h +1 -0
  176. data/src/lib/openflow_application_interface.c +128 -28
  177. data/src/lib/openflow_application_interface.h +31 -6
  178. data/src/lib/openflow_message.c +2 -1
  179. data/src/lib/openflow_service_interface.h +1 -0
  180. data/src/lib/openflow_switch_interface.c +1380 -0
  181. data/src/lib/openflow_switch_interface.h +264 -0
  182. data/src/lib/packet_info.c +94 -11
  183. data/src/lib/packet_info.h +22 -3
  184. data/src/lib/packet_parser.c +38 -2
  185. data/src/lib/secure_channel.c +498 -0
  186. data/{ruby/trema/vendor-request.h → src/lib/secure_channel.h} +11 -10
  187. data/src/lib/tcp.h +0 -3
  188. data/src/lib/trema.c +38 -5
  189. data/{ruby/trema/action-set-nw-dst.h → src/lib/trema.hpp} +17 -8
  190. data/src/lib/trema_wrapper.c +5 -0
  191. data/src/lib/trema_wrapper.h +4 -0
  192. data/src/lib/utility.c +93 -4
  193. data/src/lib/utility.h +1 -0
  194. data/src/lib/wrapper.c +30 -7
  195. data/src/lib/wrapper.h +2 -0
  196. data/src/switch_manager/ofpmsg_recv.c +44 -30
  197. data/src/switch_manager/ofpmsg_send.c +40 -1
  198. data/src/switch_manager/ofpmsg_send.h +2 -0
  199. data/src/switch_manager/switch.c +153 -8
  200. data/src/switch_manager/switch.h +1 -0
  201. data/src/switch_manager/switchinfo.h +5 -0
  202. data/src/tremashark/README +2 -2
  203. data/src/tremashark/plugin/packet-trema/packet-trema.c +1 -0
  204. data/trema +1 -1
  205. data/unittests/lib/log_test.c +158 -34
  206. data/unittests/lib/openflow_application_interface_test.c +252 -69
  207. data/unittests/lib/openflow_message_test.c +3 -1
  208. data/unittests/lib/packet_parser_test.c +60 -15
  209. data/unittests/lib/test_packets/icmp6_echo_rep.cap +0 -0
  210. data/unittests/lib/test_packets/icmp6_echo_req.cap +0 -0
  211. data/unittests/lib/trema_test.c +2 -0
  212. data/unittests/lib/utility_test.c +65 -2
  213. data/unittests/lib/wrapper_test.c +29 -0
  214. data/vendor/{README → README.md} +2 -12
  215. data/vendor/packet-openflow.diff +13 -0
  216. metadata +86 -53
  217. data/GPL2 +0 -339
  218. data/ruby/trema/action-enqueue.c +0 -161
  219. data/ruby/trema/action-output.c +0 -169
  220. data/ruby/trema/action-set-dl-dst.c +0 -131
  221. data/ruby/trema/action-set-dl-dst.h +0 -44
  222. data/ruby/trema/action-set-dl-src.c +0 -131
  223. data/ruby/trema/action-set-nw-dst.c +0 -135
  224. data/ruby/trema/action-set-nw-src.c +0 -140
  225. data/ruby/trema/action-set-nw-tos.c +0 -124
  226. data/ruby/trema/action-set-nw-tos.h +0 -42
  227. data/ruby/trema/action-set-tp-dst.c +0 -122
  228. data/ruby/trema/action-set-tp-dst.h +0 -42
  229. data/ruby/trema/action-set-tp-src.c +0 -124
  230. data/ruby/trema/action-set-tp-src.h +0 -42
  231. data/ruby/trema/action-set-vlan-pcp.c +0 -128
  232. data/ruby/trema/action-set-vlan-pcp.h +0 -42
  233. data/ruby/trema/action-set-vlan-vid.c +0 -125
  234. data/ruby/trema/action-set-vlan-vid.h +0 -42
  235. data/ruby/trema/action-strip-vlan.c +0 -81
  236. data/ruby/trema/action-strip-vlan.h +0 -42
  237. data/ruby/trema/action-vendor.c +0 -121
  238. data/ruby/trema/vendor-request.c +0 -193
  239. data/spec/trema/action-enqueue_spec.rb +0 -100
  240. data/spec/trema/action-set-dl-dst_spec.rb +0 -95
  241. data/spec/trema/action-set-dl-src_spec.rb +0 -92
  242. data/spec/trema/action-set-nw-dst_spec.rb +0 -96
  243. data/spec/trema/action-set-nw-src_spec.rb +0 -97
  244. data/spec/trema/action-set-nw-tos_spec.rb +0 -88
  245. data/spec/trema/action-set-tp-dst_spec.rb +0 -88
  246. data/spec/trema/action-set-tp-src_spec.rb +0 -88
  247. data/spec/trema/action-set-vlan-pcp_spec.rb +0 -91
  248. data/spec/trema/action-set-vlan-vid_spec.rb +0 -91
  249. data/spec/trema/action-vendor_spec.rb +0 -90
  250. data/spec/trema/vendor-request_spec.rb +0 -79
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "vendor/yard.i18n"]
2
+ path = vendor/yard.i18n
3
+ url = https://github.com/kou/yard
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ script: "rake travis"
2
+
3
+ rvm:
4
+ - 1.8.7
5
+
6
+ branches:
7
+ only:
8
+ - master
9
+ - develop
10
+
11
+ before_install:
12
+ - sudo apt-get update
13
+ - sudo apt-get install libpcap-dev
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --no-private
2
+ --readme README.md
3
+ ruby/trema/**/*.rb
4
+ ruby/trema/**/*.c
data/Gemfile CHANGED
@@ -9,8 +9,7 @@ gemspec
9
9
  # Add dependencies to develop your gem here.
10
10
  # Include everything needed to run rake, tests, features, etc.
11
11
  group :development do
12
- gem "bundler", "~> 1.1.0"
13
- gem "cucumber", "~> 1.1.9"
12
+ gem "cucumber", "~> 1.2.1"
14
13
  gem "flay", "~> 1.4.3"
15
14
  gem "flog", "~> 2.5.3"
16
15
  gem "rake", "~> 0.9.2.2"
@@ -19,6 +18,6 @@ group :development do
19
18
  gem "redcarpet", "~> 2.1.0"
20
19
  gem "reek", "~> 1.2.8"
21
20
  gem "roodi", "~> 2.1.0"
22
- gem "rspec", "~> 2.8.0"
21
+ gem "rspec", "~> 2.11.0"
23
22
  gem "yard", "~> 0.7"
24
23
  end
data/README.md CHANGED
@@ -1,43 +1,8 @@
1
- Trema ![Project status](http://stillmaintained.com/trema/trema.png)
2
- =====
3
- An Open Source modular framework for developing OpenFlow controllers in Ruby/C
1
+ Welcome to Trema
2
+ ================
4
3
 
5
-
6
- What's Trema?
7
- -------------
8
-
9
- Welcome to the Trema OpenFlow programming framework. The scope of
10
- Trema is to help developers to easily create their own OpenFlow
11
- controllers, and NOT aiming at providing a specific OpenFlow
12
- controller implementation.
13
-
14
-
15
- Getting Started
16
- ---------------
17
-
18
- Trema requires several third-party software. You can install the
19
- prerequisites as follows:
20
-
21
- $ sudo apt-get install gcc make ruby ruby-dev irb file libpcap-dev libsqlite3-dev
22
-
23
- Download Trema source tree then run its build script:
24
-
25
- $ ./build.rb
26
-
27
- NOTE: Trema has been tested ONLY on the following environments:
28
-
29
- * Ubuntu 11.10 (i386/amd64, Desktop Edition)
30
- * Ubuntu 11.04 (i386/amd64, Desktop Edition)
31
- * Ubuntu 10.10 (i386/amd64, Desktop Edition)
32
- * Ubuntu 10.04 (i386/amd64, Desktop Edition)
33
- * Debian GNU/Linux 6.0 (i386/amd64)
34
-
35
- It may also run on other GNU/Linux distributions but is not tested and
36
- NOT SUPPORTED at this moment.
37
-
38
-
39
- What's here?
40
- ------------
4
+ Trema is a OpenFlow controller framework that includes everything
5
+ needed to create OpenFlow controllers in Ruby and C.
41
6
 
42
7
  This distribution includes all the source code of Trema you need to
43
8
  develop your own OpenFlow controllers. The source tree includes basic
@@ -51,85 +16,66 @@ emulates an OpenFlow-based network and end-hosts is provided for
51
16
  testing your own controllers. For debugging, a wireshark plug-in to
52
17
  diagnose internal data-flows among functional modules is provided.
53
18
 
54
- Please refer to the quick start guide
55
- (https://github.com/trema/trema/wiki/Quick-start) for details.
19
+
20
+ Getting Started
21
+ ---------------
22
+
23
+ 1.Install the prerequisites at the command prompt:
24
+
25
+ $ sudo apt-get install gcc make ruby rubygems ruby-dev irb libpcap-dev libsqlite3-dev
26
+
27
+ 2.Install Trema at the command prompt:
28
+
29
+ $ sudo gem install trema
30
+
31
+ 3.Follow the guidelines to start developing your OpenFlow controller. You may find the following resources handy:
32
+
33
+ * The [Getting Started with Trema](https://github.com/trema/trema/wiki/Quick-start).
34
+ * The [Trema in 10 Minutes Tutorial](http://trema-10min.heroku.com/).
35
+ * The [Trema Tutorial](http://trema-tutorial.heroku.com/).
36
+ * The [Trema Ruby API documents](http://rubydoc.info/github/trema/trema/master/frames).
37
+ * The [Programming Trema Article (in Japanese)](http://gihyo.jp/dev/serial/01/openflow_sd/0007).
56
38
 
57
39
 
58
40
  Meta
59
41
  ----
60
42
 
61
- * Ruby API documents: http://rubydoc.info/github/trema/trema/master/frames
43
+ * Web Page: http://trema.github.com/trema/
62
44
  * Bugs: https://github.com/trema/trema/issues
63
45
  * Mailing List: https://groups.google.com/group/trema-dev
64
46
  * Twitter: http://twitter.com/trema_news
65
- * Web Page: http://trema.github.com/trema/
66
-
67
47
 
68
- Authors
69
- -------
70
-
71
- Please keep the list sorted.
72
-
73
- * Kazushi Sugyo
74
- * Kazuya Suzuki
75
- * Lei Sun
76
- * Nick Karanatsios <nickkaranatsios@gmail.com>
77
- * Shin'ya Zenke
78
- * Shuji Ishii
79
- * Sundell Jari <sundell.software@gmail.com>
80
- * Toshio Koide
81
- * Yasuhito Takamiya <yasuhito@gmail.com>
82
- * Yasunobu Chiba
83
- * Yasunori Nakazawa
84
48
 
49
+ Supported Platforms
50
+ -------------------
85
51
 
86
- ### Contributors
52
+ Trema has been tested ONLY on the following environments:
87
53
 
88
- Thanks to:
89
-
90
- * Initial Helios development team for implementing prototype versions.
91
- * HIDEyuki Shimonishi for providing much-needed coffee, snacks, and christmas cakes!
92
- * Anonymous alpha/beta testers for finding potential issues.
54
+ * Ubuntu 12.04, 11.10, 11.04, 10.10, and 10.04 (i386/amd64, Desktop Edition)
55
+ * Debian GNU/Linux 6.0 (i386/amd64)
93
56
 
57
+ It may also run on other GNU/Linux distributions but is not tested and
58
+ NOT SUPPORTED at this moment.
94
59
 
95
- License & Terms
96
- ---------------
97
60
 
98
- Copyright (C) 2008-2012 NEC Corporation
61
+ Contributors
62
+ ------------
99
63
 
100
- This program is free software; you can redistribute it and/or modify
101
- it under the terms of the GNU General Public License, version 2, as
102
- published by the Free Software Foundation.
64
+ Special thanks to all contributors for submitting patches. A full list of contributors including their patches can be found at:
103
65
 
104
- This program is distributed in the hope that it will be useful, but
105
- WITHOUT ANY WARRANTY; without even the implied warranty of
106
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
107
- General Public License for more details.
66
+ https://github.com/trema/trema/contributors
108
67
 
109
68
 
110
- ### Terms
69
+ Project Status
70
+ --------------
111
71
 
112
- Terms of Contributing to Trema program ("Program")
72
+ * Build Status [![Build Status](https://secure.travis-ci.org/trema/trema.png?branch=develop)](http://travis-ci.org/trema/trema)
73
+ * Dependency Status [![Dependency Status](https://gemnasium.com/trema/trema.png)](https://gemnasium.com/trema/trema)
113
74
 
114
- Please read the following terms before you submit to the Trema project
115
- ("Project") any original works of corrections, modifications,
116
- additions, patches and so forth to the Program ("Contribution"). By
117
- submitting the Contribution, you are agreeing to be bound by the
118
- following terms. If you do not or cannot agree to any of the terms,
119
- please do not submit the Contribution:
120
75
 
121
- 1. You hereby grant to any person or entity receiving or distributing
122
- the Program through the Project a worldwide, perpetual,
123
- non-exclusive, royalty free license to use, reproduce, modify,
124
- prepare derivative works of, display, perform, sublicense, and
125
- distribute the Contribution and such derivative works.
76
+ License
77
+ -------
126
78
 
127
- 2. You warrant that you have all rights necessary to submit the
128
- Contribution and, to the best of your knowledge, the Contribution
129
- does not infringe copyright, patent, trademark, trade secret, or
130
- other intellectual property rights of any third parties.
79
+ Trema is released under the GNU General Public License version 2.0:
131
80
 
132
- 3. In the event that the Contribution is combined with third parties'
133
- programs, you notify to Project maintainers including NEC
134
- Corporation ("Maintainers") the author, the license condition, and
135
- the name of such third parties' programs.
81
+ * http://www.gnu.org/licenses/gpl-2.0.html
data/Rakefile CHANGED
@@ -1,6 +1,4 @@
1
1
  #
2
- # Author: Yasuhito Takamiya <yasuhito@gmail.com>
3
- #
4
2
  # Copyright (C) 2008-2012 NEC Corporation
5
3
  #
6
4
  # This program is free software; you can redistribute it and/or modify
@@ -24,10 +22,13 @@ require "rubygems"
24
22
  require "rake"
25
23
 
26
24
  task :default do
27
- system "./build.rb"
25
+ sh "./build.rb"
28
26
  end
29
27
 
30
28
 
29
+ task :travis => [ :default, "spec:travis" ]
30
+
31
+
31
32
  begin
32
33
  require "bundler/gem_tasks"
33
34
  rescue LoadError
@@ -43,6 +44,12 @@ begin
43
44
  spec.pattern = FileList[ "spec/**/*_spec.rb" ]
44
45
  end
45
46
 
47
+ RSpec::Core::RakeTask.new( "spec:travis" ) do | spec |
48
+ spec.pattern = FileList[ "spec/**/*_spec.rb" ]
49
+ # FIXME: use --tag ~sudo
50
+ spec.rspec_opts = "--tag nosudo -fs -c"
51
+ end
52
+
46
53
  RSpec::Core::RakeTask.new( :rcov ) do | spec |
47
54
  spec.pattern = "spec/**/*_spec.rb"
48
55
  spec.rcov = true
@@ -123,9 +130,9 @@ begin
123
130
  require "flay_task"
124
131
 
125
132
  FlayTask.new do | t |
126
- # add directories such as app, bin, spec and test if need be.
127
133
  t.dirs = %w( ruby )
128
134
  t.threshold = 0
135
+ t.verbose = true
129
136
  end
130
137
  rescue LoadError
131
138
  $stderr.puts $!.to_s
@@ -142,8 +149,57 @@ begin
142
149
  require "yard"
143
150
 
144
151
  YARD::Rake::YardocTask.new do | t |
152
+ t.files = [ "ruby/trema/**/*.c", "ruby/trema/**/*.rb" ]
153
+ t.options = [ "--no-private" ]
145
154
  t.options << "--debug" << "--verbose" if $trace
146
155
  end
156
+
157
+ yardoc_i18n = "./vendor/yard.i18n/bin/yardoc"
158
+
159
+ namespace :yard do
160
+ desc "Generate YARD Documentation in Japanese"
161
+ task :ja => "yard:po" do
162
+ sh "#{ yardoc_i18n } --language ja ruby/trema"
163
+ end
164
+ end
165
+
166
+ locale_base_dir = "locale"
167
+ locale_dir = "#{ locale_base_dir }/ja"
168
+ pot = "#{ locale_base_dir }/yard.pot"
169
+ po = "#{ locale_dir }/yard.po"
170
+
171
+ namespace :yard do
172
+ desc "generate .pot file"
173
+ task :pot => pot
174
+
175
+ desc "Generate .po file"
176
+ task :po => po
177
+
178
+ file pot => FileList[ "ruby/trema/**/*.rb", "ruby/trema/**/*.c" ] do
179
+ Rake::Task[ "yard:pot:generate" ].invoke
180
+ end
181
+
182
+ namespace :pot do
183
+ task :generate do
184
+ sh( yardoc_i18n, "--no-yardopts", "--output", locale_base_dir, "--format", "pot", "ruby/trema" )
185
+ end
186
+ end
187
+
188
+ directory locale_dir
189
+ file po => [ locale_dir, pot ] do
190
+ Rake::Task[ "yard:po:generate" ].invoke
191
+ end
192
+
193
+ namespace :po do
194
+ task :generate do
195
+ if File.exist?( po )
196
+ sh( "msgmerge", "--update", "--sort-by-file", po, pot )
197
+ else
198
+ sh( "msginit", "--input", pot, "--output", po, "--locale", "ja.UTF-8" )
199
+ end
200
+ end
201
+ end
202
+ end
147
203
  rescue LoadError
148
204
  $stderr.puts $!.to_s
149
205
  end
data/Rantfile CHANGED
@@ -228,6 +228,7 @@ task "vendor:openflow" => Trema.openflow_h
228
228
  file Trema.openflow_h => Trema.objects do
229
229
  sys.unpack_tgz "#{ Trema.vendor_openflow }.tar.gz", :in => Trema.vendor
230
230
  sys.cp_r "#{ Trema.vendor_openflow }/include/openflow", Trema.objects
231
+ sys "chmod -R +r #{ File.join Trema.objects, "openflow" }"
231
232
  end
232
233
 
233
234
  task "vendor:openflow:distclean" do
@@ -462,7 +463,7 @@ end
462
463
  desc "Build switch manager."
463
464
  task :switch_manager => Trema::Executables.switch_manager
464
465
  file Trema::Executables.switch_manager => switch_manager_objects + [ libtrema ] do | t |
465
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
466
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpthread"
466
467
  end
467
468
 
468
469
 
@@ -482,7 +483,7 @@ end
482
483
  desc "Build switch."
483
484
  task :switch => Trema::Executables.switch
484
485
  file Trema::Executables.switch => switch_objects + [ libtrema ] do | t |
485
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
486
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpthread"
486
487
  end
487
488
 
488
489
 
@@ -507,7 +508,7 @@ end
507
508
  desc "Build packetin filter."
508
509
  task :packetin_filter => Trema::Executables.packetin_filter
509
510
  file Trema::Executables.packetin_filter => packetin_filter_objects.candidates + [ libtrema ] do | t |
510
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
511
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lpthread -lsqlite3 -ldl -lrt"
511
512
  end
512
513
 
513
514
 
@@ -543,7 +544,7 @@ end
543
544
  desc "Build tremashark."
544
545
  task :tremashark => Trema::Executables.tremashark
545
546
  file Trema::Executables.tremashark => tremashark_objects + [ libtrema ] do | t |
546
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
547
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap -lpthread"
547
548
  end
548
549
 
549
550
 
@@ -557,7 +558,7 @@ end
557
558
  desc "Build packet_capture."
558
559
  task :packet_capture => Trema::Executables.packet_capture
559
560
  file Trema::Executables.packet_capture => packet_capture_objects + [ libtrema ] do | t |
560
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
561
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap -lpthread"
561
562
  end
562
563
 
563
564
 
@@ -570,7 +571,7 @@ end
570
571
  desc "Build syslog_relay."
571
572
  task :syslog_relay => Trema::Executables.syslog_relay
572
573
  file Trema::Executables.syslog_relay => syslog_relay_objects + [ libtrema ] do | t |
573
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
574
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap -lpthread"
574
575
  end
575
576
 
576
577
 
@@ -583,7 +584,7 @@ end
583
584
  desc "Build stdin_relay."
584
585
  task :stdin_relay => Trema::Executables.stdin_relay
585
586
  file Trema::Executables.stdin_relay => stdin_relay_objects + [ libtrema ] do | t |
586
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
587
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap -lpthread"
587
588
  end
588
589
 
589
590
 
@@ -627,7 +628,7 @@ standalone_examples.each do | each |
627
628
  desc "Build #{ each } example."
628
629
  task "examples:#{ each }" => target
629
630
  file target => objects.candidates + [ libtrema ] do | t |
630
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
631
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpthread"
631
632
  end
632
633
  end
633
634
 
@@ -666,7 +667,7 @@ openflow_messages.each do | each |
666
667
  target = File.join( openflow_message_objects_dir, each )
667
668
  task "examples:openflow_message" => target
668
669
  file target => [ File.join( openflow_message_objects_dir, "#{ each }.o" ), libtrema ] do | t |
669
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } -ltrema -lsqlite3 -ldl -lrt"
670
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } -ltrema -lsqlite3 -ldl -lrt -lpthread"
670
671
  end
671
672
  end
672
673
 
@@ -710,7 +711,7 @@ packetin_filter_config.each do | each |
710
711
  packetin_filter_config_utils_o,
711
712
  libtrema
712
713
  ] do | t |
713
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } #{ packetin_filter_config_utils_o } -ltrema -lsqlite3 -ldl -lrt"
714
+ sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } #{ packetin_filter_config_utils_o } -ltrema -lsqlite3 -ldl -lrt -lpthread"
714
715
  end
715
716
  end
716
717
 
data/cruise.rb CHANGED
@@ -2,8 +2,6 @@
2
2
  #
3
3
  # Unit test & acceptance test runner for Trema.
4
4
  #
5
- # Author: Yasuhito Takamiya <yasuhito@gmail.com>
6
- #
7
5
  # Copyright (C) 2008-2012 NEC Corporation
8
6
  #
9
7
  # This program is free software; you can redistribute it and/or modify
@@ -26,7 +24,7 @@
26
24
  # threshold.
27
25
  #
28
26
 
29
- $coverage_threshold = 74.2
27
+ $coverage_threshold = 68.9
30
28
 
31
29
 
32
30
  ################################################################################
@@ -94,7 +92,7 @@ class Testee
94
92
  def name
95
93
  File.basename( @path )
96
94
  end
97
-
95
+
98
96
 
99
97
  def lines
100
98
  return @lines if @lines != 0
@@ -118,7 +116,7 @@ class Testee
118
116
  end
119
117
  n
120
118
  end
121
-
119
+
122
120
 
123
121
  def lines_tested
124
122
  @lines * @coverage / 100.0
@@ -350,7 +348,7 @@ end
350
348
 
351
349
  $options.separator ""
352
350
 
353
- $options.on( "-h", "--help" ) do
351
+ $options.on( "-h", "--help" ) do
354
352
  puts $options.to_s
355
353
  exit
356
354
  end