openflow-protocol 0.1.8 → 0.1.9

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/openflow-protocol/messages/packet_in.rb +1 -1
  3. data/lib/openflow-protocol/version.rb +1 -1
  4. data/spec/actions/action_enqueue_spec.rb +4 -4
  5. data/spec/actions/action_output_spec.rb +4 -4
  6. data/spec/actions/action_set_destination_port_spec.rb +4 -4
  7. data/spec/actions/action_set_ip_destination_spec.rb +4 -4
  8. data/spec/actions/action_set_ip_source_spec.rb +4 -4
  9. data/spec/actions/action_set_ip_tos_spec.rb +4 -4
  10. data/spec/actions/action_set_mac_destination_spec.rb +4 -4
  11. data/spec/actions/action_set_mac_source_spec.rb +4 -4
  12. data/spec/actions/action_set_source_port_spec.rb +4 -4
  13. data/spec/actions/action_set_vlan_id_spec.rb +4 -4
  14. data/spec/actions/action_set_vlan_pcp_spec.rb +4 -4
  15. data/spec/actions/action_strip_vlan_spec.rb +3 -3
  16. data/spec/actions/action_vendor_spec.rb +4 -4
  17. data/spec/actions/actions_spec.rb +6 -6
  18. data/spec/messages/barrier_reply_spec.rb +9 -9
  19. data/spec/messages/barrier_request_spec.rb +9 -9
  20. data/spec/messages/echo_reply_spec.rb +13 -13
  21. data/spec/messages/echo_request_spec.rb +16 -16
  22. data/spec/messages/error_spec.rb +11 -11
  23. data/spec/messages/features_reply_spec.rb +11 -11
  24. data/spec/messages/features_request_spec.rb +9 -9
  25. data/spec/messages/flow_mod_spec.rb +12 -12
  26. data/spec/messages/flow_removed_spec.rb +9 -9
  27. data/spec/messages/get_config_reply_spec.rb +9 -9
  28. data/spec/messages/get_config_request_spec.rb +9 -9
  29. data/spec/messages/hello_spec.rb +9 -9
  30. data/spec/messages/packet_in_spec.rb +9 -9
  31. data/spec/messages/packet_out_spec.rb +10 -10
  32. data/spec/messages/parser_spec.rb +7 -7
  33. data/spec/messages/port_mod_spec.rb +9 -9
  34. data/spec/messages/port_status_spec.rb +10 -10
  35. data/spec/messages/queue_get_config_reply_spec.rb +9 -9
  36. data/spec/messages/queue_get_config_request_spec.rb +9 -9
  37. data/spec/messages/set_config_spec.rb +9 -9
  38. data/spec/messages/statistics/aggregate_statistics_reply_spec.rb +4 -4
  39. data/spec/messages/statistics/aggregate_statistics_request_spec.rb +4 -4
  40. data/spec/messages/statistics/description_statistics_spec.rb +4 -4
  41. data/spec/messages/statistics/flow_statistics_reply_spec.rb +4 -4
  42. data/spec/messages/statistics/flow_statistics_request_spec.rb +4 -4
  43. data/spec/messages/statistics/port_statistics_reply_spec.rb +4 -4
  44. data/spec/messages/statistics/port_statistics_request_spec.rb +4 -4
  45. data/spec/messages/statistics/queue_statistics_reply_spec.rb +4 -4
  46. data/spec/messages/statistics/queue_statistics_request_spec.rb +4 -4
  47. data/spec/messages/statistics/table_statistics_spec.rb +4 -4
  48. data/spec/messages/statistics/vendor_statistics_spec.rb +4 -4
  49. data/spec/messages/statistics_reply_spec.rb +62 -62
  50. data/spec/messages/statistics_request_spec.rb +45 -45
  51. data/spec/messages/vendor_spec.rb +13 -13
  52. data/spec/spec_helper.rb +4 -0
  53. data/spec/structs/match_spec.rb +7 -7
  54. data/spec/structs/packet_queue_spec.rb +5 -5
  55. data/spec/structs/physical_port_spec.rb +16 -16
  56. data/spec/structs/port_number_spec.rb +11 -11
  57. data/spec/structs/queue_properties/queue_properties_spec.rb +5 -5
  58. data/spec/structs/queue_properties/queue_property_min_rate_spec.rb +5 -5
  59. data/spec/structs/queue_properties/queue_property_none_spec.rb +3 -3
  60. metadata +20 -6
