pio 0.30.1 → 0.30.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/Rakefile +6 -4
  4. data/features/step_definitions/Gemfile +2 -0
  5. data/features/step_definitions/Guardfile +2 -0
  6. data/features/step_definitions/Rakefile +2 -0
  7. data/features/step_definitions/dump_flows_steps.rb +2 -0
  8. data/features/step_definitions/open_flow_steps.rb +2 -0
  9. data/features/step_definitions/packet_data_steps.rb +3 -1
  10. data/features/step_definitions/rest_api_steps.rb +2 -0
  11. data/features/step_definitions/ruby_steps.rb +2 -0
  12. data/features/step_definitions/show_stats_steps.rb +2 -0
  13. data/features/step_definitions/trema_steps.rb +2 -0
  14. data/features/step_definitions/virtual_link_steps.rb +2 -0
  15. data/features/support/env.rb +1 -2
  16. data/features/support/hooks.rb +2 -0
  17. data/lib/pio.rb +2 -0
  18. data/lib/pio/arp.rb +2 -0
  19. data/lib/pio/arp/format.rb +2 -0
  20. data/lib/pio/arp/message.rb +2 -0
  21. data/lib/pio/arp/reply.rb +2 -0
  22. data/lib/pio/arp/request.rb +4 -2
  23. data/lib/pio/class_inspector.rb +2 -0
  24. data/lib/pio/dhcp.rb +2 -0
  25. data/lib/pio/dhcp/ack.rb +2 -0
  26. data/lib/pio/dhcp/boot_reply.rb +2 -0
  27. data/lib/pio/dhcp/boot_reply_options.rb +2 -0
  28. data/lib/pio/dhcp/boot_request.rb +2 -0
  29. data/lib/pio/dhcp/boot_request_options.rb +2 -0
  30. data/lib/pio/dhcp/client_id.rb +2 -0
  31. data/lib/pio/dhcp/common_options.rb +2 -0
  32. data/lib/pio/dhcp/dhcp_field.rb +2 -0
  33. data/lib/pio/dhcp/dhcp_tlv_options.rb +30 -20
  34. data/lib/pio/dhcp/discover.rb +2 -0
  35. data/lib/pio/dhcp/field_util.rb +3 -1
  36. data/lib/pio/dhcp/frame.rb +2 -0
  37. data/lib/pio/dhcp/message.rb +2 -0
  38. data/lib/pio/dhcp/offer.rb +2 -0
  39. data/lib/pio/dhcp/optional_tlv.rb +3 -1
  40. data/lib/pio/dhcp/parameter_list.rb +2 -0
  41. data/lib/pio/dhcp/request.rb +2 -0
  42. data/lib/pio/ethernet_frame.rb +2 -0
  43. data/lib/pio/ethernet_header.rb +2 -0
  44. data/lib/pio/icmp.rb +2 -0
  45. data/lib/pio/icmp/format.rb +2 -0
  46. data/lib/pio/icmp/message.rb +2 -0
  47. data/lib/pio/icmp/reply.rb +2 -0
  48. data/lib/pio/icmp/request.rb +2 -0
  49. data/lib/pio/instance_inspector.rb +2 -0
  50. data/lib/pio/ipv4_address.rb +2 -0
  51. data/lib/pio/ipv4_header.rb +2 -0
  52. data/lib/pio/lldp.rb +2 -0
  53. data/lib/pio/lldp/chassis_id_tlv.rb +2 -0
  54. data/lib/pio/lldp/end_of_lldpdu_value.rb +2 -0
  55. data/lib/pio/lldp/frame.rb +2 -0
  56. data/lib/pio/lldp/management_address_value.rb +2 -0
  57. data/lib/pio/lldp/optional_tlv.rb +2 -0
  58. data/lib/pio/lldp/options.rb +4 -2
  59. data/lib/pio/lldp/organizationally_specific_value.rb +2 -0
  60. data/lib/pio/lldp/port_description_value.rb +2 -0
  61. data/lib/pio/lldp/port_id_tlv.rb +2 -0
  62. data/lib/pio/lldp/system_capabilities_value.rb +2 -0
  63. data/lib/pio/lldp/system_description_value.rb +2 -0
  64. data/lib/pio/lldp/system_name_value.rb +2 -0
  65. data/lib/pio/lldp/ttl_tlv.rb +2 -0
  66. data/lib/pio/mac.rb +2 -0
  67. data/lib/pio/message.rb +2 -0
  68. data/lib/pio/message_type_selector.rb +2 -0
  69. data/lib/pio/monkey_patch/bindata_record.rb +2 -0
  70. data/lib/pio/monkey_patch/bindata_string.rb +2 -0
  71. data/lib/pio/monkey_patch/integer.rb +2 -0
  72. data/lib/pio/monkey_patch/integer/base_conversions.rb +2 -0
  73. data/lib/pio/monkey_patch/integer/ranges.rb +2 -0
  74. data/lib/pio/monkey_patch/uint.rb +2 -0
  75. data/lib/pio/monkey_patch/uint/base_conversions.rb +2 -0
  76. data/lib/pio/open_flow.rb +2 -0
  77. data/lib/pio/open_flow/action.rb +2 -0
  78. data/lib/pio/open_flow/buffer_id.rb +2 -0
  79. data/lib/pio/open_flow/datapath_id.rb +2 -0
  80. data/lib/pio/open_flow/error_message.rb +2 -0
  81. data/lib/pio/open_flow/flags.rb +2 -0
  82. data/lib/pio/open_flow/flow_match.rb +2 -0
  83. data/lib/pio/open_flow/header.rb +2 -0
  84. data/lib/pio/open_flow/hello_failed_code.rb +2 -0
  85. data/lib/pio/open_flow/instruction.rb +2 -0
  86. data/lib/pio/open_flow/message.rb +2 -0
  87. data/lib/pio/open_flow/nicira_action.rb +2 -0
  88. data/lib/pio/open_flow/nicira_resubmit.rb +2 -0
  89. data/lib/pio/open_flow/nicira_resubmit_table.rb +2 -0
  90. data/lib/pio/open_flow/parser.rb +2 -0
  91. data/lib/pio/open_flow/port.rb +2 -0
  92. data/lib/pio/open_flow/transaction_id.rb +2 -0
  93. data/lib/pio/open_flow/version.rb +2 -0
  94. data/lib/pio/open_flow10.rb +2 -0
  95. data/lib/pio/open_flow10/actions.rb +2 -0
  96. data/lib/pio/open_flow10/aggregate_stats/reply.rb +2 -0
  97. data/lib/pio/open_flow10/aggregate_stats/request.rb +2 -0
  98. data/lib/pio/open_flow10/barrier/reply.rb +2 -0
  99. data/lib/pio/open_flow10/barrier/request.rb +2 -0
  100. data/lib/pio/open_flow10/description_stats/reply.rb +2 -0
  101. data/lib/pio/open_flow10/description_stats/request.rb +2 -0
  102. data/lib/pio/open_flow10/echo/reply.rb +2 -0
  103. data/lib/pio/open_flow10/echo/request.rb +2 -0
  104. data/lib/pio/open_flow10/enqueue.rb +2 -0
  105. data/lib/pio/open_flow10/error.rb +2 -0
  106. data/lib/pio/open_flow10/error/bad_request.rb +2 -0
  107. data/lib/pio/open_flow10/error/bad_request/bad_request_code.rb +2 -0
  108. data/lib/pio/open_flow10/error/error_type10.rb +2 -0
  109. data/lib/pio/open_flow10/error/hello_failed.rb +2 -0
  110. data/lib/pio/open_flow10/exact_match.rb +2 -0
  111. data/lib/pio/open_flow10/features.rb +2 -0
  112. data/lib/pio/open_flow10/features/reply.rb +22 -20
  113. data/lib/pio/open_flow10/features/request.rb +2 -0
  114. data/lib/pio/open_flow10/flow_mod.rb +5 -3
  115. data/lib/pio/open_flow10/flow_mod/command.rb +2 -0
  116. data/lib/pio/open_flow10/flow_removed.rb +2 -0
  117. data/lib/pio/open_flow10/flow_removed/reason.rb +2 -0
  118. data/lib/pio/open_flow10/flow_stats/reply.rb +2 -0
  119. data/lib/pio/open_flow10/flow_stats/request.rb +2 -0
  120. data/lib/pio/open_flow10/hello.rb +2 -0
  121. data/lib/pio/open_flow10/match.rb +4 -2
  122. data/lib/pio/open_flow10/match10.rb +2 -0
  123. data/lib/pio/open_flow10/packet_in.rb +2 -0
  124. data/lib/pio/open_flow10/packet_in/reason.rb +2 -0
  125. data/lib/pio/open_flow10/packet_out.rb +2 -0
  126. data/lib/pio/open_flow10/phy_port16.rb +21 -19
  127. data/lib/pio/open_flow10/port16.rb +2 -0
  128. data/lib/pio/open_flow10/port_stats/request.rb +2 -0
  129. data/lib/pio/open_flow10/port_status.rb +2 -0
  130. data/lib/pio/open_flow10/port_status/reason.rb +2 -0
  131. data/lib/pio/open_flow10/queue_stats/request.rb +2 -0
  132. data/lib/pio/open_flow10/send_out_port.rb +2 -0
  133. data/lib/pio/open_flow10/set_destination_ip_address.rb +2 -0
  134. data/lib/pio/open_flow10/set_destination_mac_address.rb +2 -0
  135. data/lib/pio/open_flow10/set_source_ip_address.rb +2 -0
  136. data/lib/pio/open_flow10/set_source_mac_address.rb +2 -0
  137. data/lib/pio/open_flow10/set_tos.rb +2 -0
  138. data/lib/pio/open_flow10/set_transport_port.rb +2 -0
  139. data/lib/pio/open_flow10/set_vlan_priority.rb +2 -0
  140. data/lib/pio/open_flow10/set_vlan_vid.rb +2 -0
  141. data/lib/pio/open_flow10/stats_reply.rb +2 -0
  142. data/lib/pio/open_flow10/stats_request.rb +2 -0
  143. data/lib/pio/open_flow10/stats_type.rb +2 -0
  144. data/lib/pio/open_flow10/strip_vlan_header.rb +2 -0
  145. data/lib/pio/open_flow10/table_stats/request.rb +2 -0
  146. data/lib/pio/open_flow10/vendor_action.rb +2 -0
  147. data/lib/pio/open_flow13.rb +2 -0
  148. data/lib/pio/open_flow13/actions.rb +2 -0
  149. data/lib/pio/open_flow13/apply.rb +2 -0
  150. data/lib/pio/open_flow13/copy_ttl_inwards.rb +2 -0
  151. data/lib/pio/open_flow13/copy_ttl_outwards.rb +2 -0
  152. data/lib/pio/open_flow13/decrement_ip_ttl.rb +2 -0
  153. data/lib/pio/open_flow13/echo/reply.rb +2 -0
  154. data/lib/pio/open_flow13/echo/request.rb +2 -0
  155. data/lib/pio/open_flow13/error.rb +2 -0
  156. data/lib/pio/open_flow13/error/bad_request.rb +2 -0
  157. data/lib/pio/open_flow13/error/error_type13.rb +2 -0
  158. data/lib/pio/open_flow13/error/hello_failed.rb +2 -0
  159. data/lib/pio/open_flow13/features/reply.rb +11 -9
  160. data/lib/pio/open_flow13/features/request.rb +2 -0
  161. data/lib/pio/open_flow13/flow_mod.rb +7 -5
  162. data/lib/pio/open_flow13/goto_table.rb +2 -0
  163. data/lib/pio/open_flow13/hello.rb +2 -0
  164. data/lib/pio/open_flow13/match.rb +17 -15
  165. data/lib/pio/open_flow13/meter.rb +2 -0
  166. data/lib/pio/open_flow13/nicira_conjunction.rb +2 -0
  167. data/lib/pio/open_flow13/nicira_reg_load.rb +2 -0
  168. data/lib/pio/open_flow13/nicira_reg_move.rb +5 -3
  169. data/lib/pio/open_flow13/nicira_send_out_port.rb +2 -0
  170. data/lib/pio/open_flow13/nicira_stack_pop.rb +2 -0
  171. data/lib/pio/open_flow13/nicira_stack_push.rb +2 -0
  172. data/lib/pio/open_flow13/packet_in.rb +2 -0
  173. data/lib/pio/open_flow13/packet_out.rb +2 -0
  174. data/lib/pio/open_flow13/port32.rb +2 -0
  175. data/lib/pio/open_flow13/send_out_port.rb +2 -0
  176. data/lib/pio/open_flow13/set_arp_operation.rb +2 -0
  177. data/lib/pio/open_flow13/set_arp_sender_hardware_address.rb +2 -0
  178. data/lib/pio/open_flow13/set_arp_sender_protocol_address.rb +2 -0
  179. data/lib/pio/open_flow13/set_destination_mac_address.rb +2 -0
  180. data/lib/pio/open_flow13/set_ip_ttl.rb +2 -0
  181. data/lib/pio/open_flow13/set_metadata.rb +2 -0
  182. data/lib/pio/open_flow13/set_source_mac_address.rb +2 -0
  183. data/lib/pio/open_flow13/stats_request.rb +9 -7
  184. data/lib/pio/open_flow13/write_metadata.rb +2 -0
  185. data/lib/pio/options.rb +2 -0
  186. data/lib/pio/parse_error.rb +2 -0
  187. data/lib/pio/parser.rb +2 -0
  188. data/lib/pio/payload.rb +2 -0
  189. data/lib/pio/pcap.rb +2 -0
  190. data/lib/pio/ruby_dumper.rb +2 -0
  191. data/lib/pio/type/ether_type.rb +2 -0
  192. data/lib/pio/type/ip_address.rb +2 -0
  193. data/lib/pio/type/ipv6_address.rb +2 -0
  194. data/lib/pio/type/mac_address.rb +2 -0
  195. data/lib/pio/udp.rb +2 -0
  196. data/lib/pio/udp_header.rb +2 -0
  197. data/lib/pio/version.rb +3 -1
  198. data/pio.gemspec +7 -5
  199. data/spec/pio/arp/reply_spec.rb +2 -0
  200. data/spec/pio/arp/request_spec.rb +2 -0
  201. data/spec/pio/arp_spec.rb +2 -0
  202. data/spec/pio/dhcp/ack_spec.rb +2 -0
  203. data/spec/pio/dhcp/discover_spec.rb +2 -0
  204. data/spec/pio/dhcp/offer_spec.rb +2 -0
  205. data/spec/pio/dhcp/request_spec.rb +2 -0
  206. data/spec/pio/dhcp_spec.rb +2 -0
  207. data/spec/pio/icmp/reply_spec.rb +2 -0
  208. data/spec/pio/icmp/request_spec.rb +2 -0
  209. data/spec/pio/icmp_spec.rb +2 -0
  210. data/spec/pio/ipv4_address_spec.rb +2 -0
  211. data/spec/pio/lldp/options_spec.rb +2 -0
  212. data/spec/pio/mac_spec.rb +2 -0
  213. data/spec/pio/monkey_patch/integer_spec.rb +2 -0
  214. data/spec/pio/open_flow/nicira_resubmit_spec.rb +2 -0
  215. data/spec/pio/open_flow/nicira_resubmit_table_spec.rb +2 -0
  216. data/spec/pio/open_flow10/echo/reply_spec.rb +2 -0
  217. data/spec/pio/open_flow10/echo/request_spec.rb +2 -0
  218. data/spec/pio/open_flow10/enqueue_spec.rb +2 -0
  219. data/spec/pio/open_flow10/error/hello_failed_spec.rb +2 -0
  220. data/spec/pio/open_flow10/features/reply_spec.rb +2 -0
  221. data/spec/pio/open_flow10/features/request_spec.rb +2 -0
  222. data/spec/pio/open_flow10/flow_mod_spec.rb +29 -27
  223. data/spec/pio/open_flow10/flow_stats_reply_spec.rb +2 -0
  224. data/spec/pio/open_flow10/flow_stats_request_spec.rb +7 -5
  225. data/spec/pio/open_flow10/hello_spec.rb +2 -0
  226. data/spec/pio/open_flow10/match_spec.rb +68 -66
  227. data/spec/pio/open_flow10/packet_in_spec.rb +2 -0
  228. data/spec/pio/open_flow10/packet_out_spec.rb +2 -0
  229. data/spec/pio/open_flow10/phy_port16_spec.rb +4 -2
  230. data/spec/pio/open_flow10/send_out_port_spec.rb +2 -0
  231. data/spec/pio/open_flow10/set_destination_ip_address_spec.rb +2 -0
  232. data/spec/pio/open_flow10/set_destination_mac_address_spec.rb +2 -0
  233. data/spec/pio/open_flow10/set_source_ip_address_spec.rb +2 -0
  234. data/spec/pio/open_flow10/set_source_mac_address_spec.rb +2 -0
  235. data/spec/pio/open_flow10/set_tos_spec.rb +2 -0
  236. data/spec/pio/open_flow10/set_transport_destination_port_spec.rb +2 -0
  237. data/spec/pio/open_flow10/set_transport_source_port_spec.rb +2 -0
  238. data/spec/pio/open_flow10/set_vlan_priority_spec.rb +2 -0
  239. data/spec/pio/open_flow10/set_vlan_vid_spec.rb +2 -0
  240. data/spec/pio/open_flow10/strip_vlan_header_spec.rb +2 -0
  241. data/spec/pio/open_flow10/wildcards_spec.rb +2 -0
  242. data/spec/pio/open_flow13/echo_reply_spec.rb +2 -0
  243. data/spec/pio/open_flow13/echo_request_spec.rb +2 -0
  244. data/spec/pio/open_flow13/error/bad_request_spec.rb +2 -0
  245. data/spec/pio/open_flow13/error/hello_failed_spec.rb +2 -0
  246. data/spec/pio/open_flow13/features/reply_spec.rb +2 -0
  247. data/spec/pio/open_flow13/features/request_spec.rb +2 -0
  248. data/spec/pio/open_flow13/goto_table_spec.rb +2 -0
  249. data/spec/pio/open_flow13/hello_spec.rb +3 -1
  250. data/spec/pio/open_flow13/match_spec.rb +2 -0
  251. data/spec/pio/open_flow13/meter_spec.rb +2 -0
  252. data/spec/pio/open_flow13/nicira_reg_load_spec.rb +2 -0
  253. data/spec/pio/open_flow13/nicira_reg_move_spec.rb +2 -0
  254. data/spec/pio/open_flow13/nicira_send_out_port_spec.rb +2 -0
  255. data/spec/pio/open_flow13/packet_in_spec.rb +2 -0
  256. data/spec/pio/open_flow13/packet_out_spec.rb +2 -0
  257. data/spec/pio/open_flow13/write_metadata_spec.rb +2 -0
  258. data/spec/pio/open_flow_spec.rb +2 -0
  259. data/spec/spec_helper.rb +1 -12
  260. data/spec/support/shared_examples_for_openflow_messages.rb +2 -0
  261. metadata +134 -135
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdea8ee5cb716f9d6dd67083baf361c3b3b706b0
4
- data.tar.gz: 76628fc9d6845d884d7c366adf51861572e8683e
3
+ metadata.gz: e707c4843ee4cc795399648cf314a7a5b7f5b901
4
+ data.tar.gz: 56d5b9d2451ca62a0fb622c2ec0ad319229bdd45
5
5
  SHA512:
