pio 0.23.1 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +2 -0
  4. data/Rakefile +1 -1
  5. data/features/open_flow10/barrier_reply.feature +58 -0
  6. data/features/open_flow10/barrier_request.feature +58 -0
  7. data/features/open_flow10/echo_reply.feature +50 -40
  8. data/features/open_flow10/echo_request.feature +54 -51
  9. data/features/open_flow10/features_reply.feature +62 -63
  10. data/features/open_flow10/features_request.feature +2 -19
  11. data/features/open_flow10/flow_mod.feature +1 -0
  12. data/features/open_flow10/hello.feature +38 -44
  13. data/features/open_flow10/packet_in.feature +1 -2
  14. data/features/open_flow10/packet_in.raw +0 -0
  15. data/features/open_flow10/packet_out.feature +14 -14
  16. data/features/open_flow10/port_status.feature +17 -17
  17. data/features/open_flow13/apply_actions.feature +15 -17
  18. data/features/open_flow13/echo_reply.feature +58 -58
  19. data/features/open_flow13/echo_request.feature +58 -58
  20. data/features/open_flow13/features_reply.feature +2 -6
  21. data/features/open_flow13/features_request.feature +3 -23
  22. data/features/open_flow13/flow_mod.feature +86 -93
  23. data/features/open_flow13/goto_table.feature +4 -4
  24. data/features/open_flow13/hello.feature +8 -15
  25. data/features/open_flow13/match.feature +14 -3
  26. data/features/open_flow13/meter.feature +3 -3
  27. data/features/open_flow13/oxm_experimenter_stratos_basic_dot11.raw +0 -0
  28. data/features/open_flow13/oxm_invalid_field.raw +0 -0
  29. data/features/open_flow13/packet_in.feature +15 -20
  30. data/features/open_flow13/packet_out.feature +39 -42
  31. data/features/open_flow13/send_out_port.feature +1 -5
  32. data/features/open_flow13/write_metadata.feature +3 -3
  33. data/features/open_flow_read.feature +43 -0
  34. data/features/open_flow_version.feature +10 -0
  35. data/features/step_definitions/open_flow_steps.rb +10 -2
  36. data/features/step_definitions/packet_data_steps.rb +4 -0
  37. data/features/support/hooks.rb +7 -0
  38. data/lib/pio.rb +1 -1
  39. data/lib/pio/monkey_patch/integer/ranges.rb +4 -0
  40. data/lib/pio/open_flow.rb +54 -16
  41. data/lib/pio/open_flow/datapath_id.rb +26 -0
  42. data/lib/pio/open_flow/echo.rb +44 -0
  43. data/lib/pio/open_flow/format.rb +45 -0
  44. data/lib/pio/open_flow/message.rb +88 -0
  45. data/lib/pio/open_flow/open_flow_header.rb +0 -14
  46. data/lib/pio/open_flow10.rb +3 -8
  47. data/lib/pio/open_flow10/actions.rb +1 -1
  48. data/lib/pio/open_flow10/barrier_reply.rb +21 -0
  49. data/lib/pio/open_flow10/barrier_request.rb +22 -0
  50. data/lib/pio/open_flow10/echo.rb +15 -11
  51. data/lib/pio/open_flow10/features.rb +99 -71
  52. data/lib/pio/open_flow10/flow_mod.rb +73 -66
  53. data/lib/pio/open_flow10/hello.rb +19 -4
  54. data/lib/pio/open_flow10/match.rb +133 -131
  55. data/lib/pio/open_flow10/packet_in.rb +55 -49
  56. data/lib/pio/open_flow10/packet_out.rb +31 -24
  57. data/lib/pio/open_flow10/port_status.rb +54 -27
  58. data/lib/pio/open_flow10/send_out_port.rb +66 -64
  59. data/lib/pio/open_flow13.rb +0 -15
  60. data/lib/pio/open_flow13/echo.rb +11 -68
  61. data/lib/pio/open_flow13/features_reply.rb +48 -77
  62. data/lib/pio/open_flow13/features_request.rb +16 -45
  63. data/lib/pio/open_flow13/flow_mod.rb +125 -148
  64. data/lib/pio/open_flow13/goto_table.rb +1 -0
  65. data/lib/pio/open_flow13/hello.rb +54 -84
  66. data/lib/pio/open_flow13/match.rb +69 -11
  67. data/lib/pio/open_flow13/meter.rb +1 -0
  68. data/lib/pio/open_flow13/packet_in.rb +38 -50
  69. data/lib/pio/open_flow13/packet_out.rb +50 -75
  70. data/lib/pio/open_flow13/send_out_port.rb +34 -34
  71. data/lib/pio/open_flow13/write_metadata.rb +1 -0
  72. data/lib/pio/parser.rb +3 -0
  73. data/lib/pio/version.rb +1 -1
  74. data/pio.gemspec +6 -6
  75. data/spec/pio/open_flow10/echo_reply_spec.rb +7 -0
  76. data/spec/pio/open_flow10/echo_request_spec.rb +7 -0
  77. data/spec/pio/open_flow10/features_reply_spec.rb +8 -0
  78. data/spec/pio/open_flow10/features_request_spec.rb +13 -0
  79. data/spec/pio/open_flow10/flow_mod_spec.rb +17 -16
  80. data/spec/pio/open_flow10/hello_spec.rb +7 -0
  81. data/spec/pio/open_flow10/match_spec.rb +8 -6
  82. data/spec/pio/open_flow10/packet_in_spec.rb +14 -0
  83. data/spec/pio/open_flow10/packet_out_spec.rb +21 -14
  84. data/spec/pio/open_flow10/send_out_port_spec.rb +4 -4
  85. data/spec/pio/open_flow10/wildcards_spec.rb +2 -2
  86. data/spec/pio/open_flow13/echo_reply_spec.rb +7 -0
  87. data/spec/pio/open_flow13/echo_request_spec.rb +7 -0
  88. data/spec/pio/open_flow13/features_reply_spec.rb +8 -0
  89. data/spec/pio/open_flow13/features_request_spec.rb +13 -0
  90. data/spec/pio/open_flow13/hello_spec.rb +14 -59
  91. data/spec/pio/open_flow13/packet_in_spec.rb +14 -0
  92. data/spec/pio/open_flow13/packet_out_spec.rb +7 -0
  93. data/spec/pio/open_flow_spec.rb +34 -0
  94. data/spec/spec_helper.rb +1 -0
  95. data/spec/support/shared_examples_for_openflow_messages.rb +75 -0
  96. metadata +215 -170
  97. data/bin/byebug +0 -16
  98. data/bin/terminal-notifier +0 -16
  99. data/lib/pio/open_flow10/message.rb +0 -78
  100. data/spec/pio/open_flow/type_spec.rb +0 -5
