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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd2f141b6dabeda2e35d99495b355ea25968d55
|
4
|
+
data.tar.gz: ddb27e44037c42ed814a4697fbd6334d096bc0ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c8b7487dcd15935b847a2e9bb120b6f4d17cee7cbb2c3e8cda918c3dcafa32bcf7d95d80badec29995b324fb701a9bb758a4cc4732663e33ede082416b0a50f
|
7
|
+
data.tar.gz: 18992f20220e9f3034a7111d711c913d755ee6de92898a36685e4f09490c1b29f01f02fbfd043d7dbd048bcfec8fd2f37370857f921a761a4751381a4c00e9d2
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionEnqueue do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionEnqueue.read [
|
4
4
|
0, 11, 0, 16, # header
|
5
5
|
0, 1, # port
|
6
6
|
0, 0, 0, 0, 0, 0, # padding
|
@@ -12,14 +12,14 @@ describe OpenFlow::Protocol::ActionEnqueue do
|
|
12
12
|
expect(action.queue_id).to eq(1)
|
13
13
|
end
|
14
14
|
it 'should initialize with default values' do
|
15
|
-
action =
|
15
|
+
action = ActionEnqueue.new
|
16
16
|
expect(action.type).to eq(:enqueue)
|
17
17
|
expect(action.len).to eq(16)
|
18
18
|
expect(action.port).to eq(:none)
|
19
19
|
expect(action.queue_id).to eq(0)
|
20
20
|
end
|
21
21
|
it 'should initialize with some values' do
|
22
|
-
action =
|
22
|
+
action = ActionEnqueue.new(port: 1, queue_id: 1)
|
23
23
|
expect(action.type).to eq(:enqueue)
|
24
24
|
expect(action.len).to eq(16)
|
25
25
|
expect(action.port).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionOutput do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionOutput.read [
|
4
4
|
0, 0, 0, 8, # header
|
5
5
|
0, 1, # port
|
6
6
|
0xff, 0xff # max_length
|
@@ -11,14 +11,14 @@ describe OpenFlow::Protocol::ActionOutput do
|
|
11
11
|
expect(action.max_length).to eq(0xffff)
|
12
12
|
end
|
13
13
|
it 'should initialize with default values' do
|
14
|
-
action =
|
14
|
+
action = ActionOutput.new
|
15
15
|
expect(action.type).to eq(:output)
|
16
16
|
expect(action.len).to eq(8)
|
17
17
|
expect(action.port).to eq(:none)
|
18
18
|
expect(action.max_length).to eq(0xffff)
|
19
19
|
end
|
20
20
|
it 'should initialize with some values' do
|
21
|
-
action =
|
21
|
+
action = ActionOutput.new(port: 1)
|
22
22
|
expect(action.type).to eq(:output)
|
23
23
|
expect(action.len).to eq(8)
|
24
24
|
expect(action.port).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetDestinationPort do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetDestinationPort.read [
|
4
4
|
0, 10, 0, 8, # header
|
5
5
|
0, 1, # port
|
6
6
|
0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetDestinationPort do
|
|
10
10
|
expect(action.port).to eq(1)
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetDestinationPort.new
|
14
14
|
expect(action.type).to eq(:set_destination_port)
|
15
15
|
expect(action.len).to eq(8)
|
16
16
|
expect(action.port).to eq(0)
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetDestinationPort.new(port: 1)
|
20
20
|
expect(action.type).to eq(:set_destination_port)
|
21
21
|
expect(action.len).to eq(8)
|
22
22
|
expect(action.port).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetIpDestination do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetIpDestination.read [
|
4
4
|
0, 7, 0, 8, # header
|
5
5
|
10, 0, 0, 1 # ip_address
|
6
6
|
].pack('C*')
|
@@ -9,13 +9,13 @@ describe OpenFlow::Protocol::ActionSetIpDestination do
|
|
9
9
|
expect(action.ip_address).to eq('10.0.0.1')
|
10
10
|
end
|
11
11
|
it 'should initialize with default values' do
|
12
|
-
action =
|
12
|
+
action = ActionSetIpDestination.new
|
13
13
|
expect(action.type).to eq(:set_ip_destination)
|
14
14
|
expect(action.len).to eq(8)
|
15
15
|
expect(action.ip_address).to eq('0.0.0.0')
|
16
16
|
end
|
17
17
|
it 'should initialize with some values' do
|
18
|
-
action =
|
18
|
+
action = ActionSetIpDestination.new(ip_address: '10.0.0.1')
|
19
19
|
expect(action.type).to eq(:set_ip_destination)
|
20
20
|
expect(action.len).to eq(8)
|
21
21
|
expect(action.ip_address).to eq('10.0.0.1')
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetIpSource do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetIpSource.read [
|
4
4
|
0, 6, 0, 8, # header
|
5
5
|
10, 0, 0, 1 # ip_address
|
6
6
|
].pack('C*')
|
@@ -9,13 +9,13 @@ describe OpenFlow::Protocol::ActionSetIpSource do
|
|
9
9
|
expect(action.ip_address).to eq('10.0.0.1')
|
10
10
|
end
|
11
11
|
it 'should initialize with default values' do
|
12
|
-
action =
|
12
|
+
action = ActionSetIpSource.new
|
13
13
|
expect(action.type).to eq(:set_ip_source)
|
14
14
|
expect(action.len).to eq(8)
|
15
15
|
expect(action.ip_address).to eq('0.0.0.0')
|
16
16
|
end
|
17
17
|
it 'should initialize with some values' do
|
18
|
-
action =
|
18
|
+
action = ActionSetIpSource.new(ip_address: '10.0.0.1')
|
19
19
|
expect(action.type).to eq(:set_ip_source)
|
20
20
|
expect(action.len).to eq(8)
|
21
21
|
expect(action.ip_address).to eq('10.0.0.1')
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetIpTos do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetIpTos.read [
|
4
4
|
0, 8, 0, 8, # header
|
5
5
|
10, # tos
|
6
6
|
0, 0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetIpTos do
|
|
10
10
|
expect(action.tos).to eq(10)
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetIpTos.new
|
14
14
|
expect(action.type).to eq(:set_ip_tos)
|
15
15
|
expect(action.len).to eq(8)
|
16
16
|
expect(action.tos).to eq(0)
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetIpTos.new(tos: 10)
|
20
20
|
expect(action.type).to eq(:set_ip_tos)
|
21
21
|
expect(action.len).to eq(8)
|
22
22
|
expect(action.tos).to eq(10)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetMacDestination do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetMacDestination.read [
|
4
4
|
0, 5, 0, 16, # header
|
5
5
|
0, 0, 0, 0, 0, 1, # mac_address
|
6
6
|
0, 0, 0, 0, 0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetMacDestination do
|
|
10
10
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetMacDestination.new
|
14
14
|
expect(action.type).to eq(:set_mac_destination)
|
15
15
|
expect(action.len).to eq(16)
|
16
16
|
expect(action.mac_address).to eq('00:00:00:00:00:00')
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetMacDestination.new(mac_address: '00:00:00:00:00:01')
|
20
20
|
expect(action.type).to eq(:set_mac_destination)
|
21
21
|
expect(action.len).to eq(16)
|
22
22
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetMacSource do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetMacSource.read [
|
4
4
|
0, 4, 0, 16, # header
|
5
5
|
0, 0, 0, 0, 0, 1, # mac_address
|
6
6
|
0, 0, 0, 0, 0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetMacSource do
|
|
10
10
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetMacSource.new
|
14
14
|
expect(action.type).to eq(:set_mac_source)
|
15
15
|
expect(action.len).to eq(16)
|
16
16
|
expect(action.mac_address).to eq('00:00:00:00:00:00')
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetMacSource.new(mac_address: '00:00:00:00:00:01')
|
20
20
|
expect(action.type).to eq(:set_mac_source)
|
21
21
|
expect(action.len).to eq(16)
|
22
22
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetSourcePort do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetSourcePort.read [
|
4
4
|
0, 9, 0, 8, # header
|
5
5
|
0, 1, # port
|
6
6
|
0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetSourcePort do
|
|
10
10
|
expect(action.port).to eq(1)
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetSourcePort.new
|
14
14
|
expect(action.type).to eq(:set_source_port)
|
15
15
|
expect(action.len).to eq(8)
|
16
16
|
expect(action.port).to eq(0)
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetSourcePort.new(port: 1)
|
20
20
|
expect(action.type).to eq(:set_source_port)
|
21
21
|
expect(action.len).to eq(8)
|
22
22
|
expect(action.port).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetVlanId do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetVlanId.read [
|
4
4
|
0, 1, 0, 8, # header
|
5
5
|
0, 1, # vlan_id
|
6
6
|
0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetVlanId do
|
|
10
10
|
expect(action.vlan_id).to eq(1)
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetVlanId.new
|
14
14
|
expect(action.type).to eq(:set_vlan_id)
|
15
15
|
expect(action.len).to eq(8)
|
16
16
|
expect(action.vlan_id).to eq(0)
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetVlanId.new(vlan_id: 1)
|
20
20
|
expect(action.type).to eq(:set_vlan_id)
|
21
21
|
expect(action.len).to eq(8)
|
22
22
|
expect(action.vlan_id).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionSetVlanPcp do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionSetVlanPcp.read [
|
4
4
|
0, 2, 0, 8, # header
|
5
5
|
1, # vlan_pcp
|
6
6
|
0, 0, 0 # padding
|
@@ -10,13 +10,13 @@ describe OpenFlow::Protocol::ActionSetVlanPcp do
|
|
10
10
|
expect(action.vlan_pcp).to eq(1)
|
11
11
|
end
|
12
12
|
it 'should initialize with default values' do
|
13
|
-
action =
|
13
|
+
action = ActionSetVlanPcp.new
|
14
14
|
expect(action.type).to eq(:set_vlan_pcp)
|
15
15
|
expect(action.len).to eq(8)
|
16
16
|
expect(action.vlan_pcp).to eq(0)
|
17
17
|
end
|
18
18
|
it 'should initialize with some values' do
|
19
|
-
action =
|
19
|
+
action = ActionSetVlanPcp.new(vlan_pcp: 1)
|
20
20
|
expect(action.type).to eq(:set_vlan_pcp)
|
21
21
|
expect(action.len).to eq(8)
|
22
22
|
expect(action.vlan_pcp).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionStripVlan do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionStripVlan.read [
|
4
4
|
0, 3, 0, 8, # header
|
5
5
|
0, 0, 0, 0 # padding
|
6
6
|
].pack('C*')
|
@@ -8,7 +8,7 @@ describe OpenFlow::Protocol::ActionStripVlan do
|
|
8
8
|
expect(action.len).to eq(8)
|
9
9
|
end
|
10
10
|
it 'should initialize with default values' do
|
11
|
-
action =
|
11
|
+
action = ActionStripVlan.new
|
12
12
|
expect(action.type).to eq(:strip_vlan)
|
13
13
|
expect(action.len).to eq(8)
|
14
14
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe ActionVendor do
|
2
2
|
it 'should read binary' do
|
3
|
-
action =
|
3
|
+
action = ActionVendor.read [
|
4
4
|
0xff, 0xff, 0, 8, # header
|
5
5
|
0, 0, 0, 1 # vendor
|
6
6
|
].pack('C*')
|
@@ -9,13 +9,13 @@ describe OpenFlow::Protocol::ActionVendor do
|
|
9
9
|
expect(action.vendor).to eq(1)
|
10
10
|
end
|
11
11
|
it 'should initialize with default values' do
|
12
|
-
action =
|
12
|
+
action = ActionVendor.new
|
13
13
|
expect(action.type).to eq(:vendor)
|
14
14
|
expect(action.len).to eq(8)
|
15
15
|
expect(action.vendor).to eq(0)
|
16
16
|
end
|
17
17
|
it 'should initialize with some values' do
|
18
|
-
action =
|
18
|
+
action = ActionVendor.new(vendor: 1)
|
19
19
|
expect(action.type).to eq(:vendor)
|
20
20
|
expect(action.len).to eq(8)
|
21
21
|
expect(action.vendor).to eq(1)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe
|
1
|
+
describe Actions do
|
2
2
|
it 'should read binary' do
|
3
|
-
actions =
|
3
|
+
actions = Actions.read [
|
4
4
|
# output
|
5
5
|
0, 0, 0, 8, # header
|
6
6
|
0, 1, # port
|
@@ -16,13 +16,13 @@ describe OpenFlow::Protocol::Actions do
|
|
16
16
|
expect(actions.last.type).to eq(:enqueue)
|
17
17
|
end
|
18
18
|
it 'should initialize with default values' do
|
19
|
-
actions =
|
19
|
+
actions = Actions.new
|
20
20
|
expect(actions).to be_empty
|
21
21
|
end
|
22
22
|
it 'should initialize with some values' do
|
23
|
-
actions =
|
24
|
-
|
25
|
-
|
23
|
+
actions = Actions.new([
|
24
|
+
ActionOutput.new(port: 1, max_length: 0xffff),
|
25
|
+
ActionEnqueue.new(port: 1, queue_id: 1)
|
26
26
|
])
|
27
27
|
expect(actions.length).to eq(2)
|
28
28
|
expect(actions.first.type).to eq(:output)
|
@@ -1,27 +1,27 @@
|
|
1
|
-
describe
|
1
|
+
describe BarrierReply do
|
2
2
|
let(:data) { [1, 19, 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 = BarrierReply.read(data)
|
6
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
7
7
|
expect(msg.type).to eq(:barrier_reply)
|
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(BarrierReply)
|
14
14
|
end
|
15
15
|
it 'should initialize with default values' do
|
16
|
-
msg =
|
17
|
-
expect(msg.version).to eq(
|
16
|
+
msg = BarrierReply.new
|
17
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
18
18
|
expect(msg.type).to eq(:barrier_reply)
|
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 = BarrierReply.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
25
25
|
expect(msg.type).to eq(:barrier_reply)
|
26
26
|
expect(msg.len).to eq(8)
|
27
27
|
expect(msg.xid).to eq(1)
|
@@ -1,27 +1,27 @@
|
|
1
|
-
describe
|
1
|
+
describe BarrierRequest do
|
2
2
|
let(:data) { [1, 18, 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 = BarrierRequest.read(data)
|
6
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
7
7
|
expect(msg.type).to eq(:barrier_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(BarrierRequest)
|
14
14
|
end
|
15
15
|
it 'should initialize with default values' do
|
16
|
-
msg =
|
17
|
-
expect(msg.version).to eq(
|
16
|
+
msg = BarrierRequest.new
|
17
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
18
18
|
expect(msg.type).to eq(:barrier_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 = BarrierRequest.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(Message::OFP_VERSION)
|
25
25
|
expect(msg.type).to eq(:barrier_request)
|
26
26
|
expect(msg.len).to eq(8)
|
27
27
|
expect(msg.xid).to eq(1)
|