6
- metadata.gz: 2c8641f225a53391fa3c7a861ea52755d55e1a2e4f335af6da27eb4cb5a727e51eb10d7ec4cd2ce640cda4078d2f33006ba7bf8c5a8261040b055564c95a4241
7
- data.tar.gz: 34af6da3d91113ea51c87725791d2d9a313988133e51d14aeb085dd8f09a7b497a713f7be09129bfa7018c8c5f89f7a5fd0e52666f9781fe1fda97b27142ad21
6
+ metadata.gz: e33f76294116b64b5202404a40d0ec39f5f38cef4453e6270cda83c129bf1e61b521c44987bca56357d6433f53e44a7202c2ec145a87b3791f19f80a39217cb9
7
+ data.tar.gz: ac8bb54c42fbde230c827e7b31394e9018d8d1ee64c825536ca679c382e9a0f11bf2eaf1b1e14ee2fe62af7749585fa2f4f4fef15a2ef5d91bc057f2fd0161c2
data/README.md CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  <a href='https://rubygems.org/gems/pio'><img src='http://img.shields.io/gem/v/pio.svg?style=flat' alt='Gem Version' /></a>
4
4
  <a href='https://travis-ci.org/trema/pio'><img src='http://img.shields.io/travis/trema/pio/develop.svg?style=flat' alt='Build Status' /></a>
