pio 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +4 -0
  4. data/Rakefile +1 -1
  5. data/bin/terminal-notifier +16 -0
  6. data/features/open_flow10/bad_request.feature +35 -0
  7. data/features/open_flow10/bad_request.raw +0 -0
  8. data/features/open_flow10/barrier_reply.feature +4 -4
  9. data/features/open_flow10/barrier_request.feature +4 -4
  10. data/features/open_flow10/echo_reply.feature +13 -13
  11. data/features/open_flow10/echo_request.feature +6 -6
  12. data/features/open_flow10/enqueue.feature +17 -0
  13. data/features/open_flow10/features_reply.feature +2 -2
  14. data/features/open_flow10/features_request.feature +28 -28
  15. data/features/open_flow10/flow_mod.feature +5 -5
  16. data/features/open_flow10/flow_stats_reply.feature +12 -12
  17. data/features/open_flow10/flow_stats_request.feature +3 -3
  18. data/features/open_flow10/hello.feature +8 -15
  19. data/features/open_flow10/hello_failed.feature +69 -0
  20. data/features/open_flow10/hello_failed.raw +0 -0
  21. data/features/open_flow10/nxast_learn.raw +0 -0
  22. data/features/open_flow10/packet_in.feature +2 -2
  23. data/features/open_flow10/packet_out.feature +13 -13
  24. data/features/open_flow10/port_status.feature +1 -1
  25. data/features/open_flow10/send_out_port.feature +106 -0
  26. data/features/open_flow10/set_ether_destination_address.feature +16 -0
  27. data/features/open_flow10/set_ether_source_address.feature +16 -0
  28. data/features/open_flow10/set_ip_destination_address.feature +16 -0
  29. data/features/open_flow10/set_ip_source_address.feature +16 -0
  30. data/features/open_flow10/set_ip_tos.feature +16 -0
  31. data/features/open_flow10/set_transport_destination_port.feature +16 -0
  32. data/features/open_flow10/set_transport_source_port.feature +16 -0
  33. data/features/open_flow10/set_vlan_priority.feature +16 -0
  34. data/features/open_flow10/set_vlan_vid.feature +16 -0
  35. data/features/open_flow10/strip_vlan_header.feature +15 -0
  36. data/features/open_flow10/vendor_action.feature +14 -0
  37. data/features/open_flow13/bad_request.feature +35 -0
  38. data/features/open_flow13/bad_request.raw +0 -0
  39. data/features/open_flow13/echo_reply.feature +7 -7
  40. data/features/open_flow13/echo_request.feature +7 -7
  41. data/features/open_flow13/features_reply.feature +2 -2
  42. data/features/open_flow13/features_request.feature +28 -28
  43. data/features/open_flow13/flow_mod.feature +24 -24
  44. data/features/open_flow13/hello.feature +5 -5
  45. data/features/open_flow13/hello_failed.feature +69 -0
  46. data/features/open_flow13/hello_failed.raw +0 -0
  47. data/features/open_flow13/packet_in.feature +3 -3
  48. data/features/open_flow13/packet_out.feature +3 -3
  49. data/features/open_flow13/send_out_port.feature +101 -10
  50. data/features/open_flow13/table_stats_reply.raw +0 -0
  51. data/features/open_flow13/table_stats_request.raw +0 -0
  52. data/features/open_flow_read.feature +6 -0
  53. data/features/step_definitions/Gemfile +9 -0
  54. data/features/step_definitions/Gemfile.lock +76 -0
  55. data/features/step_definitions/Guardfile +4 -0
  56. data/features/step_definitions/LICENSE +675 -0
  57. data/features/step_definitions/README.md +7 -0
  58. data/features/step_definitions/Rakefile +10 -0
  59. data/features/step_definitions/dump_flows_steps.rb +13 -0
  60. data/features/step_definitions/packet_data_steps.rb +4 -0
  61. data/features/step_definitions/rest_api_steps.rb +40 -0
  62. data/features/step_definitions/show_stats_steps.rb +83 -0
  63. data/features/step_definitions/trema_steps.rb +33 -0
  64. data/features/step_definitions/virtual_link_steps.rb +8 -0
  65. data/lib/pio/open_flow.rb +5 -5
  66. data/lib/pio/open_flow/echo.rb +1 -1
  67. data/lib/pio/open_flow/error.rb +19 -0
  68. data/lib/pio/open_flow/format.rb +2 -1
  69. data/lib/pio/open_flow/hello_failed_code.rb +21 -0
  70. data/lib/pio/open_flow/open_flow_header.rb +11 -2
  71. data/lib/pio/open_flow/port.rb +69 -0
  72. data/lib/pio/open_flow10.rb +5 -0
  73. data/lib/pio/open_flow10/actions.rb +8 -6
  74. data/lib/pio/open_flow10/enqueue.rb +13 -13
  75. data/lib/pio/open_flow10/error.rb +28 -0
  76. data/lib/pio/open_flow10/error/bad_request.rb +66 -0
  77. data/lib/pio/open_flow10/error/error_type10.rb +26 -0
  78. data/lib/pio/open_flow10/error/hello_failed.rb +41 -0
  79. data/lib/pio/open_flow10/features.rb +6 -10
  80. data/lib/pio/open_flow10/flow_mod.rb +1 -1
  81. data/lib/pio/open_flow10/flow_stats_request.rb +1 -1
  82. data/lib/pio/open_flow10/hello.rb +2 -2
  83. data/lib/pio/open_flow10/match.rb +2 -2
  84. data/lib/pio/{open_flow/phy_port.rb → open_flow10/phy_port16.rb} +4 -4
  85. data/lib/pio/open_flow10/port16.rb +21 -0
  86. data/lib/pio/open_flow10/port_status.rb +1 -1
  87. data/lib/pio/open_flow10/send_out_port.rb +16 -40
  88. data/lib/pio/open_flow10/set_ether_address.rb +9 -8
  89. data/lib/pio/open_flow10/set_ip_address.rb +4 -4
  90. data/lib/pio/open_flow10/set_ip_tos.rb +4 -4
  91. data/lib/pio/open_flow10/set_transport_port.rb +12 -12
  92. data/lib/pio/open_flow10/set_vlan.rb +4 -4
  93. data/lib/pio/open_flow10/set_vlan_vid.rb +0 -12
  94. data/lib/pio/open_flow10/strip_vlan_header.rb +7 -7
  95. data/lib/pio/open_flow10/vendor_action.rb +33 -0
  96. data/lib/pio/open_flow13.rb +3 -0
  97. data/lib/pio/open_flow13/actions.rb +3 -3
  98. data/lib/pio/open_flow13/error.rb +28 -0
  99. data/lib/pio/open_flow13/error/bad_request.rb +66 -0
  100. data/lib/pio/open_flow13/error/error_type13.rb +37 -0
  101. data/lib/pio/open_flow13/error/hello_failed.rb +42 -0
  102. data/lib/pio/open_flow13/features_reply.rb +33 -33
  103. data/lib/pio/open_flow13/features_request.rb +3 -3
  104. data/lib/pio/open_flow13/flow_mod.rb +2 -2
  105. data/lib/pio/open_flow13/goto_table.rb +2 -0
  106. data/lib/pio/open_flow13/packet_out.rb +1 -1
  107. data/lib/pio/open_flow13/port32.rb +21 -0
  108. data/lib/pio/open_flow13/send_out_port.rb +3 -2
  109. data/lib/pio/version.rb +1 -1
  110. data/pio.gemspec +5 -5
  111. data/spec/pio/open_flow10/enqueue_spec.rb +22 -22
  112. data/spec/pio/open_flow10/error/hello_failed_spec.rb +26 -0
  113. data/spec/pio/open_flow10/flow_mod_spec.rb +6 -6
  114. data/spec/pio/open_flow10/flow_stats_request_spec.rb +1 -1
  115. data/spec/pio/open_flow10/hello_spec.rb +3 -3
  116. data/spec/pio/open_flow10/packet_out_spec.rb +33 -33
  117. data/spec/pio/{open_flow/phy_port_spec.rb → open_flow10/phy_port16_spec.rb} +7 -7
  118. data/spec/pio/open_flow10/send_out_port_spec.rb +28 -28
  119. data/spec/pio/open_flow10/set_ether_destination_address_spec.rb +2 -2
  120. data/spec/pio/open_flow10/set_ether_source_address_spec.rb +2 -2
  121. data/spec/pio/open_flow10/set_ip_destination_address_spec.rb +4 -4
  122. data/spec/pio/open_flow10/set_ip_source_address_spec.rb +4 -4
  123. data/spec/pio/open_flow10/set_ip_tos_spec.rb +4 -4
  124. data/spec/pio/open_flow10/set_transport_destination_port_spec.rb +11 -11
  125. data/spec/pio/open_flow10/set_transport_source_port_spec.rb +11 -11
  126. data/spec/pio/open_flow10/set_vlan_priority_spec.rb +4 -4
  127. data/spec/pio/open_flow10/set_vlan_vid_spec.rb +4 -4
  128. data/spec/pio/open_flow10/strip_vlan_header_spec.rb +6 -6
  129. data/spec/pio/open_flow13/error/bad_request_spec.rb +6 -0
  130. data/spec/pio/open_flow13/error/hello_failed_spec.rb +26 -0
  131. data/spec/pio/open_flow13/hello_spec.rb +3 -3
  132. data/spec/support/shared_examples_for_openflow_messages.rb +40 -27
  133. metadata +106 -16
  134. data/lib/pio/open_flow/port_number.rb +0 -39
