pio 0.19.0 → 0.20.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 +9 -0
- data/README.md +20 -18
- data/features/{packet_data/arp-storm.pcap → arp-storm.pcap} +0 -0
- data/features/arp.feature +1 -1
- data/features/{packet_data/arp.pcap → arp.pcap} +0 -0
- data/features/dhcp.feature +210 -3
- data/features/{packet_data/dhcp.pcap → dhcp.pcap} +0 -0
- data/features/icmp.feature +1 -1
- data/features/{packet_data/icmp.pcap → icmp.pcap} +0 -0
- data/features/{packet_data/lldp.detailed.pcap → lldp.detailed.pcap} +0 -0
- data/features/lldp.feature +5 -5
- data/features/{packet_data/lldp.minimal.pcap → lldp.minimal.pcap} +0 -0
- data/features/{packet_data → open_flow10}/aggregate_stats_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/aggregate_stats_request.raw +0 -0
- data/features/{packet_data → open_flow10}/barrier_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/barrier_request.raw +0 -0
- data/features/{packet_data → open_flow10}/desc_stats_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/desc_stats_request.raw +0 -0
- data/features/open_flow10/echo_reply.feature +10 -10
- data/features/{packet_data → open_flow10}/echo_reply.raw +0 -0
- data/features/open_flow10/echo_request.feature +10 -10
- data/features/{packet_data → open_flow10}/echo_request.raw +0 -0
- data/features/{packet_data → open_flow10}/error.raw +0 -0
- data/features/open_flow10/exact_match.feature +33 -33
- data/features/open_flow10/features_reply.feature +71 -71
- data/features/{packet_data → open_flow10}/features_reply.raw +0 -0
- data/features/open_flow10/features_request.feature +9 -9
- data/features/{packet_data → open_flow10}/features_request.raw +0 -0
- data/features/open_flow10/flow_mod.feature +167 -167
- data/features/{packet_data → open_flow10}/flow_mod_add.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_mod_delete.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_mod_delete_strict.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_mod_modify.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_mod_modify_strict.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_removed.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_stats_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/flow_stats_request.raw +0 -0
- data/features/{packet_data → open_flow10}/get_config_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/get_config_request.raw +0 -0
- data/features/open_flow10/hello.feature +9 -9
- data/features/{packet_data → open_flow10}/hello.raw +0 -0
- data/features/open_flow10/packet_in.feature +4 -4
- data/features/{packet_data → open_flow10}/packet_in_arp_request.raw +0 -0
- data/features/{packet_data → open_flow10}/packet_in_cbench.raw +0 -0
- data/features/open_flow10/packet_out.feature +3 -3
- data/features/{packet_data → open_flow10}/packet_out.raw +0 -0
- data/features/{packet_data → open_flow10}/port_mod.raw +0 -0
- data/features/{packet_data → open_flow10}/port_stats_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/port_stats_request.raw +0 -0
- data/features/open_flow10/port_status.feature +3 -3
- data/features/{packet_data → open_flow10}/port_status.raw +0 -0
- data/features/{packet_data → open_flow10}/queue_get_config_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/queue_get_config_request.raw +0 -0
- data/features/{packet_data → open_flow10}/set_config.raw +0 -0
- data/features/{packet_data → open_flow10}/table_stats_reply.raw +0 -0
- data/features/{packet_data → open_flow10}/table_stats_request.raw +0 -0
- data/features/{packet_data → open_flow10}/vendor.raw +0 -0
- data/features/{packet_data → open_flow10}/vendor_stats_request.raw +0 -0
- data/features/open_flow13/echo_reply.feature +64 -61
- data/features/{packet_data/echo13_reply_body.raw → open_flow13/echo_reply_body.raw} +0 -0
- data/features/{packet_data/echo13_reply_no_body.raw → open_flow13/echo_reply_no_body.raw} +0 -0
- data/features/open_flow13/echo_request.feature +64 -61
- data/features/{packet_data/echo13_request_body.raw → open_flow13/echo_request_body.raw} +0 -0
- data/features/{packet_data/echo13_request_no_body.raw → open_flow13/echo_request_no_body.raw} +0 -0
- data/features/open_flow13/features_reply.feature +53 -0
- data/features/open_flow13/features_reply.raw +0 -0
- data/features/open_flow13/features_request.feature +89 -0
- data/features/open_flow13/features_request.raw +0 -0
- data/features/open_flow13/hello.feature +26 -23
- data/features/{packet_data/hello13_no_version_bitmap.raw → open_flow13/hello_no_version_bitmap.raw} +0 -0
- data/features/{packet_data/hello13_version_bitmap.raw → open_flow13/hello_version_bitmap.raw} +0 -0
- data/features/step_definitions/open_flow_steps.rb +3 -0
- data/features/step_definitions/packet_data_steps.rb +9 -9
- data/features/udp.feature +3 -3
- data/features/{packet_data/udp_no_payload.raw → udp_no_payload.raw} +0 -0
- data/features/{packet_data/udp_with_payload.raw → udp_with_payload.raw} +0 -0
- data/lib/pio.rb +1 -9
- data/lib/pio/open_flow/actions.rb +8 -8
- data/lib/pio/open_flow/open_flow_header.rb +10 -0
- data/lib/pio/open_flow10.rb +15 -0
- data/lib/pio/open_flow10/echo.rb +15 -0
- data/lib/pio/open_flow10/exact_match.rb +51 -0
- data/lib/pio/{features.rb → open_flow10/features.rb} +8 -7
- data/lib/pio/{flow_mod.rb → open_flow10/flow_mod.rb} +1 -1
- data/lib/pio/{hello.rb → open_flow10/hello.rb} +0 -0
- data/lib/pio/{match.rb → open_flow10/match.rb} +46 -43
- data/lib/pio/{packet_in.rb → open_flow10/packet_in.rb} +0 -0
- data/lib/pio/{packet_out.rb → open_flow10/packet_out.rb} +0 -0
- data/lib/pio/{port_status.rb → open_flow10/port_status.rb} +0 -0
- data/lib/pio/open_flow13.rb +12 -0
- data/lib/pio/{echo.rb → open_flow13/echo.rb} +9 -13
- data/lib/pio/open_flow13/features_reply.rb +91 -0
- data/lib/pio/open_flow13/features_request.rb +54 -0
- data/lib/pio/{hello13.rb → open_flow13/hello.rb} +4 -1
- data/lib/pio/{set_eth_addr.rb → set_ether_address.rb} +7 -7
- data/lib/pio/{set_ip_addr.rb → set_ip_address.rb} +7 -7
- data/lib/pio/set_ip_tos.rb +1 -1
- data/lib/pio/set_transport_port.rb +2 -2
- data/lib/pio/version.rb +1 -1
- data/pio.gemspec +2 -2
- data/spec/pio/flow_mod_spec.rb +45 -45
- data/spec/pio/match_spec.rb +122 -120
- data/spec/pio/{hello13_spec.rb → open_flow13/hello_spec.rb} +11 -11
- data/spec/pio/packet_out_spec.rb +19 -19
- data/spec/pio/set_ether_destination_address_spec.rb +28 -0
- data/spec/pio/set_ether_source_address_spec.rb +28 -0
- data/spec/pio/set_ip_destination_address_spec.rb +27 -0
- data/spec/pio/set_ip_source_address_spec.rb +25 -0
- data/spec/pio/set_transport_destination_port_spec.rb +44 -0
- data/spec/pio/set_transport_source_port_spec.rb +44 -0
- data/spec/pio/wildcards_spec.rb +23 -21
- metadata +179 -165
- data/bin/byebug +0 -16
- data/lib/pio/exact_match.rb +0 -51
- data/spec/pio/set_eth_dst_addr_spec.rb +0 -28
- data/spec/pio/set_eth_src_addr_spec.rb +0 -28
- data/spec/pio/set_ip_dst_addr_spec.rb +0 -25
- data/spec/pio/set_ip_src_addr_spec.rb +0 -25
- data/spec/pio/set_transport_dst_port_spec.rb +0 -42
- data/spec/pio/set_transport_src_port_spec.rb +0 -42
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'forwardable'
|
1
2
|
require 'pio/open_flow'
|
2
3
|
|
3
4
|
module Pio
|
@@ -30,13 +31,13 @@ module Pio
|
|
30
31
|
:set_vlan_vid,
|
31
32
|
:set_vlan_pcp,
|
32
33
|
:strip_vlan,
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
34
|
+
:set_ether_source_address,
|
35
|
+
:set_ether_destination_address,
|
36
|
+
:set_ip_source_address,
|
37
|
+
:set_ip_destination_address,
|
38
|
+
:set_ip_tos,
|
39
|
+
:set_transport_source_port,
|
40
|
+
:set_transport_destination_port,
|
40
41
|
:enqueue]
|
41
42
|
|
42
43
|
endian :big
|
File without changes
|
@@ -11,32 +11,32 @@ module Pio
|
|
11
11
|
class Wildcards < BinData::Primitive
|
12
12
|
BITS = {
|
13
13
|
in_port: 1 << 0,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
14
|
+
vlan_vid: 1 << 1,
|
15
|
+
ether_source_address: 1 << 2,
|
16
|
+
ether_destination_address: 1 << 3,
|
17
|
+
ether_type: 1 << 4,
|
18
|
+
ip_protocol: 1 << 5,
|
19
|
+
transport_source_port: 1 << 6,
|
20
|
+
transport_destination_port: 1 << 7,
|
21
|
+
ip_source_address: 0,
|
22
|
+
ip_source_address0: 1 << 8,
|
23
|
+
ip_source_address1: 1 << 9,
|
24
|
+
ip_source_address2: 1 << 10,
|
25
|
+
ip_source_address3: 1 << 11,
|
26
|
+
ip_source_address4: 1 << 12,
|
27
|
+
ip_source_address_all: 1 << 13,
|
28
|
+
ip_destination_address: 0,
|
29
|
+
ip_destination_address0: 1 << 14,
|
30
|
+
ip_destination_address1: 1 << 15,
|
31
|
+
ip_destination_address2: 1 << 16,
|
32
|
+
ip_destination_address3: 1 << 17,
|
33
|
+
ip_destination_address4: 1 << 18,
|
34
|
+
ip_destination_address_all: 1 << 19,
|
35
|
+
vlan_priority: 1 << 20,
|
36
|
+
ip_tos: 1 << 21
|
37
37
|
}
|
38
|
-
NW_FLAGS = [:
|
39
|
-
FLAGS = BITS.keys.select { |each| !(/^
|
38
|
+
NW_FLAGS = [:ip_source_address, :ip_destination_address]
|
39
|
+
FLAGS = BITS.keys.select { |each| !(/^ip_(source|destination)/=~ each) }
|
40
40
|
|
41
41
|
endian :big
|
42
42
|
|
@@ -46,7 +46,7 @@ module Pio
|
|
46
46
|
def get
|
47
47
|
BITS.each_with_object(Hash.new(0)) do |(key, bit), memo|
|
48
48
|
next if flags & bit == 0
|
49
|
-
if /(
|
49
|
+
if /(ip_source_address|ip_destination_address)(\d)/=~ key
|
50
50
|
memo[$LAST_MATCH_INFO[1].intern] |= 1 << $LAST_MATCH_INFO[2].to_i
|
51
51
|
else
|
52
52
|
memo[key] = true
|
@@ -57,22 +57,23 @@ module Pio
|
|
57
57
|
def set(params)
|
58
58
|
self.flags = params.inject(0) do |memo, (key, val)|
|
59
59
|
memo | case key
|
60
|
-
when :
|
61
|
-
(params.fetch(key) & 31) <<
|
60
|
+
when :ip_source_address, :ip_destination_address
|
61
|
+
(params.fetch(key) & 31) <<
|
62
|
+
(key == :ip_source_address ? 8 : 14)
|
62
63
|
else
|
63
64
|
val ? BITS.fetch(key) : 0
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
def
|
69
|
-
get.fetch(:
|
69
|
+
def ip_source_address
|
70
|
+
get.fetch(:ip_source_address)
|
70
71
|
rescue KeyError
|
71
72
|
0
|
72
73
|
end
|
73
74
|
|
74
|
-
def
|
75
|
-
get.fetch(:
|
75
|
+
def ip_destination_address
|
76
|
+
get.fetch(:ip_destination_address)
|
76
77
|
rescue KeyError
|
77
78
|
0
|
78
79
|
end
|
@@ -105,21 +106,23 @@ module Pio
|
|
105
106
|
|
106
107
|
wildcards :wildcards
|
107
108
|
uint16 :in_port
|
108
|
-
mac_address :
|
109
|
-
mac_address :
|
110
|
-
uint16 :
|
111
|
-
uint8 :
|
109
|
+
mac_address :ether_source_address
|
110
|
+
mac_address :ether_destination_address
|
111
|
+
uint16 :vlan_vid
|
112
|
+
uint8 :vlan_priority
|
112
113
|
uint8 :padding1
|
113
114
|
hide :padding1
|
114
|
-
uint16 :
|
115
|
-
uint8 :
|
116
|
-
uint8 :
|
115
|
+
uint16 :ether_type
|
116
|
+
uint8 :ip_tos
|
117
|
+
uint8 :ip_protocol
|
117
118
|
uint16 :padding2
|
118
119
|
hide :padding2
|
119
|
-
match_ip_address :
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
match_ip_address :ip_source_address,
|
121
|
+
bitcount: -> { wildcards.ip_source_address }
|
122
|
+
match_ip_address :ip_destination_address,
|
123
|
+
bitcount: -> { wildcards.ip_destination_address }
|
124
|
+
uint16 :transport_source_port
|
125
|
+
uint16 :transport_destination_port
|
123
126
|
end
|
124
127
|
|
125
128
|
def self.read(binary)
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Pio
|
2
|
+
# OpenFlow specific types.
|
3
|
+
module OpenFlow
|
4
|
+
remove_const :VERSION
|
5
|
+
VERSION = 4
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'pio/open_flow13/echo'
|
10
|
+
require 'pio/open_flow13/features_reply'
|
11
|
+
require 'pio/open_flow13/features_request'
|
12
|
+
require 'pio/open_flow13/hello'
|
@@ -1,19 +1,11 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
require 'pio/open_flow'
|
3
3
|
|
4
|
+
# Base module.
|
4
5
|
module Pio
|
5
|
-
|
6
|
-
module Echo
|
7
|
-
# OpenFlow 1.0 Echo Request message.
|
8
|
-
class Request; end
|
9
|
-
OpenFlow::Message.factory(Request, OpenFlow::ECHO_REQUEST)
|
10
|
-
|
11
|
-
# OpenFlow 1.0 Echo Reply message.
|
12
|
-
class Reply; end
|
13
|
-
OpenFlow::Message.factory(Reply, OpenFlow::ECHO_REPLY)
|
14
|
-
end
|
6
|
+
remove_const :Echo
|
15
7
|
|
16
|
-
module
|
8
|
+
module Echo
|
17
9
|
# Base class of Echo Request and Reply.
|
18
10
|
class Message
|
19
11
|
def self.message_name
|
@@ -54,12 +46,16 @@ module Pio
|
|
54
46
|
def_delegators :open_flow_header, :message_length
|
55
47
|
def_delegators :open_flow_header, :transaction_id
|
56
48
|
def_delegator :open_flow_header, :transaction_id, :xid
|
49
|
+
|
50
|
+
def to_binary
|
51
|
+
to_binary_s
|
52
|
+
end
|
57
53
|
end
|
58
54
|
|
59
55
|
# OpenFlow 1.3 Echo Request message.
|
60
56
|
class Request < Message
|
61
57
|
# OpenFlow 1.3 Echo Request message format.
|
62
|
-
class Format <
|
58
|
+
class Format < Echo::Format
|
63
59
|
endian :big
|
64
60
|
open_flow_header :open_flow_header,
|
65
61
|
ofp_version_value: 4, message_type_value: 2
|
@@ -70,7 +66,7 @@ module Pio
|
|
70
66
|
# OpenFlow 1.3 Echo Reply message.
|
71
67
|
class Reply < Message
|
72
68
|
# OpenFlow 1.3 Echo Request message format.
|
73
|
-
class Format <
|
69
|
+
class Format < Echo::Format
|
74
70
|
endian :big
|
75
71
|
open_flow_header :open_flow_header,
|
76
72
|
ofp_version_value: 4, message_type_value: 3
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'pio/open_flow'
|
3
|
+
|
4
|
+
# Base module.
|
5
|
+
module Pio
|
6
|
+
# OpenFlow 1.3 Features Request and Reply message.
|
7
|
+
class Features
|
8
|
+
remove_const :Reply
|
9
|
+
|
10
|
+
# OpenFlow 1.3 Features Reply message.
|
11
|
+
class Reply
|
12
|
+
# OpenFlow 1.3 Features Reply message body.
|
13
|
+
class Body < BinData::Record
|
14
|
+
extend OpenFlow::Flags
|
15
|
+
|
16
|
+
flags_32bit(:capabilities,
|
17
|
+
[:flow_stats,
|
18
|
+
:table_stats,
|
19
|
+
:port_stats,
|
20
|
+
:group_stats,
|
21
|
+
:NOT_USED,
|
22
|
+
:ip_reasm,
|
23
|
+
:queue_stats,
|
24
|
+
:NOT_USED,
|
25
|
+
:port_blocked])
|
26
|
+
|
27
|
+
endian :big
|
28
|
+
|
29
|
+
uint64 :datapath_id
|
30
|
+
uint32 :n_buffers
|
31
|
+
uint8 :n_tables
|
32
|
+
uint8 :auxiliary_id
|
33
|
+
uint16 :padding
|
34
|
+
hide :padding
|
35
|
+
capabilities :capabilities
|
36
|
+
uint32 :reserved
|
37
|
+
|
38
|
+
def length
|
39
|
+
24
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# OpenFlow 1.3 Features Reply message format.
|
44
|
+
class Format < BinData::Record
|
45
|
+
extend Forwardable
|
46
|
+
|
47
|
+
endian :big
|
48
|
+
open_flow_header(:open_flow_header,
|
49
|
+
ofp_version_value: 4, message_type_value: 6)
|
50
|
+
body :body
|
51
|
+
|
52
|
+
def_delegators :open_flow_header, :ofp_version
|
53
|
+
def_delegators :open_flow_header, :message_type
|
54
|
+
def_delegators :open_flow_header, :message_length
|
55
|
+
def_delegators :open_flow_header, :transaction_id
|
56
|
+
def_delegator :open_flow_header, :transaction_id, :xid
|
57
|
+
def_delegators :body, :datapath_id
|
58
|
+
def_delegators :body, :n_buffers
|
59
|
+
def_delegators :body, :n_tables
|
60
|
+
def_delegators :body, :auxiliary_id
|
61
|
+
def_delegators :body, :capabilities
|
62
|
+
def_delegators :body, :reserved
|
63
|
+
|
64
|
+
def dpid
|
65
|
+
datapath_id
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.read(raw_data)
|
70
|
+
allocate.tap do |message|
|
71
|
+
message.instance_variable_set(:@format, Format.read(raw_data))
|
72
|
+
end
|
73
|
+
rescue BinData::ValidityError
|
74
|
+
raise Pio::ParseError, 'Invalid Features Reply 1.3 message.'
|
75
|
+
end
|
76
|
+
|
77
|
+
def initialize(user_attrs = {})
|
78
|
+
header_options = OpenFlowHeader::Options.parse(user_attrs)
|
79
|
+
body_options = user_attrs.dup
|
80
|
+
body_options[:datapath_id] =
|
81
|
+
body_options[:dpid] || body_options[:datapath_id]
|
82
|
+
@format = Format.new(open_flow_header: header_options,
|
83
|
+
body: body_options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def method_missing(method, *args, &block)
|
87
|
+
@format.__send__ method, *args, &block
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'pio/open_flow'
|
3
|
+
|
4
|
+
# Base module.
|
5
|
+
module Pio
|
6
|
+
# OpenFlow 1.3 Features Request and Reply message.
|
7
|
+
class Features
|
8
|
+
remove_const :Request
|
9
|
+
|
10
|
+
# OpenFlow 1.3 Features Request message.
|
11
|
+
class Request
|
12
|
+
# OpenFlow 1.3 Features Request message format.
|
13
|
+
class Format < BinData::Record
|
14
|
+
extend Forwardable
|
15
|
+
|
16
|
+
endian :big
|
17
|
+
open_flow_header(:open_flow_header,
|
18
|
+
ofp_version_value: 4, message_type_value: 5)
|
19
|
+
string :body, value: ''
|
20
|
+
|
21
|
+
def_delegators :open_flow_header, :ofp_version
|
22
|
+
def_delegators :open_flow_header, :message_type
|
23
|
+
def_delegators :open_flow_header, :message_length
|
24
|
+
def_delegators :open_flow_header, :transaction_id
|
25
|
+
def_delegator :open_flow_header, :transaction_id, :xid
|
26
|
+
|
27
|
+
def to_binary
|
28
|
+
to_binary_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.read(raw_data)
|
33
|
+
allocate.tap do |message|
|
34
|
+
message.instance_variable_set(:@format, Format.read(raw_data))
|
35
|
+
end
|
36
|
+
rescue BinData::ValidityError
|
37
|
+
raise Pio::ParseError, 'Invalid Features Request 1.3 message.'
|
38
|
+
end
|
39
|
+
|
40
|
+
def initialize(user_attrs = {})
|
41
|
+
unknown_attrs = user_attrs.keys - [:transaction_id, :xid]
|
42
|
+
unless unknown_attrs.empty?
|
43
|
+
fail "Unknown keyword: #{unknown_attrs.first}"
|
44
|
+
end
|
45
|
+
header_options = OpenFlowHeader::Options.parse(user_attrs)
|
46
|
+
@format = Format.new(open_flow_header: header_options)
|
47
|
+
end
|
48
|
+
|
49
|
+
def method_missing(method, *args, &block)
|
50
|
+
@format.__send__ method, *args, &block
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -3,9 +3,12 @@ require 'forwardable'
|
|
3
3
|
require 'pio/open_flow'
|
4
4
|
require 'pio/parse_error'
|
5
5
|
|
6
|
+
# Base module.
|
6
7
|
module Pio
|
8
|
+
remove_const :Hello
|
9
|
+
|
7
10
|
# OpenFlow 1.3 Hello message parser and generator
|
8
|
-
class
|
11
|
+
class Hello
|
9
12
|
# ofp_hello_elem_header and value
|
10
13
|
class Element < BinData::Record
|
11
14
|
VERSION_BITMAP = 1
|
@@ -4,7 +4,7 @@ require 'pio/type/mac_address'
|
|
4
4
|
|
5
5
|
module Pio
|
6
6
|
# An action to modify the source/destination Ethernet address of a packet.
|
7
|
-
class
|
7
|
+
class SetEtherAddress
|
8
8
|
# rubocop:disable MethodLength
|
9
9
|
def self.def_format(action_type)
|
10
10
|
str = %(
|
@@ -23,10 +23,10 @@ module Pio
|
|
23
23
|
# rubocop:enable MethodLength
|
24
24
|
|
25
25
|
def self.read(raw_data)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
set_ether_address = allocate
|
27
|
+
set_ether_address.instance_variable_set(:@format,
|
28
|
+
const_get(:Format).read(raw_data))
|
29
|
+
set_ether_address
|
30
30
|
end
|
31
31
|
|
32
32
|
extend Forwardable
|
@@ -41,12 +41,12 @@ module Pio
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# An action to modify the source Ethernet address of a packet.
|
44
|
-
class
|
44
|
+
class SetEtherSourceAddr < SetEtherAddress
|
45
45
|
def_format 4
|
46
46
|
end
|
47
47
|
|
48
48
|
# An action to modify the destination Ethernet address of a packet.
|
49
|
-
class
|
49
|
+
class SetEtherDestinationAddr < SetEtherAddress
|
50
50
|
def_format 5
|
51
51
|
end
|
52
52
|
end
|
@@ -4,7 +4,7 @@ require 'pio/type/ip_address'
|
|
4
4
|
|
5
5
|
module Pio
|
6
6
|
# An action to modify the IPv4 source/destination address of a packet.
|
7
|
-
class
|
7
|
+
class SetIpAddress
|
8
8
|
def self.def_format(action_type)
|
9
9
|
str = %(
|
10
10
|
class Format < BinData::Record
|
@@ -19,10 +19,10 @@ module Pio
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.read(raw_data)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
set_ip_address = allocate
|
23
|
+
set_ip_address.instance_variable_set(:@format,
|
24
|
+
const_get(:Format).read(raw_data))
|
25
|
+
set_ip_address
|
26
26
|
end
|
27
27
|
|
28
28
|
extend Forwardable
|
@@ -38,12 +38,12 @@ module Pio
|
|
38
38
|
end
|
39
39
|
|
40
40
|
# An action to modify the IPv4 source address of a packet.
|
41
|
-
class
|
41
|
+
class SetIpSourceAddress < SetIpAddress
|
42
42
|
def_format 6
|
43
43
|
end
|
44
44
|
|
45
45
|
# An action to modify the IPv4 source address of a packet.
|
46
|
-
class
|
46
|
+
class SetIpDestinationAddress < SetIpAddress
|
47
47
|
def_format 7
|
48
48
|
end
|
49
49
|
end
|