openflow-protocol 0.1.8 → 0.1.9
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/messages/packet_in.rb +1 -1
- data/lib/openflow-protocol/version.rb +1 -1
- data/spec/actions/action_enqueue_spec.rb +4 -4
- data/spec/actions/action_output_spec.rb +4 -4
- data/spec/actions/action_set_destination_port_spec.rb +4 -4
- data/spec/actions/action_set_ip_destination_spec.rb +4 -4
- data/spec/actions/action_set_ip_source_spec.rb +4 -4
- data/spec/actions/action_set_ip_tos_spec.rb +4 -4
- data/spec/actions/action_set_mac_destination_spec.rb +4 -4
- data/spec/actions/action_set_mac_source_spec.rb +4 -4
- data/spec/actions/action_set_source_port_spec.rb +4 -4
- data/spec/actions/action_set_vlan_id_spec.rb +4 -4
- data/spec/actions/action_set_vlan_pcp_spec.rb +4 -4
- data/spec/actions/action_strip_vlan_spec.rb +3 -3
- data/spec/actions/action_vendor_spec.rb +4 -4
- data/spec/actions/actions_spec.rb +6 -6
- data/spec/messages/barrier_reply_spec.rb +9 -9
- data/spec/messages/barrier_request_spec.rb +9 -9
- data/spec/messages/echo_reply_spec.rb +13 -13
- data/spec/messages/echo_request_spec.rb +16 -16
- data/spec/messages/error_spec.rb +11 -11
- data/spec/messages/features_reply_spec.rb +11 -11
- data/spec/messages/features_request_spec.rb +9 -9
- data/spec/messages/flow_mod_spec.rb +12 -12
- data/spec/messages/flow_removed_spec.rb +9 -9
- data/spec/messages/get_config_reply_spec.rb +9 -9
- data/spec/messages/get_config_request_spec.rb +9 -9
- data/spec/messages/hello_spec.rb +9 -9
- data/spec/messages/packet_in_spec.rb +9 -9
- data/spec/messages/packet_out_spec.rb +10 -10
- data/spec/messages/parser_spec.rb +7 -7
- data/spec/messages/port_mod_spec.rb +9 -9
- data/spec/messages/port_status_spec.rb +10 -10
- data/spec/messages/queue_get_config_reply_spec.rb +9 -9
- data/spec/messages/queue_get_config_request_spec.rb +9 -9
- data/spec/messages/set_config_spec.rb +9 -9
- data/spec/messages/statistics/aggregate_statistics_reply_spec.rb +4 -4
- data/spec/messages/statistics/aggregate_statistics_request_spec.rb +4 -4
- data/spec/messages/statistics/description_statistics_spec.rb +4 -4
- data/spec/messages/statistics/flow_statistics_reply_spec.rb +4 -4
- data/spec/messages/statistics/flow_statistics_request_spec.rb +4 -4
- data/spec/messages/statistics/port_statistics_reply_spec.rb +4 -4
- data/spec/messages/statistics/port_statistics_request_spec.rb +4 -4
- data/spec/messages/statistics/queue_statistics_reply_spec.rb +4 -4
- data/spec/messages/statistics/queue_statistics_request_spec.rb +4 -4
- data/spec/messages/statistics/table_statistics_spec.rb +4 -4
- data/spec/messages/statistics/vendor_statistics_spec.rb +4 -4
- data/spec/messages/statistics_reply_spec.rb +62 -62
- data/spec/messages/statistics_request_spec.rb +45 -45
- data/spec/messages/vendor_spec.rb +13 -13
- data/spec/spec_helper.rb +4 -0
- data/spec/structs/match_spec.rb +7 -7
- data/spec/structs/packet_queue_spec.rb +5 -5
- data/spec/structs/physical_port_spec.rb +16 -16
- data/spec/structs/port_number_spec.rb +11 -11
- data/spec/structs/queue_properties/queue_properties_spec.rb +5 -5
- data/spec/structs/queue_properties/queue_property_min_rate_spec.rb +5 -5
- data/spec/structs/queue_properties/queue_property_none_spec.rb +3 -3
- metadata +20 -6
@@ -1,27 +1,27 @@
|
|
1
|
-
describe
|
1
|
+
describe GetConfigRequest do
|
2
2
|
let(:data) { [1, 7, 0, 8, 0, 0, 0, 1].pack('C*') }
|
3
3
|
|
4
4
|
it 'should read binary' do
|
5
|
-
msg =
|
6
|
-
expect(msg.version).to eq(
|
5
|
+
msg = GetConfigRequest.read(data)
|
6
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
7
7
|
expect(msg.type).to eq(:get_config_request)
|
8
8
|
expect(msg.len).to eq(8)
|
9
9
|
expect(msg.xid).to eq(1)
|
10
10
|
end
|
11
11
|
it 'should be parsable' do
|
12
|
-
msg =
|
13
|
-
expect(msg.class).to eq(
|
12
|
+
msg = Parser.read(data)
|
13
|
+
expect(msg.class).to eq(GetConfigRequest)
|
14
14
|
end
|
15
15
|
it 'should initialize with default values' do
|
16
|
-
msg =
|
17
|
-
expect(msg.version).to eq(
|
16
|
+
msg = GetConfigRequest.new
|
17
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
18
18
|
expect(msg.type).to eq(:get_config_request)
|
19
19
|
expect(msg.len).to eq(8)
|
20
20
|
expect(msg.xid).to eq(0)
|
21
21
|
end
|
22
22
|
it 'should initialize with some values' do
|
23
|
-
msg =
|
24
|
-
expect(msg.version).to eq(
|
23
|
+
msg = GetConfigRequest.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
25
25
|
expect(msg.type).to eq(:get_config_request)
|
26
26
|
expect(msg.len).to eq(8)
|
27
27
|
expect(msg.xid).to eq(1)
|
data/spec/messages/hello_spec.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
describe
|
1
|
+
describe Hello do
|
2
2
|
let(:data) { [1, 0, 0, 8, 0, 0, 0, 1].pack('C*') }
|
3
3
|
|
4
4
|
it 'should read binary' do
|
5
|
-
msg =
|
6
|
-
expect(msg.version).to eq(
|
5
|
+
msg = Hello.read(data)
|
6
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
7
7
|
expect(msg.type).to eq(:hello)
|
8
8
|
expect(msg.len).to eq(8)
|
9
9
|
expect(msg.xid).to eq(1)
|
10
10
|
end
|
11
11
|
it 'should be parsable' do
|
12
|
-
msg =
|
13
|
-
expect(msg.class).to eq(
|
12
|
+
msg = Parser.read(data)
|
13
|
+
expect(msg.class).to eq(Hello)
|
14
14
|
end
|
15
15
|
it 'should initialize with default values' do
|
16
|
-
msg =
|
17
|
-
expect(msg.version).to eq(
|
16
|
+
msg = Hello.new
|
17
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
18
18
|
expect(msg.type).to eq(:hello)
|
19
19
|
expect(msg.len).to eq(8)
|
20
20
|
expect(msg.xid).to eq(0)
|
21
21
|
end
|
22
22
|
it 'should initialize with some values' do
|
23
|
-
msg =
|
24
|
-
expect(msg.version).to eq(
|
23
|
+
msg = Hello.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
25
25
|
expect(msg.type).to eq(:hello)
|
26
26
|
expect(msg.len).to eq(8)
|
27
27
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe PacketIn do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 10, 0, 64, 0, 0, 0, 1, # header
|
@@ -32,8 +32,8 @@ describe OpenFlow::Protocol::PacketIn do
|
|
32
32
|
}
|
33
33
|
|
34
34
|
it 'should read binary' do
|
35
|
-
msg =
|
36
|
-
expect(msg.version).to eq(
|
35
|
+
msg = PacketIn.read(data)
|
36
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
37
37
|
expect(msg.type).to eq(:packet_in)
|
38
38
|
expect(msg.len).to eq(64)
|
39
39
|
expect(msg.xid).to eq(1)
|
@@ -46,12 +46,12 @@ describe OpenFlow::Protocol::PacketIn do
|
|
46
46
|
expect(msg.parsed_data.mac_destination).to eq('00:00:00:00:00:02')
|
47
47
|
end
|
48
48
|
it 'should be parsable' do
|
49
|
-
msg =
|
50
|
-
expect(msg.class).to eq(
|
49
|
+
msg = Parser.read(data)
|
50
|
+
expect(msg.class).to eq(PacketIn)
|
51
51
|
end
|
52
52
|
it 'should initialize with default values' do
|
53
|
-
msg =
|
54
|
-
expect(msg.version).to eq(
|
53
|
+
msg = PacketIn.new
|
54
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
55
55
|
expect(msg.type).to eq(:packet_in)
|
56
56
|
expect(msg.len).to eq(18)
|
57
57
|
expect(msg.xid).to eq(0)
|
@@ -62,14 +62,14 @@ describe OpenFlow::Protocol::PacketIn do
|
|
62
62
|
expect(msg.data).to be_empty
|
63
63
|
end
|
64
64
|
it 'should initialize with some values' do
|
65
|
-
msg =
|
65
|
+
msg = PacketIn.new(
|
66
66
|
xid: 1,
|
67
67
|
buffer_id: 1,
|
68
68
|
in_port: 1,
|
69
69
|
reason: :no_match,
|
70
70
|
data: [1, 2].pack('C*')
|
71
71
|
)
|
72
|
-
expect(msg.version).to eq(
|
72
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
73
73
|
expect(msg.type).to eq(:packet_in)
|
74
74
|
expect(msg.len).to eq(20)
|
75
75
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe PacketOut do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 13, 0, 26, 0, 0, 0, 1, # header
|
@@ -16,8 +16,8 @@ describe OpenFlow::Protocol::PacketOut do
|
|
16
16
|
}
|
17
17
|
|
18
18
|
it 'should read binary' do
|
19
|
-
msg =
|
20
|
-
expect(msg.version).to eq(
|
19
|
+
msg = PacketOut.read(data)
|
20
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
21
21
|
expect(msg.type).to eq(:packet_out)
|
22
22
|
expect(msg.len).to eq(26)
|
23
23
|
expect(msg.xid).to eq(1)
|
@@ -28,12 +28,12 @@ describe OpenFlow::Protocol::PacketOut do
|
|
28
28
|
expect(msg.data.length).to eq(2)
|
29
29
|
end
|
30
30
|
it 'should be parsable' do
|
31
|
-
msg =
|
32
|
-
expect(msg.class).to eq(
|
31
|
+
msg = Parser.read(data)
|
32
|
+
expect(msg.class).to eq(PacketOut)
|
33
33
|
end
|
34
34
|
it 'should initialize with default values' do
|
35
|
-
msg =
|
36
|
-
expect(msg.version).to eq(
|
35
|
+
msg = PacketOut.new
|
36
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
37
37
|
expect(msg.type).to eq(:packet_out)
|
38
38
|
expect(msg.len).to eq(16)
|
39
39
|
expect(msg.xid).to eq(0)
|
@@ -43,13 +43,13 @@ describe OpenFlow::Protocol::PacketOut do
|
|
43
43
|
expect(msg.data).to be_empty
|
44
44
|
end
|
45
45
|
it 'should initialize with some values' do
|
46
|
-
msg =
|
46
|
+
msg = PacketOut.new(
|
47
47
|
xid: 1,
|
48
48
|
in_port: 1,
|
49
|
-
actions: [
|
49
|
+
actions: [ActionOutput.new(port: 1)],
|
50
50
|
data: [1, 2].pack('C*')
|
51
51
|
)
|
52
|
-
expect(msg.version).to eq(
|
52
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
53
53
|
expect(msg.type).to eq(:packet_out)
|
54
54
|
expect(msg.len).to eq(26)
|
55
55
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe Parser do
|
2
2
|
let(:hello_msg) { [1, 0, 0, 8, 0, 0, 0, 1].pack('C*') }
|
3
3
|
let(:packet_out_msg) {
|
4
4
|
[
|
@@ -17,18 +17,18 @@ describe OpenFlow::Protocol::Parser do
|
|
17
17
|
}
|
18
18
|
|
19
19
|
it 'should read binary Hello Message' do
|
20
|
-
msg =
|
21
|
-
expect(msg.class).to be(
|
22
|
-
expect(msg.version).to eq(
|
20
|
+
msg = Parser.read(hello_msg)
|
21
|
+
expect(msg.class).to be(Hello)
|
22
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
23
23
|
expect(msg.type).to eq(:hello)
|
24
24
|
expect(msg.len).to eq(8)
|
25
25
|
expect(msg.xid).to eq(1)
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should read binary PacketOut Message' do
|
29
|
-
msg =
|
30
|
-
expect(msg.class).to be(
|
31
|
-
expect(msg.version).to eq(
|
29
|
+
msg = Parser.read(packet_out_msg)
|
30
|
+
expect(msg.class).to be(PacketOut)
|
31
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
32
32
|
expect(msg.type).to eq(:packet_out)
|
33
33
|
expect(msg.len).to eq(26)
|
34
34
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe PortMod do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 15, 0, 32, 0, 0, 0, 1, # header
|
@@ -12,8 +12,8 @@ describe OpenFlow::Protocol::PortMod do
|
|
12
12
|
}
|
13
13
|
|
14
14
|
it 'should read binary' do
|
15
|
-
msg =
|
16
|
-
expect(msg.version).to eq(
|
15
|
+
msg = PortMod.read(data)
|
16
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
17
17
|
expect(msg.type).to eq(:port_mod)
|
18
18
|
expect(msg.len).to eq(32)
|
19
19
|
expect(msg.xid).to eq(1)
|
@@ -27,12 +27,12 @@ describe OpenFlow::Protocol::PortMod do
|
|
27
27
|
])
|
28
28
|
end
|
29
29
|
it 'should be parsable' do
|
30
|
-
msg =
|
31
|
-
expect(msg.class).to eq(
|
30
|
+
msg = Parser.read(data)
|
31
|
+
expect(msg.class).to eq(PortMod)
|
32
32
|
end
|
33
33
|
it 'should initialize with default values' do
|
34
|
-
msg =
|
35
|
-
expect(msg.version).to eq(
|
34
|
+
msg = PortMod.new
|
35
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
36
36
|
expect(msg.type).to eq(:port_mod)
|
37
37
|
expect(msg.len).to eq(32)
|
38
38
|
expect(msg.xid).to eq(0)
|
@@ -43,7 +43,7 @@ describe OpenFlow::Protocol::PortMod do
|
|
43
43
|
expect(msg.advertise).to be_empty
|
44
44
|
end
|
45
45
|
it 'should initialize with some values' do
|
46
|
-
msg =
|
46
|
+
msg = PortMod.new(
|
47
47
|
xid: 1,
|
48
48
|
port_number: 1,
|
49
49
|
hardware_address: '00:00:00:00:00:01',
|
@@ -54,7 +54,7 @@ describe OpenFlow::Protocol::PortMod do
|
|
54
54
|
:port_10mb_full_duplex
|
55
55
|
]
|
56
56
|
)
|
57
|
-
expect(msg.version).to eq(
|
57
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
58
58
|
expect(msg.type).to eq(:port_mod)
|
59
59
|
expect(msg.len).to eq(32)
|
60
60
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe PortStatus do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 12, 0, 64, 0, 0, 0, 1, # header
|
@@ -21,8 +21,8 @@ describe OpenFlow::Protocol::PortStatus do
|
|
21
21
|
}
|
22
22
|
|
23
23
|
it 'should read binary' do
|
24
|
-
msg =
|
25
|
-
expect(msg.version).to eq(
|
24
|
+
msg = PortStatus.read(data)
|
25
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
26
26
|
expect(msg.type).to eq(:port_status)
|
27
27
|
expect(msg.len).to eq(64)
|
28
28
|
expect(msg.xid).to eq(1)
|
@@ -30,12 +30,12 @@ describe OpenFlow::Protocol::PortStatus do
|
|
30
30
|
expect(msg.desc.port_number).to eq(1)
|
31
31
|
end
|
32
32
|
it 'should be parsable' do
|
33
|
-
msg =
|
34
|
-
expect(msg.class).to eq(
|
33
|
+
msg = Parser.read(data)
|
34
|
+
expect(msg.class).to eq(PortStatus)
|
35
35
|
end
|
36
36
|
it 'should initialize with default values' do
|
37
|
-
msg =
|
38
|
-
expect(msg.version).to eq(
|
37
|
+
msg = PortStatus.new
|
38
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
39
39
|
expect(msg.type).to eq(:port_status)
|
40
40
|
expect(msg.len).to eq(64)
|
41
41
|
expect(msg.xid).to eq(0)
|
@@ -43,12 +43,12 @@ describe OpenFlow::Protocol::PortStatus do
|
|
43
43
|
expect(msg.desc.port_number).to eq(0)
|
44
44
|
end
|
45
45
|
it 'should initialize with some values' do
|
46
|
-
msg =
|
46
|
+
msg = PortStatus.new(
|
47
47
|
xid: 1,
|
48
48
|
reason: :delete,
|
49
|
-
desc:
|
49
|
+
desc: PhysicalPort.new(port_number: 1)
|
50
50
|
)
|
51
|
-
expect(msg.version).to eq(
|
51
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
52
52
|
expect(msg.type).to eq(:port_status)
|
53
53
|
expect(msg.len).to eq(64)
|
54
54
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe QueueGetConfigReply do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 21, 0, 48, 0, 0, 0, 1, # header
|
@@ -21,8 +21,8 @@ describe OpenFlow::Protocol::QueueGetConfigReply do
|
|
21
21
|
}
|
22
22
|
|
23
23
|
it 'should read binary' do
|
24
|
-
msg =
|
25
|
-
expect(msg.version).to eq(
|
24
|
+
msg = QueueGetConfigReply.read(data)
|
25
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
26
26
|
expect(msg.type).to eq(:queue_get_config_reply)
|
27
27
|
expect(msg.len).to eq(48)
|
28
28
|
expect(msg.xid).to eq(1)
|
@@ -33,12 +33,12 @@ describe OpenFlow::Protocol::QueueGetConfigReply do
|
|
33
33
|
expect(msg.queues.last.queue_id).to eq(2)
|
34
34
|
end
|
35
35
|
it 'should be parsable' do
|
36
|
-
msg =
|
37
|
-
expect(msg.class).to eq(
|
36
|
+
msg = Parser.read(data)
|
37
|
+
expect(msg.class).to eq(QueueGetConfigReply)
|
38
38
|
end
|
39
39
|
it 'should initialize with default values' do
|
40
|
-
msg =
|
41
|
-
expect(msg.version).to eq(
|
40
|
+
msg = QueueGetConfigReply.new
|
41
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
42
42
|
expect(msg.type).to eq(:queue_get_config_reply)
|
43
43
|
expect(msg.len).to eq(16)
|
44
44
|
expect(msg.xid).to eq(0)
|
@@ -46,7 +46,7 @@ describe OpenFlow::Protocol::QueueGetConfigReply do
|
|
46
46
|
expect(msg.queues).to be_empty
|
47
47
|
end
|
48
48
|
it 'should initialize with some values' do
|
49
|
-
msg =
|
49
|
+
msg = QueueGetConfigReply.new(
|
50
50
|
xid: 1,
|
51
51
|
port: 2,
|
52
52
|
queues: [
|
@@ -54,7 +54,7 @@ describe OpenFlow::Protocol::QueueGetConfigReply do
|
|
54
54
|
{ queue_id: 2 },
|
55
55
|
]
|
56
56
|
)
|
57
|
-
expect(msg.version).to eq(
|
57
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
58
58
|
expect(msg.type).to eq(:queue_get_config_reply)
|
59
59
|
expect(msg.len).to eq(32)
|
60
60
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe QueueGetConfigRequest do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 20, 0, 12, 0, 0, 0, 1, # header
|
@@ -8,28 +8,28 @@ describe OpenFlow::Protocol::QueueGetConfigRequest do
|
|
8
8
|
}
|
9
9
|
|
10
10
|
it 'should read binary' do
|
11
|
-
msg =
|
12
|
-
expect(msg.version).to eq(
|
11
|
+
msg = QueueGetConfigRequest.read(data)
|
12
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
13
13
|
expect(msg.type).to eq(:queue_get_config_request)
|
14
14
|
expect(msg.len).to eq(12)
|
15
15
|
expect(msg.xid).to eq(1)
|
16
16
|
expect(msg.port).to eq(1)
|
17
17
|
end
|
18
18
|
it 'should be parsable' do
|
19
|
-
msg =
|
20
|
-
expect(msg.class).to eq(
|
19
|
+
msg = Parser.read(data)
|
20
|
+
expect(msg.class).to eq(QueueGetConfigRequest)
|
21
21
|
end
|
22
22
|
it 'should initialize with default values' do
|
23
|
-
msg =
|
24
|
-
expect(msg.version).to eq(
|
23
|
+
msg = QueueGetConfigRequest.new
|
24
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
25
25
|
expect(msg.type).to eq(:queue_get_config_request)
|
26
26
|
expect(msg.len).to eq(12)
|
27
27
|
expect(msg.xid).to eq(0)
|
28
28
|
expect(msg.port).to eq(0)
|
29
29
|
end
|
30
30
|
it 'should initialize with some values' do
|
31
|
-
msg =
|
32
|
-
expect(msg.version).to eq(
|
31
|
+
msg = QueueGetConfigRequest.new(xid: 1, port: 2)
|
32
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
33
33
|
expect(msg.type).to eq(:queue_get_config_request)
|
34
34
|
expect(msg.len).to eq(12)
|
35
35
|
expect(msg.xid).to eq(1)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe
|
1
|
+
describe SetConfig do
|
2
2
|
let(:data) {
|
3
3
|
[
|
4
4
|
1, 9, 0, 12, 0, 0, 0, 1, # header
|
@@ -8,8 +8,8 @@ describe OpenFlow::Protocol::SetConfig do
|
|
8
8
|
}
|
9
9
|
|
10
10
|
it 'should read binary' do
|
11
|
-
msg =
|
12
|
-
expect(msg.version).to eq(
|
11
|
+
msg = SetConfig.read(data)
|
12
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
13
13
|
expect(msg.type).to eq(:set_config)
|
14
14
|
expect(msg.len).to eq(12)
|
15
15
|
expect(msg.xid).to eq(1)
|
@@ -17,12 +17,12 @@ describe OpenFlow::Protocol::SetConfig do
|
|
17
17
|
expect(msg.miss_send_length).to eq(0xff)
|
18
18
|
end
|
19
19
|
it 'should be parsable' do
|
20
|
-
msg =
|
21
|
-
expect(msg.class).to eq(
|
20
|
+
msg = Parser.read(data)
|
21
|
+
expect(msg.class).to eq(SetConfig)
|
22
22
|
end
|
23
23
|
it 'should initialize with default values' do
|
24
|
-
msg =
|
25
|
-
expect(msg.version).to eq(
|
24
|
+
msg = SetConfig.new
|
25
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
26
26
|
expect(msg.type).to eq(:set_config)
|
27
27
|
expect(msg.len).to eq(12)
|
28
28
|
expect(msg.xid).to eq(0)
|
@@ -30,12 +30,12 @@ describe OpenFlow::Protocol::SetConfig do
|
|
30
30
|
expect(msg.miss_send_length).to eq(0)
|
31
31
|
end
|
32
32
|
it 'should initialize with some values' do
|
33
|
-
msg =
|
33
|
+
msg = SetConfig.new(
|
34
34
|
xid: 1,
|
35
35
|
flags: :fragments_normal,
|
36
36
|
miss_send_length: 0xff
|
37
37
|
)
|
38
|
-
expect(msg.version).to eq(
|
38
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
39
39
|
expect(msg.type).to eq(:set_config)
|
40
40
|
expect(msg.len).to eq(12)
|
41
41
|
expect(msg.xid).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe AggregateStatisticsReply do
|
2
2
|
it 'should read binary' do
|
3
|
-
stats =
|
3
|
+
stats = AggregateStatisticsReply.read [
|
4
4
|
0, 0, 0, 0, 0, 0, 0, 10, # packet_count
|
5
5
|
0, 0, 0, 0, 0, 0, 0, 80, # byte_count
|
6
6
|
0, 0, 0, 4, # flow_count
|
@@ -11,13 +11,13 @@ describe OpenFlow::Protocol::AggregateStatisticsReply do
|
|
11
11
|
expect(stats.flow_count).to eq(4)
|
12
12
|
end
|
13
13
|
it 'should initialize with default values' do
|
14
|
-
stats =
|
14
|
+
stats = AggregateStatisticsReply.new
|
15
15
|
expect(stats.packet_count).to eq(0)
|
16
16
|
expect(stats.byte_count).to eq(0)
|
17
17
|
expect(stats.flow_count).to eq(0)
|
18
18
|
end
|
19
19
|
it 'should initialize with some values' do
|
20
|
-
stats =
|
20
|
+
stats = AggregateStatisticsReply.new(
|
21
21
|
packet_count: 10,
|
22
22
|
byte_count: 80,
|
23
23
|
flow_count: 4
|