5
- <a href='https://codeclimate.com/github/trema/pio'><img src='http://img.shields.io/codeclimate/github/trema/pio.svg?style=flat' alt='Code Climate' /></a>
6
- <a href='https://coveralls.io/r/trema/pio?branch=develop'><img src='http://img.shields.io/coveralls/trema/pio/develop.svg?style=flat' alt='Coverage Status' /></a>
7
5
  <a href='https://gemnasium.com/trema/pio'><img src='http://img.shields.io/gemnasium/trema/pio.svg?style=flat' alt='Dependency Status' /></a>
8
- <a href='https://gitter.im/trema/pio'><img src='https://badges.gitter.im/Join Chat.svg?style=flat' alt='Gitter Chat' /></a>
9
- <a href="http://inch-pages.github.io/github/trema/pio"><img src="http://inch-pages.github.io/github/trema/pio.svg" alt="Inline docs"></a>
10
6
 
11
7
  Pio is a ruby gem to easily parse and generate network packets.
12
8
 
data/Rakefile CHANGED
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
 
3
- RELISH_PROJECT = 'trema/pio'.freeze
5
+ RELISH_PROJECT = 'trema/pio'
4
6
  FLAY_THRESHOLD = 1446
5
7
 
6
8
  task default: :travis
7
- task test: [:spec, :cucumber]
8
- task travis: [:test, :quality, 'coveralls:push']
9
+ task test: %i[spec cucumber]
10
+ task travis: %i[test quality]
9
11
 