@@ -2,46 +2,46 @@ require 'forwardable'
2
2
 
3
3
  # Base module.
4
4
  module Pio
5
- remove_const :SendOutPort if const_defined?(:SendOutPort)
6
-
7
- # Output to switch port.
8
- class SendOutPort
9
- # OpenFlow 1.3.4 OFPAT_OUTPUT action format.
10
- class Format < BinData::Record
11
- NO_BUFFER = 0xffff
12
-
13
- endian :big
14
-
15
- uint16 :action_type, value: 0
16
- uint16 :action_length, value: 16
17
- uint32 :port
18
- uint16 :max_length, initial_value: NO_BUFFER
19
- uint48 :padding
20
- end
5
+ module OpenFlow13
6
+ # Output to switch port.
7
+ class SendOutPort
8
+ # OpenFlow 1.3.4 OFPAT_OUTPUT action format.
9
+ class Format < BinData::Record
10
+ NO_BUFFER = 0xffff
11
+
12
+ endian :big
13
+
14
+ uint16 :action_type, value: 0
15
+ uint16 :action_length, value: 16
16
+ uint32 :port
17
+ uint16 :max_length, initial_value: NO_BUFFER
18
+ uint48 :padding
19
+ end
21
20
 
22
- def self.read(raw_data)
23
- allocate.tap do |send_out_port|
24
- send_out_port.instance_variable_set :@format, Format.read(raw_data)
21
+ def self.read(raw_data)
22
+ allocate.tap do |send_out_port|
23
+ send_out_port.instance_variable_set :@format, Format.read(raw_data)
24
+ end
25
25
  end