@@ -4,43 +4,43 @@ require 'pio/open_flow'
4
4
  module Pio
5
5
  # OpenFlow 1.3 messages
6
6
  module OpenFlow13
7
- # OpenFlow 1.3 Features Request and Reply message.
7
+ # Features Request and Reply message.
8
8
  class Features
9
- # OpenFlow 1.3 Features Reply message.
9
+ # Features Reply message.
10
10
  class Reply < OpenFlow::Message
11
- # OpenFlow 1.3 Features Reply message body.
12
- class Body < BinData::Record
13
- extend OpenFlow::Flags
14
-
15
- flags_32bit(:capabilities,
16
- [:flow_stats,
17
- :table_stats,
18
- :port_stats,
19
- :group_stats,
20
- :NOT_USED,
21
- :ip_reasm,
22
- :queue_stats,
23
- :NOT_USED,
24
- :port_blocked])
25
-
26
- endian :big
27
-
28
- datapath_id :datapath_id
29
- uint32 :n_buffers
30
- uint8 :n_tables
31
- uint8 :auxiliary_id
32
- uint16 :padding
33
- hide :padding
34
- capabilities :capabilities
35
- uint32 :reserved
36
-
37
- def length
38
- 24
11
+ # Features Reply message format.
12
+ class Format < BinData::Record
13
+ # Features Reply message body.
14
+ class Body < BinData::Record
15
+ extend OpenFlow::Flags
16
+
17
+ flags_32bit(:capabilities,
18
+ [:flow_stats,
19
+ :table_stats,
20
+ :port_stats,
21
+ :group_stats,
22
+ :NOT_USED,
23
+ :ip_reasm,
24
+ :queue_stats,
25
+ :NOT_USED,
26
+ :port_blocked])
27
+
28
+ endian :big
29
+
30
+ datapath_id :datapath_id
31
+ uint32 :n_buffers
32
+ uint8 :n_tables
33
+ uint8 :auxiliary_id
34
+ uint16 :padding
35
+ hide :padding
36
+ capabilities :capabilities
37
+ uint32 :reserved
38
+
39
+ def length
40
+ 24
41
+ end
39
42
  end