10
12
  desc 'Check for code quality'
11
- task quality: [:reek, :flog, :flay, :rubocop]
13
+ task quality: %i[reek flog flay rubocop]
12
14
 
13
15
  Dir.glob('tasks/*.rake').each { |each| import each }
14
16
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  group :development, :test do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard :rubocop do
2
4
  watch(/.+\.rb$/)
3
5
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  task default: :rubocop
2
4
 
3
5
  begin
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # rubocop:disable LineLength
2
4
 
3
5
  Then(/^the switch "(.*?)" has (\d+) flow entr(?:y|ies)$/) do |switch, num_entries|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Given(/^I switch the Pio::OpenFlow version to "([^"]*)"$/) do |version|
2
4
  Pio::OpenFlow.version = version
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  When(/^I parse a file named "(.*?\.raw)" with "(.*?)" class$/) do |path, klass|
2
4
  raw_data = IO.read(expand_path("%/#{path}"))
3
5
  parser_klass = Pio.const_get(klass)
@@ -31,7 +33,7 @@ end
31
33
  Then(/^the packet has the following fields and values:$/) do |table|
32
34
  table.hashes.each do |each|
33
35
  output = @result.instance_eval("self.#{each['field']}")
34
- if /^:/ =~ output.inspect
36
+ if /^:/.match?(output.inspect)
35
37
  expect(output.inspect).to eq(each['value'])