26
- end
27
26
 
28
- extend Forwardable
27
+ extend Forwardable
29
28
 
30
- def_delegators :@format, :action_type
31
- def_delegators :@format, :action_length
32
- def_delegators :@format, :port
33
- def_delegator :@format, :to_binary_s, :to_binary
29
+ def_delegators :@format, :action_type
30
+ def_delegators :@format, :action_length
31
+ def_delegators :@format, :port
32
+ def_delegator :@format, :to_binary_s, :to_binary
34
33
 
35
- def initialize(port)
36
- @format = Format.new(port: port)
37
- end
34
+ def initialize(port)
35
+ @format = Format.new(port: port)
36
+ end
38
37
 
39
- def max_length
40
- case @format.max_length
41
- when Format::NO_BUFFER
42
- :no_buffer
43
- else
44
- @format.max_length
38
+ def max_length
39
+ case @format.max_length
40
+ when Format::NO_BUFFER
41
+ :no_buffer
42
+ else
43
+ @format.max_length
44
+ end
45
45
  end
46
46
  end
47
47
  end
@@ -27,6 +27,7 @@ module Pio
27
27
  def_delegators :@format, :instruction_length
28
28
  def_delegators :@format, :metadata
29
29
  def_delegators :@format, :metadata_mask
30
+ def_delegators :@format, :to_binary_s
30
31
 
31
32
  def initialize(user_options)
32
33
  @options = user_options
@@ -1,3 +1,6 @@
1
+ require 'pio/ethernet_header'
2
+ require 'pio/ipv4_header'
3
+
1
4
  module Pio
2
5
  # Raw data parser.
3
6
  class Parser
@@ -1,5 +1,5 @@
1
1
  # Base module.
2
2
  module Pio
3
3
  # gem version.
4
- VERSION = '0.23.1'.freeze
4
+ VERSION = '0.24.0'.freeze
5
5
  end
@@ -31,14 +31,14 @@ Gem::Specification.new do |gem|
31
31
  gem.add_dependency 'bindata', '~> 2.1.0'
32
32
 
33
33
  gem.add_development_dependency 'rake'
34
- gem.add_development_dependency 'bundler', '~> 1.10.5'
34
+ gem.add_development_dependency 'bundler', '~> 1.10.6'
35
35
  gem.add_development_dependency 'pry', '~> 0.10.1'
36
36
 
37
37
  # Guard
38
- gem.add_development_dependency 'guard', '~> 2.12.6'
38
+ gem.add_development_dependency 'guard', '~> 2.13.0'
39
39
  gem.add_development_dependency 'guard-bundler', '~> 2.1.0'
40
40
  gem.add_development_dependency 'guard-cucumber', '~> 1.6.0'
41
- gem.add_development_dependency 'guard-rspec', '~> 4.5.2'
41
+ gem.add_development_dependency 'guard-rspec', '~> 4.6.3'
42
42
  gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'
43
43
  gem.add_development_dependency 'rb-fchange', '~> 0.0.6'
44
44
  gem.add_development_dependency 'rb-fsevent', '~> 0.9.5'
@@ -53,11 +53,11 @@ Gem::Specification.new do |gem|
53
53
  # Test
54
54
  gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.7'
55
55
  gem.add_development_dependency 'coveralls', '~> 0.8.2'
