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
@@ -1,29 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFGetConfigRequest do
|
1
|
+
describe OpenFlow::Protocol::GetConfigRequest do
|
4
2
|
let(:data) { [1, 7, 0, 8, 0, 0, 0, 1].pack('C*') }
|
5
3
|
|
6
4
|
it 'should read binary' do
|
7
|
-
msg =
|
8
|
-
expect(msg.version).to eq(
|
5
|
+
msg = OpenFlow::Protocol::GetConfigRequest.read(data)
|
6
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
9
7
|
expect(msg.type).to eq(:get_config_request)
|
10
8
|
expect(msg.len).to eq(8)
|
11
9
|
expect(msg.xid).to eq(1)
|
12
10
|
end
|
13
11
|
it 'should be parsable' do
|
14
|
-
msg =
|
15
|
-
expect(msg.class).to eq(
|
12
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
13
|
+
expect(msg.class).to eq(OpenFlow::Protocol::GetConfigRequest)
|
16
14
|
end
|
17
15
|
it 'should initialize with default values' do
|
18
|
-
msg =
|
19
|
-
expect(msg.version).to eq(
|
16
|
+
msg = OpenFlow::Protocol::GetConfigRequest.new
|
17
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
20
18
|
expect(msg.type).to eq(:get_config_request)
|
21
19
|
expect(msg.len).to eq(8)
|
22
20
|
expect(msg.xid).to eq(0)
|
23
21
|
end
|
24
22
|
it 'should initialize with some values' do
|
25
|
-
msg =
|
26
|
-
expect(msg.version).to eq(
|
23
|
+
msg = OpenFlow::Protocol::GetConfigRequest.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
27
25
|
expect(msg.type).to eq(:get_config_request)
|
28
26
|
expect(msg.len).to eq(8)
|
29
27
|
expect(msg.xid).to eq(1)
|
data/spec/messages/hello_spec.rb
CHANGED
@@ -1,29 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFHello do
|
1
|
+
describe OpenFlow::Protocol::Hello do
|
4
2
|
let(:data) { [1, 0, 0, 8, 0, 0, 0, 1].pack('C*') }
|
5
3
|
|
6
4
|
it 'should read binary' do
|
7
|
-
msg =
|
8
|
-
expect(msg.version).to eq(
|
5
|
+
msg = OpenFlow::Protocol::Hello.read(data)
|
6
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
9
7
|
expect(msg.type).to eq(:hello)
|
10
8
|
expect(msg.len).to eq(8)
|
11
9
|
expect(msg.xid).to eq(1)
|
12
10
|
end
|
13
11
|
it 'should be parsable' do
|
14
|
-
msg =
|
15
|
-
expect(msg.class).to eq(
|
12
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
13
|
+
expect(msg.class).to eq(OpenFlow::Protocol::Hello)
|
16
14
|
end
|
17
15
|
it 'should initialize with default values' do
|
18
|
-
msg =
|
19
|
-
expect(msg.version).to eq(
|
16
|
+
msg = OpenFlow::Protocol::Hello.new
|
17
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
20
18
|
expect(msg.type).to eq(:hello)
|
21
19
|
expect(msg.len).to eq(8)
|
22
20
|
expect(msg.xid).to eq(0)
|
23
21
|
end
|
24
22
|
it 'should initialize with some values' do
|
25
|
-
msg =
|
26
|
-
expect(msg.version).to eq(
|
23
|
+
msg = OpenFlow::Protocol::Hello.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
27
25
|
expect(msg.type).to eq(:hello)
|
28
26
|
expect(msg.len).to eq(8)
|
29
27
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFPacketIn do
|
1
|
+
describe OpenFlow::Protocol::PacketIn do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 10, 0, 64, 0, 0, 0, 1, # header
|
@@ -34,8 +32,8 @@ describe OFPacketIn do
|
|
34
32
|
}
|
35
33
|
|
36
34
|
it 'should read binary' do
|
37
|
-
msg =
|
38
|
-
expect(msg.version).to eq(
|
35
|
+
msg = OpenFlow::Protocol::PacketIn.read(data)
|
36
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
39
37
|
expect(msg.type).to eq(:packet_in)
|
40
38
|
expect(msg.len).to eq(64)
|
41
39
|
expect(msg.xid).to eq(1)
|
@@ -48,12 +46,12 @@ describe OFPacketIn do
|
|
48
46
|
expect(msg.parsed_data.mac_destination).to eq('00:00:00:00:00:02')
|
49
47
|
end
|
50
48
|
it 'should be parsable' do
|
51
|
-
msg =
|
52
|
-
expect(msg.class).to eq(
|
49
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
50
|
+
expect(msg.class).to eq(OpenFlow::Protocol::PacketIn)
|
53
51
|
end
|
54
52
|
it 'should initialize with default values' do
|
55
|
-
msg =
|
56
|
-
expect(msg.version).to eq(
|
53
|
+
msg = OpenFlow::Protocol::PacketIn.new
|
54
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
57
55
|
expect(msg.type).to eq(:packet_in)
|
58
56
|
expect(msg.len).to eq(18)
|
59
57
|
expect(msg.xid).to eq(0)
|
@@ -64,14 +62,14 @@ describe OFPacketIn do
|
|
64
62
|
expect(msg.data).to be_empty
|
65
63
|
end
|
66
64
|
it 'should initialize with some values' do
|
67
|
-
msg =
|
65
|
+
msg = OpenFlow::Protocol::PacketIn.new(
|
68
66
|
xid: 1,
|
69
67
|
buffer_id: 1,
|
70
68
|
in_port: 1,
|
71
69
|
reason: :no_match,
|
72
70
|
data: [1, 2].pack('C*')
|
73
71
|
)
|
74
|
-
expect(msg.version).to eq(
|
72
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
75
73
|
expect(msg.type).to eq(:packet_in)
|
76
74
|
expect(msg.len).to eq(20)
|
77
75
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFPacketOut do
|
1
|
+
describe OpenFlow::Protocol::PacketOut do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 13, 0, 26, 0, 0, 0, 1, # header
|
@@ -18,8 +16,8 @@ describe OFPacketOut do
|
|
18
16
|
}
|
19
17
|
|
20
18
|
it 'should read binary' do
|
21
|
-
msg =
|
22
|
-
expect(msg.version).to eq(
|
19
|
+
msg = OpenFlow::Protocol::PacketOut.read(data)
|
20
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
23
21
|
expect(msg.type).to eq(:packet_out)
|
24
22
|
expect(msg.len).to eq(26)
|
25
23
|
expect(msg.xid).to eq(1)
|
@@ -30,12 +28,12 @@ describe OFPacketOut do
|
|
30
28
|
expect(msg.data.length).to eq(2)
|
31
29
|
end
|
32
30
|
it 'should be parsable' do
|
33
|
-
msg =
|
34
|
-
expect(msg.class).to eq(
|
31
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
32
|
+
expect(msg.class).to eq(OpenFlow::Protocol::PacketOut)
|
35
33
|
end
|
36
34
|
it 'should initialize with default values' do
|
37
|
-
msg =
|
38
|
-
expect(msg.version).to eq(
|
35
|
+
msg = OpenFlow::Protocol::PacketOut.new
|
36
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
39
37
|
expect(msg.type).to eq(:packet_out)
|
40
38
|
expect(msg.len).to eq(16)
|
41
39
|
expect(msg.xid).to eq(0)
|
@@ -45,13 +43,13 @@ describe OFPacketOut do
|
|
45
43
|
expect(msg.data).to be_empty
|
46
44
|
end
|
47
45
|
it 'should initialize with some values' do
|
48
|
-
msg =
|
46
|
+
msg = OpenFlow::Protocol::PacketOut.new(
|
49
47
|
xid: 1,
|
50
48
|
in_port: 1,
|
51
|
-
actions: [
|
49
|
+
actions: [OpenFlow::Protocol::ActionOutput.new(port: 1)],
|
52
50
|
data: [1, 2].pack('C*')
|
53
51
|
)
|
54
|
-
expect(msg.version).to eq(
|
52
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
55
53
|
expect(msg.type).to eq(:packet_out)
|
56
54
|
expect(msg.len).to eq(26)
|
57
55
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFParser do
|
1
|
+
describe OpenFlow::Protocol::Parser do
|
4
2
|
let(:hello_msg) { [1, 0, 0, 8, 0, 0, 0, 1].pack('C*') }
|
5
3
|
let(:packet_out_msg) {
|
6
4
|
[
|
@@ -19,18 +17,18 @@ describe OFParser do
|
|
19
17
|
}
|
20
18
|
|
21
19
|
it 'should read binary Hello Message' do
|
22
|
-
msg =
|
23
|
-
expect(msg.class).to be(
|
24
|
-
expect(msg.version).to eq(
|
20
|
+
msg = OpenFlow::Protocol::Parser.read(hello_msg)
|
21
|
+
expect(msg.class).to be(OpenFlow::Protocol::Hello)
|
22
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
25
23
|
expect(msg.type).to eq(:hello)
|
26
24
|
expect(msg.len).to eq(8)
|
27
25
|
expect(msg.xid).to eq(1)
|
28
26
|
end
|
29
27
|
|
30
28
|
it 'should read binary PacketOut Message' do
|
31
|
-
msg =
|
32
|
-
expect(msg.class).to be(
|
33
|
-
expect(msg.version).to eq(
|
29
|
+
msg = OpenFlow::Protocol::Parser.read(packet_out_msg)
|
30
|
+
expect(msg.class).to be(OpenFlow::Protocol::PacketOut)
|
31
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
34
32
|
expect(msg.type).to eq(:packet_out)
|
35
33
|
expect(msg.len).to eq(26)
|
36
34
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFPortMod do
|
1
|
+
describe OpenFlow::Protocol::PortMod do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 15, 0, 32, 0, 0, 0, 1, # header
|
@@ -14,8 +12,8 @@ describe OFPortMod do
|
|
14
12
|
}
|
15
13
|
|
16
14
|
it 'should read binary' do
|
17
|
-
msg =
|
18
|
-
expect(msg.version).to eq(
|
15
|
+
msg = OpenFlow::Protocol::PortMod.read(data)
|
16
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
19
17
|
expect(msg.type).to eq(:port_mod)
|
20
18
|
expect(msg.len).to eq(32)
|
21
19
|
expect(msg.xid).to eq(1)
|
@@ -29,12 +27,12 @@ describe OFPortMod do
|
|
29
27
|
])
|
30
28
|
end
|
31
29
|
it 'should be parsable' do
|
32
|
-
msg =
|
33
|
-
expect(msg.class).to eq(
|
30
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
31
|
+
expect(msg.class).to eq(OpenFlow::Protocol::PortMod)
|
34
32
|
end
|
35
33
|
it 'should initialize with default values' do
|
36
|
-
msg =
|
37
|
-
expect(msg.version).to eq(
|
34
|
+
msg = OpenFlow::Protocol::PortMod.new
|
35
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
38
36
|
expect(msg.type).to eq(:port_mod)
|
39
37
|
expect(msg.len).to eq(32)
|
40
38
|
expect(msg.xid).to eq(0)
|
@@ -45,7 +43,7 @@ describe OFPortMod do
|
|
45
43
|
expect(msg.advertise).to be_empty
|
46
44
|
end
|
47
45
|
it 'should initialize with some values' do
|
48
|
-
msg =
|
46
|
+
msg = OpenFlow::Protocol::PortMod.new(
|
49
47
|
xid: 1,
|
50
48
|
port_number: 1,
|
51
49
|
hardware_address: '00:00:00:00:00:01',
|
@@ -56,7 +54,7 @@ describe OFPortMod do
|
|
56
54
|
:port_10mb_full_duplex
|
57
55
|
]
|
58
56
|
)
|
59
|
-
expect(msg.version).to eq(
|
57
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
60
58
|
expect(msg.type).to eq(:port_mod)
|
61
59
|
expect(msg.len).to eq(32)
|
62
60
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFPortStatus do
|
1
|
+
describe OpenFlow::Protocol::PortStatus do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 12, 0, 64, 0, 0, 0, 1, # header
|
@@ -23,8 +21,8 @@ describe OFPortStatus do
|
|
23
21
|
}
|
24
22
|
|
25
23
|
it 'should read binary' do
|
26
|
-
msg =
|
27
|
-
expect(msg.version).to eq(
|
24
|
+
msg = OpenFlow::Protocol::PortStatus.read(data)
|
25
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
28
26
|
expect(msg.type).to eq(:port_status)
|
29
27
|
expect(msg.len).to eq(64)
|
30
28
|
expect(msg.xid).to eq(1)
|
@@ -32,12 +30,12 @@ describe OFPortStatus do
|
|
32
30
|
expect(msg.desc.port_number).to eq(1)
|
33
31
|
end
|
34
32
|
it 'should be parsable' do
|
35
|
-
msg =
|
36
|
-
expect(msg.class).to eq(
|
33
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
34
|
+
expect(msg.class).to eq(OpenFlow::Protocol::PortStatus)
|
37
35
|
end
|
38
36
|
it 'should initialize with default values' do
|
39
|
-
msg =
|
40
|
-
expect(msg.version).to eq(
|
37
|
+
msg = OpenFlow::Protocol::PortStatus.new
|
38
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
41
39
|
expect(msg.type).to eq(:port_status)
|
42
40
|
expect(msg.len).to eq(64)
|
43
41
|
expect(msg.xid).to eq(0)
|
@@ -45,12 +43,12 @@ describe OFPortStatus do
|
|
45
43
|
expect(msg.desc.port_number).to eq(0)
|
46
44
|
end
|
47
45
|
it 'should initialize with some values' do
|
48
|
-
msg =
|
46
|
+
msg = OpenFlow::Protocol::PortStatus.new(
|
49
47
|
xid: 1,
|
50
48
|
reason: :delete,
|
51
|
-
desc:
|
49
|
+
desc: OpenFlow::Protocol::PhysicalPort.new(port_number: 1)
|
52
50
|
)
|
53
|
-
expect(msg.version).to eq(
|
51
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
54
52
|
expect(msg.type).to eq(:port_status)
|
55
53
|
expect(msg.len).to eq(64)
|
56
54
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFQueueGetConfigReply do
|
1
|
+
describe OpenFlow::Protocol::QueueGetConfigReply do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 21, 0, 48, 0, 0, 0, 1, # header
|
@@ -23,8 +21,8 @@ describe OFQueueGetConfigReply do
|
|
23
21
|
}
|
24
22
|
|
25
23
|
it 'should read binary' do
|
26
|
-
msg =
|
27
|
-
expect(msg.version).to eq(
|
24
|
+
msg = OpenFlow::Protocol::QueueGetConfigReply.read(data)
|
25
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
28
26
|
expect(msg.type).to eq(:queue_get_config_reply)
|
29
27
|
expect(msg.len).to eq(48)
|
30
28
|
expect(msg.xid).to eq(1)
|
@@ -35,12 +33,12 @@ describe OFQueueGetConfigReply do
|
|
35
33
|
expect(msg.queues.last.queue_id).to eq(2)
|
36
34
|
end
|
37
35
|
it 'should be parsable' do
|
38
|
-
msg =
|
39
|
-
expect(msg.class).to eq(
|
36
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
37
|
+
expect(msg.class).to eq(OpenFlow::Protocol::QueueGetConfigReply)
|
40
38
|
end
|
41
39
|
it 'should initialize with default values' do
|
42
|
-
msg =
|
43
|
-
expect(msg.version).to eq(
|
40
|
+
msg = OpenFlow::Protocol::QueueGetConfigReply.new
|
41
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
44
42
|
expect(msg.type).to eq(:queue_get_config_reply)
|
45
43
|
expect(msg.len).to eq(16)
|
46
44
|
expect(msg.xid).to eq(0)
|
@@ -48,7 +46,7 @@ describe OFQueueGetConfigReply do
|
|
48
46
|
expect(msg.queues).to be_empty
|
49
47
|
end
|
50
48
|
it 'should initialize with some values' do
|
51
|
-
msg =
|
49
|
+
msg = OpenFlow::Protocol::QueueGetConfigReply.new(
|
52
50
|
xid: 1,
|
53
51
|
port: 2,
|
54
52
|
queues: [
|
@@ -56,7 +54,7 @@ describe OFQueueGetConfigReply do
|
|
56
54
|
{ queue_id: 2 },
|
57
55
|
]
|
58
56
|
)
|
59
|
-
expect(msg.version).to eq(
|
57
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
60
58
|
expect(msg.type).to eq(:queue_get_config_reply)
|
61
59
|
expect(msg.len).to eq(32)
|
62
60
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFQueueGetConfigRequest do
|
1
|
+
describe OpenFlow::Protocol::QueueGetConfigRequest do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 20, 0, 12, 0, 0, 0, 1, # header
|
@@ -10,28 +8,28 @@ describe OFQueueGetConfigRequest do
|
|
10
8
|
}
|
11
9
|
|
12
10
|
it 'should read binary' do
|
13
|
-
msg =
|
14
|
-
expect(msg.version).to eq(
|
11
|
+
msg = OpenFlow::Protocol::QueueGetConfigRequest.read(data)
|
12
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
15
13
|
expect(msg.type).to eq(:queue_get_config_request)
|
16
14
|
expect(msg.len).to eq(12)
|
17
15
|
expect(msg.xid).to eq(1)
|
18
16
|
expect(msg.port).to eq(1)
|
19
17
|
end
|
20
18
|
it 'should be parsable' do
|
21
|
-
msg =
|
22
|
-
expect(msg.class).to eq(
|
19
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
20
|
+
expect(msg.class).to eq(OpenFlow::Protocol::QueueGetConfigRequest)
|
23
21
|
end
|
24
22
|
it 'should initialize with default values' do
|
25
|
-
msg =
|
26
|
-
expect(msg.version).to eq(
|
23
|
+
msg = OpenFlow::Protocol::QueueGetConfigRequest.new
|
24
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
27
25
|
expect(msg.type).to eq(:queue_get_config_request)
|
28
26
|
expect(msg.len).to eq(12)
|
29
27
|
expect(msg.xid).to eq(0)
|
30
28
|
expect(msg.port).to eq(0)
|
31
29
|
end
|
32
30
|
it 'should initialize with some values' do
|
33
|
-
msg =
|
34
|
-
expect(msg.version).to eq(
|
31
|
+
msg = OpenFlow::Protocol::QueueGetConfigRequest.new(xid: 1, port: 2)
|
32
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
35
33
|
expect(msg.type).to eq(:queue_get_config_request)
|
36
34
|
expect(msg.len).to eq(12)
|
37
35
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFSetConfig do
|
1
|
+
describe OpenFlow::Protocol::SetConfig do
|
4
2
|
let(:data) {
|
5
3
|
[
|
6
4
|
1, 9, 0, 12, 0, 0, 0, 1, # header
|
@@ -10,8 +8,8 @@ describe OFSetConfig do
|
|
10
8
|
}
|
11
9
|
|
12
10
|
it 'should read binary' do
|
13
|
-
msg =
|
14
|
-
expect(msg.version).to eq(
|
11
|
+
msg = OpenFlow::Protocol::SetConfig.read(data)
|
12
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
15
13
|
expect(msg.type).to eq(:set_config)
|
16
14
|
expect(msg.len).to eq(12)
|
17
15
|
expect(msg.xid).to eq(1)
|
@@ -19,12 +17,12 @@ describe OFSetConfig do
|
|
19
17
|
expect(msg.miss_send_length).to eq(0xff)
|
20
18
|
end
|
21
19
|
it 'should be parsable' do
|
22
|
-
msg =
|
23
|
-
expect(msg.class).to eq(
|
20
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
21
|
+
expect(msg.class).to eq(OpenFlow::Protocol::SetConfig)
|
24
22
|
end
|
25
23
|
it 'should initialize with default values' do
|
26
|
-
msg =
|
27
|
-
expect(msg.version).to eq(
|
24
|
+
msg = OpenFlow::Protocol::SetConfig.new
|
25
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
28
26
|
expect(msg.type).to eq(:set_config)
|
29
27
|
expect(msg.len).to eq(12)
|
30
28
|
expect(msg.xid).to eq(0)
|
@@ -32,12 +30,12 @@ describe OFSetConfig do
|
|
32
30
|
expect(msg.miss_send_length).to eq(0)
|
33
31
|
end
|
34
32
|
it 'should initialize with some values' do
|
35
|
-
msg =
|
33
|
+
msg = OpenFlow::Protocol::SetConfig.new(
|
36
34
|
xid: 1,
|
37
35
|
flags: :fragments_normal,
|
38
36
|
miss_send_length: 0xff
|
39
37
|
)
|
40
|
-
expect(msg.version).to eq(
|
38
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
41
39
|
expect(msg.type).to eq(:set_config)
|
42
40
|
expect(msg.len).to eq(12)
|
43
41
|
expect(msg.xid).to eq(1)
|