pio 0.23.1 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/features/open_flow10/barrier_reply.feature +58 -0
- data/features/open_flow10/barrier_request.feature +58 -0
- data/features/open_flow10/echo_reply.feature +50 -40
- data/features/open_flow10/echo_request.feature +54 -51
- data/features/open_flow10/features_reply.feature +62 -63
- data/features/open_flow10/features_request.feature +2 -19
- data/features/open_flow10/flow_mod.feature +1 -0
- data/features/open_flow10/hello.feature +38 -44
- data/features/open_flow10/packet_in.feature +1 -2
- data/features/open_flow10/packet_in.raw +0 -0
- data/features/open_flow10/packet_out.feature +14 -14
- data/features/open_flow10/port_status.feature +17 -17
- data/features/open_flow13/apply_actions.feature +15 -17
- data/features/open_flow13/echo_reply.feature +58 -58
- data/features/open_flow13/echo_request.feature +58 -58
- data/features/open_flow13/features_reply.feature +2 -6
- data/features/open_flow13/features_request.feature +3 -23
- data/features/open_flow13/flow_mod.feature +86 -93
- data/features/open_flow13/goto_table.feature +4 -4
- data/features/open_flow13/hello.feature +8 -15
- data/features/open_flow13/match.feature +14 -3
- data/features/open_flow13/meter.feature +3 -3
- data/features/open_flow13/oxm_experimenter_stratos_basic_dot11.raw +0 -0
- data/features/open_flow13/oxm_invalid_field.raw +0 -0
- data/features/open_flow13/packet_in.feature +15 -20
- data/features/open_flow13/packet_out.feature +39 -42
- data/features/open_flow13/send_out_port.feature +1 -5
- data/features/open_flow13/write_metadata.feature +3 -3
- data/features/open_flow_read.feature +43 -0
- data/features/open_flow_version.feature +10 -0
- data/features/step_definitions/open_flow_steps.rb +10 -2
- data/features/step_definitions/packet_data_steps.rb +4 -0
- data/features/support/hooks.rb +7 -0
- data/lib/pio.rb +1 -1
- data/lib/pio/monkey_patch/integer/ranges.rb +4 -0
- data/lib/pio/open_flow.rb +54 -16
- data/lib/pio/open_flow/datapath_id.rb +26 -0
- data/lib/pio/open_flow/echo.rb +44 -0
- data/lib/pio/open_flow/format.rb +45 -0
- data/lib/pio/open_flow/message.rb +88 -0
- data/lib/pio/open_flow/open_flow_header.rb +0 -14
- data/lib/pio/open_flow10.rb +3 -8
- data/lib/pio/open_flow10/actions.rb +1 -1
- data/lib/pio/open_flow10/barrier_reply.rb +21 -0
- data/lib/pio/open_flow10/barrier_request.rb +22 -0
- data/lib/pio/open_flow10/echo.rb +15 -11
- data/lib/pio/open_flow10/features.rb +99 -71
- data/lib/pio/open_flow10/flow_mod.rb +73 -66
- data/lib/pio/open_flow10/hello.rb +19 -4
- data/lib/pio/open_flow10/match.rb +133 -131
- data/lib/pio/open_flow10/packet_in.rb +55 -49
- data/lib/pio/open_flow10/packet_out.rb +31 -24
- data/lib/pio/open_flow10/port_status.rb +54 -27
- data/lib/pio/open_flow10/send_out_port.rb +66 -64
- data/lib/pio/open_flow13.rb +0 -15
- data/lib/pio/open_flow13/echo.rb +11 -68
- data/lib/pio/open_flow13/features_reply.rb +48 -77
- data/lib/pio/open_flow13/features_request.rb +16 -45
- data/lib/pio/open_flow13/flow_mod.rb +125 -148
- data/lib/pio/open_flow13/goto_table.rb +1 -0
- data/lib/pio/open_flow13/hello.rb +54 -84
- data/lib/pio/open_flow13/match.rb +69 -11
- data/lib/pio/open_flow13/meter.rb +1 -0
- data/lib/pio/open_flow13/packet_in.rb +38 -50
- data/lib/pio/open_flow13/packet_out.rb +50 -75
- data/lib/pio/open_flow13/send_out_port.rb +34 -34
- data/lib/pio/open_flow13/write_metadata.rb +1 -0
- data/lib/pio/parser.rb +3 -0
- data/lib/pio/version.rb +1 -1
- data/pio.gemspec +6 -6
- data/spec/pio/open_flow10/echo_reply_spec.rb +7 -0
- data/spec/pio/open_flow10/echo_request_spec.rb +7 -0
- data/spec/pio/open_flow10/features_reply_spec.rb +8 -0
- data/spec/pio/open_flow10/features_request_spec.rb +13 -0
- data/spec/pio/open_flow10/flow_mod_spec.rb +17 -16
- data/spec/pio/open_flow10/hello_spec.rb +7 -0
- data/spec/pio/open_flow10/match_spec.rb +8 -6
- data/spec/pio/open_flow10/packet_in_spec.rb +14 -0
- data/spec/pio/open_flow10/packet_out_spec.rb +21 -14
- data/spec/pio/open_flow10/send_out_port_spec.rb +4 -4
- data/spec/pio/open_flow10/wildcards_spec.rb +2 -2
- data/spec/pio/open_flow13/echo_reply_spec.rb +7 -0
- data/spec/pio/open_flow13/echo_request_spec.rb +7 -0
- data/spec/pio/open_flow13/features_reply_spec.rb +8 -0
- data/spec/pio/open_flow13/features_request_spec.rb +13 -0
- data/spec/pio/open_flow13/hello_spec.rb +14 -59
- data/spec/pio/open_flow13/packet_in_spec.rb +14 -0
- data/spec/pio/open_flow13/packet_out_spec.rb +7 -0
- data/spec/pio/open_flow_spec.rb +34 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/shared_examples_for_openflow_messages.rb +75 -0
- metadata +215 -170
- data/bin/byebug +0 -16
- data/bin/terminal-notifier +0 -16
- data/lib/pio/open_flow10/message.rb +0 -78
- 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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
27
|
+
extend Forwardable
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def initialize(port)
|
35
|
+
@format = Format.new(port: port)
|
36
|
+
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
data/lib/pio/parser.rb
CHANGED
data/lib/pio/version.rb
CHANGED
data/pio.gemspec
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
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', '~>
|
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.
|
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,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(
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
|
@@ -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
|
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,
|
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
|
-
|
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),
|
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
|