36
38
  else
37
39
  expect(output.to_s).to eq(each['value'])
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'rack/test'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  When(/^I eval the following Ruby code:$/) do |ruby_code|
2
4
  @result = Pio.module_eval(ruby_code)
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # rubocop:disable LineLength
2
4
 
3
5
  Then(/^the number of packets sent from "(.*?)" should be:$/) do |host_name, table|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Given(/^I use OpenFlow 1\.0$/) do
2
4
  @open_flow_version = :open_flow10
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # rubocop:disable LineLength
2
4
 
3
5
  Then(/^virtual links should not exist$/) do
@@ -1,5 +1,4 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ # frozen_string_literal: true
3
2
 
4
3
  require 'aruba/cucumber'
5
4
  require 'pio'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Before('@open_flow10') do
2
4
  Pio::OpenFlow.version = :OpenFlow10
3
5
  end
data/lib/pio.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/parse_error'
2
4
 
3
5
  require 'pio/arp'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/arp/format'
2
4
  require 'pio/arp/reply'
3
5
  require 'pio/arp/request'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bindata'
2
4
  require 'pio/ethernet_header'
3
5
  require 'pio/type/ip_address'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/arp/format'
2
4
  require 'pio/message'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/arp/message'
2
4
  require 'pio/instance_inspector'