@@ -1,4 +1,4 @@
1
- describe OpenFlow::Protocol::StatisticsRequest do
1
+ describe StatisticsRequest do
2
2
  let(:data) {
3
3
  [
4
4
  1, 16, 0, 12, 0, 0, 0, 1, # header
@@ -9,8 +9,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
9
9
 
10
10
  context 'with description' do
11
11
  it 'should read binary' do
12
- msg = OpenFlow::Protocol::StatisticsRequest.read(data)
13
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
12
+ msg = StatisticsRequest.read(data)
13
+ expect(msg.version).to eq(Message::OFP_VERSION)
14
14
  expect(msg.type).to eq(:statistics_request)
15
15
  expect(msg.len).to eq(12)
16
16
  expect(msg.xid).to eq(1)
@@ -19,12 +19,12 @@ describe OpenFlow::Protocol::StatisticsRequest do
19
19
  expect(msg.statistics).to be_empty
20
20
  end
21
21
  it 'should be parsable' do
22
- msg = OpenFlow::Protocol::Parser.read(data)
23
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsRequest)
22
+ msg = Parser.read(data)
23
+ expect(msg.class).to eq(StatisticsRequest)
24
24
  end
25
25
  it 'should initialize with default values' do
26
- msg = OpenFlow::Protocol::StatisticsRequest.new
27
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
26
+ msg = StatisticsRequest.new
27
+ expect(msg.version).to eq(Message::OFP_VERSION)
28
28
  expect(msg.type).to eq(:statistics_request)
29
29
  expect(msg.len).to eq(12)
30
30
  expect(msg.xid).to eq(0)
@@ -33,11 +33,11 @@ describe OpenFlow::Protocol::StatisticsRequest do
33
33
  expect(msg.statistics).to be_empty
34
34
  end
35
35
  it 'should initialize with some values' do
36
- msg = OpenFlow::Protocol::StatisticsRequest.new(
36
+ msg = StatisticsRequest.new(
37
37
  xid: 1,
38
38
  statistic_type: :description
39
39
  )
40
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
40
+ expect(msg.version).to eq(Message::OFP_VERSION)
41
41
  expect(msg.type).to eq(:statistics_request)
42
42
  expect(msg.len).to eq(12)
43
43
  expect(msg.xid).to eq(1)
@@ -49,7 +49,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
49
49
 
50
50
  context 'with flow' do
51
51
  it 'should read binary' do
52
- msg = OpenFlow::Protocol::StatisticsRequest.read [
52
+ msg = StatisticsRequest.read [
53
53
  1, 16, 0, 56, 0, 0, 0, 1, # header
54
54
  0, 1, # statistic_type
55
55
  0, 0, # flags
@@ -76,7 +76,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
76
76
  0, # padding
77
77
  0, 1 # out_port
78
78
  ].pack('C*')
79
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
79
+ expect(msg.version).to eq(Message::OFP_VERSION)
80
80
  expect(msg.type).to eq(:statistics_request)
81
81
  expect(msg.len).to eq(56)
82
82
  expect(msg.xid).to eq(1)
@@ -85,8 +85,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
85
85
  expect(msg.statistics.table_id).to eq(1)
86
86
  end
87
87
  it 'should initialize with default values' do
88
- msg = OpenFlow::Protocol::StatisticsRequest.new(statistic_type: :flow)
89
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
88
+ msg = StatisticsRequest.new(statistic_type: :flow)
89
+ expect(msg.version).to eq(Message::OFP_VERSION)
90
90
  expect(msg.type).to eq(:statistics_request)
91
91
  expect(msg.len).to eq(56)
92
92
  expect(msg.xid).to eq(0)
@@ -95,14 +95,14 @@ describe OpenFlow::Protocol::StatisticsRequest do
95
95
  expect(msg.statistics.table_id).to eq(:all)
96
96
  end
97
97
  it 'should initialize with some values' do
98
- msg = OpenFlow::Protocol::StatisticsRequest.new(
98
+ msg = StatisticsRequest.new(
99
99
  xid: 1,
100
100
  statistic_type: :flow,
101
101
  statistics: {
102
102
  table_id: 1
103
103
  }
104
104
  )
105
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
105
+ expect(msg.version).to eq(Message::OFP_VERSION)
106
106
  expect(msg.type).to eq(:statistics_request)
107
107
  expect(msg.len).to eq(56)
108
108
  expect(msg.xid).to eq(1)
@@ -114,7 +114,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
114
114
 
115
115
  context 'with aggregate' do
116
116
  it 'should read binary' do
117
- msg = OpenFlow::Protocol::StatisticsRequest.read [
117
+ msg = StatisticsRequest.read [
118
118
  1, 16, 0, 56, 0, 0, 0, 1, # header
119
119
  0, 2, # statistic_type
120
120
  0, 0, # flags
@@ -141,7 +141,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
141
141
  0, # padding
142
142
  0, 1 # out_port
143
143
  ].pack('C*')
144
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
144
+ expect(msg.version).to eq(Message::OFP_VERSION)
145
145
  expect(msg.type).to eq(:statistics_request)
146
146
  expect(msg.len).to eq(56)
147
147
  expect(msg.xid).to eq(1)
@@ -150,8 +150,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
150
150
  expect(msg.statistics.table_id).to eq(1)
151
151
  end
152
152
  it 'should initialize with default values' do
153
- msg = OpenFlow::Protocol::StatisticsRequest.new(statistic_type: :aggregate)
154
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
153
+ msg = StatisticsRequest.new(statistic_type: :aggregate)
154
+ expect(msg.version).to eq(Message::OFP_VERSION)
155
155
  expect(msg.type).to eq(:statistics_request)
156
156
  expect(msg.len).to eq(56)
157
157
  expect(msg.xid).to eq(0)
@@ -160,14 +160,14 @@ describe OpenFlow::Protocol::StatisticsRequest do
160
160
  expect(msg.statistics.table_id).to eq(:all)
161
161
  end
162
162
  it 'should initialize with some values' do
163
- msg = OpenFlow::Protocol::StatisticsRequest.new(
163
+ msg = StatisticsRequest.new(
164
164
  xid: 1,
165
165
  statistic_type: :aggregate,
166
166
  statistics: {
167
167
  table_id: 1
168
168
  }
169
169
  )
170
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
170
+ expect(msg.version).to eq(Message::OFP_VERSION)
171
171
  expect(msg.type).to eq(:statistics_request)
172
172
  expect(msg.len).to eq(56)
173
173
  expect(msg.xid).to eq(1)
@@ -179,12 +179,12 @@ describe OpenFlow::Protocol::StatisticsRequest do
179
179
 
180
180
  context 'with table' do
181
181
  it 'should read binary' do
182
- msg = OpenFlow::Protocol::StatisticsRequest.read [
182
+ msg = StatisticsRequest.read [
183
183
  1, 16, 0, 12, 0, 0, 0, 1, # header
184
184
  0, 3, # statistic_type
185
185
  0, 0, # flags
186
186
  ].pack('C*')
187
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
187
+ expect(msg.version).to eq(Message::OFP_VERSION)
188
188
  expect(msg.type).to eq(:statistics_request)
189
189
  expect(msg.len).to eq(12)
190
190
  expect(msg.xid).to eq(1)
@@ -193,8 +193,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
193
193
  expect(msg.statistics).to be_empty
194
194
  end
195
195
  it 'should initialize with default values' do
196
- msg = OpenFlow::Protocol::StatisticsRequest.new(statistic_type: :table)
197
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
196
+ msg = StatisticsRequest.new(statistic_type: :table)
197
+ expect(msg.version).to eq(Message::OFP_VERSION)
198
198
  expect(msg.type).to eq(:statistics_request)
199
199
  expect(msg.len).to eq(12)
200
200
  expect(msg.xid).to eq(0)
@@ -203,11 +203,11 @@ describe OpenFlow::Protocol::StatisticsRequest do
203
203
  expect(msg.statistics).to be_empty
204
204
  end
205
205
  it 'should initialize with some values' do
206
- msg = OpenFlow::Protocol::StatisticsRequest.new(
206
+ msg = StatisticsRequest.new(
207
207
  xid: 1,
208
208
  statistic_type: :table
209
209
  )
210
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
210
+ expect(msg.version).to eq(Message::OFP_VERSION)
211
211
  expect(msg.type).to eq(:statistics_request)
212
212
  expect(msg.len).to eq(12)
213
213
  expect(msg.xid).to eq(1)
@@ -219,7 +219,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
219
219
 
220
220
  context 'with port' do
221
221
  it 'should read binary' do
222
- msg = OpenFlow::Protocol::StatisticsRequest.read [
222
+ msg = StatisticsRequest.read [
223
223
  1, 16, 0, 20, 0, 0, 0, 1, # header
224
224
  0, 4, # statistic_type
225
225
  0, 0, # flags
@@ -228,7 +228,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
228
228
  0, 1, # port_number
229
229
  0, 0, 0, 0, 0, 0 # padding
230
230
  ].pack('C*')
231
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
231
+ expect(msg.version).to eq(Message::OFP_VERSION)
232
232
  expect(msg.type).to eq(:statistics_request)
233
233
  expect(msg.len).to eq(20)
234
234
  expect(msg.xid).to eq(1)
@@ -237,8 +237,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
237
237
  expect(msg.statistics.port_number).to eq(1)
238
238
  end
239
239
  it 'should initialize with default values' do
240
- msg = OpenFlow::Protocol::StatisticsRequest.new(statistic_type: :port)
241
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
240
+ msg = StatisticsRequest.new(statistic_type: :port)
241
+ expect(msg.version).to eq(Message::OFP_VERSION)
242
242
  expect(msg.type).to eq(:statistics_request)
243
243
  expect(msg.len).to eq(20)
244
244
  expect(msg.xid).to eq(0)
@@ -247,12 +247,12 @@ describe OpenFlow::Protocol::StatisticsRequest do
247
247
  expect(msg.statistics.port_number).to eq(:none)
248
248
  end
249
249
  it 'should initialize with some values' do
250
- msg = OpenFlow::Protocol::StatisticsRequest.new(
250
+ msg = StatisticsRequest.new(
251
251
  xid: 1,
252
252
  statistic_type: :port,
253
253
  statistics: {port_number: 1}
254
254
  )
255
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
255
+ expect(msg.version).to eq(Message::OFP_VERSION)
256
256
  expect(msg.type).to eq(:statistics_request)
257
257
  expect(msg.len).to eq(20)
258
258
  expect(msg.xid).to eq(1)
@@ -264,7 +264,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
264
264
 
265
265
  context 'with queue' do
266
266
  it 'should read binary' do
267
- msg = OpenFlow::Protocol::StatisticsRequest.read [
267
+ msg = StatisticsRequest.read [
268
268
  1, 16, 0, 20, 0, 0, 0, 1, # header
269
269
  0, 5, # statistic_type
270
270
  0, 0, # flags
@@ -274,7 +274,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
274
274
  0, 0, # padding
275
275
  0, 0, 0, 1 # queue_id
276
276
  ].pack('C*')
277
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
277
+ expect(msg.version).to eq(Message::OFP_VERSION)
278
278
  expect(msg.type).to eq(:statistics_request)
279
279
  expect(msg.len).to eq(20)
280
280
  expect(msg.xid).to eq(1)
@@ -283,8 +283,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
283
283
  expect(msg.statistics.port_number).to eq(1)
284
284
  end
285
285
  it 'should initialize with default values' do
286
- msg = OpenFlow::Protocol::StatisticsRequest.new(statistic_type: :queue)
287
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
286
+ msg = StatisticsRequest.new(statistic_type: :queue)
287
+ expect(msg.version).to eq(Message::OFP_VERSION)
288
288
  expect(msg.type).to eq(:statistics_request)
289
289
  expect(msg.len).to eq(20)
290
290
  expect(msg.xid).to eq(0)
@@ -293,12 +293,12 @@ describe OpenFlow::Protocol::StatisticsRequest do
293
293
  expect(msg.statistics.port_number).to eq(:all)
294
294
  end
295
295
  it 'should initialize with some values' do
296
- msg = OpenFlow::Protocol::StatisticsRequest.new(
296
+ msg = StatisticsRequest.new(
297
297
  xid: 1,
298
298
  statistic_type: :queue,
299
299
  statistics: {port_number: 1}
300
300
  )
301
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
301
+ expect(msg.version).to eq(Message::OFP_VERSION)
302
302
  expect(msg.type).to eq(:statistics_request)
303
303
  expect(msg.len).to eq(20)
304
304
  expect(msg.xid).to eq(1)
@@ -310,7 +310,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
310
310
 
311
311
  context 'with vendor' do
312
312
  it 'should read binary' do
313
- msg = OpenFlow::Protocol::StatisticsRequest.read [
313
+ msg = StatisticsRequest.read [
314
314
  1, 16, 0, 20, 0, 0, 0, 1, # header
315
315
  0xff, 0xff, # statistic_type
316
316
  0, 0, # flags
@@ -319,7 +319,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
319
319
  0, 0, 0, 1, # vendor
320
320
  1, 2, 3, 4 # body
321
321
  ].pack('C*')
322
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
322
+ expect(msg.version).to eq(Message::OFP_VERSION)
323
323
  expect(msg.type).to eq(:statistics_request)
324
324
  expect(msg.len).to eq(20)
325
325
  expect(msg.xid).to eq(1)
@@ -329,8 +329,8 @@ describe OpenFlow::Protocol::StatisticsRequest do
329
329
  expect(msg.statistics.body).to eq([1, 2, 3, 4].pack('C*'))
330
330
  end
331
331
  it 'should initialize with default values' do
332
- msg = OpenFlow::Protocol::StatisticsRequest.new(statistic_type: :vendor)
333
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
332
+ msg = StatisticsRequest.new(statistic_type: :vendor)
333
+ expect(msg.version).to eq(Message::OFP_VERSION)
334
334
  expect(msg.type).to eq(:statistics_request)
335
335
  expect(msg.len).to eq(16)
336
336
  expect(msg.xid).to eq(0)
@@ -340,7 +340,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
340
340
  expect(msg.statistics.body).to be_empty
341
341
  end
342
342
  it 'should initialize with some values' do
343
- msg = OpenFlow::Protocol::StatisticsRequest.new(
343
+ msg = StatisticsRequest.new(
344
344
  xid: 1,
345
345
  statistic_type: :vendor,
346
346
  statistics: {
@@ -348,7 +348,7 @@ describe OpenFlow::Protocol::StatisticsRequest do
348
348
  body: [1, 2, 3, 4].pack('C*')
349
349
  }
350
350
  )
351
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
351
+ expect(msg.version).to eq(Message::OFP_VERSION)
352
352
  expect(msg.type).to eq(:statistics_request)
353
353
  expect(msg.len).to eq(20)
354
354
  expect(msg.xid).to eq(1)
@@ -1,4 +1,4 @@
1
- describe OpenFlow::Protocol::Vendor do
1
+ describe Vendor do
2
2
  let(:data) {
3
3
  [
4
4
  1, 4, 0, 12, 0, 0, 0, 1, # header
@@ -7,8 +7,8 @@ describe OpenFlow::Protocol::Vendor do
7
7
  }
8
8
 
9
9
  it 'should read binary' do
10
- msg = OpenFlow::Protocol::Vendor.read(data)
11
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
10
+ msg = Vendor.read(data)
11
+ expect(msg.version).to eq(Message::OFP_VERSION)
12
12
  expect(msg.type).to eq(:vendor)
13
13
  expect(msg.len).to eq(12)
14
14
  expect(msg.xid).to eq(1)
@@ -16,16 +16,16 @@ describe OpenFlow::Protocol::Vendor do
16
16
  expect(msg.data).to be_empty
17
17
  end
18
18
  it 'should be parsable' do
19
- msg = OpenFlow::Protocol::Parser.read(data)
20
- expect(msg.class).to eq(OpenFlow::Protocol::Vendor)
19
+ msg = Parser.read(data)
20
+ expect(msg.class).to eq(Vendor)
21
21
  end
22
22
  it 'should read binary with data' do
23
- msg = OpenFlow::Protocol::Vendor.read [
23
+ msg = Vendor.read [
24
24
  1, 4, 0, 14, 0, 0, 0, 1, # header
25
25
  0, 0, 0, 1, # vendor
26
26
  10, 20 # data
27
27
  ].pack('C*')
28
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
28
+ expect(msg.version).to eq(Message::OFP_VERSION)
29
29
  expect(msg.type).to eq(:vendor)
30
30
  expect(msg.len).to eq(14)
31
31
  expect(msg.xid).to eq(1)
@@ -33,8 +33,8 @@ describe OpenFlow::Protocol::Vendor do
33
33
  expect(msg.data.length).to eq(2)
34
34
  end
35
35
  it 'should initialize with default values' do
36
- msg = OpenFlow::Protocol::Vendor.new
37
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
36
+ msg = Vendor.new
37
+ expect(msg.version).to eq(Message::OFP_VERSION)
38
38
  expect(msg.type).to eq(:vendor)
39
39
  expect(msg.len).to eq(12)
40
40
  expect(msg.xid).to eq(0)
@@ -42,8 +42,8 @@ describe OpenFlow::Protocol::Vendor do
42
42
  expect(msg.data).to be_empty
43
43
  end
44
44
  it 'should initialize with some values' do
45
- msg = OpenFlow::Protocol::Vendor.new(xid: 1, vendor: 1)
46
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
45
+ msg = Vendor.new(xid: 1, vendor: 1)
46
+ expect(msg.version).to eq(Message::OFP_VERSION)
47
47
  expect(msg.type).to eq(:vendor)
48
48
  expect(msg.len).to eq(12)
49
49
  expect(msg.xid).to eq(1)
@@ -51,8 +51,8 @@ describe OpenFlow::Protocol::Vendor do
51
51
  expect(msg.data).to be_empty
52
52
  end
53
53
  it 'should initialize with data' do
54
- msg = OpenFlow::Protocol::Vendor.new(vendor: 1, data: [10, 20].pack('C*'))
55
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
54
+ msg = Vendor.new(vendor: 1, data: [10, 20].pack('C*'))
55
+ expect(msg.version).to eq(Message::OFP_VERSION)
56
56
  expect(msg.type).to eq(:vendor)
57
57
  expect(msg.len).to eq(14)
58
58
  expect(msg.xid).to eq(0)
@@ -1,4 +1,8 @@
1
1
  require 'openflow-protocol'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+
5
+ include OpenFlow::Protocol
2
6
 
3
7
  class String
4
8
  def pad(length, value = [0].pack('C*'))
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::Match do
1
+ describe Match do
2
2
  it 'should read binary' do
3
- match = OpenFlow::Protocol::Match.read [
3
+ match = Match.read [
4
4
  0, 0x30, 0x20, 0x4f, # wildcards
5
5
  0, 0, # in_port
6
6
  0, 0, 0, 0, 0, 0, # mac_source
@@ -41,8 +41,8 @@ describe OpenFlow::Protocol::Match do
41
41
  expect(match.destination_port).to eq(3000)
42
42
  end
43
43
  it 'should initialize with default values' do
44
- match = OpenFlow::Protocol::Match.new
45
- expect(match.wildcards).to eq(OpenFlow::Protocol::Match::Wildcards::ALL_FLAGS)
44
+ match = Match.new
45
+ expect(match.wildcards).to eq(Match::Wildcards::ALL_FLAGS)
46
46
  expect(match.in_port).to eq(0)
47
47
  expect(match.mac_source).to eq('00:00:00:00:00:00')
48
48
  expect(match.mac_destination).to eq('00:00:00:00:00:00')
@@ -57,7 +57,7 @@ describe OpenFlow::Protocol::Match do
57
57
  expect(match.destination_port).to eq(0)
58
58
  end
59
59
  it 'should initialize with some values' do
60
- match = OpenFlow::Protocol::Match.new(
60
+ match = Match.new(
61
61
  wildcards: {
62
62
  in_port: true,
63
63
  mac_source: true,
@@ -99,7 +99,7 @@ describe OpenFlow::Protocol::Match do
99
99
  expect(match.destination_port).to eq(3000)
100
100
  end
101
101
  it 'should initialize with wildcards as array' do
102
- match = OpenFlow::Protocol::Match.new(
102
+ match = Match.new(
103
103
  wildcards: [:in_port, :mac_source, :mac_destination]
104
104
  )
105
105
  expect(match.wildcards).to eq(
@@ -109,7 +109,7 @@ describe OpenFlow::Protocol::Match do
109
109
  )
110
110
  end
111
111
  it 'should initialize wildcards based on matching values given' do
112
- match = OpenFlow::Protocol::Match.create(
112
+ match = Match.create(
113
113
  mac_source: '00:00:00:00:00:01',
114
114
  mac_destination: '00:00:00:00:00:02',
115
115
  mac_protocol: :ipv4,
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::PacketQueue do
1
+ describe PacketQueue do
2
2
  it 'should read binary' do
3
- queue = OpenFlow::Protocol::PacketQueue.read [
3
+ queue = PacketQueue.read [
4
4
  0, 0, 0, 1, # queue_id
5
5
  0, 24, # len
6
6
  0, 0, # padding
@@ -17,14 +17,14 @@ describe OpenFlow::Protocol::PacketQueue do
17
17
  expect(queue.properties.first.rate).to eq(100)
18
18
  end
19
19
  it 'should initialize with default values' do
20
- queue = OpenFlow::Protocol::PacketQueue.new
20
+ queue = PacketQueue.new
21
21
  expect(queue.queue_id).to eq(0)
22
22
  expect(queue.len).to eq(8)
23
23
  end
24
24
  it 'should initialize with some values' do
25
- queue = OpenFlow::Protocol::PacketQueue.new(
25
+ queue = PacketQueue.new(
26
26
  queue_id: 1,
27
- properties: [OpenFlow::Protocol::QueuePropertyMinRate.new(rate: 100)]
27
+ properties: [QueuePropertyMinRate.new(rate: 100)]
28
28
  )
29
29
  expect(queue.queue_id).to eq(1)
30
30
  expect(queue.len).to eq(24)