pio 0.27.2 → 0.28.0

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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/Rakefile +1 -1
  4. data/bin/{code_metrics → terminal-notifier} +2 -2
  5. data/features/dhcp.feature +12 -12
  6. data/features/icmp.feature +12 -12
  7. data/features/open_flow10/aggregate_stats_request.feature +10 -10
  8. data/features/open_flow10/enqueue.feature +7 -7
  9. data/features/open_flow10/exact_match.feature +15 -15
  10. data/features/open_flow10/features_reply.feature +40 -40
  11. data/features/open_flow10/flow_mod.feature +49 -49
  12. data/features/open_flow10/flow_removed.feature +34 -0
  13. data/features/open_flow10/flow_stats_reply.feature +14 -14
  14. data/features/open_flow10/flow_stats_request.feature +15 -15
  15. data/features/open_flow10/nicira_resubmit.feature +30 -0
  16. data/features/open_flow10/nicira_resubmit_table.feature +32 -0
  17. data/features/open_flow10/port_stats_request.feature +48 -0
  18. data/features/open_flow10/port_stats_request.raw +0 -0
  19. data/features/open_flow10/queue_stats_request.feature +51 -0
  20. data/features/open_flow10/queue_stats_request.raw +0 -0
  21. data/features/open_flow10/send_out_port.feature +40 -40
  22. data/features/open_flow10/set_destination_mac_address.feature +16 -0
  23. data/features/open_flow10/set_ip_destination_address.feature +6 -6
  24. data/features/open_flow10/set_source_ip_address.feature +16 -0
  25. data/features/open_flow10/set_source_mac_address.feature +16 -0
  26. data/features/open_flow10/{set_ip_tos.feature → set_tos.feature} +3 -3
  27. data/features/open_flow10/set_transport_destination_port.feature +6 -6
  28. data/features/open_flow10/set_transport_source_port.feature +6 -6
  29. data/features/open_flow10/set_vlan_priority.feature +3 -3
  30. data/features/open_flow10/set_vlan_vid.feature +6 -6
  31. data/features/open_flow10/strip_vlan_header.feature +5 -5
  32. data/features/open_flow10/table_stats_request.feature +31 -0
  33. data/features/open_flow13/match.feature +33 -33
  34. data/features/open_flow13/send_out_port.feature +45 -45
  35. data/features/udp.feature +2 -2
  36. data/lib/pio/arp/format.rb +5 -5
  37. data/lib/pio/dhcp/boot_reply_options.rb +6 -6
  38. data/lib/pio/dhcp/boot_request_options.rb +2 -2
  39. data/lib/pio/dhcp/common_options.rb +5 -5
  40. data/lib/pio/dhcp/message.rb +2 -2
  41. data/lib/pio/icmp/options.rb +2 -2
  42. data/lib/pio/icmp/reply.rb +6 -6
  43. data/lib/pio/icmp/request.rb +6 -6
  44. data/lib/pio/ipv4_header.rb +11 -11
  45. data/lib/pio/open_flow.rb +5 -2
  46. data/lib/pio/open_flow/action.rb +41 -0
  47. data/lib/pio/open_flow/nicira_action.rb +17 -0
  48. data/lib/pio/open_flow10.rb +12 -1
  49. data/lib/pio/open_flow10/actions.rb +17 -15
  50. data/lib/pio/open_flow10/enqueue.rb +27 -46
  51. data/lib/pio/open_flow10/features/reply.rb +5 -5
  52. data/lib/pio/open_flow10/flow_removed.rb +40 -0
  53. data/lib/pio/open_flow10/match.rb +33 -33
  54. data/lib/pio/open_flow10/nicira_resubmit.rb +20 -0
  55. data/lib/pio/open_flow10/nicira_resubmit_table.rb +17 -0
  56. data/lib/pio/open_flow10/port_stats/request.rb +25 -0
  57. data/lib/pio/open_flow10/queue_stats/request.rb +22 -0
  58. data/lib/pio/open_flow10/send_out_port.rb +6 -27
  59. data/lib/pio/open_flow10/set_destination_ip_address.rb +16 -0
  60. data/lib/pio/open_flow10/set_destination_mac_address.rb +18 -0
  61. data/lib/pio/open_flow10/set_source_ip_address.rb +16 -0
  62. data/lib/pio/open_flow10/set_source_mac_address.rb +18 -0
  63. data/lib/pio/open_flow10/set_tos.rb +24 -0
  64. data/lib/pio/open_flow10/set_transport_port.rb +32 -48
  65. data/lib/pio/open_flow10/set_vlan_priority.rb +16 -11
  66. data/lib/pio/open_flow10/set_vlan_vid.rb +16 -11
  67. data/lib/pio/open_flow10/stats_request.rb +5 -1
  68. data/lib/pio/open_flow10/strip_vlan_header.rb +8 -25
  69. data/lib/pio/open_flow10/table_stats/request.rb +19 -0
  70. data/lib/pio/open_flow13/actions.rb +1 -1
  71. data/lib/pio/open_flow13/match.rb +19 -19
  72. data/lib/pio/open_flow13/send_out_port.rb +9 -28
  73. data/lib/pio/udp_header.rb +4 -4
  74. data/lib/pio/version.rb +1 -1
  75. data/pio.gemspec +3 -2
  76. data/spec/pio/dhcp/ack_spec.rb +8 -8
  77. data/spec/pio/dhcp/offer_spec.rb +8 -8
  78. data/spec/pio/dhcp_spec.rb +16 -16
  79. data/spec/pio/icmp/reply_spec.rb +4 -4
  80. data/spec/pio/icmp/request_spec.rb +6 -6
  81. data/spec/pio/icmp_spec.rb +4 -4
  82. data/spec/pio/open_flow10/enqueue_spec.rb +13 -11
  83. data/spec/pio/open_flow10/flow_mod_spec.rb +20 -20
  84. data/spec/pio/open_flow10/flow_stats_request_spec.rb +4 -4
  85. data/spec/pio/open_flow10/match_spec.rb +59 -59
  86. data/spec/pio/open_flow10/packet_out_spec.rb +31 -29
  87. data/spec/pio/open_flow10/set_destination_ip_address_spec.rb +27 -0
  88. data/spec/pio/open_flow10/set_destination_mac_address_spec.rb +28 -0
  89. data/spec/pio/open_flow10/set_source_ip_address_spec.rb +27 -0
  90. data/spec/pio/open_flow10/set_source_mac_address_spec.rb +28 -0
  91. data/spec/pio/open_flow10/set_tos_spec.rb +30 -0
  92. data/spec/pio/open_flow10/set_transport_destination_port_spec.rb +4 -4
  93. data/spec/pio/open_flow10/set_transport_source_port_spec.rb +4 -4
  94. data/spec/pio/open_flow10/set_vlan_priority_spec.rb +4 -4
  95. data/spec/pio/open_flow10/set_vlan_vid_spec.rb +4 -4
  96. data/spec/pio/open_flow10/strip_vlan_header_spec.rb +5 -5
  97. data/spec/pio/open_flow10/wildcards_spec.rb +18 -18
  98. data/spec/pio/open_flow13/match_spec.rb +20 -20
  99. metadata +73 -37
  100. data/bin/code_metrics-profile +0 -16
  101. data/features/open_flow10/set_ether_destination_address.feature +0 -16
  102. data/features/open_flow10/set_ether_source_address.feature +0 -16
  103. data/features/open_flow10/set_ip_source_address.feature +0 -16
  104. data/lib/pio/open_flow10/set_ether_address.rb +0 -53
  105. data/lib/pio/open_flow10/set_ip_address.rb +0 -49
  106. data/lib/pio/open_flow10/set_ip_tos.rb +0 -42
  107. data/lib/pio/open_flow10/set_vlan.rb +0 -37
  108. data/spec/pio/open_flow10/set_ether_destination_address_spec.rb +0 -28
  109. data/spec/pio/open_flow10/set_ether_source_address_spec.rb +0 -28
  110. data/spec/pio/open_flow10/set_ip_destination_address_spec.rb +0 -27
  111. data/spec/pio/open_flow10/set_ip_source_address_spec.rb +0 -25
  112. data/spec/pio/open_flow10/set_ip_tos_spec.rb +0 -30
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'code_metrics-profile' 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('code_metrics', 'code_metrics-profile')
@@ -1,16 +0,0 @@
1
- @open_flow10
2
- Feature: Pio::SetEtherDestinationAddress
3
-
4
- Scenario: new('11:22:33:44:55:66')
5
- When I try to create an OpenFlow action with:
6
- """
7
- Pio::SetEtherDestinationAddress.new('11:22:33:44:55:66')
8
- """
9
- Then it should finish successfully
10
- And the action has the following fields and values:
11
- | field | value |
12
- | action_type | 5 |
13
- | length | 16 |
14
- | mac_address | 11:22:33:44:55:66 |
15
-
16
-
@@ -1,16 +0,0 @@
1
- @open_flow10
2
- Feature: Pio::SetEtherSourceAddress
3
-
4
- Scenario: new('11:22:33:44:55:66')
5
- When I try to create an OpenFlow action with:
6
- """
7
- Pio::SetEtherSourceAddress.new('11:22:33:44:55:66')
8
- """
9
- Then it should finish successfully
10
- And the action has the following fields and values:
11
- | field | value |
12
- | action_type | 4 |
13
- | length | 16 |
14
- | mac_address | 11:22:33:44:55:66 |
15
-
16
-
@@ -1,16 +0,0 @@
1
- @open_flow10
2
- Feature: Pio::SetIpSourceAddress
3
-
4
- Scenario: new('192.168.0.1')
5
- When I try to create an OpenFlow action with:
6
- """
7
- Pio::SetIpSourceAddress.new('192.168.0.1')
8
- """
9
- Then it should finish successfully
10
- And the action has the following fields and values:
11
- | field | value |
12
- | action_type | 6 |
13
- | length | 8 |
14
- | ip_address | 192.168.0.1 |
15
-
16
-
@@ -1,53 +0,0 @@
1
- require 'bindata'
2
- require 'forwardable'
3
- require 'pio/type/mac_address'
4
-
5
- module Pio
6
- # An action to modify the source/destination Ethernet address of a packet.
7
- class SetEtherAddress
8
- # rubocop:disable MethodLength
9
- def self.action_type(action_type)
10
- str = %(
11
- class Format < BinData::Record
12
- endian :big
13
-
14
- uint16 :action_type, value: #{action_type}
15
- uint16 :action_length, value: 16
16
- mac_address :mac_address
17
- uint48 :padding
18
- hide :padding
19
- end
20
- )
21
- module_eval str
22
- end
23
- # rubocop:enable MethodLength
24
-
25
- def self.read(raw_data)
26
- set_ether_address = allocate
27
- set_ether_address.instance_variable_set(:@format,
28
- const_get(:Format).read(raw_data))
29
- set_ether_address
30
- end
31
-
32
- extend Forwardable
33
-
34
- def_delegators :@format, :action_type
35
- def_delegator :@format, :action_length, :length
36
- def_delegators :@format, :mac_address
37
- def_delegator :@format, :to_binary_s, :to_binary
38
-
39
- def initialize(mac_address)
40
- @format = self.class.const_get(:Format).new(mac_address: mac_address)
41
- end
42
- end
43
-
44
- # An action to modify the source Ethernet address of a packet.
45
- class SetEtherSourceAddress < SetEtherAddress
46
- action_type 4
47
- end
48
-
49
- # An action to modify the destination Ethernet address of a packet.
50
- class SetEtherDestinationAddress < SetEtherAddress
51
- action_type 5
52
- end
53
- end
@@ -1,49 +0,0 @@
1
- require 'bindata'
2
- require 'forwardable'
3
- require 'pio/type/ip_address'
4
-
5
- module Pio
6
- # An action to modify the IPv4 source/destination address of a packet.
7
- class SetIpAddress
8
- def self.def_format(action_type)
9
- str = %(
10
- class Format < BinData::Record
11
- endian :big
12
-
13
- uint16 :action_type, value: #{action_type}
14
- uint16 :action_length, value: 8
15
- ip_address :ip_address
16
- end
17
- )
18
- module_eval str
19
- end
20
-
21
- def self.read(raw_data)
22
- set_ip_address = allocate
23
- set_ip_address.instance_variable_set(:@format,
24
- const_get(:Format).read(raw_data))
25
- set_ip_address
26
- end
27
-
28
- extend Forwardable
29
-
30
- def_delegators :@format, :action_type
31
- def_delegator :@format, :action_length, :length
32
- def_delegators :@format, :ip_address
33
- def_delegator :@format, :to_binary_s, :to_binary
34
-
35
- def initialize(ip_address)
36
- @format = self.class.const_get(:Format).new(ip_address: ip_address)
37
- end
38
- end
39
-
40
- # An action to modify the IPv4 source address of a packet.
41
- class SetIpSourceAddress < SetIpAddress
42
- def_format 6
43
- end
44
-
45
- # An action to modify the IPv4 source address of a packet.
46
- class SetIpDestinationAddress < SetIpAddress
47
- def_format 7
48
- end
49
- end
@@ -1,42 +0,0 @@
1
- require 'bindata'
2
- require 'forwardable'
3
- require 'pio/monkey_patch/integer'
4
-
5
- module Pio
6
- # An action to modify the IP ToS/DSCP field of a packet.
7
- class SetIpTos
8
- # OpenFlow 1.0 OFPAT_SET_NW_TOS action format.
9
- class Format < BinData::Record
10
- endian :big
11
-
12
- uint16 :action_type, value: 8
13
- uint16 :action_length, value: 8
14
- uint8 :type_of_service
15
- uint24 :padding
16
- hide :padding
17
- end
18
-
19
- def self.read(raw_data)
20
- set_ip_tos = allocate
21
- set_ip_tos.instance_variable_set :@format, Format.read(raw_data)
22
- set_ip_tos
23
- end
24
-
25
- extend Forwardable
26
-
27
- def_delegators :@format, :action_type
28
- def_delegator :@format, :action_length, :length
29
- def_delegators :@format, :type_of_service
30
- def_delegator :@format, :to_binary_s, :to_binary
31
-
32
- def initialize(type_of_service)
33
- # ip_tos (IP ToS) value consists of 8 bits, of which only the 6
34
- # high-order bits belong to DSCP, the 2 low-order bits must be
35
- # zero.
36
- unless type_of_service.unsigned_8bit? && type_of_service % 4 == 0
37
- fail ArgumentError, 'Invalid type_of_service (ToS) value.'
38
- end
39
- @format = Format.new(type_of_service: type_of_service)
40
- end
41
- end
42
- end
@@ -1,37 +0,0 @@
1
- require 'bindata'
2
- require 'forwardable'
3
-
4
- module Pio
5
- # An action to modify the VLAN related fields of a packet.
6
- class SetVlan
7
- extend Forwardable
8
-
9
- # rubocop:disable MethodLength
10
- def self.def_format(field_name, action_type)
11
- str = %(
12
- class Format < BinData::Record
13
- endian :big
14
-
15
- uint16 :action_type, value: #{action_type}
16
- uint16 :action_length, value: 8
17
- uint16 :#{field_name}
18
- uint16 :padding
19
- hide :padding
20
- end
21
- )
22
- module_eval str
23
- module_eval "def_delegators :@format, :#{field_name}"
24
- end
25
- # rubocop:enable MethodLength
26
-
27
- def self.read(raw_data)
28
- set_vlan = allocate
29
- set_vlan.instance_variable_set :@format, const_get(:Format).read(raw_data)
30
- set_vlan
31
- end
32
-
33
- def_delegators :@format, :action_type
34
- def_delegator :@format, :action_length, :length
35
- def_delegator :@format, :to_binary_s, :to_binary
36
- end
37
- end
@@ -1,28 +0,0 @@
1
- require 'pio/open_flow10/set_ether_address'
2
-
3
- describe Pio::SetEtherDestinationAddress do
4
- describe '.new' do
5
- Given(:set_ether_destination_address) do
6
- Pio::SetEtherDestinationAddress.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_ether_destination_address.mac_address == '11:22:33:44:55:66' }
12
-
13
- describe '#to_binary' do
14
- Then { set_ether_destination_address.to_binary.length == 16 }
15
- end
16
- end
17
-
18
- context 'with 0x112233445566' do
19
- When(:mac_address) { 0x112233445566 }
20
- Then { set_ether_destination_address.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_ether_destination_address.mac_address == '11:22:33:44:55:66' }
26
- end
27
- end
28
- end
@@ -1,28 +0,0 @@
1
- require 'pio/open_flow10/set_ether_address'
2
-
3
- describe Pio::SetEtherSourceAddress do
4
- describe '.new' do
5
- Given(:set_ether_source_address) do
6
- Pio::SetEtherSourceAddress.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_ether_source_address.mac_address == '11:22:33:44:55:66' }
12
-
13
- describe '#to_binary' do
14
- Then { set_ether_source_address.to_binary.length == 16 }
15
- end
16
- end
17
-
18
- context 'with 0x112233445566' do
19
- When(:mac_address) { 0x112233445566 }
20
- Then { set_ether_source_address.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_ether_source_address.mac_address == '11:22:33:44:55:66' }
26
- end
27
- end
28
- end
@@ -1,27 +0,0 @@
1
- require 'pio/open_flow10/set_ip_address'
2
-
3
- describe Pio::SetIpDestinationAddress do
4
- describe '.new' do
5
- context "with '1.2.3.4'" do
6
- When(:set_ip_destination_addr) do
7
- Pio::SetIpDestinationAddress.new('1.2.3.4')
8
- end
9
-
10
- describe '#ip_address' do
11
- Then { set_ip_destination_addr.ip_address == '1.2.3.4' }
12
- end
13
-
14
- describe '#action_type' do
15
- Then { set_ip_destination_addr.action_type == 7 }
16
- end
17
-
18
- describe '#length' do
19
- Then { set_ip_destination_addr.length == 8 }
20
- end
21
-
22
- describe '#to_binary' do
23
- Then { set_ip_destination_addr.to_binary.length == 8 }
24
- end
25
- end
26
- end
27
- end
@@ -1,25 +0,0 @@
1
- require 'pio/open_flow10/set_ip_address'
2
-
3
- describe Pio::SetIpSourceAddress do
4
- describe '.new' do
5
- context "with '1.2.3.4'" do
6
- When(:set_ip_source_addr) { Pio::SetIpSourceAddress.new('1.2.3.4') }
7
-
8
- describe '#ip_address' do
9
- Then { set_ip_source_addr.ip_address == '1.2.3.4' }
10
- end
11
-
12
- describe '#action_type' do
13
- Then { set_ip_source_addr.action_type == 6 }
14
- end
15
-
16
- describe '#length' do
17
- Then { set_ip_source_addr.length == 8 }
18
- end
19
-
20
- describe '#to_binary' do
21
- Then { set_ip_source_addr.to_binary.length == 8 }
22
- end
23
- end
24
- end
25
- end
@@ -1,30 +0,0 @@
1
- require 'pio/open_flow10/set_ip_tos'
2
-
3
- describe Pio::SetIpTos do
4
- describe '.new' do
5
- context 'with 32' do
6
- When(:set_ip_tos) { Pio::SetIpTos.new(32) }
7
-
8
- describe '#type_of_service' do
9
- Then { set_ip_tos.type_of_service == 32 }
10
- end
11
-
12
- describe '#action_type' do
13
- Then { set_ip_tos.action_type == 8 }
14
- end
15
-
16
- describe '#length' do
17
- Then { set_ip_tos.length == 8 }
18
- end
19
-
20
- describe '#to_binary' do
21
- Then { set_ip_tos.to_binary.length == 8 }
22
- end
23
- end
24
-
25
- context 'with 1' do
26
- When(:set_ip_tos) { Pio::SetIpTos.new(1) }
27
- Then { set_ip_tos == Failure(ArgumentError) }
28
- end
29
- end
30
- end