openflow-protocol 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openflow-protocol.rb +2 -1
- data/lib/openflow-protocol/actions/action.rb +30 -0
- data/lib/openflow-protocol/actions/action_enqueue.rb +16 -0
- data/lib/openflow-protocol/actions/action_output.rb +14 -0
- data/lib/openflow-protocol/actions/action_set_destination_port.rb +7 -0
- data/lib/openflow-protocol/actions/action_set_ip_destination.rb +7 -0
- data/lib/openflow-protocol/actions/action_set_ip_source.rb +13 -0
- data/lib/openflow-protocol/actions/action_set_ip_tos.rb +15 -0
- data/lib/openflow-protocol/actions/action_set_mac_destination.rb +7 -0
- data/lib/openflow-protocol/actions/action_set_mac_source.rb +15 -0
- data/lib/openflow-protocol/actions/action_set_source_port.rb +15 -0
- data/lib/openflow-protocol/actions/action_set_vlan_id.rb +15 -0
- data/lib/openflow-protocol/actions/action_set_vlan_pcp.rb +15 -0
- data/lib/openflow-protocol/actions/action_strip_vlan.rb +14 -0
- data/lib/openflow-protocol/actions/action_vendor.rb +13 -0
- data/lib/openflow-protocol/actions/actions.rb +9 -0
- data/lib/openflow-protocol/helpers/array_of_subclasses.rb +42 -0
- data/lib/openflow-protocol/helpers/superclass_base.rb +26 -0
- data/lib/openflow-protocol/messages/barrier_reply.rb +7 -0
- data/lib/openflow-protocol/messages/barrier_request.rb +7 -0
- data/lib/openflow-protocol/messages/echo_reply.rb +13 -0
- data/lib/openflow-protocol/messages/echo_request.rb +13 -0
- data/lib/openflow-protocol/messages/error.rb +69 -0
- data/lib/openflow-protocol/messages/features_reply.rb +44 -0
- data/lib/openflow-protocol/messages/features_request.rb +7 -0
- data/lib/openflow-protocol/messages/flow_mod.rb +24 -0
- data/lib/openflow-protocol/messages/flow_removed.rb +27 -0
- data/lib/openflow-protocol/messages/get_config_reply.rb +16 -0
- data/lib/openflow-protocol/messages/get_config_request.rb +7 -0
- data/lib/openflow-protocol/messages/hello.rb +7 -0
- data/lib/openflow-protocol/messages/message.rb +49 -0
- data/lib/openflow-protocol/messages/packet_in.rb +27 -0
- data/lib/openflow-protocol/messages/packet_out.rb +17 -0
- data/lib/openflow-protocol/messages/parser.rb +26 -0
- data/lib/openflow-protocol/messages/port_mod.rb +19 -0
- data/lib/openflow-protocol/messages/port_status.rb +18 -0
- data/lib/openflow-protocol/messages/queue_get_config_reply.rb +18 -0
- data/lib/openflow-protocol/messages/queue_get_config_request.rb +15 -0
- data/lib/openflow-protocol/messages/set_config.rb +7 -0
- data/lib/openflow-protocol/messages/statistics.rb +28 -0
- data/lib/openflow-protocol/messages/statistics/aggregate_statistics_reply.rb +14 -0
- data/lib/openflow-protocol/messages/statistics/aggregate_statistics_request.rb +7 -0
- data/lib/openflow-protocol/messages/statistics/description_statistics.rb +32 -0
- data/lib/openflow-protocol/messages/statistics/flow_statistics_reply.rb +25 -0
- data/lib/openflow-protocol/messages/statistics/flow_statistics_request.rb +14 -0
- data/lib/openflow-protocol/messages/statistics/port_statistics_reply.rb +24 -0
- data/lib/openflow-protocol/messages/statistics/port_statistics_request.rb +12 -0
- data/lib/openflow-protocol/messages/statistics/queue_statistics_reply.rb +16 -0
- data/lib/openflow-protocol/messages/statistics/queue_statistics_request.rb +13 -0
- data/lib/openflow-protocol/messages/statistics/table_statistics.rb +20 -0
- data/lib/openflow-protocol/messages/statistics/vendor_statistics.rb +11 -0
- data/lib/openflow-protocol/messages/statistics_reply.rb +26 -0
- data/lib/openflow-protocol/messages/statistics_request.rb +18 -0
- data/lib/openflow-protocol/messages/vendor.rb +14 -0
- data/lib/openflow-protocol/structs/match.rb +106 -0
- data/lib/openflow-protocol/structs/packet_queue.rb +14 -0
- data/lib/openflow-protocol/structs/physical_port.rb +50 -0
- data/lib/openflow-protocol/structs/port_number.rb +49 -0
- data/lib/openflow-protocol/structs/queue_properties/queue_properties.rb +9 -0
- data/lib/openflow-protocol/structs/queue_properties/queue_property.rb +20 -0
- data/lib/openflow-protocol/structs/queue_properties/queue_property_min_rate.rb +30 -0
- data/lib/openflow-protocol/structs/queue_properties/queue_property_none.rb +7 -0
- data/lib/openflow-protocol/version.rb +1 -1
- data/spec/actions/action_enqueue_spec.rb +4 -6
- data/spec/actions/action_output_spec.rb +4 -6
- data/spec/actions/action_set_destination_port_spec.rb +4 -6
- data/spec/actions/action_set_ip_destination_spec.rb +4 -6
- data/spec/actions/action_set_ip_source_spec.rb +4 -6
- data/spec/actions/action_set_ip_tos_spec.rb +4 -6
- data/spec/actions/action_set_mac_destination_spec.rb +4 -6
- data/spec/actions/action_set_mac_source_spec.rb +4 -6
- data/spec/actions/action_set_source_port_spec.rb +4 -6
- data/spec/actions/action_set_vlan_id_spec.rb +4 -6
- data/spec/actions/action_set_vlan_pcp_spec.rb +4 -6
- data/spec/actions/action_strip_vlan_spec.rb +3 -5
- data/spec/actions/action_vendor_spec.rb +4 -6
- data/spec/actions/actions_spec.rb +6 -8
- data/spec/messages/barrier_reply_spec.rb +9 -11
- data/spec/messages/barrier_request_spec.rb +9 -11
- data/spec/messages/echo_reply_spec.rb +13 -15
- data/spec/messages/echo_request_spec.rb +16 -18
- data/spec/messages/error_spec.rb +23 -20
- data/spec/messages/features_reply_spec.rb +11 -13
- data/spec/messages/features_request_spec.rb +9 -11
- data/spec/messages/flow_mod_spec.rb +12 -14
- data/spec/messages/flow_removed_spec.rb +9 -11
- data/spec/messages/get_config_reply_spec.rb +9 -11
- data/spec/messages/get_config_request_spec.rb +9 -11
- data/spec/messages/hello_spec.rb +9 -11
- data/spec/messages/packet_in_spec.rb +9 -11
- data/spec/messages/packet_out_spec.rb +10 -12
- data/spec/messages/parser_spec.rb +7 -9
- data/spec/messages/port_mod_spec.rb +9 -11
- data/spec/messages/port_status_spec.rb +10 -12
- data/spec/messages/queue_get_config_reply_spec.rb +9 -11
- data/spec/messages/queue_get_config_request_spec.rb +9 -11
- data/spec/messages/set_config_spec.rb +9 -11
- data/spec/messages/statistics/aggregate_statistics_reply_spec.rb +4 -6
- data/spec/messages/statistics/aggregate_statistics_request_spec.rb +4 -6
- data/spec/messages/statistics/description_statistics_spec.rb +11 -9
- data/spec/messages/statistics/flow_statistics_reply_spec.rb +4 -6
- data/spec/messages/statistics/flow_statistics_request_spec.rb +4 -6
- data/spec/messages/statistics/port_statistics_reply_spec.rb +4 -6
- data/spec/messages/statistics/port_statistics_request_spec.rb +4 -6
- data/spec/messages/statistics/queue_statistics_reply_spec.rb +4 -6
- data/spec/messages/statistics/queue_statistics_request_spec.rb +4 -6
- data/spec/messages/statistics/table_statistics_spec.rb +4 -6
- data/spec/messages/statistics/vendor_statistics_spec.rb +4 -6
- data/spec/messages/statistics_reply_spec.rb +62 -64
- data/spec/messages/statistics_request_spec.rb +45 -47
- data/spec/messages/vendor_spec.rb +13 -15
- data/spec/spec_helper.rb +1 -1
- data/spec/structs/match_spec.rb +7 -9
- data/spec/structs/packet_queue_spec.rb +5 -7
- data/spec/structs/physical_port_spec.rb +16 -18
- data/spec/structs/port_number_spec.rb +11 -13
- data/spec/structs/queue_properties/queue_properties_spec.rb +5 -7
- data/spec/structs/queue_properties/queue_property_min_rate_spec.rb +5 -7
- data/spec/structs/queue_properties/queue_property_none_spec.rb +3 -5
- metadata +78 -64
- data/lib/actions/action.rb +0 -26
- data/lib/actions/action_enqueue.rb +0 -12
- data/lib/actions/action_output.rb +0 -10
- data/lib/actions/action_set_destination_port.rb +0 -3
- data/lib/actions/action_set_ip_destination.rb +0 -3
- data/lib/actions/action_set_ip_source.rb +0 -9
- data/lib/actions/action_set_ip_tos.rb +0 -11
- data/lib/actions/action_set_mac_destination.rb +0 -3
- data/lib/actions/action_set_mac_source.rb +0 -11
- data/lib/actions/action_set_source_port.rb +0 -11
- data/lib/actions/action_set_vlan_id.rb +0 -11
- data/lib/actions/action_set_vlan_pcp.rb +0 -11
- data/lib/actions/action_strip_vlan.rb +0 -10
- data/lib/actions/action_vendor.rb +0 -9
- data/lib/actions/actions.rb +0 -5
- data/lib/helpers/array_of_subclasses.rb +0 -38
- data/lib/helpers/superclass_base.rb +0 -24
- data/lib/messages/barrier_reply.rb +0 -3
- data/lib/messages/barrier_request.rb +0 -3
- data/lib/messages/echo_reply.rb +0 -9
- data/lib/messages/echo_request.rb +0 -9
- data/lib/messages/error.rb +0 -61
- data/lib/messages/features_reply.rb +0 -40
- data/lib/messages/features_request.rb +0 -3
- data/lib/messages/flow_mod.rb +0 -20
- data/lib/messages/flow_removed.rb +0 -23
- data/lib/messages/get_config_reply.rb +0 -12
- data/lib/messages/get_config_request.rb +0 -3
- data/lib/messages/hello.rb +0 -3
- data/lib/messages/message.rb +0 -45
- data/lib/messages/packet_in.rb +0 -23
- data/lib/messages/packet_out.rb +0 -13
- data/lib/messages/parser.rb +0 -22
- data/lib/messages/port_mod.rb +0 -15
- data/lib/messages/port_status.rb +0 -14
- data/lib/messages/queue_get_config_reply.rb +0 -14
- data/lib/messages/queue_get_config_request.rb +0 -11
- data/lib/messages/set_config.rb +0 -3
- data/lib/messages/statistics.rb +0 -24
- data/lib/messages/statistics/aggregate_statistics_reply.rb +0 -10
- data/lib/messages/statistics/aggregate_statistics_request.rb +0 -3
- data/lib/messages/statistics/description_statistics.rb +0 -28
- data/lib/messages/statistics/flow_statistics_reply.rb +0 -21
- data/lib/messages/statistics/flow_statistics_request.rb +0 -10
- data/lib/messages/statistics/port_statistics_reply.rb +0 -20
- data/lib/messages/statistics/port_statistics_request.rb +0 -8
- data/lib/messages/statistics/queue_statistics_reply.rb +0 -12
- data/lib/messages/statistics/queue_statistics_request.rb +0 -9
- data/lib/messages/statistics/table_statistics.rb +0 -16
- data/lib/messages/statistics/vendor_statistics.rb +0 -7
- data/lib/messages/statistics_reply.rb +0 -22
- data/lib/messages/statistics_request.rb +0 -14
- data/lib/messages/vendor.rb +0 -10
- data/lib/structs/match.rb +0 -102
- data/lib/structs/packet_queue.rb +0 -10
- data/lib/structs/physical_port.rb +0 -46
- data/lib/structs/port_number.rb +0 -45
- data/lib/structs/queue_properties/queue_properties.rb +0 -5
- data/lib/structs/queue_properties/queue_property.rb +0 -16
- data/lib/structs/queue_properties/queue_property_min_rate.rb +0 -26
- data/lib/structs/queue_properties/queue_property_none.rb +0 -3
data/lib/actions/actions.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'bindata'
|
2
|
-
|
3
|
-
class ArrayOfSubclasses < BinData::Primitive
|
4
|
-
default_parameter length: 0
|
5
|
-
endian :big
|
6
|
-
string :binary, read_length: :length
|
7
|
-
|
8
|
-
def get
|
9
|
-
items = []
|
10
|
-
tmp = binary
|
11
|
-
until tmp.empty?
|
12
|
-
type_index = BinData::Uint16be.read(tmp)
|
13
|
-
type_str = types.fetch(type_index)
|
14
|
-
class_name = name + type_str.to_s.split('_').map(&:capitalize).join
|
15
|
-
klass = Object.const_get class_name
|
16
|
-
item = klass.read(tmp)
|
17
|
-
items << item
|
18
|
-
tmp = tmp[item.len..-1]
|
19
|
-
end
|
20
|
-
items
|
21
|
-
end
|
22
|
-
|
23
|
-
def set(value)
|
24
|
-
self.binary = value.map(&:to_binary_s).join
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def name
|
30
|
-
plural = self.class.to_s
|
31
|
-
return plural[0..-4] + 'y' if plural[-3..-1] == 'ies'
|
32
|
-
plural[0..-2]
|
33
|
-
end
|
34
|
-
|
35
|
-
def types
|
36
|
-
Object.const_get(name + '::TYPES')
|
37
|
-
end
|
38
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'bindata'
|
2
|
-
require 'bindata-contrib'
|
3
|
-
|
4
|
-
class SuperclassBase < BinData::Record
|
5
|
-
attr_reader :type_str
|
6
|
-
|
7
|
-
endian :big
|
8
|
-
|
9
|
-
def initialize_instance
|
10
|
-
super
|
11
|
-
if self.class.name[2..7] == 'Action'
|
12
|
-
name = self.class.name[8..-1]
|
13
|
-
elsif self.class.name[2..14] == 'QueueProperty'
|
14
|
-
name = self.class.name[15..-1]
|
15
|
-
else
|
16
|
-
name = self.class.name[2..-1]
|
17
|
-
end
|
18
|
-
@type_str = name.gsub(/([A-Z])/, '_\1')[1..-1].downcase
|
19
|
-
end
|
20
|
-
|
21
|
-
def body_length
|
22
|
-
0
|
23
|
-
end
|
24
|
-
end
|
data/lib/messages/echo_reply.rb
DELETED
data/lib/messages/error.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require_relative 'message'
|
2
|
-
|
3
|
-
class OFError < OFMessage
|
4
|
-
TYPES = [
|
5
|
-
:hello_failed,
|
6
|
-
:bad_request,
|
7
|
-
:bad_action,
|
8
|
-
:flow_mod_failed,
|
9
|
-
:port_mod_failed,
|
10
|
-
:queue_op_failed
|
11
|
-
]
|
12
|
-
HELLO_FAILED_CODES = [:incompatible, :eperm]
|
13
|
-
BAD_REQUEST_CODES = [
|
14
|
-
:bad_version,
|
15
|
-
:bad_type,
|
16
|
-
:bad_stat,
|
17
|
-
:bad_vendor,
|
18
|
-
:bad_sub_type,
|
19
|
-
:eperm,
|
20
|
-
:bad_length,
|
21
|
-
:buffer_empty,
|
22
|
-
:buffer_unknown
|
23
|
-
]
|
24
|
-
BAD_ACTION_CODES = [
|
25
|
-
:bad_type,
|
26
|
-
:bad_length,
|
27
|
-
:bad_vendor,
|
28
|
-
:bad_vendor_type,
|
29
|
-
:bad_out_port,
|
30
|
-
:bad_argument,
|
31
|
-
:eperm,
|
32
|
-
:too_many,
|
33
|
-
:bad_queue
|
34
|
-
]
|
35
|
-
FLOW_MOD_FAILED_CODES = [
|
36
|
-
:all_tables_full,
|
37
|
-
:overlap,
|
38
|
-
:eperm,
|
39
|
-
:bad_emerg_timeout,
|
40
|
-
:bad_command,
|
41
|
-
:unsupported
|
42
|
-
]
|
43
|
-
PORT_MOD_FAILED_CODES = [:bad_port, :bad_hardware_address]
|
44
|
-
QUEUE_OP_FAILED_CODES = [:bad_port, :bad_queue, :eperm]
|
45
|
-
|
46
|
-
enum16 :error_type, list: TYPES
|
47
|
-
choice :error_code, selection: -> { error_type.to_s } do
|
48
|
-
enum16 'hello_failed', list: HELLO_FAILED_CODES
|
49
|
-
enum16 'bad_request', list: BAD_REQUEST_CODES
|
50
|
-
enum16 'bad_action', list: BAD_ACTION_CODES
|
51
|
-
enum16 'flow_mod_failed', list: FLOW_MOD_FAILED_CODES
|
52
|
-
enum16 'port_mod_failed', list: PORT_MOD_FAILED_CODES
|
53
|
-
enum16 'queue_op_failed', list: QUEUE_OP_FAILED_CODES
|
54
|
-
uint16 :default
|
55
|
-
end
|
56
|
-
rest :data
|
57
|
-
|
58
|
-
def body_length
|
59
|
-
4 + data.length
|
60
|
-
end
|
61
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require_relative 'message'
|
2
|
-
|
3
|
-
class OFFeaturesReply < OFMessage
|
4
|
-
uint64 :datapath_id, initial_value: 0
|
5
|
-
uint32 :n_buffers, initial_value: 0
|
6
|
-
uint8 :n_tables, initial_value: 0
|
7
|
-
uint24 :padding
|
8
|
-
hide :padding
|
9
|
-
flags32 :capabilities, list: [
|
10
|
-
:flow_stats,
|
11
|
-
:table_stats,
|
12
|
-
:port_stats,
|
13
|
-
:stp,
|
14
|
-
:reserved,
|
15
|
-
:ip_reasm,
|
16
|
-
:queue_stats,
|
17
|
-
:arp_match_ip
|
18
|
-
]
|
19
|
-
flags32 :actions, list: [
|
20
|
-
:output,
|
21
|
-
:set_vlan_vid,
|
22
|
-
:set_vlan_pcp,
|
23
|
-
:strip_vlan,
|
24
|
-
:set_dl_src,
|
25
|
-
:set_dl_dst,
|
26
|
-
:set_nw_src,
|
27
|
-
:set_nw_dst,
|
28
|
-
:set_nw_tos,
|
29
|
-
:set_tp_src,
|
30
|
-
:set_tp_dst,
|
31
|
-
:enqueue
|
32
|
-
]
|
33
|
-
array :ports,
|
34
|
-
type: :of_physical_port,
|
35
|
-
initial_length: -> { (len - ports.rel_offset) / 48 }
|
36
|
-
|
37
|
-
def body_length
|
38
|
-
24 + ports.to_binary_s.length
|
39
|
-
end
|
40
|
-
end
|
data/lib/messages/flow_mod.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require_relative 'message'
|
2
|
-
|
3
|
-
class OFFlowMod < OFMessage
|
4
|
-
of_match :match
|
5
|
-
uint64 :cookie, initial_value: 0
|
6
|
-
enum16 :command, list: [:add, :modify, :modify_strict, :delete, :delete_strict]
|
7
|
-
uint16 :idle_timeout, initial_value: 0
|
8
|
-
uint16 :hard_timeout, initial_value: 0
|
9
|
-
uint16 :priority, initial_value: 0
|
10
|
-
enum32 :buffer_id, list: {none: 0xffffffff}, initial_value: -> { :none }
|
11
|
-
of_port_number :out_port, initial_value: (lambda do
|
12
|
-
/^delete/ =~ command.to_s ? :none : 0
|
13
|
-
end)
|
14
|
-
flags16 :flags, list: [:send_flow_removed, :check_overlapping, :emergency]
|
15
|
-
of_actions :actions, length: -> { len - actions.rel_offset }
|
16
|
-
|
17
|
-
def body_length
|
18
|
-
64 + actions.to_binary_s.length
|
19
|
-
end
|
20
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative 'message'
|
2
|
-
|
3
|
-
class OFFlowRemoved < OFMessage
|
4
|
-
REASONS = [:idle_timeout, :hard_timeout, :delete]
|
5
|
-
|
6
|
-
of_match :match
|
7
|
-
uint64 :cookie, initial_value: 0
|
8
|
-
uint16 :priority, initial_value: 0
|
9
|
-
enum8 :reason, list: REASONS
|
10
|
-
uint8 :padding
|
11
|
-
hide :padding
|
12
|
-
uint32 :duration_seconds, initial_value: 0
|
13
|
-
uint32 :duration_nanoseconds, initial_value: 0
|
14
|
-
uint16 :idle_timeout, initial_value: 0
|
15
|
-
uint16 :padding2
|
16
|
-
hide :padding2
|
17
|
-
uint64 :packet_count, initial_value: 0
|
18
|
-
uint64 :byte_count, initial_value: 0
|
19
|
-
|
20
|
-
def body_length
|
21
|
-
80
|
22
|
-
end
|
23
|
-
end
|
data/lib/messages/hello.rb
DELETED
data/lib/messages/message.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
(Dir[File.expand_path '../helpers/**/*.rb', __dir__] +
|
2
|
-
Dir[File.expand_path '../structs/**/*.rb', __dir__] +
|
3
|
-
Dir[File.expand_path '../actions/**/*.rb', __dir__] +
|
4
|
-
Dir[File.expand_path 'statistics/**/*.rb', __dir__]).each do |file|
|
5
|
-
require file
|
6
|
-
end
|
7
|
-
|
8
|
-
# TODO: use OFPT_, OFPP_, OFPQ_, ... in place of Symbols?
|
9
|
-
# check: https://github.com/noxrepo/pox/blob/carp/pox/openflow/libopenflow_01.py
|
10
|
-
# -> see decorators
|
11
|
-
# ruby decorators: https://github.com/fredwu/ruby_decorators
|
12
|
-
|
13
|
-
class OFMessage < SuperclassBase
|
14
|
-
OFP_VERSION = 0x1
|
15
|
-
HEADER_LENGTH = 8
|
16
|
-
TYPES = [
|
17
|
-
:hello,
|
18
|
-
:error,
|
19
|
-
:echo_request,
|
20
|
-
:echo_reply,
|
21
|
-
:vendor,
|
22
|
-
:features_request,
|
23
|
-
:features_reply,
|
24
|
-
:get_config_request,
|
25
|
-
:get_config_reply,
|
26
|
-
:set_config,
|
27
|
-
:packet_in,
|
28
|
-
:flow_removed,
|
29
|
-
:port_status,
|
30
|
-
:packet_out,
|
31
|
-
:flow_mod,
|
32
|
-
:port_mod,
|
33
|
-
:statistics_request,
|
34
|
-
:statistics_reply,
|
35
|
-
:barrier_request,
|
36
|
-
:barrier_reply,
|
37
|
-
:queue_get_config_request, # TODO
|
38
|
-
:queue_get_config_reply # TODO
|
39
|
-
]
|
40
|
-
|
41
|
-
uint8 :version, asserted_value: OFP_VERSION
|
42
|
-
enum8 :type, list: TYPES, asserted_value: -> { type_str.to_sym }
|
43
|
-
uint16 :len, value: -> { HEADER_LENGTH + body_length }
|
44
|
-
uint32 :xid, initial_value: 0
|
45
|
-
end
|
data/lib/messages/packet_in.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'packet-protocols'
|
2
|
-
require_relative 'message'
|
3
|
-
|
4
|
-
class OFPacketIn < OFMessage
|
5
|
-
REASONS = [:no_match, :action]
|
6
|
-
|
7
|
-
enum32 :buffer_id, list: {none: 0xffffffff}, initial_value: -> { :none }
|
8
|
-
uint16 :total_length, value: -> { data.length }
|
9
|
-
of_port_number :in_port
|
10
|
-
enum8 :reason, list: REASONS
|
11
|
-
uint8 :padding
|
12
|
-
hide :padding
|
13
|
-
string :data, read_length: :total_length
|
14
|
-
|
15
|
-
def body_length
|
16
|
-
10 + data.length
|
17
|
-
end
|
18
|
-
|
19
|
-
def parsed_data
|
20
|
-
@parsed_data ||= Ethernet.read(data)
|
21
|
-
@parsed_data
|
22
|
-
end
|
23
|
-
end
|
data/lib/messages/packet_out.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require_relative 'message'
|
2
|
-
|
3
|
-
class OFPacketOut < OFMessage
|
4
|
-
enum32 :buffer_id, list: {none: 0xffffffff}, initial_value: -> { :none }
|
5
|
-
of_port_number :in_port
|
6
|
-
uint16 :actions_length, value: -> { actions.to_binary_s.length }
|
7
|
-
of_actions :actions, length: -> { actions_length }
|
8
|
-
string :data, read_length: -> { len - data.rel_offset }
|
9
|
-
|
10
|
-
def body_length
|
11
|
-
8 + actions_length + data.length
|
12
|
-
end
|
13
|
-
end
|