56
- gem.add_development_dependency 'cucumber', '~> 2.0.0'
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', '~> 2.2.1'
59
+ gem.add_development_dependency 'reek', '~> 3.1'
60
60
  gem.add_development_dependency 'rspec', '~> 3.3.0'
61
- gem.add_development_dependency 'rspec-given', '~> 3.7.0'
61
+ gem.add_development_dependency 'rspec-given', '~> 3.7.1'
62
62
  gem.add_development_dependency 'rubocop', '~> 0.32.1'
63
63
  end
@@ -0,0 +1,7 @@
1
+ require 'pio/open_flow10/echo'
2
+
3
+ describe Pio::OpenFlow10::Echo::Reply do
4
+ describe '.new' do
5
+ it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::Echo::Reply)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'pio/open_flow10/echo'
2
+
3
+ describe Pio::OpenFlow10::Echo::Request do
4
+ describe '.new' do
5
+ it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::Echo::Request)
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'pio/open_flow10/features'
2
+
3
+ describe Pio::OpenFlow10::Features::Reply do
4
+ describe '.new' do
5
+ it_should_behave_like('an OpenFlow message with Datapath ID',
6
+ Pio::OpenFlow10::Features::Reply)
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ require 'pio/open_flow10/features'
2
+
3
+ describe Pio::OpenFlow10::Features::Request do
4
+ describe '.new' do
5
+ it_should_behave_like('an OpenFlow message',
6
+ Pio::OpenFlow10::Features::Request)
7
+
8
+ context "with body: 'abcde'" do
9
+ When(:message) { Pio::OpenFlow10::Features::Request.new(body: 'abcde') }
10
+ Then { message == Failure(RuntimeError, 'Unknown option: body') }
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,6 @@
1
1
  require 'pio/open_flow10/flow_mod'
2
2
 
3
- describe Pio::FlowMod do
3
+ describe Pio::OpenFlow10::FlowMod do
4
4
  Given(:dump) do