3
5
  require 'pio/mac'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/arp/message'
2
4
  require 'pio/instance_inspector'
3
5
  require 'pio/mac'
@@ -10,9 +12,9 @@ module Pio
10
12
 
11
13
  option :operation, value: 1
12
14
  option :source_mac
13
- option :destination_mac, default: 'ff:ff:ff:ff:ff:ff'.freeze
15
+ option :destination_mac, default: 'ff:ff:ff:ff:ff:ff'
14
16
  option :sender_hardware_address, value: :source_mac
15
- option :target_hardware_address, default: '00:00:00:00:00:00'.freeze
17
+ option :target_hardware_address, default: '00:00:00:00:00:00'
16
18
  option :sender_protocol_address
17
19
  option :target_protocol_address
18
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support/core_ext/string/inflections'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Packet parser and generator library.
2
4
  module Pio
3
5
  # Dhcp parser and generator.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/boot_reply'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/message'
2
4
  require 'pio/dhcp/boot_reply_options'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/options'
2
4
  require 'pio/dhcp/common_options'
3
5
  require 'pio/dhcp/dhcp_tlv_options'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/message'
2
4
  require 'pio/dhcp/boot_request_options'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/options'
2
4
  require 'pio/dhcp/common_options'
3
5
  require 'pio/dhcp/dhcp_tlv_options'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/type/mac_address'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pio
