pio 0.27.1 → 0.27.2
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/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
@@ -8,28 +8,24 @@ module Pio
|
|
8
8
|
|
9
9
|
uint8 :ofp_version
|
10
10
|
uint8 :message_type
|
11
|
-
uint16 :
|
11
|
+
uint16 :message_length
|
12
12
|
transaction_id :transaction_id
|
13
13
|
rest :body
|
14
|
-
|
15
|
-
def length
|
16
|
-
_length
|
17
|
-
end
|
18
14
|
end
|
19
15
|
|
20
16
|
# OpenFlow message header.
|
21
|
-
class
|
17
|
+
class OfpHeader < BinData::Record
|
22
18
|
endian :big
|
23
19
|
|
24
|
-
uint8 :ofp_version, value: :
|
25
|
-
virtual assert: -> { ofp_version ==
|
20
|
+
uint8 :ofp_version, value: :version_value
|
21
|
+
virtual assert: -> { ofp_version == version_value }
|
26
22
|
uint8 :message_type, value: :message_type_value
|
27
23
|
virtual assert: -> { message_type == message_type_value }
|
28
|
-
uint16 :
|
24
|
+
uint16 :message_length, initial_value: -> { length + body_length }
|
29
25
|
transaction_id :transaction_id, initial_value: 0
|
30
26
|
|
31
27
|
def length
|
32
|
-
|
28
|
+
8
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
data/lib/pio/open_flow10.rb
CHANGED
@@ -1,24 +1,29 @@
|
|
1
|
-
|
2
|
-
require 'pio/open_flow10/
|
3
|
-
require 'pio/open_flow10/
|
4
|
-
require 'pio/open_flow10/
|
5
|
-
require 'pio/open_flow10/
|
6
|
-
require 'pio/open_flow10/
|
7
|
-
require 'pio/open_flow10/
|
1
|
+
# Messages
|
2
|
+
require 'pio/open_flow10/stats_reply'
|
3
|
+
require 'pio/open_flow10/aggregate_stats/reply'
|
4
|
+
require 'pio/open_flow10/aggregate_stats/request'
|
5
|
+
require 'pio/open_flow10/barrier/reply'
|
6
|
+
require 'pio/open_flow10/barrier/request'
|
7
|
+
require 'pio/open_flow10/description_stats/reply'
|
8
|
+
require 'pio/open_flow10/description_stats/request'
|
9
|
+
require 'pio/open_flow10/echo/reply'
|
10
|
+
require 'pio/open_flow10/echo/request'
|
8
11
|
require 'pio/open_flow10/error'
|
9
12
|
require 'pio/open_flow10/error/bad_request'
|
10
13
|
require 'pio/open_flow10/error/hello_failed'
|
11
|
-
require 'pio/open_flow10/
|
12
|
-
require 'pio/open_flow10/features'
|
14
|
+
require 'pio/open_flow10/features/reply'
|
15
|
+
require 'pio/open_flow10/features/request'
|
13
16
|
require 'pio/open_flow10/flow_mod'
|
14
|
-
require 'pio/open_flow10/
|
15
|
-
require 'pio/open_flow10/
|
17
|
+
require 'pio/open_flow10/flow_stats/reply'
|
18
|
+
require 'pio/open_flow10/flow_stats/request'
|
16
19
|
require 'pio/open_flow10/hello'
|
17
20
|
require 'pio/open_flow10/packet_in'
|
18
21
|
require 'pio/open_flow10/packet_out'
|
19
|
-
require 'pio/open_flow10/phy_port16'
|
20
|
-
require 'pio/open_flow10/port16'
|
21
22
|
require 'pio/open_flow10/port_status'
|
22
|
-
require 'pio/open_flow10/send_out_port'
|
23
|
-
require 'pio/open_flow10/stats_reply'
|
24
23
|
require 'pio/open_flow10/stats_request'
|
24
|
+
|
25
|
+
# Actions
|
26
|
+
require 'pio/open_flow10/send_out_port'
|
27
|
+
|
28
|
+
# Misc.
|
29
|
+
require 'pio/open_flow10/exact_match'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'pio/open_flow10/stats_type'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# Aggregate Stats messages
|
6
|
+
module AggregateStats
|
7
|
+
# Aggregate Stats Reply message
|
8
|
+
class Reply < OpenFlow::Message
|
9
|
+
open_flow_header version: 1, message_type: 17, message_length: 32
|
10
|
+
stats_type :stats_type, value: -> { :aggregate }
|
11
|
+
uint16 :flags
|
12
|
+
uint64 :packet_count
|
13
|
+
uint64 :byte_count
|
14
|
+
uint32 :flow_count
|
15
|
+
string :padding, length: 4
|
16
|
+
hide :padding
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'pio/open_flow/message'
|
2
|
+
require 'pio/open_flow10/match10'
|
3
|
+
require 'pio/open_flow10/port16'
|
4
|
+
require 'pio/open_flow10/stats_type'
|
5
|
+
|
6
|
+
module Pio
|
7
|
+
module OpenFlow10
|
8
|
+
# OpenFlow 1.0 Aggregate Stats messages
|
9
|
+
module AggregateStats
|
10
|
+
# OpenFlow 1.0 Aggregate Stats Request message
|
11
|
+
class Request < OpenFlow::Message
|
12
|
+
open_flow_header version: 1,
|
13
|
+
message_type: 16,
|
14
|
+
message_length: 56
|
15
|
+
stats_type :stats_type, value: -> { :aggregate }
|
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'pio/open_flow/message'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# OpenFlow 1.0 Barrier messages
|
6
|
+
module Barrier
|
7
|
+
# OpenFlow 1.0 Barrier Request message
|
8
|
+
class Reply < OpenFlow::Message
|
9
|
+
open_flow_header version: 1, message_type: 19
|
10
|
+
string :body, value: ''
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'pio/open_flow/message'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# OpenFlow 1.0 Barrier messages
|
6
|
+
module Barrier
|
7
|
+
# OpenFlow 1.0 Barrier Request message
|
8
|
+
class Request < OpenFlow::Message
|
9
|
+
open_flow_header version: 1, message_type: 18
|
10
|
+
string :body, value: ''
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'pio/open_flow10/stats_type'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# OpenFlow 1.0 Description Stats messages
|
6
|
+
module DescriptionStats
|
7
|
+
# OpenFlow 1.0 Description Stats Reply message
|
8
|
+
class Reply < OpenFlow::Message
|
9
|
+
open_flow_header version: 1, message_type: 17, message_length: 1068
|
10
|
+
stats_type :stats_type, value: -> { :description }
|
11
|
+
uint16 :flags
|
12
|
+
|
13
|
+
stringz :manufacturer, length: 256
|
14
|
+
stringz :hardware, length: 256
|
15
|
+
stringz :software, length: 256
|
16
|
+
stringz :serial_number, length: 32
|
17
|
+
stringz :datapath, length: 256
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'pio/open_flow10/stats_type'
|
2
|
+
require 'pio/open_flow/message'
|
3
|
+
|
4
|
+
module Pio
|
5
|
+
module OpenFlow10
|
6
|
+
# OpenFlow 1.0 Description Stats messages
|
7
|
+
module DescriptionStats
|
8
|
+
# OpenFlow 1.0 Description Stats Request message
|
9
|
+
class Request < OpenFlow::Message
|
10
|
+
open_flow_header version: 1,
|
11
|
+
message_type: 16,
|
12
|
+
message_length: 12
|
13
|
+
stats_type :stats_type, value: -> { :description }
|
14
|
+
uint16 :flags
|
15
|
+
string :body, value: ''
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'pio/open_flow/message'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# OpenFlow 1.0 Echo Request and Reply message.
|
6
|
+
module Echo
|
7
|
+
# OpenFlow 1.0 Echo Reply message.
|
8
|
+
class Reply < OpenFlow::Message
|
9
|
+
open_flow_header version: 1, message_type: 3
|
10
|
+
string :body, read_length: -> { message_length - 8 }
|
11
|
+
|
12
|
+
alias_method :user_data, :body
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'pio/open_flow/message'
|
2
|
+
|
3
|
+
module Pio
|
4
|
+
module OpenFlow10
|
5
|
+
# OpenFlow 1.0 Echo Request and Reply message.
|
6
|
+
module Echo
|
7
|
+
# OpenFlow 1.0 Echo Request message.
|
8
|
+
class Request < OpenFlow::Message
|
9
|
+
open_flow_header version: 1, message_type: 2
|
10
|
+
string :body, read_length: -> { message_length - 8 }
|
11
|
+
|
12
|
+
alias_method :user_data, :body
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'bindata'
|
2
|
-
require 'pio/open_flow/format'
|
3
1
|
require 'pio/open_flow/message'
|
4
2
|
require 'pio/open_flow10/error/error_type10'
|
5
3
|
|
@@ -8,58 +6,38 @@ module Pio
|
|
8
6
|
module Error
|
9
7
|
# Bad request error.
|
10
8
|
class BadRequest < OpenFlow::Message
|
11
|
-
#
|
12
|
-
class
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
uint16 :error_code
|
31
|
-
|
32
|
-
def get
|
33
|
-
ERROR_CODES.invert.fetch(error_code)
|
34
|
-
end
|
35
|
-
|
36
|
-
def set(value)
|
37
|
-
self.error_code = ERROR_CODES.fetch(value)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
endian :big
|
42
|
-
|
43
|
-
error_type10 :error_type, value: -> { :bad_request }
|
44
|
-
bad_request_code :error_code
|
45
|
-
rest :raw_data
|
46
|
-
|
47
|
-
def length
|
48
|
-
4 + raw_data.length
|
49
|
-
end
|
9
|
+
# enum ofp_bad_request_code
|
10
|
+
class BadRequestCode < BinData::Primitive
|
11
|
+
ERROR_CODES = {
|
12
|
+
bad_version: 0,
|
13
|
+
bad_type: 1,
|
14
|
+
bad_stats: 2,
|
15
|
+
bad_vendor: 3,
|
16
|
+
bad_subtype: 4,
|
17
|
+
permissions_error: 5,
|
18
|
+
bad_length: 6,
|
19
|
+
buffer_empty: 7,
|
20
|
+
buffer_unknown: 8
|
21
|
+
}
|
22
|
+
|
23
|
+
endian :big
|
24
|
+
uint16 :error_code
|
25
|
+
|
26
|
+
def get
|
27
|
+
ERROR_CODES.invert.fetch(error_code)
|
50
28
|
end
|
51
29
|
|
52
|
-
|
53
|
-
|
54
|
-
header version: 1, message_type: 1
|
55
|
-
body :body
|
56
|
-
|
57
|
-
def length
|
58
|
-
8 + body.length
|
30
|
+
def set(value)
|
31
|
+
self.error_code = ERROR_CODES.fetch(value)
|
59
32
|
end
|
60
33
|
end
|
61
34
|
|
62
|
-
|
35
|
+
open_flow_header version: 1,
|
36
|
+
message_type: 1,
|
37
|
+
message_length: -> { 12 + raw_data.length }
|
38
|
+
error_type10 :error_type, value: -> { :bad_request }
|
39
|
+
bad_request_code :error_code
|
40
|
+
rest :raw_data
|
63
41
|
end
|
64
42
|
end
|
65
43
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'pio/open_flow/format'
|
2
1
|
require 'pio/open_flow/hello_failed_code'
|
3
2
|
require 'pio/open_flow/message'
|
4
3
|
require 'pio/open_flow10/error/error_type10'
|
@@ -8,33 +7,12 @@ module Pio
|
|
8
7
|
module Error
|
9
8
|
# Hello failed error.
|
10
9
|
class HelloFailed < OpenFlow::Message
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
error_type10 :error_type
|
18
|
-
hello_failed_code :error_code
|
19
|
-
rest :description
|
20
|
-
|
21
|
-
def length
|
22
|
-
4 + description.length
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
extend OpenFlow::Format
|
27
|
-
|
28
|
-
header version: 1, message_type: 1
|
29
|
-
body :body
|
30
|
-
|
31
|
-
def length
|
32
|
-
8 + body.length
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
body_option :error_code
|
37
|
-
body_option :description
|
10
|
+
open_flow_header version: 1,
|
11
|
+
message_type: 1,
|
12
|
+
message_length: -> { 12 + description.length }
|
13
|
+
error_type10 :error_type
|
14
|
+
hello_failed_code :error_code
|
15
|
+
rest :description
|
38
16
|
end
|
39
17
|
end
|
40
18
|
end
|
@@ -1,49 +1,14 @@
|
|
1
1
|
require 'pio/open_flow10/match'
|
2
|
-
require 'pio/parser'
|
3
2
|
|
4
3
|
module Pio
|
5
4
|
# OpenFlow 1.0 exact match
|
6
5
|
class ExactMatch
|
7
|
-
# rubocop:disable MethodLength
|
8
|
-
# rubocop:disable AbcSize
|
9
6
|
def initialize(packet_in)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
in_port: packet_in.in_port,
|
15
|
-
ether_source_address: packet_in.source_mac,
|
16
|
-
ether_destination_address: packet_in.destination_mac,
|
17
|
-
vlan_vid: data.vlan_vid,
|
18
|
-
vlan_priority: data.vlan_pcp,
|
19
|
-
ether_type: data.ether_type,
|
20
|
-
ip_tos: data.ip_type_of_service,
|
21
|
-
ip_protocol: data.ip_protocol,
|
22
|
-
ip_source_address: data.ip_source_address,
|
23
|
-
ip_destination_address: data.ip_destination_address,
|
24
|
-
transport_source_port: data.transport_source_port,
|
25
|
-
transport_destination_port: data.transport_destination_port
|
26
|
-
}
|
27
|
-
when Arp::Request
|
28
|
-
options = {
|
29
|
-
in_port: packet_in.in_port,
|
30
|
-
ether_source_address: packet_in.source_mac,
|
31
|
-
ether_destination_address: packet_in.destination_mac,
|
32
|
-
vlan_vid: data.vlan_vid,
|
33
|
-
vlan_priority: data.vlan_pcp,
|
34
|
-
ether_type: data.ether_type,
|
35
|
-
ip_tos: 0,
|
36
|
-
ip_protocol: data.operation,
|
37
|
-
ip_source_address: data.sender_protocol_address,
|
38
|
-
ip_destination_address: data.target_protocol_address,
|
39
|
-
transport_source_port: 0,
|
40
|
-
transport_destination_port: 0
|
41
|
-
}
|
42
|
-
end
|
43
|
-
@match = Pio::Match.new(options)
|
7
|
+
@match = packet_in.data.to_exact_match(packet_in.in_port)
|
8
|
+
rescue NoMethodError
|
9
|
+
raise NotImplementedError,
|
10
|
+
"#{packet_in.data.class} is not yet supported by ExactMatch."
|
44
11
|
end
|
45
|
-
# rubocop:enable MethodLength
|
46
|
-
# rubocop:enable AbcSize
|
47
12
|
|
48
13
|
def method_missing(method, *args, &block)
|
49
14
|
@match.__send__ method, *args, &block
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'pio/open_flow'
|
2
2
|
require 'pio/open_flow10/phy_port16'
|
3
|
+
require 'pio/open_flow10/port16'
|
3
4
|
|
4
5
|
module Pio
|
5
6
|
module OpenFlow10
|
@@ -7,89 +8,64 @@ module Pio
|
|
7
8
|
class Features
|
8
9
|
# OpenFlow 1.0 Features Reply message.
|
9
10
|
class Reply < OpenFlow::Message
|
10
|
-
|
11
|
-
class Body < BinData::Record
|
12
|
-
extend OpenFlow::Flags
|
11
|
+
extend OpenFlow::Flags
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
# enum ofp_capabilities
|
14
|
+
flags_32bit :capabilities,
|
15
|
+
[:flow_stats,
|
16
|
+
:table_stats,
|
17
|
+
:port_stats,
|
18
|
+
:stp,
|
19
|
+
:reserved,
|
20
|
+
:ip_reasm,
|
21
|
+
:queue_stats,
|
22
|
+
:arp_match_ip]
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
24
|
+
# enum ofp_action_type
|
25
|
+
flags_32bit :actions_flag,
|
26
|
+
[:output,
|
27
|
+
:set_vlan_vid,
|
28
|
+
:set_vlan_pcp,
|
29
|
+
:strip_vlan,
|
30
|
+
:set_ether_source_address,
|
31
|
+
:set_ether_destination_address,
|
32
|
+
:set_ip_source_address,
|
33
|
+
:set_ip_destination_address,
|
34
|
+
:set_ip_tos,
|
35
|
+
:set_transport_source_port,
|
36
|
+
:set_transport_destination_port,
|
37
|
+
:enqueue]
|
39
38
|
|
40
|
-
|
39
|
+
open_flow_header version: 1,
|
40
|
+
message_type: 6,
|
41
|
+
message_length: -> { 32 + ports.to_binary_s.length }
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
datapath_id :datapath_id
|
44
|
+
uint32 :n_buffers
|
45
|
+
uint8 :n_tables
|
46
|
+
uint24 :padding
|
47
|
+
hide :padding
|
48
|
+
capabilities :capabilities
|
49
|
+
actions_flag :actions
|
50
|
+
array :ports, type: :phy_port16, read_until: :eof
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def length
|
56
|
-
24 + ports.to_binary_s.length
|
57
|
-
end
|
52
|
+
def datapath_id
|
53
|
+
@format.datapath_id.to_i
|
58
54
|
end
|
55
|
+
alias_method :dpid, :datapath_id
|
59
56
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
header version: 1, message_type: 6
|
65
|
-
body :body
|
66
|
-
|
67
|
-
def ports
|
68
|
-
body.snapshot.ports.map do |each|
|
69
|
-
each.instance_variable_set :@datapath_id, datapath_id
|
70
|
-
each
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def physical_ports
|
75
|
-
ports.select do |each|
|
76
|
-
each.port_no <= Port16::MAX
|
77
|
-
end
|
57
|
+
def ports
|
58
|
+
snapshot.ports.map do |each|
|
59
|
+
each.instance_variable_set :@datapath_id, datapath_id
|
60
|
+
each
|
78
61
|
end
|
62
|
+
end
|
79
63
|
|
80
|
-
|
81
|
-
|
64
|
+
def physical_ports
|
65
|
+
ports.select do |each|
|
66
|
+
each.port_no <= OpenFlow10::Port16::MAX
|
82
67
|
end
|
83
|
-
alias_method :dpid, :datapath_id
|
84
68
|
end
|
85
|
-
|
86
|
-
body_option :dpid
|
87
|
-
body_option :datapath_id
|
88
|
-
body_option :n_buffers
|
89
|
-
body_option :n_tables
|
90
|
-
body_option :capabilities
|
91
|
-
body_option :actions
|
92
|
-
body_option :ports
|
93
69
|
end
|
94
70
|
end
|
95
71
|
end
|