40
- end
41
43
 
42
- # OpenFlow 1.3 Features Reply message format.
43
- class Format < BinData::Record
44
44
  extend OpenFlow::Format
45
45
 
46
46
  header version: 4, message_type: 6
@@ -4,11 +4,11 @@ require 'pio/open_flow'
4
4
  module Pio
5
5
  # OpenFlow 1.3 messages
6
6
  module OpenFlow13
7
- # OpenFlow 1.3 Features Request and Reply message.
7
+ # Features Request and Reply message.
8
8
  class Features
9
- # OpenFlow 1.3 Features Request message.
9
+ # Features Request message.
10
10
  class Request < OpenFlow::Message
11
- # OpenFlow 1.3 Features Request message format.
11
+ # Features Request message format.
12
12
  class Format < BinData::Record
13
13
  extend OpenFlow::Format
14
14
 
@@ -69,8 +69,8 @@ module Pio
69
69
  count_bytes_remaining :instructions_length
70
70
  string :instructions, read_length: :instructions_length
71
71
 
72
- def set(object)
73
- self.instructions = [object].flatten.map(&:to_binary_s).join
72
+ def set(instructions)
73
+ self.instructions = Array(instructions).map(&:to_binary_s).join
74
74
  end
75
75
 
76
76
  # rubocop:disable MethodLength
@@ -1,3 +1,4 @@
1
+ require 'bindata'
1
2
  require 'forwardable'
2
3
 
3
4
  # Base module.
@@ -12,6 +13,7 @@ module Pio
12
13
  uint16 :instruction_length, value: 8
13
14
  uint8 :table_id
14
15
  bit24 :padding
16
+ hide :padding
15
17
  end
16
18
 
17
19
  def self.read(raw_data)
@@ -33,7 +33,7 @@ module Pio
33
33
  string :padding, length: 6
34
34
  actions :actions, length: :actions_length
35
35
  string :raw_data,
36
- read_length: -> { message_length - 24 - actions_length }
36
+ read_length: -> { _length - 24 - actions_length }
37
37
 
38
38
  def length
39
39
  10 + padding.length + actions_length + raw_data.length
