openflow-protocol 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 OFActionEnqueue do
|
1
|
+
describe OpenFlow::Protocol::ActionEnqueue do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionEnqueue.read [
|
6
4
|
0, 11, 0, 16, # header
|
7
5
|
0, 1, # port
|
8
6
|
0, 0, 0, 0, 0, 0, # padding
|
@@ -14,14 +12,14 @@ describe OFActionEnqueue do
|
|
14
12
|
expect(action.queue_id).to eq(1)
|
15
13
|
end
|
16
14
|
it 'should initialize with default values' do
|
17
|
-
action =
|
15
|
+
action = OpenFlow::Protocol::ActionEnqueue.new
|
18
16
|
expect(action.type).to eq(:enqueue)
|
19
17
|
expect(action.len).to eq(16)
|
20
18
|
expect(action.port).to eq(:none)
|
21
19
|
expect(action.queue_id).to eq(0)
|
22
20
|
end
|
23
21
|
it 'should initialize with some values' do
|
24
|
-
action =
|
22
|
+
action = OpenFlow::Protocol::ActionEnqueue.new(port: 1, queue_id: 1)
|
25
23
|
expect(action.type).to eq(:enqueue)
|
26
24
|
expect(action.len).to eq(16)
|
27
25
|
expect(action.port).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionOutput do
|
1
|
+
describe OpenFlow::Protocol::ActionOutput do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionOutput.read [
|
6
4
|
0, 0, 0, 8, # header
|
7
5
|
0, 1, # port
|
8
6
|
0xff, 0xff # max_length
|
@@ -13,14 +11,14 @@ describe OFActionOutput do
|
|
13
11
|
expect(action.max_length).to eq(0xffff)
|
14
12
|
end
|
15
13
|
it 'should initialize with default values' do
|
16
|
-
action =
|
14
|
+
action = OpenFlow::Protocol::ActionOutput.new
|
17
15
|
expect(action.type).to eq(:output)
|
18
16
|
expect(action.len).to eq(8)
|
19
17
|
expect(action.port).to eq(:none)
|
20
18
|
expect(action.max_length).to eq(0xffff)
|
21
19
|
end
|
22
20
|
it 'should initialize with some values' do
|
23
|
-
action =
|
21
|
+
action = OpenFlow::Protocol::ActionOutput.new(port: 1)
|
24
22
|
expect(action.type).to eq(:output)
|
25
23
|
expect(action.len).to eq(8)
|
26
24
|
expect(action.port).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetDestinationPort do
|
1
|
+
describe OpenFlow::Protocol::ActionSetDestinationPort do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetDestinationPort.read [
|
6
4
|
0, 10, 0, 8, # header
|
7
5
|
0, 1, # port
|
8
6
|
0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetDestinationPort do
|
|
12
10
|
expect(action.port).to eq(1)
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetDestinationPort.new
|
16
14
|
expect(action.type).to eq(:set_destination_port)
|
17
15
|
expect(action.len).to eq(8)
|
18
16
|
expect(action.port).to eq(0)
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetDestinationPort.new(port: 1)
|
22
20
|
expect(action.type).to eq(:set_destination_port)
|
23
21
|
expect(action.len).to eq(8)
|
24
22
|
expect(action.port).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetIpDestination do
|
1
|
+
describe OpenFlow::Protocol::ActionSetIpDestination do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetIpDestination.read [
|
6
4
|
0, 7, 0, 8, # header
|
7
5
|
10, 0, 0, 1 # ip_address
|
8
6
|
].pack('C*')
|
@@ -11,13 +9,13 @@ describe OFActionSetIpDestination do
|
|
11
9
|
expect(action.ip_address).to eq('10.0.0.1')
|
12
10
|
end
|
13
11
|
it 'should initialize with default values' do
|
14
|
-
action =
|
12
|
+
action = OpenFlow::Protocol::ActionSetIpDestination.new
|
15
13
|
expect(action.type).to eq(:set_ip_destination)
|
16
14
|
expect(action.len).to eq(8)
|
17
15
|
expect(action.ip_address).to eq('0.0.0.0')
|
18
16
|
end
|
19
17
|
it 'should initialize with some values' do
|
20
|
-
action =
|
18
|
+
action = OpenFlow::Protocol::ActionSetIpDestination.new(ip_address: '10.0.0.1')
|
21
19
|
expect(action.type).to eq(:set_ip_destination)
|
22
20
|
expect(action.len).to eq(8)
|
23
21
|
expect(action.ip_address).to eq('10.0.0.1')
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetIpSource do
|
1
|
+
describe OpenFlow::Protocol::ActionSetIpSource do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetIpSource.read [
|
6
4
|
0, 6, 0, 8, # header
|
7
5
|
10, 0, 0, 1 # ip_address
|
8
6
|
].pack('C*')
|
@@ -11,13 +9,13 @@ describe OFActionSetIpSource do
|
|
11
9
|
expect(action.ip_address).to eq('10.0.0.1')
|
12
10
|
end
|
13
11
|
it 'should initialize with default values' do
|
14
|
-
action =
|
12
|
+
action = OpenFlow::Protocol::ActionSetIpSource.new
|
15
13
|
expect(action.type).to eq(:set_ip_source)
|
16
14
|
expect(action.len).to eq(8)
|
17
15
|
expect(action.ip_address).to eq('0.0.0.0')
|
18
16
|
end
|
19
17
|
it 'should initialize with some values' do
|
20
|
-
action =
|
18
|
+
action = OpenFlow::Protocol::ActionSetIpSource.new(ip_address: '10.0.0.1')
|
21
19
|
expect(action.type).to eq(:set_ip_source)
|
22
20
|
expect(action.len).to eq(8)
|
23
21
|
expect(action.ip_address).to eq('10.0.0.1')
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetIpTos do
|
1
|
+
describe OpenFlow::Protocol::ActionSetIpTos do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetIpTos.read [
|
6
4
|
0, 8, 0, 8, # header
|
7
5
|
10, # tos
|
8
6
|
0, 0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetIpTos do
|
|
12
10
|
expect(action.tos).to eq(10)
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetIpTos.new
|
16
14
|
expect(action.type).to eq(:set_ip_tos)
|
17
15
|
expect(action.len).to eq(8)
|
18
16
|
expect(action.tos).to eq(0)
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetIpTos.new(tos: 10)
|
22
20
|
expect(action.type).to eq(:set_ip_tos)
|
23
21
|
expect(action.len).to eq(8)
|
24
22
|
expect(action.tos).to eq(10)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetMacDestination do
|
1
|
+
describe OpenFlow::Protocol::ActionSetMacDestination do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetMacDestination.read [
|
6
4
|
0, 5, 0, 16, # header
|
7
5
|
0, 0, 0, 0, 0, 1, # mac_address
|
8
6
|
0, 0, 0, 0, 0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetMacDestination do
|
|
12
10
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetMacDestination.new
|
16
14
|
expect(action.type).to eq(:set_mac_destination)
|
17
15
|
expect(action.len).to eq(16)
|
18
16
|
expect(action.mac_address).to eq('00:00:00:00:00:00')
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetMacDestination.new(mac_address: '00:00:00:00:00:01')
|
22
20
|
expect(action.type).to eq(:set_mac_destination)
|
23
21
|
expect(action.len).to eq(16)
|
24
22
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetMacSource do
|
1
|
+
describe OpenFlow::Protocol::ActionSetMacSource do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetMacSource.read [
|
6
4
|
0, 4, 0, 16, # header
|
7
5
|
0, 0, 0, 0, 0, 1, # mac_address
|
8
6
|
0, 0, 0, 0, 0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetMacSource do
|
|
12
10
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetMacSource.new
|
16
14
|
expect(action.type).to eq(:set_mac_source)
|
17
15
|
expect(action.len).to eq(16)
|
18
16
|
expect(action.mac_address).to eq('00:00:00:00:00:00')
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetMacSource.new(mac_address: '00:00:00:00:00:01')
|
22
20
|
expect(action.type).to eq(:set_mac_source)
|
23
21
|
expect(action.len).to eq(16)
|
24
22
|
expect(action.mac_address).to eq('00:00:00:00:00:01')
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetSourcePort do
|
1
|
+
describe OpenFlow::Protocol::ActionSetSourcePort do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetSourcePort.read [
|
6
4
|
0, 9, 0, 8, # header
|
7
5
|
0, 1, # port
|
8
6
|
0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetSourcePort do
|
|
12
10
|
expect(action.port).to eq(1)
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetSourcePort.new
|
16
14
|
expect(action.type).to eq(:set_source_port)
|
17
15
|
expect(action.len).to eq(8)
|
18
16
|
expect(action.port).to eq(0)
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetSourcePort.new(port: 1)
|
22
20
|
expect(action.type).to eq(:set_source_port)
|
23
21
|
expect(action.len).to eq(8)
|
24
22
|
expect(action.port).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetVlanId do
|
1
|
+
describe OpenFlow::Protocol::ActionSetVlanId do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetVlanId.read [
|
6
4
|
0, 1, 0, 8, # header
|
7
5
|
0, 1, # vlan_id
|
8
6
|
0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetVlanId do
|
|
12
10
|
expect(action.vlan_id).to eq(1)
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetVlanId.new
|
16
14
|
expect(action.type).to eq(:set_vlan_id)
|
17
15
|
expect(action.len).to eq(8)
|
18
16
|
expect(action.vlan_id).to eq(0)
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetVlanId.new(vlan_id: 1)
|
22
20
|
expect(action.type).to eq(:set_vlan_id)
|
23
21
|
expect(action.len).to eq(8)
|
24
22
|
expect(action.vlan_id).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionSetVlanPcp do
|
1
|
+
describe OpenFlow::Protocol::ActionSetVlanPcp do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionSetVlanPcp.read [
|
6
4
|
0, 2, 0, 8, # header
|
7
5
|
1, # vlan_pcp
|
8
6
|
0, 0, 0 # padding
|
@@ -12,13 +10,13 @@ describe OFActionSetVlanPcp do
|
|
12
10
|
expect(action.vlan_pcp).to eq(1)
|
13
11
|
end
|
14
12
|
it 'should initialize with default values' do
|
15
|
-
action =
|
13
|
+
action = OpenFlow::Protocol::ActionSetVlanPcp.new
|
16
14
|
expect(action.type).to eq(:set_vlan_pcp)
|
17
15
|
expect(action.len).to eq(8)
|
18
16
|
expect(action.vlan_pcp).to eq(0)
|
19
17
|
end
|
20
18
|
it 'should initialize with some values' do
|
21
|
-
action =
|
19
|
+
action = OpenFlow::Protocol::ActionSetVlanPcp.new(vlan_pcp: 1)
|
22
20
|
expect(action.type).to eq(:set_vlan_pcp)
|
23
21
|
expect(action.len).to eq(8)
|
24
22
|
expect(action.vlan_pcp).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionStripVlan do
|
1
|
+
describe OpenFlow::Protocol::ActionStripVlan do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionStripVlan.read [
|
6
4
|
0, 3, 0, 8, # header
|
7
5
|
0, 0, 0, 0 # padding
|
8
6
|
].pack('C*')
|
@@ -10,7 +8,7 @@ describe OFActionStripVlan do
|
|
10
8
|
expect(action.len).to eq(8)
|
11
9
|
end
|
12
10
|
it 'should initialize with default values' do
|
13
|
-
action =
|
11
|
+
action = OpenFlow::Protocol::ActionStripVlan.new
|
14
12
|
expect(action.type).to eq(:strip_vlan)
|
15
13
|
expect(action.len).to eq(8)
|
16
14
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActionVendor do
|
1
|
+
describe OpenFlow::Protocol::ActionVendor do
|
4
2
|
it 'should read binary' do
|
5
|
-
action =
|
3
|
+
action = OpenFlow::Protocol::ActionVendor.read [
|
6
4
|
0xff, 0xff, 0, 8, # header
|
7
5
|
0, 0, 0, 1 # vendor
|
8
6
|
].pack('C*')
|
@@ -11,13 +9,13 @@ describe OFActionVendor do
|
|
11
9
|
expect(action.vendor).to eq(1)
|
12
10
|
end
|
13
11
|
it 'should initialize with default values' do
|
14
|
-
action =
|
12
|
+
action = OpenFlow::Protocol::ActionVendor.new
|
15
13
|
expect(action.type).to eq(:vendor)
|
16
14
|
expect(action.len).to eq(8)
|
17
15
|
expect(action.vendor).to eq(0)
|
18
16
|
end
|
19
17
|
it 'should initialize with some values' do
|
20
|
-
action =
|
18
|
+
action = OpenFlow::Protocol::ActionVendor.new(vendor: 1)
|
21
19
|
expect(action.type).to eq(:vendor)
|
22
20
|
expect(action.len).to eq(8)
|
23
21
|
expect(action.vendor).to eq(1)
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFActions do
|
1
|
+
describe OpenFlow::Protocol::Actions do
|
4
2
|
it 'should read binary' do
|
5
|
-
actions =
|
3
|
+
actions = OpenFlow::Protocol::Actions.read [
|
6
4
|
# output
|
7
5
|
0, 0, 0, 8, # header
|
8
6
|
0, 1, # port
|
@@ -18,13 +16,13 @@ describe OFActions do
|
|
18
16
|
expect(actions.last.type).to eq(:enqueue)
|
19
17
|
end
|
20
18
|
it 'should initialize with default values' do
|
21
|
-
actions =
|
19
|
+
actions = OpenFlow::Protocol::Actions.new
|
22
20
|
expect(actions).to be_empty
|
23
21
|
end
|
24
22
|
it 'should initialize with some values' do
|
25
|
-
actions =
|
26
|
-
|
27
|
-
|
23
|
+
actions = OpenFlow::Protocol::Actions.new([
|
24
|
+
OpenFlow::Protocol::ActionOutput.new(port: 1, max_length: 0xffff),
|
25
|
+
OpenFlow::Protocol::ActionEnqueue.new(port: 1, queue_id: 1)
|
28
26
|
])
|
29
27
|
expect(actions.length).to eq(2)
|
30
28
|
expect(actions.first.type).to eq(:output)
|
@@ -1,29 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFBarrierReply do
|
1
|
+
describe OpenFlow::Protocol::BarrierReply do
|
4
2
|
let(:data) { [1, 19, 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::BarrierReply.read(data)
|
6
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
9
7
|
expect(msg.type).to eq(:barrier_reply)
|
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::BarrierReply)
|
16
14
|
end
|
17
15
|
it 'should initialize with default values' do
|
18
|
-
msg =
|
19
|
-
expect(msg.version).to eq(
|
16
|
+
msg = OpenFlow::Protocol::BarrierReply.new
|
17
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
20
18
|
expect(msg.type).to eq(:barrier_reply)
|
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::BarrierReply.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
27
25
|
expect(msg.type).to eq(:barrier_reply)
|
28
26
|
expect(msg.len).to eq(8)
|
29
27
|
expect(msg.xid).to eq(1)
|
@@ -1,29 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe OFBarrierRequest do
|
1
|
+
describe OpenFlow::Protocol::BarrierRequest do
|
4
2
|
let(:data) { [1, 18, 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::BarrierRequest.read(data)
|
6
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
9
7
|
expect(msg.type).to eq(:barrier_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::BarrierRequest)
|
16
14
|
end
|
17
15
|
it 'should initialize with default values' do
|
18
|
-
msg =
|
19
|
-
expect(msg.version).to eq(
|
16
|
+
msg = OpenFlow::Protocol::BarrierRequest.new
|
17
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
20
18
|
expect(msg.type).to eq(:barrier_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::BarrierRequest.new(xid: 1)
|
24
|
+
expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
|
27
25
|
expect(msg.type).to eq(:barrier_request)
|
28
26
|
expect(msg.len).to eq(8)
|
29
27
|
expect(msg.xid).to eq(1)
|