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.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openflow-protocol.rb +2 -1
  3. data/lib/openflow-protocol/actions/action.rb +30 -0
  4. data/lib/openflow-protocol/actions/action_enqueue.rb +16 -0
  5. data/lib/openflow-protocol/actions/action_output.rb +14 -0
  6. data/lib/openflow-protocol/actions/action_set_destination_port.rb +7 -0
  7. data/lib/openflow-protocol/actions/action_set_ip_destination.rb +7 -0
  8. data/lib/openflow-protocol/actions/action_set_ip_source.rb +13 -0
  9. data/lib/openflow-protocol/actions/action_set_ip_tos.rb +15 -0
  10. data/lib/openflow-protocol/actions/action_set_mac_destination.rb +7 -0
  11. data/lib/openflow-protocol/actions/action_set_mac_source.rb +15 -0
  12. data/lib/openflow-protocol/actions/action_set_source_port.rb +15 -0
  13. data/lib/openflow-protocol/actions/action_set_vlan_id.rb +15 -0
  14. data/lib/openflow-protocol/actions/action_set_vlan_pcp.rb +15 -0
  15. data/lib/openflow-protocol/actions/action_strip_vlan.rb +14 -0
  16. data/lib/openflow-protocol/actions/action_vendor.rb +13 -0
  17. data/lib/openflow-protocol/actions/actions.rb +9 -0
  18. data/lib/openflow-protocol/helpers/array_of_subclasses.rb +42 -0
  19. data/lib/openflow-protocol/helpers/superclass_base.rb +26 -0
  20. data/lib/openflow-protocol/messages/barrier_reply.rb +7 -0
  21. data/lib/openflow-protocol/messages/barrier_request.rb +7 -0
  22. data/lib/openflow-protocol/messages/echo_reply.rb +13 -0
  23. data/lib/openflow-protocol/messages/echo_request.rb +13 -0
  24. data/lib/openflow-protocol/messages/error.rb +69 -0
  25. data/lib/openflow-protocol/messages/features_reply.rb +44 -0
  26. data/lib/openflow-protocol/messages/features_request.rb +7 -0
  27. data/lib/openflow-protocol/messages/flow_mod.rb +24 -0
  28. data/lib/openflow-protocol/messages/flow_removed.rb +27 -0
  29. data/lib/openflow-protocol/messages/get_config_reply.rb +16 -0
  30. data/lib/openflow-protocol/messages/get_config_request.rb +7 -0
  31. data/lib/openflow-protocol/messages/hello.rb +7 -0
  32. data/lib/openflow-protocol/messages/message.rb +49 -0
  33. data/lib/openflow-protocol/messages/packet_in.rb +27 -0
  34. data/lib/openflow-protocol/messages/packet_out.rb +17 -0
  35. data/lib/openflow-protocol/messages/parser.rb +26 -0
  36. data/lib/openflow-protocol/messages/port_mod.rb +19 -0
  37. data/lib/openflow-protocol/messages/port_status.rb +18 -0
  38. data/lib/openflow-protocol/messages/queue_get_config_reply.rb +18 -0
  39. data/lib/openflow-protocol/messages/queue_get_config_request.rb +15 -0
  40. data/lib/openflow-protocol/messages/set_config.rb +7 -0
  41. data/lib/openflow-protocol/messages/statistics.rb +28 -0
  42. data/lib/openflow-protocol/messages/statistics/aggregate_statistics_reply.rb +14 -0
  43. data/lib/openflow-protocol/messages/statistics/aggregate_statistics_request.rb +7 -0
  44. data/lib/openflow-protocol/messages/statistics/description_statistics.rb +32 -0
  45. data/lib/openflow-protocol/messages/statistics/flow_statistics_reply.rb +25 -0
  46. data/lib/openflow-protocol/messages/statistics/flow_statistics_request.rb +14 -0
  47. data/lib/openflow-protocol/messages/statistics/port_statistics_reply.rb +24 -0
  48. data/lib/openflow-protocol/messages/statistics/port_statistics_request.rb +12 -0
  49. data/lib/openflow-protocol/messages/statistics/queue_statistics_reply.rb +16 -0
  50. data/lib/openflow-protocol/messages/statistics/queue_statistics_request.rb +13 -0
  51. data/lib/openflow-protocol/messages/statistics/table_statistics.rb +20 -0
  52. data/lib/openflow-protocol/messages/statistics/vendor_statistics.rb +11 -0
  53. data/lib/openflow-protocol/messages/statistics_reply.rb +26 -0
  54. data/lib/openflow-protocol/messages/statistics_request.rb +18 -0
  55. data/lib/openflow-protocol/messages/vendor.rb +14 -0
  56. data/lib/openflow-protocol/structs/match.rb +106 -0
  57. data/lib/openflow-protocol/structs/packet_queue.rb +14 -0
  58. data/lib/openflow-protocol/structs/physical_port.rb +50 -0
  59. data/lib/openflow-protocol/structs/port_number.rb +49 -0
  60. data/lib/openflow-protocol/structs/queue_properties/queue_properties.rb +9 -0
  61. data/lib/openflow-protocol/structs/queue_properties/queue_property.rb +20 -0
  62. data/lib/openflow-protocol/structs/queue_properties/queue_property_min_rate.rb +30 -0
  63. data/lib/openflow-protocol/structs/queue_properties/queue_property_none.rb +7 -0
  64. data/lib/openflow-protocol/version.rb +1 -1
  65. data/spec/actions/action_enqueue_spec.rb +4 -6
  66. data/spec/actions/action_output_spec.rb +4 -6
  67. data/spec/actions/action_set_destination_port_spec.rb +4 -6
  68. data/spec/actions/action_set_ip_destination_spec.rb +4 -6
  69. data/spec/actions/action_set_ip_source_spec.rb +4 -6
  70. data/spec/actions/action_set_ip_tos_spec.rb +4 -6
  71. data/spec/actions/action_set_mac_destination_spec.rb +4 -6
  72. data/spec/actions/action_set_mac_source_spec.rb +4 -6
  73. data/spec/actions/action_set_source_port_spec.rb +4 -6
  74. data/spec/actions/action_set_vlan_id_spec.rb +4 -6
  75. data/spec/actions/action_set_vlan_pcp_spec.rb +4 -6
  76. data/spec/actions/action_strip_vlan_spec.rb +3 -5
  77. data/spec/actions/action_vendor_spec.rb +4 -6
  78. data/spec/actions/actions_spec.rb +6 -8
  79. data/spec/messages/barrier_reply_spec.rb +9 -11
  80. data/spec/messages/barrier_request_spec.rb +9 -11
  81. data/spec/messages/echo_reply_spec.rb +13 -15
  82. data/spec/messages/echo_request_spec.rb +16 -18
  83. data/spec/messages/error_spec.rb +23 -20
  84. data/spec/messages/features_reply_spec.rb +11 -13
  85. data/spec/messages/features_request_spec.rb +9 -11
  86. data/spec/messages/flow_mod_spec.rb +12 -14
  87. data/spec/messages/flow_removed_spec.rb +9 -11
  88. data/spec/messages/get_config_reply_spec.rb +9 -11
  89. data/spec/messages/get_config_request_spec.rb +9 -11
  90. data/spec/messages/hello_spec.rb +9 -11
  91. data/spec/messages/packet_in_spec.rb +9 -11
  92. data/spec/messages/packet_out_spec.rb +10 -12
  93. data/spec/messages/parser_spec.rb +7 -9
  94. data/spec/messages/port_mod_spec.rb +9 -11
  95. data/spec/messages/port_status_spec.rb +10 -12
  96. data/spec/messages/queue_get_config_reply_spec.rb +9 -11
  97. data/spec/messages/queue_get_config_request_spec.rb +9 -11
  98. data/spec/messages/set_config_spec.rb +9 -11
  99. data/spec/messages/statistics/aggregate_statistics_reply_spec.rb +4 -6
  100. data/spec/messages/statistics/aggregate_statistics_request_spec.rb +4 -6
  101. data/spec/messages/statistics/description_statistics_spec.rb +11 -9
  102. data/spec/messages/statistics/flow_statistics_reply_spec.rb +4 -6
  103. data/spec/messages/statistics/flow_statistics_request_spec.rb +4 -6
  104. data/spec/messages/statistics/port_statistics_reply_spec.rb +4 -6
  105. data/spec/messages/statistics/port_statistics_request_spec.rb +4 -6
  106. data/spec/messages/statistics/queue_statistics_reply_spec.rb +4 -6
  107. data/spec/messages/statistics/queue_statistics_request_spec.rb +4 -6
  108. data/spec/messages/statistics/table_statistics_spec.rb +4 -6
  109. data/spec/messages/statistics/vendor_statistics_spec.rb +4 -6
  110. data/spec/messages/statistics_reply_spec.rb +62 -64
  111. data/spec/messages/statistics_request_spec.rb +45 -47
  112. data/spec/messages/vendor_spec.rb +13 -15
  113. data/spec/spec_helper.rb +1 -1
  114. data/spec/structs/match_spec.rb +7 -9
  115. data/spec/structs/packet_queue_spec.rb +5 -7
  116. data/spec/structs/physical_port_spec.rb +16 -18
  117. data/spec/structs/port_number_spec.rb +11 -13
  118. data/spec/structs/queue_properties/queue_properties_spec.rb +5 -7
  119. data/spec/structs/queue_properties/queue_property_min_rate_spec.rb +5 -7
  120. data/spec/structs/queue_properties/queue_property_none_spec.rb +3 -5
  121. metadata +78 -64
  122. data/lib/actions/action.rb +0 -26
  123. data/lib/actions/action_enqueue.rb +0 -12
  124. data/lib/actions/action_output.rb +0 -10
  125. data/lib/actions/action_set_destination_port.rb +0 -3
  126. data/lib/actions/action_set_ip_destination.rb +0 -3
  127. data/lib/actions/action_set_ip_source.rb +0 -9
  128. data/lib/actions/action_set_ip_tos.rb +0 -11
  129. data/lib/actions/action_set_mac_destination.rb +0 -3
  130. data/lib/actions/action_set_mac_source.rb +0 -11
  131. data/lib/actions/action_set_source_port.rb +0 -11
  132. data/lib/actions/action_set_vlan_id.rb +0 -11
  133. data/lib/actions/action_set_vlan_pcp.rb +0 -11
  134. data/lib/actions/action_strip_vlan.rb +0 -10
  135. data/lib/actions/action_vendor.rb +0 -9
  136. data/lib/actions/actions.rb +0 -5
  137. data/lib/helpers/array_of_subclasses.rb +0 -38
  138. data/lib/helpers/superclass_base.rb +0 -24
  139. data/lib/messages/barrier_reply.rb +0 -3
  140. data/lib/messages/barrier_request.rb +0 -3
  141. data/lib/messages/echo_reply.rb +0 -9
  142. data/lib/messages/echo_request.rb +0 -9
  143. data/lib/messages/error.rb +0 -61
  144. data/lib/messages/features_reply.rb +0 -40
  145. data/lib/messages/features_request.rb +0 -3
  146. data/lib/messages/flow_mod.rb +0 -20
  147. data/lib/messages/flow_removed.rb +0 -23
  148. data/lib/messages/get_config_reply.rb +0 -12
  149. data/lib/messages/get_config_request.rb +0 -3
  150. data/lib/messages/hello.rb +0 -3
  151. data/lib/messages/message.rb +0 -45
  152. data/lib/messages/packet_in.rb +0 -23
  153. data/lib/messages/packet_out.rb +0 -13
  154. data/lib/messages/parser.rb +0 -22
  155. data/lib/messages/port_mod.rb +0 -15
  156. data/lib/messages/port_status.rb +0 -14
  157. data/lib/messages/queue_get_config_reply.rb +0 -14
  158. data/lib/messages/queue_get_config_request.rb +0 -11
  159. data/lib/messages/set_config.rb +0 -3
  160. data/lib/messages/statistics.rb +0 -24
  161. data/lib/messages/statistics/aggregate_statistics_reply.rb +0 -10
  162. data/lib/messages/statistics/aggregate_statistics_request.rb +0 -3
  163. data/lib/messages/statistics/description_statistics.rb +0 -28
  164. data/lib/messages/statistics/flow_statistics_reply.rb +0 -21
  165. data/lib/messages/statistics/flow_statistics_request.rb +0 -10
  166. data/lib/messages/statistics/port_statistics_reply.rb +0 -20
  167. data/lib/messages/statistics/port_statistics_request.rb +0 -8
  168. data/lib/messages/statistics/queue_statistics_reply.rb +0 -12
  169. data/lib/messages/statistics/queue_statistics_request.rb +0 -9
  170. data/lib/messages/statistics/table_statistics.rb +0 -16
  171. data/lib/messages/statistics/vendor_statistics.rb +0 -7
  172. data/lib/messages/statistics_reply.rb +0 -22
  173. data/lib/messages/statistics_request.rb +0 -14
  174. data/lib/messages/vendor.rb +0 -10
  175. data/lib/structs/match.rb +0 -102
  176. data/lib/structs/packet_queue.rb +0 -10
  177. data/lib/structs/physical_port.rb +0 -46
  178. data/lib/structs/port_number.rb +0 -45
  179. data/lib/structs/queue_properties/queue_properties.rb +0 -5
  180. data/lib/structs/queue_properties/queue_property.rb +0 -16
  181. data/lib/structs/queue_properties/queue_property_min_rate.rb +0 -26
  182. data/lib/structs/queue_properties/queue_property_none.rb +0 -3
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
2
-
3
- describe OFAggregateStatisticsReply do
1
+ describe OpenFlow::Protocol::AggregateStatisticsReply do
4
2
  it 'should read binary' do