@@ -0,0 +1,21 @@
1
+ require 'pio/open_flow/port'
2
+
3
+ module Pio
4
+ module OpenFlow13
5
+ # Port numbering (32bit).
6
+ class Port32 < OpenFlow::Port
7
+ port_size_in_bytes 32
8
+
9
+ max_port_number 0xffffffff00
10
+
11
+ reserved_ports(in_port: 0xfffffff8,
12
+ table: 0xfffffff9,
13
+ normal: 0xfffffffa,
14
+ flood: 0xfffffffb,
15
+ all: 0xfffffffc,
16
+ controller: 0xfffffffd,
17
+ local: 0xfffffffe,
18
+ any: 0xffffffff)
19
+ end
20
+ end
21
+ end
@@ -1,4 +1,5 @@
1
1
  require 'forwardable'
2
+ require 'pio/open_flow13/port32'
2
3
 
3
4
  # Base module.
4
5
  module Pio
@@ -13,7 +14,7 @@ module Pio
13
14
 
14
15
  uint16 :action_type, value: 0
15
16
  uint16 :action_length, value: 16
16
- uint32 :port
17
+ port32 :port
17
18
  uint16 :max_length, initial_value: NO_BUFFER
18
19
  uint48 :padding
19
20
  end
@@ -27,7 +28,7 @@ module Pio
27
28
  extend Forwardable
28
29
 
29
30
  def_delegators :@format, :action_type
30
- def_delegators :@format, :action_length
31
+ def_delegator :@format, :action_length, :length
31
32
  def_delegators :@format, :port
32
33
  def_delegator :@format, :to_binary_s, :to_binary
33
34
 
@@ -1,5 +1,5 @@
1
1
  # Base module.
2
2
  module Pio
3
3
  # gem version.
4
- VERSION = '0.25.0'.freeze
4
+ VERSION = '0.26.0'.freeze
5
5
  end
@@ -41,23 +41,23 @@ Gem::Specification.new do |gem|
41
41
  gem.add_development_dependency 'guard-rspec', '~> 4.6.4'
42
42
  gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'
43
43
  gem.add_development_dependency 'rb-fchange', '~> 0.0.6'
44
- gem.add_development_dependency 'rb-fsevent', '~> 0.9.5'
44
+ gem.add_development_dependency 'rb-fsevent', '~> 0.9.6'
45
45
  gem.add_development_dependency 'rb-inotify', '~> 0.9.5'
46
46
  gem.add_development_dependency 'terminal-notifier-guard', '~> 1.6.4'
47
47
 
48
48
  # Docs
49
- gem.add_development_dependency 'inch', '~> 0.6.3'
49
+ gem.add_development_dependency 'inch', '~> 0.6.4'
50
50
  gem.add_development_dependency 'relish', '~> 0.7.1'
51
51
  gem.add_development_dependency 'yard', '~> 0.8.7.6'
52
52
 
53
53
  # Test
54
- gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.7'
54
+ gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.8'
55
55
  gem.add_development_dependency 'coveralls', '~> 0.8.2'
56
56
  gem.add_development_dependency 'cucumber', '~> 2.0.2'
57
57
  gem.add_development_dependency 'flay', '~> 2.6.1'
58
58
  gem.add_development_dependency 'flog', '~> 4.3.2'
59
- gem.add_development_dependency 'reek', '~> 3.1'
59
+ gem.add_development_dependency 'reek', '~> 3.3.1'
60
60
  gem.add_development_dependency 'rspec', '~> 3.3.0'
61
61
  gem.add_development_dependency 'rspec-given', '~> 3.7.1'
62
- gem.add_development_dependency 'rubocop', '~> 0.33.0'
62
+ gem.add_development_dependency 'rubocop', '~> 0.34.0'
63
63
  end
@@ -2,23 +2,23 @@ require 'pio/open_flow10/enqueue'
2
2
 
3
3
  describe Pio::Enqueue do
4
4
  describe '.new' do
5
- context 'with port_number: 1, queue_id: 2' do
6
- When(:enqueue) { Pio::Enqueue.new(port_number: 1, queue_id: 2) }
5
+ context 'with port: 1, queue_id: 2' do
6
+ When(:enqueue) { Pio::Enqueue.new(port: 1, queue_id: 2) }
7
7
 
8
- describe '#port_number' do
9
- Then { enqueue.port_number == 1 }
8
+ describe '#port' do
9
+ Then { enqueue.port == 1 }
10
10
  end
11
11
 
12
12
  describe '#queue_id' do
13
13
  Then { enqueue.queue_id == 2 }
14
14
  end
15
15
 