5
5
  [
6
6
  0x01,
@@ -26,10 +26,10 @@ describe Pio::FlowMod do
26
26
  describe '.read' do
27
27
  context 'with a flow_mod message' do
28
28
  When(:flow_mod) do
29
- Pio::FlowMod.read(dump)
29
+ Pio::OpenFlow10::FlowMod.read(dump)
30
30
  end
31
31
 
32
- Then { flow_mod.class == Pio::FlowMod }
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
35
  Then { flow_mod.message_length == 0x50 }
@@ -73,7 +73,7 @@ describe Pio::FlowMod do
73
73
  Then { flow_mod.out_port == 2 }
74
74
  Then { flow_mod.flags == [:send_flow_rem, :check_overwrap] }
75
75
  Then { flow_mod.actions.length == 1 }
76
- Then { flow_mod.actions[0].is_a? Pio::SendOutPort }
76
+ Then { flow_mod.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
77
77
  Then { flow_mod.actions[0].port_number == 2 }
78
78
  Then { flow_mod.actions[0].max_len == 2**16 - 1 }
79
79
  end
@@ -82,19 +82,20 @@ describe Pio::FlowMod do
82
82
  describe '.new' do
83
83
  context 'with a SendOutPort action' do
84
84
  When(:flow_mod) do
85
- Pio::FlowMod.new(transaction_id: 0x15,
86
- buffer_id: 0xffffffff,
87
- match: Pio::Match.new(in_port: 1),
88
- cookie: 1,
89
- command: :add,
90
- priority: 0xffff,
91
- out_port: 2,
92
- flags: [:send_flow_rem, :check_overwrap],
93
- actions: Pio::SendOutPort.new(2)
94
- )
85
+ Pio::OpenFlow10::FlowMod.new(
86
+ transaction_id: 0x15,
87
+ buffer_id: 0xffffffff,
88
+ match: Pio::OpenFlow10::Match.new(in_port: 1),
89
+ cookie: 1,
90
+ command: :add,
91
+ priority: 0xffff,
92
+ out_port: 2,
93
+ flags: [:send_flow_rem, :check_overwrap],
94
+ actions: Pio::OpenFlow10::SendOutPort.new(2)
95
+ )
95
96
  end
96
97
 
97
- Then { flow_mod.class == Pio::FlowMod }
98
+ Then { flow_mod.class == Pio::OpenFlow10::FlowMod }
98
99
  Then { flow_mod.ofp_version == 0x1 }
99
100
  Then { flow_mod.message_type == 0xe }
100
101
  Then { flow_mod.message_length == 0x50 }
@@ -138,7 +139,7 @@ describe Pio::FlowMod do
138
139
  Then { flow_mod.out_port == 2 }
139
140
  Then { flow_mod.flags == [:send_flow_rem, :check_overwrap] }
140
141
  Then { flow_mod.actions.length == 1 }
141
- Then { flow_mod.actions[0].is_a? Pio::SendOutPort }
142
+ Then { flow_mod.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
142
143
  Then { flow_mod.actions[0].port_number == 2 }
143
144
  Then { flow_mod.actions[0].max_len == 2**16 - 1 }
144
145
 
@@ -0,0 +1,7 @@
1
+ require 'pio/open_flow10/hello'
2
+
3
+ describe Pio::OpenFlow10::Hello do
4
+ describe '.new' do
5
+ it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::Hello)
6
+ end
7
+ end
@@ -1,8 +1,8 @@
1
1
  require 'pio/open_flow10/match'
2
2
 
3
- describe Pio::Match do
3
+ describe Pio::OpenFlow10::Match do
4
4
  describe '.read' do
5
- When(:match) { Pio::Match.read(binary) }
5
+ When(:match) { Pio::OpenFlow10::Match.read(binary) }
6
6
 
7
7
  context 'with a Match binary' do
8
8
  Given(:binary) do
@@ -54,9 +54,11 @@ describe Pio::Match do
54
54
  Then { match.transport_destination_port == 0 }
55
55
  end
56
56
 
57
- context 'with a Match binary generated with Pio::Match.new' do
57
+ context 'with a Match binary generated with Pio::OpenFlow10::Match.new' do
58
58
  Given(:binary) do
59
- Pio::Match.new(ip_source_address: '192.168.1.0/24').to_binary_s
59
+ Pio::OpenFlow10::Match
60
+ .new(ip_source_address: '192.168.1.0/24')
61
+ .to_binary_s
60
62
  end
61
63
 
62
64
  Then do
@@ -93,7 +95,7 @@ describe Pio::Match do
93
95
  end
94
96
 
95
97
  describe '.new' do
96
- When(:match) { Pio::Match.new(options) }
98
+ When(:match) { Pio::OpenFlow10::Match.new(options) }
97
99
 
98
100
  context 'with in_port: 1' do
99
101
  Given(:options) { { in_port: 1 } }
@@ -129,7 +131,7 @@ describe Pio::Match do
129
131
  When(:result) { match == other }
130
132
 
131
133
  context 'with Match.new(in_port: 1)' do
132
- Given(:other) { Pio::Match.new(in_port: 1) }
134
+ Given(:other) { Pio::OpenFlow10::Match.new(in_port: 1) }
133
135
  Then { result == true }
134
136
  end
135
137
  end
@@ -0,0 +1,14 @@
1
+ require 'pio/open_flow10/packet_in'
2
+
3
+ describe Pio::OpenFlow10::PacketIn do
4
+ Given(:packet_in) { Pio::OpenFlow10::PacketIn.new }
5
+
6
+ describe '.new' do
7
+ it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::PacketIn)
8
+ end
9
+
10
+ describe 'datapath_id=' do
11
+ When { packet_in.datapath_id = 1 }
12
+ Then { packet_in.datapath_id == 1 }
13
+ end
14
+ end
@@ -1,6 +1,7 @@
1
1
  require 'pio/open_flow10/packet_out'
2
+ require 'pio/parse_error'
2
3
 
3
- describe Pio::PacketOut do
4
+ describe Pio::OpenFlow10::PacketOut do
4
5
  Given(:header_dump) do
5
6
  [
6
7
  0x01,
@@ -9,6 +10,7 @@ describe Pio::PacketOut do
9
10
  0x00, 0x00, 0x00, 0x16
10
11
  ].pack('C*')
11
12
  end
13
+
12
14
  Given(:data_dump) do
13
15
  [
14
16
  0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e, 0x01, 0x02, 0x03, 0x04,
@@ -20,6 +22,7 @@ describe Pio::PacketOut do
20
22
  0x00, 0x00, 0x00, 0x00
21
23
  ].pack('C*')
22
24
  end
25
+
23
26
  Given(:body_dump) do
24
27
  [
25
28
  0xff, 0xff, 0xff, 0xff,
@@ -30,12 +33,12 @@ describe Pio::PacketOut do
30
33
  end
31
34
 
32
35
  describe '.read' do
33
- When(:result) { Pio::PacketOut.read(binary) }
36
+ When(:result) { Pio::OpenFlow10::PacketOut.read(binary) }
34
37
 
35
38
  context 'with a Packet-Out message' do
36
39
  When(:binary) { header_dump + body_dump }
37
40
 
38
- Then { result.class == Pio::PacketOut }
41
+ Then { result.class == Pio::OpenFlow10::PacketOut }
39
42
  Then { result.ofp_version == 0x1 }
40
43
  Then { result.message_type == 0xd }
41
44
  Then { result.message_length == 0x58 }
@@ -47,7 +50,7 @@ describe Pio::PacketOut do
47
50
  Then { result.in_port == 0xffff }
48
51
  Then { result.actions_len == 0x8 }
49
52
  Then { result.actions.length == 1 }
50
- Then { result.actions[0].is_a? Pio::SendOutPort }
53
+ Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
51
54
  Then { result.actions[0].port_number == 2 }
52
55
  Then { result.actions[0].max_len == 2**16 - 1 }
53
56
  Then { result.raw_data.length == 64 }
@@ -55,16 +58,16 @@ describe Pio::PacketOut do
55
58
 
56
59
  context 'with a Packet-Out message generated with PacketOut.new' do
57
60
  When(:binary) do
58
- Pio::PacketOut.new(
61
+ Pio::OpenFlow10::PacketOut.new(
59
62
  transaction_id: 0x16,
60
63
  buffer_id: 0xffffffff,
61
64
  in_port: 0xffff,
62
- actions: Pio::SendOutPort.new(2),
65
+ actions: Pio::OpenFlow10::SendOutPort.new(2),
63
66
  raw_data: data_dump
64
67
  ).to_binary
65
68
  end
66
69
 
67
- Then { result.class == Pio::PacketOut }
70
+ Then { result.class == Pio::OpenFlow10::PacketOut }
68
71
  Then { result.ofp_version == 0x1 }
69
72
  Then { result.message_type == 0xd }
70
73
  Then { result.message_length == 0x58 }
@@ -76,7 +79,7 @@ describe Pio::PacketOut do
76
79
  Then { result.in_port == 0xffff }
77
80
  Then { result.actions_len == 0x8 }
78
81
  Then { result.actions.length == 1 }
79
- Then { result.actions[0].is_a? Pio::SendOutPort }
82
+ Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
80
83
  Then { result.actions[0].port_number == 2 }
81
84
  Then { result.actions[0].max_len == 2**16 - 1 }
82
85
  Then { result.raw_data.length == 64 }
@@ -86,13 +89,16 @@ describe Pio::PacketOut do
86
89
  When(:binary) { [1, 0, 0, 8, 0, 0, 0, 0].pack('C*') }
87
90
 
88
91
  Then do
89
- result == Failure(Pio::ParseError, 'Invalid PacketOut message.')
92
+ result == Failure(Pio::ParseError,
93
+ 'Invalid OpenFlow10 PacketOut message.')
90
94
  end
91
95
  end
92
96
  end
93
97
 
94
98
  describe '.new' do
95
- When(:result) { Pio::PacketOut.new(user_options) }
99
+ it_should_behave_like('an OpenFlow message', Pio::OpenFlow10::PacketOut)
100
+
101
+ When(:result) { Pio::OpenFlow10::PacketOut.new(user_options) }
96
102
 
97
103
  context 'with a SendOutPort action' do
98
104
  When(:user_options) do
@@ -100,7 +106,7 @@ describe Pio::PacketOut do
100
106
  transaction_id: 0x16,
101
107
  buffer_id: 0xffffffff,
102
108
  in_port: 0xffff,
103
- actions: Pio::SendOutPort.new(2),
109
+ actions: Pio::OpenFlow10::SendOutPort.new(2),
104
110
  raw_data: data_dump
105
111
  }
106
112
  end
@@ -116,7 +122,7 @@ describe Pio::PacketOut do
116
122
  Then { result.in_port == 0xffff }
117
123
  Then { result.actions_len == 0x8 }
118
124
  Then { result.actions.length == 1 }
119
- Then { result.actions[0].is_a? Pio::SendOutPort }
125
+ Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
120
126
  Then { result.actions[0].port_number == 2 }
121
127
  Then { result.actions[0].max_len == 2**16 - 1 }
122
128
  Then { result.raw_data.length == 64 }
@@ -332,7 +338,8 @@ describe Pio::PacketOut do
332
338
  transaction_id: 0x16,
333
339
  buffer_id: 0xffffffff,
334
340
  in_port: 0xffff,
335
- actions: [Pio::SendOutPort.new(2), Pio::SetVlanVid.new(10)],
341
+ actions: [Pio::OpenFlow10::SendOutPort.new(2),
342
+ Pio::SetVlanVid.new(10)],
336
343
  raw_data: data_dump
337
344
  }
338
345
  end
@@ -340,7 +347,7 @@ describe Pio::PacketOut do
340
347
  Then { result.message_length == 0x60 }
341
348
  Then { result.actions_len == 0x10 }
342
349
  Then { result.actions.length == 2 }
343
- Then { result.actions[0].is_a? Pio::SendOutPort }
350
+ Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
344
351
  Then { result.actions[0].port_number == 2 }
345
352
  Then { result.actions[0].max_len == 2**16 - 1 }
346
353
  Then { result.actions[1].is_a? Pio::SetVlanVid }
@@ -1,8 +1,8 @@
1
1
  require 'pio/open_flow10/send_out_port'
2
2
 
3
- describe Pio::SendOutPort do
3
+ describe Pio::OpenFlow10::SendOutPort do
4
4
  describe '.new' do
5
- When(:send_out_port) { Pio::SendOutPort.new(options) }
5
+ When(:send_out_port) { Pio::OpenFlow10::SendOutPort.new(options) }
6
6
 
7
7
  context 'with 1' do
8
8
  Given(:options) { 1 }
@@ -13,12 +13,12 @@ describe Pio::SendOutPort do
13
13
  When(:result) { send_out_port == other }
14
14
 
15
15
  context 'with SendOutPort.new(1)' do
16
- Given(:other) { Pio::SendOutPort.new(1) }
16
+ Given(:other) { Pio::OpenFlow10::SendOutPort.new(1) }
17
17
  Then { result == true }
18
18
  end
19
19
 
20
20
  context 'with SendOutPort.new(2)' do
21
- Given(:other) { Pio::SendOutPort.new(2) }
21
+ Given(:other) { Pio::OpenFlow10::SendOutPort.new(2) }
22
22
  Then { result == false }
23
23
  end
24
24
  end