5
- stats = OFAggregateStatisticsReply.read [
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 = OFAggregateStatisticsReply.new
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 = OFAggregateStatisticsReply.new(
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
- require 'spec_helper'
2
-
3
- describe OFAggregateStatisticsRequest do
1
+ describe OpenFlow::Protocol::AggregateStatisticsRequest do
4
2
  it 'should read binary' do
5
- stats = OFAggregateStatisticsRequest.read [
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 = OFAggregateStatisticsRequest.new
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 = OFAggregateStatisticsRequest.new(
36
+ stats = OpenFlow::Protocol::AggregateStatisticsRequest.new(
39
37
  table_id: 1,
40
38
  out_port: 1
41
39
  )
@@ -1,12 +1,14 @@
1
- require 'spec_helper'
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 = OFDescriptionStatistics.read 'Manufacturer description'.pad(256) +
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 = OFDescriptionStatistics.new
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 = OFDescriptionStatistics.new(
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
- require 'spec_helper'
2
-
3
- describe OFFlowStatisticsReply do
1
+ describe OpenFlow::Protocol::FlowStatisticsReply do
4
2
  it 'should read binary' do
5
- stats = OFFlowStatisticsReply.read [
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 = OFFlowStatisticsReply.new
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 = OFFlowStatisticsReply.new(
68
+ stats = OpenFlow::Protocol::FlowStatisticsReply.new(
71
69
  )
72
70
 
73
71
  end
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
2
-
3
- describe OFFlowStatisticsRequest do
1
+ describe OpenFlow::Protocol::FlowStatisticsRequest do
4
2
  it 'should read binary' do
5
- stats = OFFlowStatisticsRequest.read [
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 = OFFlowStatisticsRequest.new
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 = OFFlowStatisticsRequest.new(
36
+ stats = OpenFlow::Protocol::FlowStatisticsRequest.new(
39
37
  table_id: 1,
40
38
  out_port: 1
41
39
  )
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
2
-
3
- describe OFPortStatisticsReply do
1
+ describe OpenFlow::Protocol::PortStatisticsReply do
4
2
  it 'should read binary' do
5
- stats = OFPortStatisticsReply.read [
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 = OFPortStatisticsReply.new
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 = OFPortStatisticsReply.new(
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
- require 'spec_helper'
2
-
3
- describe OFPortStatisticsRequest do
1
+ describe OpenFlow::Protocol::PortStatisticsRequest do
4
2
  it 'should read binary' do
5
- stats = OFPortStatisticsRequest.read [
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 = OFPortStatisticsRequest.new
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 = OFPortStatisticsRequest.new(port_number: 1)
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
- require 'spec_helper'
2
-
3
- describe OFQueueStatisticsReply do
1
+ describe OpenFlow::Protocol::QueueStatisticsReply do
4
2
  it 'should read binary' do
5
- stats = OFQueueStatisticsReply.read [
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 = OFQueueStatisticsReply.new
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 = OFQueueStatisticsReply.new(
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
- require 'spec_helper'
2
-
3
- describe OFQueueStatisticsRequest do
1
+ describe OpenFlow::Protocol::QueueStatisticsRequest do
4
2
  it 'should read binary' do
5
- stats = OFQueueStatisticsRequest.read [
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 = OFQueueStatisticsRequest.new
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 = OFQueueStatisticsRequest.new(
17
+ stats = OpenFlow::Protocol::QueueStatisticsRequest.new(
20
18
  port_number: 1,
21
19
  queue_id: 1
22
20
  )
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
2
-
3
- describe OFTableStatistics do
1
+ describe OpenFlow::Protocol::TableStatistics do
4
2
  it 'should read binary' do
5
- stats = OFTableStatistics.read [
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 = OFTableStatistics.new
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 = OFTableStatistics.new(
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
- require 'spec_helper'
2
-
3
- describe OFVendorStatistics do
1
+ describe OpenFlow::Protocol::VendorStatistics do
4
2
  it 'should read binary' do
5
- stats = OFVendorStatistics.read [
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 = OFVendorStatistics.new
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 = OFVendorStatistics.new(
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
- require 'spec_helper'
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
- 'Software description'.pad(256) +
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 = OFStatisticsReply.read(data)
22
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
32
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new
36
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(
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(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.read(data)
112
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
123
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new(statistic_type: :flow)
127
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(
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: [OFActionOutput.new(port: 1)]
141
+ actions: [OpenFlow::Protocol::ActionOutput.new(port: 1)]
144
142
  }
145
143
  )
146
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.read(data)
174
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(statistic_type: :aggregate)
184
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
194
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new(
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(OFMessage::OFP_VERSION)
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 of table_statistics
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 = OFStatisticsReply.read(data)
241
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
252
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new(statistic_type: :table)
256
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(
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(OFMessage::OFP_VERSION)
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 of port_statistics_reply
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 = OFStatisticsReply.read(data)
309
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
320
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new(statistic_type: :port)
324
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(
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(OFMessage::OFP_VERSION)
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 of queue_statistics_reply
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 = OFStatisticsReply.read(data)
369
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
380
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new(statistic_type: :queue)
384
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(
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(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.read(data)
425
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFParser.read(data)
436
- expect(msg.class).to eq(OFStatisticsReply)
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 = OFStatisticsReply.new(statistic_type: :vendor)
440
- expect(msg.version).to eq(OFMessage::OFP_VERSION)
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 = OFStatisticsReply.new(
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(OFMessage::OFP_VERSION)
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)