16
- describe '#type' do
17
- Then { enqueue.type == 11 }
16
+ describe '#action_type' do
17
+ Then { enqueue.action_type == 11 }
18
18
  end
19
19
 
20
- describe '#message_length' do
21
- Then { enqueue.message_length == 16 }
20
+ describe '#length' do
21
+ Then { enqueue.length == 16 }
22
22
  end
23
23
 
24
24
  describe '#to_binary' do
@@ -26,36 +26,36 @@ describe Pio::Enqueue do
26
26
  end
27
27
  end
28
28
 
29
- context 'with port_number: :in_port, queue_id: 2' do
30
- When(:enqueue) { Pio::Enqueue.new(port_number: :in_port, queue_id: 2) }
29
+ context 'with port: :in_port, queue_id: 2' do
30
+ When(:enqueue) { Pio::Enqueue.new(port: :in_port, queue_id: 2) }
31
31
 
32
- describe '#port_number' do
33
- Then { enqueue.port_number == :in_port }
32
+ describe '#port' do
33
+ Then { enqueue.port == :in_port }
34
34
  end
35
35
  end
36
36
 
37
- context 'with port_number: :local, queue_id: 2' do
38
- When(:enqueue) { Pio::Enqueue.new(port_number: :local, queue_id: 2) }
37
+ context 'with port: :local, queue_id: 2' do
38
+ When(:enqueue) { Pio::Enqueue.new(port: :local, queue_id: 2) }
39
39
  Then { enqueue == Failure(ArgumentError) }
40
40
  end
41
41
 
42
- context 'with port_number: -1, queue_id: 2' do
43
- When(:enqueue) { Pio::Enqueue.new(port_number: -1, queue_id: 2) }
42
+ context 'with port: -1, queue_id: 2' do
43
+ When(:enqueue) { Pio::Enqueue.new(port: -1, queue_id: 2) }
44
44
  Then { enqueue == Failure(ArgumentError) }
45
45
  end
46
46
 
47
- context 'with port_number: 0xff00, queue_id: 2' do
48
- When(:enqueue) { Pio::Enqueue.new(port_number: 0xff00, queue_id: 2) }
47
+ context 'with port: 0xff00, queue_id: 2' do
48
+ When(:enqueue) { Pio::Enqueue.new(port: 0xff00, queue_id: 2) }
49
49
  Then { enqueue == Failure(ArgumentError) }
50
50
  end
51
51
 
52
- context 'with port_number: 1, queue_id: -2' do
53
- When(:enqueue) { Pio::Enqueue.new(port_number: 1, queue_id: -2) }
52
+ context 'with port: 1, queue_id: -2' do
53
+ When(:enqueue) { Pio::Enqueue.new(port: 1, queue_id: -2) }
54
54
  Then { enqueue == Failure(ArgumentError) }
55
55
  end
56
56
 
57
- context 'with port_number: 1' do
58
- When(:enqueue) { Pio::Enqueue.new(port_number: 1) }
57
+ context 'with port: 1' do
58
+ When(:enqueue) { Pio::Enqueue.new(port: 1) }
59
59
  Then { enqueue == Failure(ArgumentError) }
60
60
  end
61
61
 
@@ -0,0 +1,26 @@
1
+ require 'pio/open_flow10/error/hello_failed'
2
+
3
+ describe Pio::OpenFlow10::Error::HelloFailed do
4
+ it_should_behave_like('an OpenFlow message',
5
+ Pio::OpenFlow10::Error::HelloFailed)
6
+
7
+ describe '.new' do
8
+ When(:hello_failed) { Pio::OpenFlow10::Error::HelloFailed.new(options) }
9
+
10
+ context 'with {}' do
11
+ Given(:options) { {} }
12
+
13
+ Then { hello_failed.length == 12 }
14
+ Then { hello_failed.error_type == :hello_failed }
15
+ Then { hello_failed.error_code == :incompatible }
16
+ Then { hello_failed.description == '' }
17
+ end
18
+
19
+ context "with description: 'error description'" do
20
+ Given(:options) { { description: 'error description' } }
21
+
22
+ Then { hello_failed.length == 29 }
23
+ Then { hello_failed.description == 'error description' }
24
+ end
25
+ end
26
+ end
@@ -32,7 +32,7 @@ describe Pio::OpenFlow10::FlowMod do
32
32
  Then { flow_mod.class == Pio::OpenFlow10::FlowMod }
33
33
  Then { flow_mod.ofp_version == 0x1 }
34
34
  Then { flow_mod.message_type == 0xe }
35
- Then { flow_mod.message_length == 0x50 }
35
+ Then { flow_mod.length == 0x50 }
36
36
  Then { flow_mod.transaction_id == 0x15 }
