pio 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +20 -18
  4. data/features/{packet_data/arp-storm.pcap → arp-storm.pcap} +0 -0
  5. data/features/arp.feature +1 -1
  6. data/features/{packet_data/arp.pcap → arp.pcap} +0 -0
  7. data/features/dhcp.feature +210 -3
  8. data/features/{packet_data/dhcp.pcap → dhcp.pcap} +0 -0
  9. data/features/icmp.feature +1 -1
  10. data/features/{packet_data/icmp.pcap → icmp.pcap} +0 -0
  11. data/features/{packet_data/lldp.detailed.pcap → lldp.detailed.pcap} +0 -0
  12. data/features/lldp.feature +5 -5
  13. data/features/{packet_data/lldp.minimal.pcap → lldp.minimal.pcap} +0 -0
  14. data/features/{packet_data → open_flow10}/aggregate_stats_reply.raw +0 -0
  15. data/features/{packet_data → open_flow10}/aggregate_stats_request.raw +0 -0
  16. data/features/{packet_data → open_flow10}/barrier_reply.raw +0 -0
  17. data/features/{packet_data → open_flow10}/barrier_request.raw +0 -0
  18. data/features/{packet_data → open_flow10}/desc_stats_reply.raw +0 -0
  19. data/features/{packet_data → open_flow10}/desc_stats_request.raw +0 -0
  20. data/features/open_flow10/echo_reply.feature +10 -10
  21. data/features/{packet_data → open_flow10}/echo_reply.raw +0 -0
  22. data/features/open_flow10/echo_request.feature +10 -10
  23. data/features/{packet_data → open_flow10}/echo_request.raw +0 -0
  24. data/features/{packet_data → open_flow10}/error.raw +0 -0
  25. data/features/open_flow10/exact_match.feature +33 -33
  26. data/features/open_flow10/features_reply.feature +71 -71
  27. data/features/{packet_data → open_flow10}/features_reply.raw +0 -0
  28. data/features/open_flow10/features_request.feature +9 -9
  29. data/features/{packet_data → open_flow10}/features_request.raw +0 -0
  30. data/features/open_flow10/flow_mod.feature +167 -167
  31. data/features/{packet_data → open_flow10}/flow_mod_add.raw +0 -0
  32. data/features/{packet_data → open_flow10}/flow_mod_delete.raw +0 -0
  33. data/features/{packet_data → open_flow10}/flow_mod_delete_strict.raw +0 -0
  34. data/features/{packet_data → open_flow10}/flow_mod_modify.raw +0 -0
  35. data/features/{packet_data → open_flow10}/flow_mod_modify_strict.raw +0 -0
  36. data/features/{packet_data → open_flow10}/flow_removed.raw +0 -0
  37. data/features/{packet_data → open_flow10}/flow_stats_reply.raw +0 -0
  38. data/features/{packet_data → open_flow10}/flow_stats_request.raw +0 -0
  39. data/features/{packet_data → open_flow10}/get_config_reply.raw +0 -0
  40. data/features/{packet_data → open_flow10}/get_config_request.raw +0 -0
  41. data/features/open_flow10/hello.feature +9 -9
  42. data/features/{packet_data → open_flow10}/hello.raw +0 -0
  43. data/features/open_flow10/packet_in.feature +4 -4
  44. data/features/{packet_data → open_flow10}/packet_in_arp_request.raw +0 -0
  45. data/features/{packet_data → open_flow10}/packet_in_cbench.raw +0 -0
  46. data/features/open_flow10/packet_out.feature +3 -3
  47. data/features/{packet_data → open_flow10}/packet_out.raw +0 -0
  48. data/features/{packet_data → open_flow10}/port_mod.raw +0 -0
  49. data/features/{packet_data → open_flow10}/port_stats_reply.raw +0 -0
  50. data/features/{packet_data → open_flow10}/port_stats_request.raw +0 -0
  51. data/features/open_flow10/port_status.feature +3 -3
  52. data/features/{packet_data → open_flow10}/port_status.raw +0 -0
  53. data/features/{packet_data → open_flow10}/queue_get_config_reply.raw +0 -0
  54. data/features/{packet_data → open_flow10}/queue_get_config_request.raw +0 -0
  55. data/features/{packet_data → open_flow10}/set_config.raw +0 -0
  56. data/features/{packet_data → open_flow10}/table_stats_reply.raw +0 -0
  57. data/features/{packet_data → open_flow10}/table_stats_request.raw +0 -0
  58. data/features/{packet_data → open_flow10}/vendor.raw +0 -0
  59. data/features/{packet_data → open_flow10}/vendor_stats_request.raw +0 -0
  60. data/features/open_flow13/echo_reply.feature +64 -61
  61. data/features/{packet_data/echo13_reply_body.raw → open_flow13/echo_reply_body.raw} +0 -0
  62. data/features/{packet_data/echo13_reply_no_body.raw → open_flow13/echo_reply_no_body.raw} +0 -0
  63. data/features/open_flow13/echo_request.feature +64 -61
  64. data/features/{packet_data/echo13_request_body.raw → open_flow13/echo_request_body.raw} +0 -0
  65. data/features/{packet_data/echo13_request_no_body.raw → open_flow13/echo_request_no_body.raw} +0 -0
  66. data/features/open_flow13/features_reply.feature +53 -0
  67. data/features/open_flow13/features_reply.raw +0 -0
  68. data/features/open_flow13/features_request.feature +89 -0
  69. data/features/open_flow13/features_request.raw +0 -0
  70. data/features/open_flow13/hello.feature +26 -23
  71. data/features/{packet_data/hello13_no_version_bitmap.raw → open_flow13/hello_no_version_bitmap.raw} +0 -0
  72. data/features/{packet_data/hello13_version_bitmap.raw → open_flow13/hello_version_bitmap.raw} +0 -0
  73. data/features/step_definitions/open_flow_steps.rb +3 -0
  74. data/features/step_definitions/packet_data_steps.rb +9 -9
  75. data/features/udp.feature +3 -3
  76. data/features/{packet_data/udp_no_payload.raw → udp_no_payload.raw} +0 -0
  77. data/features/{packet_data/udp_with_payload.raw → udp_with_payload.raw} +0 -0
  78. data/lib/pio.rb +1 -9
  79. data/lib/pio/open_flow/actions.rb +8 -8
  80. data/lib/pio/open_flow/open_flow_header.rb +10 -0
  81. data/lib/pio/open_flow10.rb +15 -0
  82. data/lib/pio/open_flow10/echo.rb +15 -0
  83. data/lib/pio/open_flow10/exact_match.rb +51 -0
  84. data/lib/pio/{features.rb → open_flow10/features.rb} +8 -7
  85. data/lib/pio/{flow_mod.rb → open_flow10/flow_mod.rb} +1 -1
  86. data/lib/pio/{hello.rb → open_flow10/hello.rb} +0 -0
  87. data/lib/pio/{match.rb → open_flow10/match.rb} +46 -43
  88. data/lib/pio/{packet_in.rb → open_flow10/packet_in.rb} +0 -0
  89. data/lib/pio/{packet_out.rb → open_flow10/packet_out.rb} +0 -0
  90. data/lib/pio/{port_status.rb → open_flow10/port_status.rb} +0 -0
  91. data/lib/pio/open_flow13.rb +12 -0
  92. data/lib/pio/{echo.rb → open_flow13/echo.rb} +9 -13
  93. data/lib/pio/open_flow13/features_reply.rb +91 -0
  94. data/lib/pio/open_flow13/features_request.rb +54 -0
  95. data/lib/pio/{hello13.rb → open_flow13/hello.rb} +4 -1
  96. data/lib/pio/{set_eth_addr.rb → set_ether_address.rb} +7 -7
  97. data/lib/pio/{set_ip_addr.rb → set_ip_address.rb} +7 -7
  98. data/lib/pio/set_ip_tos.rb +1 -1
  99. data/lib/pio/set_transport_port.rb +2 -2
  100. data/lib/pio/version.rb +1 -1
  101. data/pio.gemspec +2 -2
  102. data/spec/pio/flow_mod_spec.rb +45 -45
  103. data/spec/pio/match_spec.rb +122 -120
  104. data/spec/pio/{hello13_spec.rb → open_flow13/hello_spec.rb} +11 -11
  105. data/spec/pio/packet_out_spec.rb +19 -19
  106. data/spec/pio/set_ether_destination_address_spec.rb +28 -0
  107. data/spec/pio/set_ether_source_address_spec.rb +28 -0
  108. data/spec/pio/set_ip_destination_address_spec.rb +27 -0
  109. data/spec/pio/set_ip_source_address_spec.rb +25 -0
  110. data/spec/pio/set_transport_destination_port_spec.rb +44 -0
  111. data/spec/pio/set_transport_source_port_spec.rb +44 -0
  112. data/spec/pio/wildcards_spec.rb +23 -21
  113. metadata +179 -165
  114. data/bin/byebug +0 -16
  115. data/lib/pio/exact_match.rb +0 -51
  116. data/spec/pio/set_eth_dst_addr_spec.rb +0 -28
  117. data/spec/pio/set_eth_src_addr_spec.rb +0 -28
  118. data/spec/pio/set_ip_dst_addr_spec.rb +0 -25
  119. data/spec/pio/set_ip_src_addr_spec.rb +0 -25
  120. data/spec/pio/set_transport_dst_port_spec.rb +0 -42
  121. data/spec/pio/set_transport_src_port_spec.rb +0 -42
