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,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFAggregateStatisticsReply do
|
1
|
+
describe OpenFlow::Protocol::AggregateStatisticsReply do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::AggregateStatisticsReply.read [
|
6
4
|
0, 0, 0, 0, 0, 0, 0, 10, # packet_count
|
7
5
|
0, 0, 0, 0, 0, 0, 0, 80, # byte_count
|
8
6
|
0, 0, 0, 4, # flow_count
|
@@ -13,13 +11,13 @@ describe OFAggregateStatisticsReply do
|
|
13
11
|
expect(stats.flow_count).to eq(4)
|
14
12
|
end
|
15
13
|
it 'should initialize with default values' do
|
16
|
-
stats =
|
14
|
+
stats = OpenFlow::Protocol::AggregateStatisticsReply.new
|
17
15
|
expect(stats.packet_count).to eq(0)
|
18
16
|
expect(stats.byte_count).to eq(0)
|
19
17
|
expect(stats.flow_count).to eq(0)
|
20
18
|
end
|
21
19
|
it 'should initialize with some values' do
|
22
|
-
stats =
|
20
|
+
stats = OpenFlow::Protocol::AggregateStatisticsReply.new(
|
23
21
|
packet_count: 10,
|
24
22
|
byte_count: 80,
|
25
23
|
flow_count: 4
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFAggregateStatisticsRequest do
|
1
|
+
describe OpenFlow::Protocol::AggregateStatisticsRequest do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::AggregateStatisticsRequest.read [
|
6
4
|
# match
|
7
5
|
0, 0x30, 0x20, 0x4f, # wildcards
|
8
6
|
0, 0, # in_port
|
@@ -29,13 +27,13 @@ describe OFAggregateStatisticsRequest do
|
|
29
27
|
expect(stats.out_port).to eq(1)
|
30
28
|
end
|
31
29
|
it 'should initialize with default values' do
|
32
|
-
stats =
|
30
|
+
stats = OpenFlow::Protocol::AggregateStatisticsRequest.new
|
33
31
|
expect(stats.match.ip_destination).to eq('0.0.0.0')
|
34
32
|
expect(stats.table_id).to eq(:all)
|
35
33
|
expect(stats.out_port).to eq(:none)
|
36
34
|
end
|
37
35
|
it 'should initialize with some values' do
|
38
|
-
stats =
|
36
|
+
stats = OpenFlow::Protocol::AggregateStatisticsRequest.new(
|
39
37
|
table_id: 1,
|
40
38
|
out_port: 1
|
41
39
|
)
|
@@ -1,12 +1,14 @@
|
|
1
|
-
|
1
|
+
describe OpenFlow::Protocol::DescriptionStatistics do
|
2
|
+
let(:desc) {
|
3
|
+
'Manufacturer description'.pad(256) +
|
4
|
+
'Hardware description'.pad(256) +
|
5
|
+
'Software description'.pad(256) +
|
6
|
+
'123456789'.pad(32) +
|
7
|
+
'Datapath description'.pad(256)
|
8
|
+
}
|
2
9
|
|
3
|
-
describe OFDescriptionStatistics do
|
4
10
|
it 'should read binary' do
|
5
|
-
stats =
|
6
|
-
'Hardware description'.pad(256) +
|
7
|
-
'Software description'.pad(256) +
|
8
|
-
'123456789'.pad(32) +
|
9
|
-
'Datapath description'.pad(256)
|
11
|
+
stats = OpenFlow::Protocol::DescriptionStatistics.read(desc)
|
10
12
|
expect(stats.manufacturer_description).to eq('Manufacturer description')
|
11
13
|
expect(stats.hardware_description).to eq('Hardware description')
|
12
14
|
expect(stats.software_description).to eq('Software description')
|
@@ -14,7 +16,7 @@ describe OFDescriptionStatistics do
|
|
14
16
|
expect(stats.datapath_description).to eq('Datapath description')
|
15
17
|
end
|
16
18
|
it 'should initialize with default values' do
|
17
|
-
stats =
|
19
|
+
stats = OpenFlow::Protocol::DescriptionStatistics.new
|
18
20
|
expect(stats.manufacturer_description).to eq('')
|
19
21
|
expect(stats.hardware_description).to eq('')
|
20
22
|
expect(stats.software_description).to eq('')
|
@@ -22,7 +24,7 @@ describe OFDescriptionStatistics do
|
|
22
24
|
expect(stats.datapath_description).to eq('')
|
23
25
|
end
|
24
26
|
it 'should initialize with some values' do
|
25
|
-
stats =
|
27
|
+
stats = OpenFlow::Protocol::DescriptionStatistics.new(
|
26
28
|
manufacturer_description: 'Manufacturer description',
|
27
29
|
hardware_description: 'Hardware description',
|
28
30
|
software_description: 'Software description',
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFFlowStatisticsReply do
|
1
|
+
describe OpenFlow::Protocol::FlowStatisticsReply do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::FlowStatisticsReply.read [
|
6
4
|
0, 96, # len
|
7
5
|
1, # table_id
|
8
6
|
0, # padding
|
@@ -53,7 +51,7 @@ describe OFFlowStatisticsReply do
|
|
53
51
|
expect(stats.actions.length).to eq(1)
|
54
52
|
end
|
55
53
|
it 'should initialize with default values' do
|
56
|
-
stats =
|
54
|
+
stats = OpenFlow::Protocol::FlowStatisticsReply.new
|
57
55
|
expect(stats.len).to eq(88)
|
58
56
|
expect(stats.table_id).to eq(:all)
|
59
57
|
expect(stats.match.ip_destination).to eq('0.0.0.0')
|
@@ -67,7 +65,7 @@ describe OFFlowStatisticsReply do
|
|
67
65
|
expect(stats.actions).to be_empty
|
68
66
|
end
|
69
67
|
it 'should initialize with some values' do
|
70
|
-
stats =
|
68
|
+
stats = OpenFlow::Protocol::FlowStatisticsReply.new(
|
71
69
|
)
|
72
70
|
|
73
71
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFFlowStatisticsRequest do
|
1
|
+
describe OpenFlow::Protocol::FlowStatisticsRequest do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::FlowStatisticsRequest.read [
|
6
4
|
# match
|
7
5
|
0, 0x30, 0x20, 0x4f, # wildcards
|
8
6
|
0, 0, # in_port
|
@@ -29,13 +27,13 @@ describe OFFlowStatisticsRequest do
|
|
29
27
|
expect(stats.out_port).to eq(1)
|
30
28
|
end
|
31
29
|
it 'should initialize with default values' do
|
32
|
-
stats =
|
30
|
+
stats = OpenFlow::Protocol::FlowStatisticsRequest.new
|
33
31
|
expect(stats.match.ip_destination).to eq('0.0.0.0')
|
34
32
|
expect(stats.table_id).to eq(:all)
|
35
33
|
expect(stats.out_port).to eq(:none)
|
36
34
|
end
|
37
35
|
it 'should initialize with some values' do
|
38
|
-
stats =
|
36
|
+
stats = OpenFlow::Protocol::FlowStatisticsRequest.new(
|
39
37
|
table_id: 1,
|
40
38
|
out_port: 1
|
41
39
|
)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFPortStatisticsReply do
|
1
|
+
describe OpenFlow::Protocol::PortStatisticsReply do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::PortStatisticsReply.read [
|
6
4
|
0, 1, # port_number
|
7
5
|
0, 0, 0, 0, 0, 0, # padding
|
8
6
|
0, 0, 0, 0, 0, 0, 0, 10, # receive_packets
|
@@ -33,7 +31,7 @@ describe OFPortStatisticsReply do
|
|
33
31
|
expect(stats.collisions).to eq(3)
|
34
32
|
end
|
35
33
|
it 'should initialize with default values' do
|
36
|
-
stats =
|
34
|
+
stats = OpenFlow::Protocol::PortStatisticsReply.new
|
37
35
|
expect(stats.port_number).to eq(0)
|
38
36
|
expect(stats.receive_packets).to eq(0)
|
39
37
|
expect(stats.transmit_packets).to eq(0)
|
@@ -49,7 +47,7 @@ describe OFPortStatisticsReply do
|
|
49
47
|
expect(stats.collisions).to eq(0)
|
50
48
|
end
|
51
49
|
it 'should initialize with some values' do
|
52
|
-
stats =
|
50
|
+
stats = OpenFlow::Protocol::PortStatisticsReply.new(
|
53
51
|
port_number: 1,
|
54
52
|
receive_packets: 10,
|
55
53
|
transmit_packets: 10,
|
@@ -1,19 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFPortStatisticsRequest do
|
1
|
+
describe OpenFlow::Protocol::PortStatisticsRequest do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::PortStatisticsRequest.read [
|
6
4
|
0, 1, # port_number
|
7
5
|
0, 0, 0, 0, 0, 0 # padding
|
8
6
|
].pack('C*')
|
9
7
|
expect(stats.port_number).to eq(1)
|
10
8
|
end
|
11
9
|
it 'should initialize with default values' do
|
12
|
-
stats =
|
10
|
+
stats = OpenFlow::Protocol::PortStatisticsRequest.new
|
13
11
|
expect(stats.port_number).to eq(:none)
|
14
12
|
end
|
15
13
|
it 'should initialize with some values' do
|
16
|
-
stats =
|
14
|
+
stats = OpenFlow::Protocol::PortStatisticsRequest.new(port_number: 1)
|
17
15
|
expect(stats.port_number).to eq(1)
|
18
16
|
end
|
19
17
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFQueueStatisticsReply do
|
1
|
+
describe OpenFlow::Protocol::QueueStatisticsReply do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::QueueStatisticsReply.read [
|
6
4
|
0, 1, # port_number
|
7
5
|
0, 0, # padding
|
8
6
|
0, 0, 0, 1, # queue_id
|
@@ -17,7 +15,7 @@ describe OFQueueStatisticsReply do
|
|
17
15
|
expect(stats.transmit_errors).to eq(2)
|
18
16
|
end
|
19
17
|
it 'should initialize with default values' do
|
20
|
-
stats =
|
18
|
+
stats = OpenFlow::Protocol::QueueStatisticsReply.new
|
21
19
|
expect(stats.port_number).to eq(0)
|
22
20
|
# expect(stats.queue_id).to eq(:all)
|
23
21
|
# TODO: QUEUE_IDS somewhere!
|
@@ -26,7 +24,7 @@ describe OFQueueStatisticsReply do
|
|
26
24
|
expect(stats.transmit_errors).to eq(0)
|
27
25
|
end
|
28
26
|
it 'should initialize with some values' do
|
29
|
-
stats =
|
27
|
+
stats = OpenFlow::Protocol::QueueStatisticsReply.new(
|
30
28
|
port_number: 1,
|
31
29
|
queue_id: 1,
|
32
30
|
transmit_bytes: 80,
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFQueueStatisticsRequest do
|
1
|
+
describe OpenFlow::Protocol::QueueStatisticsRequest do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::QueueStatisticsRequest.read [
|
6
4
|
0, 1, # port_number
|
7
5
|
0, 0, # padding
|
8
6
|
0, 0, 0, 1 # queue_id
|
@@ -11,12 +9,12 @@ describe OFQueueStatisticsRequest do
|
|
11
9
|
expect(stats.queue_id).to eq(1)
|
12
10
|
end
|
13
11
|
it 'should initialize with default values' do
|
14
|
-
stats =
|
12
|
+
stats = OpenFlow::Protocol::QueueStatisticsRequest.new
|
15
13
|
expect(stats.port_number).to eq(:all)
|
16
14
|
expect(stats.queue_id).to eq(:all)
|
17
15
|
end
|
18
16
|
it 'should initialize with some values' do
|
19
|
-
stats =
|
17
|
+
stats = OpenFlow::Protocol::QueueStatisticsRequest.new(
|
20
18
|
port_number: 1,
|
21
19
|
queue_id: 1
|
22
20
|
)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFTableStatistics do
|
1
|
+
describe OpenFlow::Protocol::TableStatistics do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::TableStatistics.read [
|
6
4
|
1, # table_id
|
7
5
|
0, 0, 0, # padding
|
8
6
|
116, 97, 98, 108, 101, 45, 49, 0, # name
|
@@ -24,7 +22,7 @@ describe OFTableStatistics do
|
|
24
22
|
expect(stats.matched_count).to eq(1)
|
25
23
|
end
|
26
24
|
it 'should initialize with default values' do
|
27
|
-
stats =
|
25
|
+
stats = OpenFlow::Protocol::TableStatistics.new
|
28
26
|
expect(stats.table_id).to eq(0)
|
29
27
|
expect(stats.name).to eq('')
|
30
28
|
expect(stats.wildcards).to be_empty
|
@@ -34,7 +32,7 @@ describe OFTableStatistics do
|
|
34
32
|
expect(stats.matched_count).to eq(0)
|
35
33
|
end
|
36
34
|
it 'should initialize with some values' do
|
37
|
-
stats =
|
35
|
+
stats = OpenFlow::Protocol::TableStatistics.new(
|
38
36
|
table_id: 1,
|
39
37
|
name: 'table-1',
|
40
38
|
wildcards: [:in_port, :ip_source_all, :ip_destination_all],
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFVendorStatistics do
|
1
|
+
describe OpenFlow::Protocol::VendorStatistics do
|
4
2
|
it 'should read binary' do
|
5
|
-
stats =
|
3
|
+
stats = OpenFlow::Protocol::VendorStatistics.read [
|
6
4
|
0, 0, 0, 1, # vendor
|
7
5
|
1, 2, 3, 4 # body
|
8
6
|
].pack('C*')
|
@@ -10,12 +8,12 @@ describe OFVendorStatistics do
|
|
10
8
|
expect(stats.body).to eq([1, 2, 3, 4].pack('C*'))
|
11
9
|
end
|
12
10
|
it 'should initialize with default values' do
|
13
|
-
stats =
|
11
|
+
stats = OpenFlow::Protocol::VendorStatistics.new
|
14
12
|
expect(stats.vendor).to eq(0)
|
15
13
|
expect(stats.body).to be_empty
|
16
14
|
end
|
17
15
|
it 'should initialize with some values' do
|
18
|
-
stats =
|
16
|
+
stats = OpenFlow::Protocol::VendorStatistics.new(
|
19
17
|
vendor: 1,
|
20
18
|
body: [1, 2, 3, 4].pack('C*')
|
21
19
|
)
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFStatisticsReply do
|
1
|
+
describe OpenFlow::Protocol::StatisticsReply do
|
4
2
|
context 'with description' do
|
5
3
|
let(:desc) {
|
6
4
|
'Manufacturer description'.pad(256) +
|
7
5
|
'Hardware description'.pad(256) +
|
8
|
-
'
|
6
|
+
'SOpenFlow::Protocol::tware description'.pad(256) +
|
9
7
|
'123456789'.pad(32) +
|
10
8
|
'Datapath description'.pad(256)
|
11
9
|
}
|
@@ -18,8 +16,8 @@ describe OFStatisticsReply do
|
|
18
16
|
}
|
19
17
|
|
20
18
|
it 'should read binary' do
|
21
|
-
msg =
|
22
|
-
expect(msg.version).to eq(
|
19
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
20
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
23
21
|
expect(msg.type).to eq(:statistics_reply)
|
24
22
|
expect(msg.len).to eq(1068)
|
25
23
|
expect(msg.xid).to eq(1)
|
@@ -28,12 +26,12 @@ describe OFStatisticsReply do
|
|
28
26
|
expect(msg.statistics.serial_number).to eq('123456789')
|
29
27
|
end
|
30
28
|
it 'should be parsable' do
|
31
|
-
msg =
|
32
|
-
expect(msg.class).to eq(
|
29
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
30
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
33
31
|
end
|
34
32
|
it 'should initialize with default values' do
|
35
|
-
msg =
|
36
|
-
expect(msg.version).to eq(
|
33
|
+
msg = OpenFlow::Protocol::StatisticsReply.new
|
34
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
37
35
|
expect(msg.type).to eq(:statistics_reply)
|
38
36
|
expect(msg.len).to eq(1068)
|
39
37
|
expect(msg.xid).to eq(0)
|
@@ -42,7 +40,7 @@ describe OFStatisticsReply do
|
|
42
40
|
expect(msg.statistics.serial_number).to eq('')
|
43
41
|
end
|
44
42
|
it 'should initialize with some values' do
|
45
|
-
msg =
|
43
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
46
44
|
xid: 1,
|
47
45
|
statistic_type: :description,
|
48
46
|
flags: [:reply_more],
|
@@ -50,7 +48,7 @@ describe OFStatisticsReply do
|
|
50
48
|
serial_number: '123456789'
|
51
49
|
}
|
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(:statistics_reply)
|
55
53
|
expect(msg.len).to eq(1068)
|
56
54
|
expect(msg.xid).to eq(1)
|
@@ -108,8 +106,8 @@ describe OFStatisticsReply do
|
|
108
106
|
}
|
109
107
|
|
110
108
|
it 'should read binary' do
|
111
|
-
msg =
|
112
|
-
expect(msg.version).to eq(
|
109
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
110
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
113
111
|
expect(msg.type).to eq(:statistics_reply)
|
114
112
|
expect(msg.len).to eq(108)
|
115
113
|
expect(msg.xid).to eq(1)
|
@@ -119,12 +117,12 @@ describe OFStatisticsReply do
|
|
119
117
|
expect(msg.statistics.actions.length).to eq(1)
|
120
118
|
end
|
121
119
|
it 'should be parsable' do
|
122
|
-
msg =
|
123
|
-
expect(msg.class).to eq(
|
120
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
121
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
124
122
|
end
|
125
123
|
it 'should initialize with default values' do
|
126
|
-
msg =
|
127
|
-
expect(msg.version).to eq(
|
124
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :flow)
|
125
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
128
126
|
expect(msg.type).to eq(:statistics_reply)
|
129
127
|
expect(msg.len).to eq(100)
|
130
128
|
expect(msg.xid).to eq(0)
|
@@ -134,16 +132,16 @@ describe OFStatisticsReply do
|
|
134
132
|
expect(msg.statistics.actions).to be_empty
|
135
133
|
end
|
136
134
|
it 'should initialize with some values' do
|
137
|
-
msg =
|
135
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
138
136
|
xid: 1,
|
139
137
|
statistic_type: :flow,
|
140
138
|
flags: [:reply_more],
|
141
139
|
statistics: {
|
142
140
|
table_id: 1,
|
143
|
-
actions: [
|
141
|
+
actions: [OpenFlow::Protocol::ActionOutput.new(port: 1)]
|
144
142
|
}
|
145
143
|
)
|
146
|
-
expect(msg.version).to eq(
|
144
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
147
145
|
expect(msg.type).to eq(:statistics_reply)
|
148
146
|
expect(msg.len).to eq(108)
|
149
147
|
expect(msg.xid).to eq(1)
|
@@ -170,8 +168,8 @@ describe OFStatisticsReply do
|
|
170
168
|
}
|
171
169
|
|
172
170
|
it 'should read binary' do
|
173
|
-
msg =
|
174
|
-
expect(msg.version).to eq(
|
171
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
172
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
175
173
|
expect(msg.type).to eq(:statistics_reply)
|
176
174
|
expect(msg.len).to eq(36)
|
177
175
|
expect(msg.xid).to eq(1)
|
@@ -180,8 +178,8 @@ describe OFStatisticsReply do
|
|
180
178
|
expect(msg.statistics.packet_count).to eq(10)
|
181
179
|
end
|
182
180
|
it 'should initialize with default values' do
|
183
|
-
msg =
|
184
|
-
expect(msg.version).to eq(
|
181
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :aggregate)
|
182
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
185
183
|
expect(msg.type).to eq(:statistics_reply)
|
186
184
|
expect(msg.len).to eq(36)
|
187
185
|
expect(msg.xid).to eq(0)
|
@@ -190,11 +188,11 @@ describe OFStatisticsReply do
|
|
190
188
|
expect(msg.statistics.packet_count).to eq(0)
|
191
189
|
end
|
192
190
|
it 'should be parsable' do
|
193
|
-
msg =
|
194
|
-
expect(msg.class).to eq(
|
191
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
192
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
195
193
|
end
|
196
194
|
it 'should initialize with some values' do
|
197
|
-
msg =
|
195
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
198
196
|
xid: 1,
|
199
197
|
statistic_type: :aggregate,
|
200
198
|
flags: [:reply_more],
|
@@ -204,7 +202,7 @@ describe OFStatisticsReply do
|
|
204
202
|
flow_count: 4
|
205
203
|
}
|
206
204
|
)
|
207
|
-
expect(msg.version).to eq(
|
205
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
208
206
|
expect(msg.type).to eq(:statistics_reply)
|
209
207
|
expect(msg.len).to eq(36)
|
210
208
|
expect(msg.xid).to eq(1)
|
@@ -221,7 +219,7 @@ describe OFStatisticsReply do
|
|
221
219
|
0, 3, # statistic_type
|
222
220
|
0, 1, # flags
|
223
221
|
|
224
|
-
# array
|
222
|
+
# array OpenFlow::Protocol:: table_statistics
|
225
223
|
1, # table_id
|
226
224
|
0, 0, 0, # padding
|
227
225
|
116, 97, 98, 108, 101, 45, 49, 0, # name
|
@@ -237,8 +235,8 @@ describe OFStatisticsReply do
|
|
237
235
|
}
|
238
236
|
|
239
237
|
it 'should read binary' do
|
240
|
-
msg =
|
241
|
-
expect(msg.version).to eq(
|
238
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
239
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
242
240
|
expect(msg.type).to eq(:statistics_reply)
|
243
241
|
expect(msg.len).to eq(76)
|
244
242
|
expect(msg.xid).to eq(1)
|
@@ -248,12 +246,12 @@ describe OFStatisticsReply do
|
|
248
246
|
expect(msg.statistics.first.table_id).to eq(1)
|
249
247
|
end
|
250
248
|
it 'should be parsable' do
|
251
|
-
msg =
|
252
|
-
expect(msg.class).to eq(
|
249
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
250
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
253
251
|
end
|
254
252
|
it 'should initialize with default values' do
|
255
|
-
msg =
|
256
|
-
expect(msg.version).to eq(
|
253
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :table)
|
254
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
257
255
|
expect(msg.type).to eq(:statistics_reply)
|
258
256
|
expect(msg.len).to eq(12)
|
259
257
|
expect(msg.xid).to eq(0)
|
@@ -262,13 +260,13 @@ describe OFStatisticsReply do
|
|
262
260
|
expect(msg.statistics).to be_empty
|
263
261
|
end
|
264
262
|
it 'should initialize with some values' do
|
265
|
-
msg =
|
263
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
266
264
|
xid: 1,
|
267
265
|
statistic_type: :table,
|
268
266
|
flags: [:reply_more],
|
269
267
|
statistics: [{table_id: 1}]
|
270
268
|
)
|
271
|
-
expect(msg.version).to eq(
|
269
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
272
270
|
expect(msg.type).to eq(:statistics_reply)
|
273
271
|
expect(msg.len).to eq(76)
|
274
272
|
expect(msg.xid).to eq(1)
|
@@ -286,7 +284,7 @@ describe OFStatisticsReply do
|
|
286
284
|
0, 4, # statistic_type
|
287
285
|
0, 1, # flags
|
288
286
|
|
289
|
-
# array
|
287
|
+
# array OpenFlow::Protocol:: port_statistics_reply
|
290
288
|
0, 1, # port_number
|
291
289
|
0, 0, 0, 0, 0, 0, # padding
|
292
290
|
0, 0, 0, 0, 0, 0, 0, 10, # receive_packets
|
@@ -305,8 +303,8 @@ describe OFStatisticsReply do
|
|
305
303
|
}
|
306
304
|
|
307
305
|
it 'should read binary' do
|
308
|
-
msg =
|
309
|
-
expect(msg.version).to eq(
|
306
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
307
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
310
308
|
expect(msg.type).to eq(:statistics_reply)
|
311
309
|
expect(msg.len).to eq(116)
|
312
310
|
expect(msg.xid).to eq(1)
|
@@ -316,12 +314,12 @@ describe OFStatisticsReply do
|
|
316
314
|
expect(msg.statistics.first.port_number).to eq(1)
|
317
315
|
end
|
318
316
|
it 'should be parsable' do
|
319
|
-
msg =
|
320
|
-
expect(msg.class).to eq(
|
317
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
318
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
321
319
|
end
|
322
320
|
it 'should initialize with default values' do
|
323
|
-
msg =
|
324
|
-
expect(msg.version).to eq(
|
321
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :port)
|
322
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
325
323
|
expect(msg.type).to eq(:statistics_reply)
|
326
324
|
expect(msg.len).to eq(12)
|
327
325
|
expect(msg.xid).to eq(0)
|
@@ -330,13 +328,13 @@ describe OFStatisticsReply do
|
|
330
328
|
expect(msg.statistics).to be_empty
|
331
329
|
end
|
332
330
|
it 'should initialize with some values' do
|
333
|
-
msg =
|
331
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
334
332
|
xid: 1,
|
335
333
|
statistic_type: :port,
|
336
334
|
flags: [:reply_more],
|
337
335
|
statistics: [{port_number: 1}]
|
338
336
|
)
|
339
|
-
expect(msg.version).to eq(
|
337
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
340
338
|
expect(msg.type).to eq(:statistics_reply)
|
341
339
|
expect(msg.len).to eq(116)
|
342
340
|
expect(msg.xid).to eq(1)
|
@@ -354,7 +352,7 @@ describe OFStatisticsReply do
|
|
354
352
|
0, 5, # statistic_type
|
355
353
|
0, 1, # flags
|
356
354
|
|
357
|
-
# array
|
355
|
+
# array OpenFlow::Protocol:: queue_statistics_reply
|
358
356
|
0, 1, # port_number
|
359
357
|
0, 0, # padding
|
360
358
|
0, 0, 0, 1, # queue_id
|
@@ -365,8 +363,8 @@ describe OFStatisticsReply do
|
|
365
363
|
}
|
366
364
|
|
367
365
|
it 'should read binary' do
|
368
|
-
msg =
|
369
|
-
expect(msg.version).to eq(
|
366
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
367
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
370
368
|
expect(msg.type).to eq(:statistics_reply)
|
371
369
|
expect(msg.len).to eq(44)
|
372
370
|
expect(msg.xid).to eq(1)
|
@@ -376,12 +374,12 @@ describe OFStatisticsReply do
|
|
376
374
|
expect(msg.statistics.first.port_number).to eq(1)
|
377
375
|
end
|
378
376
|
it 'should be parsable' do
|
379
|
-
msg =
|
380
|
-
expect(msg.class).to eq(
|
377
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
378
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
381
379
|
end
|
382
380
|
it 'should initialize with default values' do
|
383
|
-
msg =
|
384
|
-
expect(msg.version).to eq(
|
381
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :queue)
|
382
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
385
383
|
expect(msg.type).to eq(:statistics_reply)
|
386
384
|
expect(msg.len).to eq(12)
|
387
385
|
expect(msg.xid).to eq(0)
|
@@ -390,13 +388,13 @@ describe OFStatisticsReply do
|
|
390
388
|
expect(msg.statistics).to be_empty
|
391
389
|
end
|
392
390
|
it 'should initialize with some values' do
|
393
|
-
msg =
|
391
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
394
392
|
xid: 1,
|
395
393
|
statistic_type: :queue,
|
396
394
|
flags: [:reply_more],
|
397
395
|
statistics: [{port_number: 1}]
|
398
396
|
)
|
399
|
-
expect(msg.version).to eq(
|
397
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
400
398
|
expect(msg.type).to eq(:statistics_reply)
|
401
399
|
expect(msg.len).to eq(44)
|
402
400
|
expect(msg.xid).to eq(1)
|
@@ -421,8 +419,8 @@ describe OFStatisticsReply do
|
|
421
419
|
}
|
422
420
|
|
423
421
|
it 'should read binary' do
|
424
|
-
msg =
|
425
|
-
expect(msg.version).to eq(
|
422
|
+
msg = OpenFlow::Protocol::StatisticsReply.read(data)
|
423
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
426
424
|
expect(msg.type).to eq(:statistics_reply)
|
427
425
|
expect(msg.len).to eq(20)
|
428
426
|
expect(msg.xid).to eq(1)
|
@@ -432,12 +430,12 @@ describe OFStatisticsReply do
|
|
432
430
|
expect(msg.statistics.body).to eq([1, 2, 3, 4].pack('C*'))
|
433
431
|
end
|
434
432
|
it 'should be parsable' do
|
435
|
-
msg =
|
436
|
-
expect(msg.class).to eq(
|
433
|
+
msg = OpenFlow::Protocol::Parser.read(data)
|
434
|
+
expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
|
437
435
|
end
|
438
436
|
it 'should initialize with default values' do
|
439
|
-
msg =
|
440
|
-
expect(msg.version).to eq(
|
437
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :vendor)
|
438
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
441
439
|
expect(msg.type).to eq(:statistics_reply)
|
442
440
|
expect(msg.len).to eq(16)
|
443
441
|
expect(msg.xid).to eq(0)
|
@@ -447,7 +445,7 @@ describe OFStatisticsReply do
|
|
447
445
|
expect(msg.statistics.body).to be_empty
|
448
446
|
end
|
449
447
|
it 'should initialize with some values' do
|
450
|
-
msg =
|
448
|
+
msg = OpenFlow::Protocol::StatisticsReply.new(
|
451
449
|
xid: 1,
|
452
450
|
statistic_type: :vendor,
|
453
451
|
statistics: {
|
@@ -455,7 +453,7 @@ describe OFStatisticsReply do
|
|
455
453
|
body: [1, 2, 3, 4].pack('C*')
|
456
454
|
}
|
457
455
|
)
|
458
|
-
expect(msg.version).to eq(
|
456
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
459
457
|
expect(msg.type).to eq(:statistics_reply)
|
460
458
|
expect(msg.len).to eq(20)
|
461
459
|
expect(msg.xid).to eq(1)
|