37
37
  Then { flow_mod.xid == 0x15 }
38
38
 
@@ -74,8 +74,8 @@ describe Pio::OpenFlow10::FlowMod do
74
74
  Then { flow_mod.flags == [:send_flow_rem, :check_overwrap] }
75
75
  Then { flow_mod.actions.length == 1 }
76
76
  Then { flow_mod.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
77
- Then { flow_mod.actions[0].port_number == 2 }
78
- Then { flow_mod.actions[0].max_len == 2**16 - 1 }
77
+ Then { flow_mod.actions[0].port == 2 }
78
+ Then { flow_mod.actions[0].max_length == 2**16 - 1 }
79
79
  end
80
80
  end
81
81
 
@@ -98,7 +98,7 @@ describe Pio::OpenFlow10::FlowMod do
98
98
  Then { flow_mod.class == Pio::OpenFlow10::FlowMod }
99
99
  Then { flow_mod.ofp_version == 0x1 }
100
100
  Then { flow_mod.message_type == 0xe }
101
- Then { flow_mod.message_length == 0x50 }
101
+ Then { flow_mod.length == 0x50 }
102
102
  Then { flow_mod.transaction_id == 0x15 }
103
103
  Then { flow_mod.xid == 0x15 }
104
104
 
@@ -140,8 +140,8 @@ describe Pio::OpenFlow10::FlowMod do
140
140
  Then { flow_mod.flags == [:send_flow_rem, :check_overwrap] }
141
141
  Then { flow_mod.actions.length == 1 }
142
142
  Then { flow_mod.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
143
- Then { flow_mod.actions[0].port_number == 2 }
144
- Then { flow_mod.actions[0].max_len == 2**16 - 1 }
143
+ Then { flow_mod.actions[0].port == 2 }
144
+ Then { flow_mod.actions[0].max_length == 2**16 - 1 }
145
145
 
146
146
  context '#to_binary' do
147
147
  When(:binary) { flow_mod.to_binary }
@@ -19,7 +19,7 @@ describe Pio::OpenFlow10::FlowStats::Request do
19
19
  Then { flow_stats_request.class == Pio::OpenFlow10::FlowStats::Request }
20
20
  Then { flow_stats_request.ofp_version == 1 }
21
21
  Then { flow_stats_request.message_type == 16 }
22
- Then { flow_stats_request.message_length == 56 }
22
+ Then { flow_stats_request.length == 56 }
23
23
  Then { flow_stats_request.transaction_id == 13 }
24
24
  Then { flow_stats_request.xid == 13 }
25
25
  Then { flow_stats_request.stats_type == :flow }
@@ -1,7 +1,7 @@
1
1
  require 'pio/open_flow10/hello'
2
2
 
3
3
  describe Pio::OpenFlow10::Hello do
4
- describe '.new' do
5
- it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::Hello)
6
- end
4
+ it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::Hello)
5
+ it_should_behave_like('an OpenFlow message with no body',
6
+ Pio::OpenFlow10::Hello)
7
7
  end
@@ -41,7 +41,7 @@ describe Pio::OpenFlow10::PacketOut do
41
41
  Then { result.class == Pio::OpenFlow10::PacketOut }
42
42
  Then { result.ofp_version == 0x1 }
43
43
  Then { result.message_type == 0xd }
44
- Then { result.message_length == 0x58 }
44
+ Then { result.length == 0x58 }
45
45
  Then { result.transaction_id == 0x16 }
46
46
  Then { result.xid == 0x16 }
47
47
 
@@ -51,8 +51,8 @@ describe Pio::OpenFlow10::PacketOut do
51
51
  Then { result.actions_len == 0x8 }
52
52
  Then { result.actions.length == 1 }
53
53
  Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
54
- Then { result.actions[0].port_number == 2 }
55
- Then { result.actions[0].max_len == 2**16 - 1 }
54
+ Then { result.actions[0].port == 2 }
55
+ Then { result.actions[0].max_length == 2**16 - 1 }
56
56
  Then { result.raw_data.length == 64 }
57
57
  end
58
58
 
@@ -70,7 +70,7 @@ describe Pio::OpenFlow10::PacketOut do
70
70
  Then { result.class == Pio::OpenFlow10::PacketOut }
71
71
  Then { result.ofp_version == 0x1 }
72
72
  Then { result.message_type == 0xd }
73
- Then { result.message_length == 0x58 }
73
+ Then { result.length == 0x58 }
74
74
  Then { result.transaction_id == 0x16 }
75
75
  Then { result.xid == 0x16 }
76
76
 
