pio 0.25.0 → 0.26.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +4 -0
- data/Rakefile +1 -1
- data/bin/terminal-notifier +16 -0
- data/features/open_flow10/bad_request.feature +35 -0
- data/features/open_flow10/bad_request.raw +0 -0
- data/features/open_flow10/barrier_reply.feature +4 -4
- data/features/open_flow10/barrier_request.feature +4 -4
- data/features/open_flow10/echo_reply.feature +13 -13
- data/features/open_flow10/echo_request.feature +6 -6
- data/features/open_flow10/enqueue.feature +17 -0
- data/features/open_flow10/features_reply.feature +2 -2
- data/features/open_flow10/features_request.feature +28 -28
- data/features/open_flow10/flow_mod.feature +5 -5
- data/features/open_flow10/flow_stats_reply.feature +12 -12
- data/features/open_flow10/flow_stats_request.feature +3 -3
- data/features/open_flow10/hello.feature +8 -15
- data/features/open_flow10/hello_failed.feature +69 -0
- data/features/open_flow10/hello_failed.raw +0 -0
- data/features/open_flow10/nxast_learn.raw +0 -0
- data/features/open_flow10/packet_in.feature +2 -2
- data/features/open_flow10/packet_out.feature +13 -13
- data/features/open_flow10/port_status.feature +1 -1
- data/features/open_flow10/send_out_port.feature +106 -0
- data/features/open_flow10/set_ether_destination_address.feature +16 -0
- data/features/open_flow10/set_ether_source_address.feature +16 -0
- data/features/open_flow10/set_ip_destination_address.feature +16 -0
- data/features/open_flow10/set_ip_source_address.feature +16 -0
- data/features/open_flow10/set_ip_tos.feature +16 -0
- data/features/open_flow10/set_transport_destination_port.feature +16 -0
- data/features/open_flow10/set_transport_source_port.feature +16 -0
- data/features/open_flow10/set_vlan_priority.feature +16 -0
- data/features/open_flow10/set_vlan_vid.feature +16 -0
- data/features/open_flow10/strip_vlan_header.feature +15 -0
- data/features/open_flow10/vendor_action.feature +14 -0
- data/features/open_flow13/bad_request.feature +35 -0
- data/features/open_flow13/bad_request.raw +0 -0
- data/features/open_flow13/echo_reply.feature +7 -7
- data/features/open_flow13/echo_request.feature +7 -7
- data/features/open_flow13/features_reply.feature +2 -2
- data/features/open_flow13/features_request.feature +28 -28
- data/features/open_flow13/flow_mod.feature +24 -24
- data/features/open_flow13/hello.feature +5 -5
- data/features/open_flow13/hello_failed.feature +69 -0
- data/features/open_flow13/hello_failed.raw +0 -0
- data/features/open_flow13/packet_in.feature +3 -3
- data/features/open_flow13/packet_out.feature +3 -3
- data/features/open_flow13/send_out_port.feature +101 -10
- data/features/open_flow13/table_stats_reply.raw +0 -0
- data/features/open_flow13/table_stats_request.raw +0 -0
- data/features/open_flow_read.feature +6 -0
- data/features/step_definitions/Gemfile +9 -0
- data/features/step_definitions/Gemfile.lock +76 -0
- data/features/step_definitions/Guardfile +4 -0
- data/features/step_definitions/LICENSE +675 -0
- data/features/step_definitions/README.md +7 -0
- data/features/step_definitions/Rakefile +10 -0
- data/features/step_definitions/dump_flows_steps.rb +13 -0
- data/features/step_definitions/packet_data_steps.rb +4 -0
- data/features/step_definitions/rest_api_steps.rb +40 -0
- data/features/step_definitions/show_stats_steps.rb +83 -0
- data/features/step_definitions/trema_steps.rb +33 -0
- data/features/step_definitions/virtual_link_steps.rb +8 -0
- data/lib/pio/open_flow.rb +5 -5
- data/lib/pio/open_flow/echo.rb +1 -1
- data/lib/pio/open_flow/error.rb +19 -0
- data/lib/pio/open_flow/format.rb +2 -1
- data/lib/pio/open_flow/hello_failed_code.rb +21 -0
- data/lib/pio/open_flow/open_flow_header.rb +11 -2
- data/lib/pio/open_flow/port.rb +69 -0
- data/lib/pio/open_flow10.rb +5 -0
- data/lib/pio/open_flow10/actions.rb +8 -6
- data/lib/pio/open_flow10/enqueue.rb +13 -13
- data/lib/pio/open_flow10/error.rb +28 -0
- data/lib/pio/open_flow10/error/bad_request.rb +66 -0
- data/lib/pio/open_flow10/error/error_type10.rb +26 -0
- data/lib/pio/open_flow10/error/hello_failed.rb +41 -0
- data/lib/pio/open_flow10/features.rb +6 -10
- data/lib/pio/open_flow10/flow_mod.rb +1 -1
- data/lib/pio/open_flow10/flow_stats_request.rb +1 -1
- data/lib/pio/open_flow10/hello.rb +2 -2
- data/lib/pio/open_flow10/match.rb +2 -2
- data/lib/pio/{open_flow/phy_port.rb → open_flow10/phy_port16.rb} +4 -4
- data/lib/pio/open_flow10/port16.rb +21 -0
- data/lib/pio/open_flow10/port_status.rb +1 -1
- data/lib/pio/open_flow10/send_out_port.rb +16 -40
- data/lib/pio/open_flow10/set_ether_address.rb +9 -8
- data/lib/pio/open_flow10/set_ip_address.rb +4 -4
- data/lib/pio/open_flow10/set_ip_tos.rb +4 -4
- data/lib/pio/open_flow10/set_transport_port.rb +12 -12
- data/lib/pio/open_flow10/set_vlan.rb +4 -4
- data/lib/pio/open_flow10/set_vlan_vid.rb +0 -12
- data/lib/pio/open_flow10/strip_vlan_header.rb +7 -7
- data/lib/pio/open_flow10/vendor_action.rb +33 -0
- data/lib/pio/open_flow13.rb +3 -0
- data/lib/pio/open_flow13/actions.rb +3 -3
- data/lib/pio/open_flow13/error.rb +28 -0
- data/lib/pio/open_flow13/error/bad_request.rb +66 -0
- data/lib/pio/open_flow13/error/error_type13.rb +37 -0
- data/lib/pio/open_flow13/error/hello_failed.rb +42 -0
- data/lib/pio/open_flow13/features_reply.rb +33 -33
- data/lib/pio/open_flow13/features_request.rb +3 -3
- data/lib/pio/open_flow13/flow_mod.rb +2 -2
- data/lib/pio/open_flow13/goto_table.rb +2 -0
- data/lib/pio/open_flow13/packet_out.rb +1 -1
- data/lib/pio/open_flow13/port32.rb +21 -0
- data/lib/pio/open_flow13/send_out_port.rb +3 -2
- data/lib/pio/version.rb +1 -1
- data/pio.gemspec +5 -5
- data/spec/pio/open_flow10/enqueue_spec.rb +22 -22
- data/spec/pio/open_flow10/error/hello_failed_spec.rb +26 -0
- data/spec/pio/open_flow10/flow_mod_spec.rb +6 -6
- data/spec/pio/open_flow10/flow_stats_request_spec.rb +1 -1
- data/spec/pio/open_flow10/hello_spec.rb +3 -3
- data/spec/pio/open_flow10/packet_out_spec.rb +33 -33
- data/spec/pio/{open_flow/phy_port_spec.rb → open_flow10/phy_port16_spec.rb} +7 -7
- data/spec/pio/open_flow10/send_out_port_spec.rb +28 -28
- data/spec/pio/open_flow10/set_ether_destination_address_spec.rb +2 -2
- data/spec/pio/open_flow10/set_ether_source_address_spec.rb +2 -2
- data/spec/pio/open_flow10/set_ip_destination_address_spec.rb +4 -4
- data/spec/pio/open_flow10/set_ip_source_address_spec.rb +4 -4
- data/spec/pio/open_flow10/set_ip_tos_spec.rb +4 -4
- data/spec/pio/open_flow10/set_transport_destination_port_spec.rb +11 -11
- data/spec/pio/open_flow10/set_transport_source_port_spec.rb +11 -11
- data/spec/pio/open_flow10/set_vlan_priority_spec.rb +4 -4
- data/spec/pio/open_flow10/set_vlan_vid_spec.rb +4 -4
- data/spec/pio/open_flow10/strip_vlan_header_spec.rb +6 -6
- data/spec/pio/open_flow13/error/bad_request_spec.rb +6 -0
- data/spec/pio/open_flow13/error/hello_failed_spec.rb +26 -0
- data/spec/pio/open_flow13/hello_spec.rb +3 -3
- data/spec/support/shared_examples_for_openflow_messages.rb +40 -27
- metadata +106 -16
- 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
|
-
#
|
7
|
+
# Features Request and Reply message.
|
8
8
|
class Features
|
9
|
-
#
|
9
|
+
# Features Reply message.
|
10
10
|
class Reply < OpenFlow::Message
|
11
|
-
#
|
12
|
-
class
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
#
|
7
|
+
# Features Request and Reply message.
|
8
8
|
class Features
|
9
|
-
#
|
9
|
+
# Features Request message.
|
10
10
|
class Request < OpenFlow::Message
|
11
|
-
#
|
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(
|
73
|
-
self.instructions =
|
72
|
+
def set(instructions)
|
73
|
+
self.instructions = Array(instructions).map(&:to_binary_s).join
|
74
74
|
end
|
75
75
|
|
76
76
|
# rubocop:disable MethodLength
|
@@ -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: -> {
|
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
|
-
|
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
|
-
|
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
|
|
data/lib/pio/version.rb
CHANGED
data/pio.gemspec
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
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
|
6
|
-
When(:enqueue) { Pio::Enqueue.new(
|
5
|
+
context 'with port: 1, queue_id: 2' do
|
6
|
+
When(:enqueue) { Pio::Enqueue.new(port: 1, queue_id: 2) }
|
7
7
|
|
8
|
-
describe '#
|
9
|
-
Then { enqueue.
|
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 '#
|
17
|
-
Then { enqueue.
|
16
|
+
describe '#action_type' do
|
17
|
+
Then { enqueue.action_type == 11 }
|
18
18
|
end
|
19
19
|
|
20
|
-
describe '#
|
21
|
-
Then { enqueue.
|
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
|
30
|
-
When(:enqueue) { Pio::Enqueue.new(
|
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 '#
|
33
|
-
Then { enqueue.
|
32
|
+
describe '#port' do
|
33
|
+
Then { enqueue.port == :in_port }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
context 'with
|
38
|
-
When(:enqueue) { Pio::Enqueue.new(
|
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
|
43
|
-
When(:enqueue) { Pio::Enqueue.new(
|
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
|
48
|
-
When(:enqueue) { Pio::Enqueue.new(
|
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
|
53
|
-
When(:enqueue) { Pio::Enqueue.new(
|
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
|
58
|
-
When(:enqueue) { Pio::Enqueue.new(
|
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.
|
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].
|
78
|
-
Then { flow_mod.actions[0].
|
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.
|
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].
|
144
|
-
Then { flow_mod.actions[0].
|
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.
|
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
|
-
|
5
|
-
|
6
|
-
|
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.
|
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].
|
55
|
-
Then { result.actions[0].
|
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.
|
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].
|
84
|
-
Then { result.actions[0].
|
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.
|
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].
|
127
|
-
Then { result.actions[0].
|
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.
|
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.
|
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.
|
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
|
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::
|
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.
|
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::
|
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
|
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::
|
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.
|
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::
|
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.
|
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.
|
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.
|
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.
|
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].
|
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.
|
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].
|
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(
|
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.
|
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].
|
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.
|
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].
|
352
|
-
Then { result.actions[0].
|
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
|