pio 0.27.1 → 0.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Rakefile +1 -1
- data/bin/{terminal-notifier → code_metrics} +2 -2
- data/bin/code_metrics-profile +16 -0
- data/features/icmpv6.pcap +0 -0
- data/features/open_flow10/aggregate_stats_reply.feature +1 -1
- data/features/open_flow10/aggregate_stats_request.feature +2 -2
- data/features/open_flow10/bad_request.feature +2 -2
- data/features/open_flow10/barrier_reply.feature +3 -18
- data/features/open_flow10/barrier_request.feature +3 -18
- data/features/open_flow10/description_stats_reply.feature +1 -1
- data/features/open_flow10/description_stats_request.feature +3 -3
- data/features/open_flow10/echo_reply.feature +4 -47
- data/features/open_flow10/echo_request.feature +4 -36
- data/features/open_flow10/exact_match.feature +20 -2
- data/features/open_flow10/features_reply.feature +65 -72
- data/features/open_flow10/features_request.feature +3 -22
- data/features/open_flow10/flow_mod.feature +5 -5
- data/features/open_flow10/flow_stats_reply.feature +2 -2
- data/features/open_flow10/flow_stats_request.feature +3 -4
- data/features/open_flow10/hello.feature +4 -20
- data/features/open_flow10/hello_failed.feature +4 -4
- data/features/open_flow10/packet_in.feature +2 -2
- data/features/open_flow10/packet_in_arp_reply.raw +0 -0
- data/features/open_flow10/packet_out.feature +1 -1
- data/features/open_flow10/port_status.feature +1 -1
- data/features/open_flow13/bad_request.feature +2 -2
- data/features/open_flow13/echo_reply.feature +5 -37
- data/features/open_flow13/echo_request.feature +5 -37
- data/features/open_flow13/features_reply.feature +3 -7
- data/features/open_flow13/features_request.feature +3 -18
- data/features/open_flow13/flow_mod.feature +5 -5
- data/features/open_flow13/hello.feature +4 -19
- data/features/open_flow13/hello_failed.feature +4 -4
- data/features/open_flow13/match.feature +4 -4
- data/features/open_flow13/packet_in.feature +3 -3
- data/features/open_flow13/packet_out.feature +3 -3
- data/features/parser.feature +10 -0
- data/lib/pio/arp/format.rb +20 -0
- data/lib/pio/ipv4_header.rb +20 -0
- data/lib/pio/open_flow.rb +0 -1
- data/lib/pio/open_flow/message.rb +51 -57
- data/lib/pio/open_flow/open_flow_header.rb +6 -10
- data/lib/pio/open_flow10.rb +20 -15
- data/lib/pio/open_flow10/aggregate_stats/reply.rb +20 -0
- data/lib/pio/open_flow10/aggregate_stats/request.rb +25 -0
- data/lib/pio/open_flow10/barrier/reply.rb +14 -0
- data/lib/pio/open_flow10/barrier/request.rb +14 -0
- data/lib/pio/open_flow10/description_stats/reply.rb +21 -0
- data/lib/pio/open_flow10/description_stats/request.rb +19 -0
- data/lib/pio/open_flow10/echo/reply.rb +16 -0
- data/lib/pio/open_flow10/echo/request.rb +16 -0
- data/lib/pio/open_flow10/error/bad_request.rb +27 -49
- data/lib/pio/open_flow10/error/hello_failed.rb +6 -28
- data/lib/pio/open_flow10/exact_match.rb +4 -39
- data/lib/pio/open_flow10/features/reply.rb +48 -72
- data/lib/pio/open_flow10/features/request.rb +4 -11
- data/lib/pio/open_flow10/flow_mod.rb +21 -51
- data/lib/pio/open_flow10/{flow_stats_reply.rb → flow_stats/reply.rb} +7 -23
- data/lib/pio/open_flow10/flow_stats/request.rb +25 -0
- data/lib/pio/open_flow10/hello.rb +3 -13
- data/lib/pio/open_flow10/match.rb +0 -18
- data/lib/pio/open_flow10/match10.rb +22 -0
- data/lib/pio/open_flow10/packet_in.rb +18 -42
- data/lib/pio/open_flow10/packet_out.rb +8 -31
- data/lib/pio/open_flow10/port_status.rb +11 -39
- data/lib/pio/open_flow10/stats_reply.rb +11 -8
- data/lib/pio/open_flow10/stats_request.rb +8 -8
- data/lib/pio/open_flow13.rb +13 -6
- data/lib/pio/open_flow13/echo/reply.rb +15 -0
- data/lib/pio/open_flow13/echo/request.rb +15 -0
- data/lib/pio/open_flow13/error/bad_request.rb +32 -49
- data/lib/pio/open_flow13/error/hello_failed.rb +7 -30
- data/lib/pio/open_flow13/features/reply.rb +27 -51
- data/lib/pio/open_flow13/features/request.rb +3 -10
- data/lib/pio/open_flow13/flow_mod.rb +29 -52
- data/lib/pio/open_flow13/hello.rb +18 -22
- data/lib/pio/open_flow13/packet_in.rb +26 -44
- data/lib/pio/open_flow13/packet_out.rb +16 -35
- data/lib/pio/open_flow13/stats_request.rb +5 -21
- data/lib/pio/parser.rb +5 -4
- data/lib/pio/version.rb +1 -1
- data/pio.gemspec +6 -6
- data/spec/pio/open_flow10/{echo_reply_spec.rb → echo/reply_spec.rb} +1 -1
- data/spec/pio/open_flow10/{echo_request_spec.rb → echo/request_spec.rb} +1 -1
- data/spec/pio/open_flow10/error/hello_failed_spec.rb +2 -2
- data/spec/pio/open_flow10/features/request_spec.rb +0 -5
- data/spec/pio/open_flow10/flow_mod_spec.rb +2 -4
- data/spec/pio/open_flow10/flow_stats_reply_spec.rb +1 -1
- data/spec/pio/open_flow10/flow_stats_request_spec.rb +2 -2
- data/spec/pio/open_flow10/packet_out_spec.rb +15 -18
- data/spec/pio/open_flow13/echo_reply_spec.rb +1 -1
- data/spec/pio/open_flow13/echo_request_spec.rb +1 -1
- data/spec/pio/open_flow13/error/hello_failed_spec.rb +2 -2
- data/spec/pio/open_flow13/features/request_spec.rb +5 -3
- data/spec/pio/open_flow13/hello_spec.rb +3 -3
- data/spec/support/shared_examples_for_openflow_messages.rb +5 -12
- metadata +92 -85
- data/lib/pio/open_flow/echo.rb +0 -44
- data/lib/pio/open_flow/format.rb +0 -46
- data/lib/pio/open_flow10/aggregate_stats_reply.rb +0 -38
- data/lib/pio/open_flow10/aggregate_stats_request.rb +0 -42
- data/lib/pio/open_flow10/barrier_reply.rb +0 -21
- data/lib/pio/open_flow10/barrier_request.rb +0 -22
- data/lib/pio/open_flow10/description_stats_reply.rb +0 -35
- data/lib/pio/open_flow10/description_stats_request.rb +0 -36
- data/lib/pio/open_flow10/echo.rb +0 -20
- data/lib/pio/open_flow10/flow_stats_request.rb +0 -64
- data/lib/pio/open_flow13/echo.rb +0 -20
- data/lib/pio/open_flow13/features.rb +0 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'pio/open_flow'
|
1
|
+
require 'pio/open_flow/message'
|
2
2
|
|
3
3
|
module Pio
|
4
4
|
module OpenFlow10
|
@@ -6,17 +6,10 @@ module Pio
|
|
6
6
|
class Features
|
7
7
|
# Features Request message.
|
8
8
|
class Request < OpenFlow::Message
|
9
|
-
|
10
|
-
|
11
|
-
extend OpenFlow::Format
|
9
|
+
open_flow_header version: 1, message_type: 5
|
10
|
+
string :body, length: 0
|
12
11
|
|
13
|
-
|
14
|
-
string :body, value: ''
|
15
|
-
|
16
|
-
def user_data
|
17
|
-
body
|
18
|
-
end
|
19
|
-
end
|
12
|
+
alias_method :user_data, :body
|
20
13
|
end
|
21
14
|
end
|
22
15
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'pio/open_flow'
|
2
2
|
require 'pio/open_flow10/actions'
|
3
|
-
require 'pio/open_flow10/
|
3
|
+
require 'pio/open_flow10/match10'
|
4
4
|
|
5
|
-
# Base module.
|
6
5
|
module Pio
|
7
6
|
module OpenFlow10
|
8
7
|
# OpenFlow 1.0 Flow Mod message.
|
@@ -29,55 +28,26 @@ module Pio
|
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
actions :actions, length: -> { header.length - 72 }
|
53
|
-
|
54
|
-
def empty?
|
55
|
-
false
|
56
|
-
end
|
57
|
-
|
58
|
-
def length
|
59
|
-
64 + actions.binary.length
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# OpenFlow 1.0 Flow Mod message format.
|
64
|
-
class Format < BinData::Record
|
65
|
-
extend OpenFlow::Format
|
66
|
-
|
67
|
-
header version: 1, message_type: 14
|
68
|
-
body :body
|
69
|
-
end
|
70
|
-
|
71
|
-
body_option :actions
|
72
|
-
body_option :buffer_id
|
73
|
-
body_option :command
|
74
|
-
body_option :cookie
|
75
|
-
body_option :flags
|
76
|
-
body_option :hard_timeout
|
77
|
-
body_option :idle_timeout
|
78
|
-
body_option :match
|
79
|
-
body_option :out_port
|
80
|
-
body_option :priority
|
31
|
+
extend OpenFlow::Flags
|
32
|
+
|
33
|
+
flags_16bit :flags,
|
34
|
+
[:send_flow_rem,
|
35
|
+
:check_overwrap,
|
36
|
+
:emerg]
|
37
|
+
|
38
|
+
open_flow_header version: 1,
|
39
|
+
message_type: 14,
|
40
|
+
message_length: -> { 72 + actions.binary.length }
|
41
|
+
match10 :match
|
42
|
+
uint64 :cookie
|
43
|
+
command :command
|
44
|
+
uint16 :idle_timeout
|
45
|
+
uint16 :hard_timeout
|
46
|
+
uint16 :priority
|
47
|
+
uint32 :buffer_id
|
48
|
+
uint16 :out_port
|
49
|
+
flags :flags
|
50
|
+
actions :actions, length: -> { message_length - 72 }
|
81
51
|
end
|
82
52
|
end
|
83
53
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'pio/open_flow10/actions'
|
2
|
+
require 'pio/open_flow10/match10'
|
2
3
|
require 'pio/open_flow10/stats_type'
|
3
4
|
|
4
|
-
# Base module.
|
5
5
|
module Pio
|
6
|
-
# OpenFlow 1.0 messages
|
7
6
|
module OpenFlow10
|
8
7
|
# OpenFlow 1.0 FlowStats messages
|
9
8
|
module FlowStats
|
@@ -31,28 +30,13 @@ module Pio
|
|
31
30
|
actions :actions, length: -> { entry_length - 88 }
|
32
31
|
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
stats_type :stats_type, value: -> { :flow }
|
39
|
-
uint16 :flags
|
40
|
-
array(:stats,
|
41
|
-
type: :flow_stats_entry,
|
42
|
-
read_until: :eof)
|
43
|
-
|
44
|
-
def length
|
45
|
-
4 + stats.to_binary_s.length
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# OpenFlow 1.0 Flow Stats Reply message format.
|
50
|
-
class Format < BinData::Record
|
51
|
-
extend OpenFlow::Format
|
33
|
+
open_flow_header version: 1,
|
34
|
+
message_type: 17,
|
35
|
+
message_length: -> { 12 + stats.to_binary_s.length }
|
52
36
|
|
53
|
-
|
54
|
-
|
55
|
-
|
37
|
+
stats_type :stats_type, value: -> { :flow }
|
38
|
+
uint16 :flags
|
39
|
+
array :stats, type: :flow_stats_entry, read_until: :eof
|
56
40
|
end
|
57
41
|
end
|
58
42
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pio/open_flow/message'
|
2
|
+
require 'pio/open_flow10/match10'
|
3
|
+
require 'pio/open_flow10/stats_type'
|
4
|
+
|
5
|
+
module Pio
|
6
|
+
module OpenFlow10
|
7
|
+
# OpenFlow 1.0 FlowStats messages
|
8
|
+
module FlowStats
|
9
|
+
# OpenFlow 1.0 Flow Stats Request message
|
10
|
+
class Request < OpenFlow::Message
|
11
|
+
open_flow_header version: 1,
|
12
|
+
message_type: 16,
|
13
|
+
message_length: 56
|
14
|
+
|
15
|
+
stats_type :stats_type, value: -> { :flow }
|
16
|
+
uint16 :flags
|
17
|
+
match10 :match
|
18
|
+
uint8 :table_id, initial_value: 0xff
|
19
|
+
string :padding, length: 1
|
20
|
+
hide :padding
|
21
|
+
port16 :out_port, initial_value: -> { :none }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,23 +1,13 @@
|
|
1
|
-
require 'pio/open_flow/format'
|
2
1
|
require 'pio/open_flow/message'
|
3
2
|
|
4
|
-
# Base module.
|
5
3
|
module Pio
|
6
|
-
# OpenFlow 1.0 messages
|
7
4
|
module OpenFlow10
|
8
5
|
# Hello message
|
9
6
|
class Hello < OpenFlow::Message
|
10
|
-
|
11
|
-
|
12
|
-
extend OpenFlow::Format
|
7
|
+
open_flow_header version: 1, message_type: 0
|
8
|
+
string :body, length: 0
|
13
9
|
|
14
|
-
|
15
|
-
string :body
|
16
|
-
|
17
|
-
def user_data
|
18
|
-
body
|
19
|
-
end
|
20
|
-
end
|
10
|
+
alias_method :user_data, :body
|
21
11
|
end
|
22
12
|
end
|
23
13
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'English'
|
2
2
|
require 'bindata'
|
3
|
-
require 'pio/open_flow'
|
4
3
|
require 'pio/type/ip_address'
|
5
4
|
require 'pio/type/mac_address'
|
6
5
|
|
@@ -161,22 +160,5 @@ module Pio
|
|
161
160
|
@format.__send__ method, *args, &block
|
162
161
|
end
|
163
162
|
end
|
164
|
-
|
165
|
-
# Pio::MatchFormat wrapper.
|
166
|
-
class Match10 < BinData::Primitive
|
167
|
-
endian :big
|
168
|
-
|
169
|
-
string :match,
|
170
|
-
read_length: 40,
|
171
|
-
initial_value: Pio::OpenFlow10::Match.new.to_binary_s
|
172
|
-
|
173
|
-
def set(object)
|
174
|
-
self.match = object.to_binary_s
|
175
|
-
end
|
176
|
-
|
177
|
-
def get
|
178
|
-
Pio::OpenFlow10::Match.read match
|
179
|
-
end
|
180
|
-
end
|
181
163
|
end
|
182
164
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'pio/open_flow10/match'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# Pio::MatchFormat wrapper.
|
6
|
+
class Match10 < BinData::Primitive
|
7
|
+
endian :big
|
8
|
+
|
9
|
+
string :match,
|
10
|
+
read_length: 40,
|
11
|
+
initial_value: Pio::OpenFlow10::Match.new.to_binary_s
|
12
|
+
|
13
|
+
def set(object)
|
14
|
+
self.match = object.to_binary_s
|
15
|
+
end
|
16
|
+
|
17
|
+
def get
|
18
|
+
Pio::OpenFlow10::Match.read match
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -4,7 +4,6 @@ require 'pio/open_flow'
|
|
4
4
|
require 'pio/parse_error'
|
5
5
|
require 'pio/parser'
|
6
6
|
|
7
|
-
# Base module.
|
8
7
|
module Pio
|
9
8
|
module OpenFlow10
|
10
9
|
# OpenFlow 1.0 Packet-In message
|
@@ -25,55 +24,32 @@ module Pio
|
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
@data ||= Pio::Parser.read(raw_data)
|
42
|
-
end
|
43
|
-
|
44
|
-
def empty?
|
45
|
-
false
|
46
|
-
end
|
47
|
-
|
48
|
-
def length
|
49
|
-
10 + raw_data.length
|
50
|
-
end
|
51
|
-
|
52
|
-
def lldp?
|
53
|
-
data.is_a? Lldp
|
54
|
-
end
|
55
|
-
|
56
|
-
def method_missing(method, *args)
|
57
|
-
data.__send__(method, *args).snapshot
|
58
|
-
end
|
27
|
+
open_flow_header version: 1,
|
28
|
+
message_type: 10,
|
29
|
+
message_length: -> { 18 + raw_data.length }
|
30
|
+
uint32 :buffer_id
|
31
|
+
uint16 :total_len, value: -> { raw_data.length }
|
32
|
+
uint16 :in_port
|
33
|
+
reason :reason
|
34
|
+
uint8 :padding
|
35
|
+
hide :padding
|
36
|
+
string :raw_data, read_length: :total_len
|
37
|
+
|
38
|
+
def data
|
39
|
+
@data ||= Pio::Parser.read(raw_data)
|
59
40
|
end
|
60
41
|
|
61
|
-
|
62
|
-
|
63
|
-
|
42
|
+
def lldp?
|
43
|
+
data.is_a? Lldp
|
44
|
+
end
|
64
45
|
|
65
|
-
|
66
|
-
|
46
|
+
def method_missing(method, *args)
|
47
|
+
data.__send__(method, *args).snapshot
|
67
48
|
end
|
68
49
|
|
69
50
|
attr_accessor :datapath_id
|
70
51
|
alias_method :dpid, :datapath_id
|
71
52
|
alias_method :dpid=, :datapath_id=
|
72
|
-
|
73
|
-
body_option :buffer_id
|
74
|
-
body_option :in_port
|
75
|
-
body_option :reason
|
76
|
-
body_option :raw_data
|
77
53
|
end
|
78
54
|
end
|
79
55
|
end
|
@@ -6,37 +6,14 @@ module Pio
|
|
6
6
|
module OpenFlow10
|
7
7
|
# OpenFlow 1.0 Packet-Out message
|
8
8
|
class PacketOut < OpenFlow::Message
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
uint16 :actions_len, initial_value: -> { actions.binary.length }
|
18
|
-
actions :actions, length: -> { actions_len }
|
19
|
-
rest :raw_data
|
20
|
-
|
21
|
-
def empty?
|
22
|
-
false
|
23
|
-
end
|
24
|
-
|
25
|
-
def length
|
26
|
-
8 + actions_len + raw_data.length
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
extend OpenFlow::Format
|
31
|
-
|
32
|
-
header version: 1, message_type: 13
|
33
|
-
body :body
|
34
|
-
end
|
35
|
-
|
36
|
-
body_option :buffer_id
|
37
|
-
body_option :in_port
|
38
|
-
body_option :actions
|
39
|
-
body_option :raw_data
|
9
|
+
open_flow_header version: 1,
|
10
|
+
message_type: 13,
|
11
|
+
message_length: -> { 16 + actions_len + raw_data.length }
|
12
|
+
uint32 :buffer_id
|
13
|
+
uint16 :in_port
|
14
|
+
uint16 :actions_len, initial_value: -> { actions.binary.length }
|
15
|
+
actions :actions, length: -> { actions_len }
|
16
|
+
rest :raw_data
|
40
17
|
end
|
41
18
|
end
|
42
19
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'pio/open_flow'
|
1
|
+
require 'pio/open_flow/message'
|
2
2
|
|
3
|
-
# Base module.
|
4
3
|
module Pio
|
5
|
-
# OpenFlow 1.0 messages
|
6
4
|
module OpenFlow10
|
7
5
|
# OpenFlow 1.0 Port Status message
|
8
6
|
class PortStatus < OpenFlow::Message
|
@@ -21,51 +19,25 @@ module Pio
|
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
open_flow_header version: 1,
|
23
|
+
message_type: 12,
|
24
|
+
message_length: 10
|
25
|
+
reason :reason
|
26
|
+
uint56 :padding
|
27
|
+
hide :padding
|
28
|
+
phy_port16 :desc
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
hide :padding
|
31
|
-
phy_port16 :desc
|
32
|
-
end
|
33
|
-
|
34
|
-
# OpenFlow 1.0 Flow Mod message format.
|
35
|
-
class Format < BinData::Record
|
36
|
-
extend OpenFlow::Format
|
37
|
-
|
38
|
-
header version: 1, message_type: 12
|
39
|
-
body :body
|
40
|
-
|
41
|
-
def reason
|
42
|
-
body.reason.to_sym
|
43
|
-
end
|
30
|
+
def reason
|
31
|
+
@format.reason.to_sym
|
44
32
|
end
|
45
33
|
|
46
34
|
attr_writer :datapath_id
|
47
35
|
|
48
36
|
def desc
|
49
|
-
@desc ||= @format.
|
37
|
+
@desc ||= @format.desc.snapshot
|
50
38
|
@desc.instance_variable_set :@datapath_id, @datapath_id
|
51
39
|
@desc
|
52
40
|
end
|
53
|
-
|
54
|
-
# rubocop:disable MethodLength
|
55
|
-
def initialize(user_options = {})
|
56
|
-
header_options = parse_header_options(user_options)
|
57
|
-
body_options = if user_options.respond_to?(:fetch)
|
58
|
-
user_options.delete :transaction_id
|
59
|
-
user_options.delete :xid
|
60
|
-
dpid = user_options[:dpid]
|
61
|
-
user_options[:datapath_id] = dpid if dpid
|
62
|
-
user_options
|
63
|
-
else
|
64
|
-
''
|
65
|
-
end
|
66
|
-
@format = Format.new(header: header_options, body: body_options)
|
67
|
-
end
|
68
|
-
# rubocop:enable MethodLength
|
69
41
|
end
|
70
42
|
end
|
71
43
|
end
|