@@ -80,8 +80,8 @@ describe Pio::OpenFlow10::PacketOut do
80
80
  Then { result.actions_len == 0x8 }
81
81
  Then { result.actions.length == 1 }
82
82
  Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
83
- Then { result.actions[0].port_number == 2 }
84
- Then { result.actions[0].max_len == 2**16 - 1 }
83
+ Then { result.actions[0].port == 2 }
84
+ Then { result.actions[0].max_length == 2**16 - 1 }
85
85
  Then { result.raw_data.length == 64 }
86
86
  end
87
87
 
@@ -113,7 +113,7 @@ describe Pio::OpenFlow10::PacketOut do
113
113
 
114
114
  Then { result.ofp_version == 0x1 }
115
115
  Then { result.message_type == 0xd }
116
- Then { result.message_length == 0x58 }
116
+ Then { result.length == 0x58 }
117
117
  Then { result.transaction_id == 0x16 }
118
118
  Then { result.xid == 0x16 }
119
119
 
@@ -123,8 +123,8 @@ describe Pio::OpenFlow10::PacketOut do
123
123
  Then { result.actions_len == 0x8 }
124
124
  Then { result.actions.length == 1 }
125
125
  Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
126
- Then { result.actions[0].port_number == 2 }
127
- Then { result.actions[0].max_len == 2**16 - 1 }
126
+ Then { result.actions[0].port == 2 }
127
+ Then { result.actions[0].max_length == 2**16 - 1 }
128
128
  Then { result.raw_data.length == 64 }
129
129
 
130
130
  context '#to_binary' do
@@ -145,7 +145,7 @@ describe Pio::OpenFlow10::PacketOut do
145
145
  }
146
146
  end
147
147
 
148
- Then { result.message_length == 0x58 }
148
+ Then { result.length == 0x58 }
149
149
  Then { result.actions_len == 0x8 }
150
150
  Then { result.actions.length == 1 }
151
151
  Then { result.actions[0].is_a? Pio::SetVlanVid }
@@ -163,7 +163,7 @@ describe Pio::OpenFlow10::PacketOut do
163
163
  }
164
164
  end
165
165
 
166
- Then { result.message_length == 0x58 }
166
+ Then { result.length == 0x58 }
167
167
  Then { result.actions_len == 0x8 }
168
168
  Then { result.actions.length == 1 }
169
169
  Then { result.actions[0].is_a? Pio::SetVlanPriority }
@@ -181,45 +181,45 @@ describe Pio::OpenFlow10::PacketOut do
181
181
  }
182
182
  end
183
183
 
184
- Then { result.message_length == 0x58 }
184
+ Then { result.length == 0x58 }
185
185
  Then { result.actions_len == 0x8 }
186
186
  Then { result.actions.length == 1 }
187
187
  Then { result.actions[0].is_a? Pio::StripVlanHeader }
188
188
  end
189
189
 
190
- context 'with a SetEtherSourceAddr action' do
190
+ context 'with a SetEtherSourceAddress action' do
191
191
  When(:user_options) do
192
192
  {
193
193
  transaction_id: 0x16,
194
194
  buffer_id: 0xffffffff,
195
195
  in_port: 0xffff,
196
- actions: Pio::SetEtherSourceAddr.new('11:22:33:44:55:66'),
196
+ actions: Pio::SetEtherSourceAddress.new('11:22:33:44:55:66'),
197
197
  raw_data: data_dump
198
198
  }
199
199
  end
200
200
 
201
- Then { result.message_length == 0x60 }
201
+ Then { result.length == 0x60 }
202
202
  Then { result.actions_len == 0x10 }
203
203
  Then { result.actions.length == 1 }
204
- Then { result.actions[0].is_a? Pio::SetEtherSourceAddr }
204
+ Then { result.actions[0].is_a? Pio::SetEtherSourceAddress }
205
205
  Then { result.actions[0].mac_address == '11:22:33:44:55:66' }
206
206
  end
207
207
 
208
- context 'with a SetEtherDestinationAddr action' do
208
+ context 'with a SetEtherDestinationAddress action' do
209
209
  When(:user_options) do
210
210
  {
211
211
  transaction_id: 0x16,
212
212
  buffer_id: 0xffffffff,
213
213
  in_port: 0xffff,
214
- actions: Pio::SetEtherDestinationAddr.new('11:22:33:44:55:66'),
214
+ actions: Pio::SetEtherDestinationAddress.new('11:22:33:44:55:66'),
215
215
  raw_data: data_dump
216
216
  }
217
217
  end
218
218
 
219
- Then { result.message_length == 0x60 }
219
+ Then { result.length == 0x60 }
220
220
  Then { result.actions_len == 0x10 }