data/bin/byebug DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'byebug' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('byebug', 'byebug')
@@ -1,51 +0,0 @@
1
- require 'pio/match'
2
-
3
- module Pio
4
- # OpenFlow 1.0 exact match
5
- class ExactMatch
6
- # rubocop:disable MethodLength
7
- # rubocop:disable AbcSize
8
- def initialize(packet_in)
9
- data = packet_in.data
10
- case data
11
- when PacketIn::DataParser::IPv4Packet
12
- options = {
13
- in_port: packet_in.in_port,
14
- dl_src: packet_in.source_mac,
15
- dl_dst: packet_in.destination_mac,
16
- dl_vlan: data.vlan_vid,
17
- dl_vlan_pcp: data.vlan_pcp,
18
- dl_type: data.ether_type,
19
- nw_tos: data.ip_type_of_service,
20
- nw_proto: data.ip_protocol,
21
- nw_src: data.ip_source_address,
22
- nw_dst: data.ip_destination_address,
23
- tp_src: data.transport_source_port,
24
- tp_dst: data.transport_destination_port
25
- }
26
- when Arp::Request
27
- options = {
28
- in_port: packet_in.in_port,
29
- dl_src: packet_in.source_mac,
30
- dl_dst: packet_in.destination_mac,
31
- dl_vlan: data.vlan_vid,
32
- dl_vlan_pcp: data.vlan_pcp,
33
- dl_type: data.ether_type,
34
- nw_tos: 0,
35
- nw_proto: data.operation,
36
- nw_src: data.sender_protocol_address,
37
- nw_dst: data.target_protocol_address,
38
- tp_src: 0,
39
- tp_dst: 0
40
- }
41
- end
42
- @match = Pio::Match.new(options)
43
- end
44
- # rubocop:enable MethodLength
45
- # rubocop:enable AbcSize
46
-
47
- def method_missing(method, *args, &block)
48
- @match.__send__ method, *args, &block
49
- end
50
- end
51
- end
@@ -1,28 +0,0 @@
1
- require 'pio/set_eth_addr'
2
-
3
- describe Pio::SetEthDstAddr do
4
- describe '.new' do
5
- Given(:set_eth_dst_addr) do
6
- Pio::SetEthDstAddr.new(mac_address)
7
- end
8
-
9
- context "with '11:22:33:44:55:66'" do
10
- When(:mac_address) { '11:22:33:44:55:66' }
11
- Then { set_eth_dst_addr.mac_address == '11:22:33:44:55:66' }
12
-
13
- describe '#to_binary' do
14
- Then { set_eth_dst_addr.to_binary.length == 16 }
15
- end
16
- end
17
-
18
- context 'with 0x112233445566' do
19
- When(:mac_address) { 0x112233445566 }
20
- Then { set_eth_dst_addr.mac_address == '11:22:33:44:55:66' }
21
- end
22
-
23
- context "with Pio::Mac.new('11:22:33:44:55:66')" do
24
- When(:mac_address) { Pio::Mac.new('11:22:33:44:55:66') }
25
- Then { set_eth_dst_addr.mac_address == '11:22:33:44:55:66' }
26
- end
27
- end
28
- end
@@ -1,28 +0,0 @@
1
- require 'pio/set_eth_addr'
2
-
3
- describe Pio::SetEthSrcAddr do
4
- describe '.new' do
5
- Given(:set_eth_src_addr) do
6
- Pio::SetEthSrcAddr.new(mac_address)
7
- end
8
-
9
- context "with '11:22:33:44:55:66'" do
10
- When(:mac_address) { '11:22:33:44:55:66' }
11
- Then { set_eth_src_addr.mac_address == '11:22:33:44:55:66' }
12
-
13
- describe '#to_binary' do
14
- Then { set_eth_src_addr.to_binary.length == 16 }
15
- end
16
- end
17
-
18
- context 'with 0x112233445566' do
19
- When(:mac_address) { 0x112233445566 }
20
- Then { set_eth_src_addr.mac_address == '11:22:33:44:55:66' }
21
- end
22
-
23
- context "with Pio::Mac.new('11:22:33:44:55:66')" do
24
- When(:mac_address) { Pio::Mac.new('11:22:33:44:55:66') }
25
- Then { set_eth_src_addr.mac_address == '11:22:33:44:55:66' }
26
- end
27
- end
28
- end
@@ -1,25 +0,0 @@
1
- require 'pio/set_ip_addr'
2
-
3
- describe Pio::SetIpDstAddr do
4
- describe '.new' do
5
- context "with '1.2.3.4'" do
6
- When(:set_ip_dst_addr) { Pio::SetIpDstAddr.new('1.2.3.4') }
7
-
8
- describe '#ip_address' do
9
- Then { set_ip_dst_addr.ip_address == '1.2.3.4' }
10
- end
11
-
12
- describe '#type' do
13
- Then { set_ip_dst_addr.type == 7 }
14
- end
15
-
16
- describe '#message_length' do
17
- Then { set_ip_dst_addr.message_length == 8 }
18
- end
19
-
20
- describe '#to_binary' do
21
- Then { set_ip_dst_addr.to_binary.length == 8 }
22
- end
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- require 'pio/set_ip_addr'
2
-
3
- describe Pio::SetIpSrcAddr do
4
- describe '.new' do
5
- context "with '1.2.3.4'" do
6
- When(:set_ip_src_addr) { Pio::SetIpSrcAddr.new('1.2.3.4') }
7
-
8
- describe '#ip_address' do
9
- Then { set_ip_src_addr.ip_address == '1.2.3.4' }
10
- end
11
-
12
- describe '#type' do
13
- Then { set_ip_src_addr.type == 6 }
14
- end
15
-
16
- describe '#message_length' do
17
- Then { set_ip_src_addr.message_length == 8 }
18
- end
19
-
20
- describe '#to_binary' do
21
- Then { set_ip_src_addr.to_binary.length == 8 }
22
- end
23
- end
24
- end
25
- end
@@ -1,42 +0,0 @@
1
- require 'pio/set_transport_port'
2
-
3
- describe Pio::SetTransportDstPort do
4
- describe '.new' do
5
- When(:set_transport_dst_port) { Pio::SetTransportDstPort.new(port_number) }
6
-
7
- context 'with 100' do
8
- When(:port_number) { 100 }
9
-
10
- describe '#port_number' do
11
- Then { set_transport_dst_port.port_number == 100 }
12
- end
13
-
14
- describe '#type' do
15
- Then { set_transport_dst_port.type == 10 }
16
- end
17
-
18
- describe '#message_length' do
19
- Then { set_transport_dst_port.message_length == 8 }
20
- end
21
-
22
- describe '#to_binary' do
23
- Then { set_transport_dst_port.to_binary.length == 8 }
24
- end
25
- end
26
-
27
- context 'with -1' do
28
- When(:port_number) { -1 }
29
- Then { set_transport_dst_port == Failure(ArgumentError) }
30
- end
31
-
32
- context 'with 2**16' do
33
- When(:port_number) { 2**16 }
34
- Then { set_transport_dst_port == Failure(ArgumentError) }
35
- end
36
-
37
- context 'with :INVALID_PORT_NUMBER' do
38
- When(:port_number) { :INVALID_PORT_NUMBER }
39
- Then { set_transport_dst_port == Failure(TypeError) }
40
- end
41
- end
42
- end
@@ -1,42 +0,0 @@
1
- require 'pio/set_transport_port'
2
-
3
- describe Pio::SetTransportSrcPort do
4
- describe '.new' do
5
- When(:set_transport_src_port) { Pio::SetTransportSrcPort.new(port_number) }
6
-
7
- context 'with 100' do
8
- When(:port_number) { 100 }
9
-
10
- describe '#port_number' do
11
- Then { set_transport_src_port.port_number == 100 }
12
- end
13
-
14
- describe '#type' do
15
- Then { set_transport_src_port.type == 9 }
16
- end
17
-
18
- describe '#message_length' do
19
- Then { set_transport_src_port.message_length == 8 }
20
- end
21
-
22
- describe '#to_binary' do
23
- Then { set_transport_src_port.to_binary.length == 8 }
24
- end
25
- end
26
-
27
- context 'with -1' do
28
- When(:port_number) { -1 }
29
- Then { set_transport_src_port == Failure(ArgumentError) }
30
- end
31
-
32
- context 'with 2**16' do
33
- When(:port_number) { 2**16 }
34
- Then { set_transport_src_port == Failure(ArgumentError) }
35
- end
36
-
37
- context 'with :INVALID_PORT_NUMBER' do
38
- When(:port_number) { :INVALID_PORT_NUMBER }
39
- Then { set_transport_src_port == Failure(TypeError) }
40
- end
41
- end
42
- end