2
4
  class Dhcp
3
5
  # DHCP Common Options.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/optional_tlv'
2
4
  require 'pio/type/ip_address'
3
5
  require 'pio/type/mac_address'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/common_options'
2
4
 
3
5
  module Pio
@@ -31,11 +33,13 @@ module Pio
31
33
  end
32
34
 
33
35
  def dhcp_server_identifier_hash
34
- {
35
- tlv_type: Dhcp::SERVER_IDENTIFIER_TLV,
36
- tlv_info_length: 4,
37
- tlv_value: server_identifier
38
- } if server_identifier
36
+ if server_identifier
37
+ {
38
+ tlv_type: Dhcp::SERVER_IDENTIFIER_TLV,
39
+ tlv_info_length: 4,
40
+ tlv_value: server_identifier
41
+ }
42
+ end
39
43
  end
40
44
 
41
45
  def parameters_list_hash
@@ -47,19 +51,23 @@ module Pio
47
51
  end
48
52
 
49
53
  def renewal_time_value_hash
50
- {
51
- tlv_type: Dhcp::RENEWAL_TIME_VALUE_TLV,
52
- tlv_info_length: 4,
53
- tlv_value: renewal_time_value
54
- } if renewal_time_value
54
+ if renewal_time_value
55
+ {
56
+ tlv_type: Dhcp::RENEWAL_TIME_VALUE_TLV,
57
+ tlv_info_length: 4,
58
+ tlv_value: renewal_time_value
59
+ }
60
+ end
55
61
  end