221
221
  Then { result.actions.length == 1 }
222
- Then { result.actions[0].is_a? Pio::SetEtherDestinationAddr }
222
+ Then { result.actions[0].is_a? Pio::SetEtherDestinationAddress }
223
223
  Then { result.actions[0].mac_address == '11:22:33:44:55:66' }
224
224
  end
225
225
 
@@ -234,7 +234,7 @@ describe Pio::OpenFlow10::PacketOut do
234
234
  }
235
235
  end
236
236
 
237
- Then { result.message_length == 0x58 }
237
+ Then { result.length == 0x58 }
238
238
  Then { result.actions_len == 0x8 }
239
239
  Then { result.actions.length == 1 }
240
240
  Then { result.actions[0].is_a? Pio::SetIpSourceAddress }
@@ -252,7 +252,7 @@ describe Pio::OpenFlow10::PacketOut do
252
252
  }
253
253
  end
254
254
 
255
- Then { result.message_length == 0x58 }
255
+ Then { result.length == 0x58 }
256
256
  Then { result.actions_len == 0x8 }
257
257
  Then { result.actions.length == 1 }
258
258
  Then { result.actions[0].is_a? Pio::SetIpDestinationAddress }
@@ -270,7 +270,7 @@ describe Pio::OpenFlow10::PacketOut do
270
270
  }
271
271
  end
272
272
 
273
- Then { result.message_length == 0x58 }
273
+ Then { result.length == 0x58 }
274
274
  Then { result.actions_len == 0x8 }
275
275
  Then { result.actions.length == 1 }
276
276
  Then { result.actions[0].is_a? Pio::SetIpTos }
@@ -288,11 +288,11 @@ describe Pio::OpenFlow10::PacketOut do
288
288
  }
289
289
  end
290
290
 
291
- Then { result.message_length == 0x58 }
291
+ Then { result.length == 0x58 }
292
292
  Then { result.actions_len == 0x8 }
293
293
  Then { result.actions.length == 1 }
294
294
  Then { result.actions[0].is_a? Pio::SetTransportSourcePort }
295
- Then { result.actions[0].port_number == 100 }
295
+ Then { result.actions[0].port == 100 }
296
296
  end
297
297
 
298
298
  context 'with a SetTransportDestinationPort action' do
@@ -306,11 +306,11 @@ describe Pio::OpenFlow10::PacketOut do
306
306
  }
307
307
  end
308
308
 
309
- Then { result.message_length == 0x58 }
309
+ Then { result.length == 0x58 }
310
310
  Then { result.actions_len == 0x8 }
311
311
  Then { result.actions.length == 1 }
312
312
  Then { result.actions[0].is_a? Pio::SetTransportDestinationPort }
313
- Then { result.actions[0].port_number == 100 }
313
+ Then { result.actions[0].port == 100 }
314
314
  end
315
315
 
316
316
  context 'with a Enqueue action' do
@@ -319,16 +319,16 @@ describe Pio::OpenFlow10::PacketOut do
319
319
  transaction_id: 0x16,
320
320
  buffer_id: 0xffffffff,
321
321
  in_port: 0xffff,
322
- actions: Pio::Enqueue.new(port_number: 1, queue_id: 2),
322
+ actions: Pio::Enqueue.new(port: 1, queue_id: 2),
323
323
  raw_data: data_dump
324
324
  }
325
325
  end
326
326
 
327
- Then { result.message_length == 0x60 }
327
+ Then { result.length == 0x60 }
328
328
  Then { result.actions_len == 0x10 }
329
329
  Then { result.actions.length == 1 }
330
330
  Then { result.actions[0].is_a? Pio::Enqueue }
331
- Then { result.actions[0].port_number == 1 }
331
+ Then { result.actions[0].port == 1 }
332
332
  Then { result.actions[0].queue_id == 2 }
333
333
  end
334
334
 
@@ -344,12 +344,12 @@ describe Pio::OpenFlow10::PacketOut do
344
344
  }
345
345
  end
346
346
 
347
- Then { result.message_length == 0x60 }
347
+ Then { result.length == 0x60 }
348
348
  Then { result.actions_len == 0x10 }
349
349
  Then { result.actions.length == 2 }
350
350
  Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
351
- Then { result.actions[0].port_number == 2 }
352
- Then { result.actions[0].max_len == 2**16 - 1 }
351
+ Then { result.actions[0].port == 2 }
352
+ Then { result.actions[0].max_length == 2**16 - 1 }
353
353
  Then { result.actions[1].is_a? Pio::SetVlanVid }
354
354
  Then { result.actions[1].vlan_id == 10 }
355
355
  end