56
62
 
57
63
  def rebinding_time_value_hash
58
- {
59
- tlv_type: Dhcp::REBINDING_TIME_VALUE_TLV,
60
- tlv_info_length: 4,
61
- tlv_value: rebinding_time_value
62
- } if rebinding_time_value
64
+ if rebinding_time_value
65
+ {
66
+ tlv_type: Dhcp::REBINDING_TIME_VALUE_TLV,
67
+ tlv_info_length: 4,
68
+ tlv_value: rebinding_time_value
69
+ }
70
+ end
63
71
  end
64
72
 
65
73
  def ip_address_lease_time_hash
@@ -71,11 +79,13 @@ module Pio
71
79
  end
72
80
 
73
81
  def subnet_mask_hash
74
- {
75
- tlv_type: Dhcp::SUBNET_MASK_TLV,
76
- tlv_info_length: 4,
77
- tlv_value: subnet_mask
78
- } if subnet_mask
82
+ if subnet_mask
83
+ {
84
+ tlv_type: Dhcp::SUBNET_MASK_TLV,
85
+ tlv_info_length: 4,
86
+ tlv_value: subnet_mask
87
+ }
88
+ end
79
89
  end
80
90
  end
81
91
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/boot_request'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Pio
2
4
  class Dhcp
3
5
  # Dhcp Field Read Methods.
@@ -93,7 +95,7 @@ module Pio
93
95
 
94
96
  def get_tlv_field(tlv_type)
95
97
  tlv = get_tlv(tlv_type)
96
- tlv.snapshot if tlv
98
+ tlv&.snapshot
97
99
  end
98
100
  end
99
101
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/dhcp_field'
2
4
  require 'pio/dhcp/field_util'
3
5
  require 'pio/ipv4_header'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/frame'
2
4
  require 'forwardable'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/boot_reply'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/parameter_list'
2
4
  require 'pio/dhcp/client_id'
3
5
  require 'pio/type/ip_address'
@@ -7,7 +9,7 @@ module Pio
7
9
  class Dhcp
8
10
  # DHCP Optional TLV
9
11
  class OptionalTlv < BinData::Record
10
- DEFAULT = 'default'.freeze
12
+ DEFAULT = 'default'
11
13
 
12
14
  endian :big
13
15
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bindata'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/dhcp/boot_request'
2
4
 
3
5
  module Pio
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bindata'
2
4
  require 'pio/ethernet_header'
3
5
  require 'pio/class_inspector'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/class_inspector'
2
4
  require 'pio/instance_inspector'
3
5
  require 'pio/ruby_dumper'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/icmp/format'
2
4
  require 'pio/icmp/reply'
3
5
  require 'pio/icmp/request'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pio/ethernet_header'
2
4
  require 'pio/ipv4_header'
3
5
  require 'pio/monkey_patch/bindata_record'