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.
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,6 +1,6 @@
1
- describe OpenFlow::Protocol::AggregateStatisticsRequest do
1
+ describe AggregateStatisticsRequest do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::AggregateStatisticsRequest.read [
3
+ stats = AggregateStatisticsRequest.read [
4
4
  # match
5
5
  0, 0x30, 0x20, 0x4f, # wildcards
6
6
  0, 0, # in_port
@@ -27,13 +27,13 @@ describe OpenFlow::Protocol::AggregateStatisticsRequest do
27
27
  expect(stats.out_port).to eq(1)
28
28
  end
29
29
  it 'should initialize with default values' do
30
- stats = OpenFlow::Protocol::AggregateStatisticsRequest.new
30
+ stats = AggregateStatisticsRequest.new
31
31
  expect(stats.match.ip_destination).to eq('0.0.0.0')
32
32
  expect(stats.table_id).to eq(:all)
33
33
  expect(stats.out_port).to eq(:none)
34
34
  end
35
35
  it 'should initialize with some values' do
36
- stats = OpenFlow::Protocol::AggregateStatisticsRequest.new(
36
+ stats = AggregateStatisticsRequest.new(
37
37
  table_id: 1,
38
38
  out_port: 1
39
39
  )
@@ -1,4 +1,4 @@
1
- describe OpenFlow::Protocol::DescriptionStatistics do
1
+ describe DescriptionStatistics do
2
2
  let(:desc) {
3
3
  'Manufacturer description'.pad(256) +
4
4
  'Hardware description'.pad(256) +
@@ -8,7 +8,7 @@ describe OpenFlow::Protocol::DescriptionStatistics do
8
8
  }
9
9
 
10
10
  it 'should read binary' do
11
- stats = OpenFlow::Protocol::DescriptionStatistics.read(desc)
11
+ stats = DescriptionStatistics.read(desc)
12
12
  expect(stats.manufacturer_description).to eq('Manufacturer description')
13
13
  expect(stats.hardware_description).to eq('Hardware description')
14
14
  expect(stats.software_description).to eq('Software description')
@@ -16,7 +16,7 @@ describe OpenFlow::Protocol::DescriptionStatistics do
16
16
  expect(stats.datapath_description).to eq('Datapath description')
17
17
  end
18
18
  it 'should initialize with default values' do
19
- stats = OpenFlow::Protocol::DescriptionStatistics.new
19
+ stats = DescriptionStatistics.new
20
20
  expect(stats.manufacturer_description).to eq('')
21
21
  expect(stats.hardware_description).to eq('')
22
22
  expect(stats.software_description).to eq('')
@@ -24,7 +24,7 @@ describe OpenFlow::Protocol::DescriptionStatistics do
24
24
  expect(stats.datapath_description).to eq('')
25
25
  end
26
26
  it 'should initialize with some values' do
27
- stats = OpenFlow::Protocol::DescriptionStatistics.new(
27
+ stats = DescriptionStatistics.new(
28
28
  manufacturer_description: 'Manufacturer description',
29
29
  hardware_description: 'Hardware description',
30
30
  software_description: 'Software description',
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::FlowStatisticsReply do
1
+ describe FlowStatisticsReply do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::FlowStatisticsReply.read [
3
+ stats = FlowStatisticsReply.read [
4
4
  0, 96, # len
5
5
  1, # table_id
6
6
  0, # padding
@@ -51,7 +51,7 @@ describe OpenFlow::Protocol::FlowStatisticsReply do
51
51
  expect(stats.actions.length).to eq(1)
52
52
  end
53
53
  it 'should initialize with default values' do
54
- stats = OpenFlow::Protocol::FlowStatisticsReply.new
54
+ stats = FlowStatisticsReply.new
55
55
  expect(stats.len).to eq(88)
56
56
  expect(stats.table_id).to eq(:all)
57
57
  expect(stats.match.ip_destination).to eq('0.0.0.0')
@@ -65,7 +65,7 @@ describe OpenFlow::Protocol::FlowStatisticsReply do
65
65
  expect(stats.actions).to be_empty
66
66
  end
67
67
  it 'should initialize with some values' do
68
- stats = OpenFlow::Protocol::FlowStatisticsReply.new(
68
+ stats = FlowStatisticsReply.new(
69
69
  )
70
70
 
71
71
  end
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::FlowStatisticsRequest do
1
+ describe FlowStatisticsRequest do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::FlowStatisticsRequest.read [
3
+ stats = FlowStatisticsRequest.read [
4
4
  # match
5
5
  0, 0x30, 0x20, 0x4f, # wildcards
6
6
  0, 0, # in_port
@@ -27,13 +27,13 @@ describe OpenFlow::Protocol::FlowStatisticsRequest do
27
27
  expect(stats.out_port).to eq(1)
28
28
  end
29
29
  it 'should initialize with default values' do
30
- stats = OpenFlow::Protocol::FlowStatisticsRequest.new
30
+ stats = FlowStatisticsRequest.new
31
31
  expect(stats.match.ip_destination).to eq('0.0.0.0')
32
32
  expect(stats.table_id).to eq(:all)
33
33
  expect(stats.out_port).to eq(:none)
34
34
  end
35
35
  it 'should initialize with some values' do
36
- stats = OpenFlow::Protocol::FlowStatisticsRequest.new(
36
+ stats = FlowStatisticsRequest.new(
37
37
  table_id: 1,
38
38
  out_port: 1
39
39
  )
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::PortStatisticsReply do
1
+ describe PortStatisticsReply do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::PortStatisticsReply.read [
3
+ stats = PortStatisticsReply.read [
4
4
  0, 1, # port_number
5
5
  0, 0, 0, 0, 0, 0, # padding
6
6
  0, 0, 0, 0, 0, 0, 0, 10, # receive_packets
@@ -31,7 +31,7 @@ describe OpenFlow::Protocol::PortStatisticsReply do
31
31
  expect(stats.collisions).to eq(3)
32
32
  end
33
33
  it 'should initialize with default values' do
34
- stats = OpenFlow::Protocol::PortStatisticsReply.new
34
+ stats = PortStatisticsReply.new
35
35
  expect(stats.port_number).to eq(0)
36
36
  expect(stats.receive_packets).to eq(0)
37
37
  expect(stats.transmit_packets).to eq(0)
@@ -47,7 +47,7 @@ describe OpenFlow::Protocol::PortStatisticsReply do
47
47
  expect(stats.collisions).to eq(0)
48
48
  end
49
49
  it 'should initialize with some values' do
50
- stats = OpenFlow::Protocol::PortStatisticsReply.new(
50
+ stats = PortStatisticsReply.new(
51
51
  port_number: 1,
52
52
  receive_packets: 10,
53
53
  transmit_packets: 10,
@@ -1,17 +1,17 @@
1
- describe OpenFlow::Protocol::PortStatisticsRequest do
1
+ describe PortStatisticsRequest do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::PortStatisticsRequest.read [
3
+ stats = PortStatisticsRequest.read [
4
4
  0, 1, # port_number
5
5
  0, 0, 0, 0, 0, 0 # padding
6
6
  ].pack('C*')
7
7
  expect(stats.port_number).to eq(1)
8
8
  end
9
9
  it 'should initialize with default values' do
10
- stats = OpenFlow::Protocol::PortStatisticsRequest.new
10
+ stats = PortStatisticsRequest.new
11
11
  expect(stats.port_number).to eq(:none)
12
12
  end
13
13
  it 'should initialize with some values' do
14
- stats = OpenFlow::Protocol::PortStatisticsRequest.new(port_number: 1)
14
+ stats = PortStatisticsRequest.new(port_number: 1)
15
15
  expect(stats.port_number).to eq(1)
16
16
  end
17
17
  end
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::QueueStatisticsReply do
1
+ describe QueueStatisticsReply do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::QueueStatisticsReply.read [
3
+ stats = QueueStatisticsReply.read [
4
4
  0, 1, # port_number
5
5
  0, 0, # padding
6
6
  0, 0, 0, 1, # queue_id
@@ -15,7 +15,7 @@ describe OpenFlow::Protocol::QueueStatisticsReply do
15
15
  expect(stats.transmit_errors).to eq(2)
16
16
  end
17
17
  it 'should initialize with default values' do
18
- stats = OpenFlow::Protocol::QueueStatisticsReply.new
18
+ stats = QueueStatisticsReply.new
19
19
  expect(stats.port_number).to eq(0)
20
20
  # expect(stats.queue_id).to eq(:all)
21
21
  # TODO: QUEUE_IDS somewhere!
@@ -24,7 +24,7 @@ describe OpenFlow::Protocol::QueueStatisticsReply do
24
24
  expect(stats.transmit_errors).to eq(0)
25
25
  end
26
26
  it 'should initialize with some values' do
27
- stats = OpenFlow::Protocol::QueueStatisticsReply.new(
27
+ stats = QueueStatisticsReply.new(
28
28
  port_number: 1,
29
29
  queue_id: 1,
30
30
  transmit_bytes: 80,
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::QueueStatisticsRequest do
1
+ describe QueueStatisticsRequest do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::QueueStatisticsRequest.read [
3
+ stats = QueueStatisticsRequest.read [
4
4
  0, 1, # port_number
5
5
  0, 0, # padding
6
6
  0, 0, 0, 1 # queue_id
@@ -9,12 +9,12 @@ describe OpenFlow::Protocol::QueueStatisticsRequest do
9
9
  expect(stats.queue_id).to eq(1)
10
10
  end
11
11
  it 'should initialize with default values' do
12
- stats = OpenFlow::Protocol::QueueStatisticsRequest.new
12
+ stats = QueueStatisticsRequest.new
13
13
  expect(stats.port_number).to eq(:all)
14
14
  expect(stats.queue_id).to eq(:all)
15
15
  end
16
16
  it 'should initialize with some values' do
17
- stats = OpenFlow::Protocol::QueueStatisticsRequest.new(
17
+ stats = QueueStatisticsRequest.new(
18
18
  port_number: 1,
19
19
  queue_id: 1
20
20
  )
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::TableStatistics do
1
+ describe TableStatistics do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::TableStatistics.read [
3
+ stats = TableStatistics.read [
4
4
  1, # table_id
5
5
  0, 0, 0, # padding
6
6
  116, 97, 98, 108, 101, 45, 49, 0, # name
@@ -22,7 +22,7 @@ describe OpenFlow::Protocol::TableStatistics do
22
22
  expect(stats.matched_count).to eq(1)
23
23
  end
24
24
  it 'should initialize with default values' do
25
- stats = OpenFlow::Protocol::TableStatistics.new
25
+ stats = TableStatistics.new
26
26
  expect(stats.table_id).to eq(0)
27
27
  expect(stats.name).to eq('')
28
28
  expect(stats.wildcards).to be_empty
@@ -32,7 +32,7 @@ describe OpenFlow::Protocol::TableStatistics do
32
32
  expect(stats.matched_count).to eq(0)
33
33
  end
34
34
  it 'should initialize with some values' do
35
- stats = OpenFlow::Protocol::TableStatistics.new(
35
+ stats = TableStatistics.new(
36
36
  table_id: 1,
37
37
  name: 'table-1',
38
38
  wildcards: [:in_port, :ip_source_all, :ip_destination_all],
@@ -1,6 +1,6 @@
1
- describe OpenFlow::Protocol::VendorStatistics do
1
+ describe VendorStatistics do
2
2
  it 'should read binary' do
3
- stats = OpenFlow::Protocol::VendorStatistics.read [
3
+ stats = VendorStatistics.read [
4
4
  0, 0, 0, 1, # vendor
5
5
  1, 2, 3, 4 # body
6
6
  ].pack('C*')
@@ -8,12 +8,12 @@ describe OpenFlow::Protocol::VendorStatistics do
8
8
  expect(stats.body).to eq([1, 2, 3, 4].pack('C*'))
9
9
  end
10
10
  it 'should initialize with default values' do
11
- stats = OpenFlow::Protocol::VendorStatistics.new
11
+ stats = VendorStatistics.new
12
12
  expect(stats.vendor).to eq(0)
13
13
  expect(stats.body).to be_empty
14
14
  end
15
15
  it 'should initialize with some values' do
16
- stats = OpenFlow::Protocol::VendorStatistics.new(
16
+ stats = VendorStatistics.new(
17
17
  vendor: 1,
18
18
  body: [1, 2, 3, 4].pack('C*')
19
19
  )
@@ -1,9 +1,9 @@
1
- describe OpenFlow::Protocol::StatisticsReply do
1
+ describe StatisticsReply do
2
2
  context 'with description' do
3
3
  let(:desc) {
4
4
  'Manufacturer description'.pad(256) +
5
5
  'Hardware description'.pad(256) +
6
- 'SOpenFlow::Protocol::tware description'.pad(256) +
6
+ 'Stware description'.pad(256) +
7
7
  '123456789'.pad(32) +
8
8
  'Datapath description'.pad(256)
9
9
  }
@@ -16,8 +16,8 @@ describe OpenFlow::Protocol::StatisticsReply do
16
16
  }
17
17
 
18
18
  it 'should read binary' do
19
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
20
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
19
+ msg = StatisticsReply.read(data)
20
+ expect(msg.version).to eq(Message::OFP_VERSION)
21
21
  expect(msg.type).to eq(:statistics_reply)
22
22
  expect(msg.len).to eq(1068)
23
23
  expect(msg.xid).to eq(1)
@@ -26,12 +26,12 @@ describe OpenFlow::Protocol::StatisticsReply do
26
26
  expect(msg.statistics.serial_number).to eq('123456789')
27
27
  end
28
28
  it 'should be parsable' do
29
- msg = OpenFlow::Protocol::Parser.read(data)
30
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
29
+ msg = Parser.read(data)
30
+ expect(msg.class).to eq(StatisticsReply)
31
31
  end
32
32
  it 'should initialize with default values' do
33
- msg = OpenFlow::Protocol::StatisticsReply.new
34
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
33
+ msg = StatisticsReply.new
34
+ expect(msg.version).to eq(Message::OFP_VERSION)
35
35
  expect(msg.type).to eq(:statistics_reply)
36
36
  expect(msg.len).to eq(1068)
37
37
  expect(msg.xid).to eq(0)
@@ -40,7 +40,7 @@ describe OpenFlow::Protocol::StatisticsReply do
40
40
  expect(msg.statistics.serial_number).to eq('')
41
41
  end
42
42
  it 'should initialize with some values' do
43
- msg = OpenFlow::Protocol::StatisticsReply.new(
43
+ msg = StatisticsReply.new(
44
44
  xid: 1,
45
45
  statistic_type: :description,
46
46
  flags: [:reply_more],
@@ -48,7 +48,7 @@ describe OpenFlow::Protocol::StatisticsReply do
48
48
  serial_number: '123456789'
49
49
  }
50
50
  )
51
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
51
+ expect(msg.version).to eq(Message::OFP_VERSION)
52
52
  expect(msg.type).to eq(:statistics_reply)
53
53
  expect(msg.len).to eq(1068)
54
54
  expect(msg.xid).to eq(1)
@@ -106,8 +106,8 @@ describe OpenFlow::Protocol::StatisticsReply do
106
106
  }
107
107
 
108
108
  it 'should read binary' do
109
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
110
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
109
+ msg = StatisticsReply.read(data)
110
+ expect(msg.version).to eq(Message::OFP_VERSION)
111
111
  expect(msg.type).to eq(:statistics_reply)
112
112
  expect(msg.len).to eq(108)
113
113
  expect(msg.xid).to eq(1)
@@ -117,12 +117,12 @@ describe OpenFlow::Protocol::StatisticsReply do
117
117
  expect(msg.statistics.actions.length).to eq(1)
118
118
  end
119
119
  it 'should be parsable' do
120
- msg = OpenFlow::Protocol::Parser.read(data)
121
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
120
+ msg = Parser.read(data)
121
+ expect(msg.class).to eq(StatisticsReply)
122
122
  end
123
123
  it 'should initialize with default values' do
124
- msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :flow)
125
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
124
+ msg = StatisticsReply.new(statistic_type: :flow)
125
+ expect(msg.version).to eq(Message::OFP_VERSION)
126
126
  expect(msg.type).to eq(:statistics_reply)
127
127
  expect(msg.len).to eq(100)
128
128
  expect(msg.xid).to eq(0)
@@ -132,16 +132,16 @@ describe OpenFlow::Protocol::StatisticsReply do
132
132
  expect(msg.statistics.actions).to be_empty
133
133
  end
134
134
  it 'should initialize with some values' do
135
- msg = OpenFlow::Protocol::StatisticsReply.new(
135
+ msg = StatisticsReply.new(
136
136
  xid: 1,
137
137
  statistic_type: :flow,
138
138
  flags: [:reply_more],
139
139
  statistics: {
140
140
  table_id: 1,
141
- actions: [OpenFlow::Protocol::ActionOutput.new(port: 1)]
141
+ actions: [ActionOutput.new(port: 1)]
142
142
  }
143
143
  )
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_reply)
146
146
  expect(msg.len).to eq(108)
147
147
  expect(msg.xid).to eq(1)
@@ -168,8 +168,8 @@ describe OpenFlow::Protocol::StatisticsReply do
168
168
  }
169
169
 
170
170
  it 'should read binary' do
171
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
172
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
171
+ msg = StatisticsReply.read(data)
172
+ expect(msg.version).to eq(Message::OFP_VERSION)
173
173
  expect(msg.type).to eq(:statistics_reply)
174
174
  expect(msg.len).to eq(36)
175
175
  expect(msg.xid).to eq(1)
@@ -178,8 +178,8 @@ describe OpenFlow::Protocol::StatisticsReply do
178
178
  expect(msg.statistics.packet_count).to eq(10)
179
179
  end
180
180
  it 'should initialize with default values' do
181
- msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :aggregate)
182
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
181
+ msg = StatisticsReply.new(statistic_type: :aggregate)
182
+ expect(msg.version).to eq(Message::OFP_VERSION)
183
183
  expect(msg.type).to eq(:statistics_reply)
184
184
  expect(msg.len).to eq(36)
185
185
  expect(msg.xid).to eq(0)
@@ -188,11 +188,11 @@ describe OpenFlow::Protocol::StatisticsReply do
188
188
  expect(msg.statistics.packet_count).to eq(0)
189
189
  end
190
190
  it 'should be parsable' do
191
- msg = OpenFlow::Protocol::Parser.read(data)
192
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
191
+ msg = Parser.read(data)
192
+ expect(msg.class).to eq(StatisticsReply)
193
193
  end
194
194
  it 'should initialize with some values' do
195
- msg = OpenFlow::Protocol::StatisticsReply.new(
195
+ msg = StatisticsReply.new(
196
196
  xid: 1,
197
197
  statistic_type: :aggregate,
198
198
  flags: [:reply_more],
@@ -202,7 +202,7 @@ describe OpenFlow::Protocol::StatisticsReply do
202
202
  flow_count: 4
203
203
  }
204
204
  )
205
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
205
+ expect(msg.version).to eq(Message::OFP_VERSION)
206
206
  expect(msg.type).to eq(:statistics_reply)
207
207
  expect(msg.len).to eq(36)
208
208
  expect(msg.xid).to eq(1)
@@ -219,7 +219,7 @@ describe OpenFlow::Protocol::StatisticsReply do
219
219
  0, 3, # statistic_type
220
220
  0, 1, # flags
221
221
 
222
- # array OpenFlow::Protocol:: table_statistics
222
+ # array table_statistics
223
223
  1, # table_id
224
224
  0, 0, 0, # padding
225
225
  116, 97, 98, 108, 101, 45, 49, 0, # name
@@ -235,8 +235,8 @@ describe OpenFlow::Protocol::StatisticsReply do
235
235
  }
236
236
 
237
237
  it 'should read binary' do
238
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
239
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
238
+ msg = StatisticsReply.read(data)
239
+ expect(msg.version).to eq(Message::OFP_VERSION)
240
240
  expect(msg.type).to eq(:statistics_reply)
241
241
  expect(msg.len).to eq(76)
242
242
  expect(msg.xid).to eq(1)
@@ -246,12 +246,12 @@ describe OpenFlow::Protocol::StatisticsReply do
246
246
  expect(msg.statistics.first.table_id).to eq(1)
247
247
  end
248
248
  it 'should be parsable' do
249
- msg = OpenFlow::Protocol::Parser.read(data)
250
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
249
+ msg = Parser.read(data)
250
+ expect(msg.class).to eq(StatisticsReply)
251
251
  end
252
252
  it 'should initialize with default values' do
253
- msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :table)
254
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
253
+ msg = StatisticsReply.new(statistic_type: :table)
254
+ expect(msg.version).to eq(Message::OFP_VERSION)
255
255
  expect(msg.type).to eq(:statistics_reply)
256
256
  expect(msg.len).to eq(12)
257
257
  expect(msg.xid).to eq(0)
@@ -260,13 +260,13 @@ describe OpenFlow::Protocol::StatisticsReply do
260
260
  expect(msg.statistics).to be_empty
261
261
  end
262
262
  it 'should initialize with some values' do
263
- msg = OpenFlow::Protocol::StatisticsReply.new(
263
+ msg = StatisticsReply.new(
264
264
  xid: 1,
265
265
  statistic_type: :table,
266
266
  flags: [:reply_more],
267
267
  statistics: [{table_id: 1}]
268
268
  )
269
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
269
+ expect(msg.version).to eq(Message::OFP_VERSION)
270
270
  expect(msg.type).to eq(:statistics_reply)
271
271
  expect(msg.len).to eq(76)
272
272
  expect(msg.xid).to eq(1)
@@ -284,7 +284,7 @@ describe OpenFlow::Protocol::StatisticsReply do
284
284
  0, 4, # statistic_type
285
285
  0, 1, # flags
286
286
 
287
- # array OpenFlow::Protocol:: port_statistics_reply
287
+ # array port_statistics_reply
288
288
  0, 1, # port_number
289
289
  0, 0, 0, 0, 0, 0, # padding
290
290
  0, 0, 0, 0, 0, 0, 0, 10, # receive_packets
@@ -303,8 +303,8 @@ describe OpenFlow::Protocol::StatisticsReply do
303
303
  }
304
304
 
305
305
  it 'should read binary' do
306
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
307
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
306
+ msg = StatisticsReply.read(data)
307
+ expect(msg.version).to eq(Message::OFP_VERSION)
308
308
  expect(msg.type).to eq(:statistics_reply)
309
309
  expect(msg.len).to eq(116)
310
310
  expect(msg.xid).to eq(1)
@@ -314,12 +314,12 @@ describe OpenFlow::Protocol::StatisticsReply do
314
314
  expect(msg.statistics.first.port_number).to eq(1)
315
315
  end
316
316
  it 'should be parsable' do
317
- msg = OpenFlow::Protocol::Parser.read(data)
318
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
317
+ msg = Parser.read(data)
318
+ expect(msg.class).to eq(StatisticsReply)
319
319
  end
320
320
  it 'should initialize with default values' do
321
- msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :port)
322
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
321
+ msg = StatisticsReply.new(statistic_type: :port)
322
+ expect(msg.version).to eq(Message::OFP_VERSION)
323
323
  expect(msg.type).to eq(:statistics_reply)
324
324
  expect(msg.len).to eq(12)
325
325
  expect(msg.xid).to eq(0)
@@ -328,13 +328,13 @@ describe OpenFlow::Protocol::StatisticsReply do
328
328
  expect(msg.statistics).to be_empty
329
329
  end
330
330
  it 'should initialize with some values' do
331
- msg = OpenFlow::Protocol::StatisticsReply.new(
331
+ msg = StatisticsReply.new(
332
332
  xid: 1,
333
333
  statistic_type: :port,
334
334
  flags: [:reply_more],
335
335
  statistics: [{port_number: 1}]
336
336
  )
337
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
337
+ expect(msg.version).to eq(Message::OFP_VERSION)
338
338
  expect(msg.type).to eq(:statistics_reply)
339
339
  expect(msg.len).to eq(116)
340
340
  expect(msg.xid).to eq(1)
@@ -352,7 +352,7 @@ describe OpenFlow::Protocol::StatisticsReply do
352
352
  0, 5, # statistic_type
353
353
  0, 1, # flags
354
354
 
355
- # array OpenFlow::Protocol:: queue_statistics_reply
355
+ # array queue_statistics_reply
356
356
  0, 1, # port_number
357
357
  0, 0, # padding
358
358
  0, 0, 0, 1, # queue_id
@@ -363,8 +363,8 @@ describe OpenFlow::Protocol::StatisticsReply do
363
363
  }
364
364
 
365
365
  it 'should read binary' do
366
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
367
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
366
+ msg = StatisticsReply.read(data)
367
+ expect(msg.version).to eq(Message::OFP_VERSION)
368
368
  expect(msg.type).to eq(:statistics_reply)
369
369
  expect(msg.len).to eq(44)
370
370
  expect(msg.xid).to eq(1)
@@ -374,12 +374,12 @@ describe OpenFlow::Protocol::StatisticsReply do
374
374
  expect(msg.statistics.first.port_number).to eq(1)
375
375
  end
376
376
  it 'should be parsable' do
377
- msg = OpenFlow::Protocol::Parser.read(data)
378
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
377
+ msg = Parser.read(data)
378
+ expect(msg.class).to eq(StatisticsReply)
379
379
  end
380
380
  it 'should initialize with default values' do
381
- msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :queue)
382
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
381
+ msg = StatisticsReply.new(statistic_type: :queue)
382
+ expect(msg.version).to eq(Message::OFP_VERSION)
383
383
  expect(msg.type).to eq(:statistics_reply)
384
384
  expect(msg.len).to eq(12)
385
385
  expect(msg.xid).to eq(0)
@@ -388,13 +388,13 @@ describe OpenFlow::Protocol::StatisticsReply do
388
388
  expect(msg.statistics).to be_empty
389
389
  end
390
390
  it 'should initialize with some values' do
391
- msg = OpenFlow::Protocol::StatisticsReply.new(
391
+ msg = StatisticsReply.new(
392
392
  xid: 1,
393
393
  statistic_type: :queue,
394
394
  flags: [:reply_more],
395
395
  statistics: [{port_number: 1}]
396
396
  )
397
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
397
+ expect(msg.version).to eq(Message::OFP_VERSION)
398
398
  expect(msg.type).to eq(:statistics_reply)
399
399
  expect(msg.len).to eq(44)
400
400
  expect(msg.xid).to eq(1)
@@ -419,8 +419,8 @@ describe OpenFlow::Protocol::StatisticsReply do
419
419
  }
420
420
 
421
421
  it 'should read binary' do
422
- msg = OpenFlow::Protocol::StatisticsReply.read(data)
423
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
422
+ msg = StatisticsReply.read(data)
423
+ expect(msg.version).to eq(Message::OFP_VERSION)
424
424
  expect(msg.type).to eq(:statistics_reply)
425
425
  expect(msg.len).to eq(20)
426
426
  expect(msg.xid).to eq(1)
@@ -430,12 +430,12 @@ describe OpenFlow::Protocol::StatisticsReply do
430
430
  expect(msg.statistics.body).to eq([1, 2, 3, 4].pack('C*'))
431
431
  end
432
432
  it 'should be parsable' do
433
- msg = OpenFlow::Protocol::Parser.read(data)
434
- expect(msg.class).to eq(OpenFlow::Protocol::StatisticsReply)
433
+ msg = Parser.read(data)
434
+ expect(msg.class).to eq(StatisticsReply)
435
435
  end
436
436
  it 'should initialize with default values' do
437
- msg = OpenFlow::Protocol::StatisticsReply.new(statistic_type: :vendor)
438
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
437
+ msg = StatisticsReply.new(statistic_type: :vendor)
438
+ expect(msg.version).to eq(Message::OFP_VERSION)
439
439
  expect(msg.type).to eq(:statistics_reply)
440
440
  expect(msg.len).to eq(16)
441
441
  expect(msg.xid).to eq(0)
@@ -445,7 +445,7 @@ describe OpenFlow::Protocol::StatisticsReply do
445
445
  expect(msg.statistics.body).to be_empty
446
446
  end
447
447
  it 'should initialize with some values' do
448
- msg = OpenFlow::Protocol::StatisticsReply.new(
448
+ msg = StatisticsReply.new(
449
449
  xid: 1,
450
450
  statistic_type: :vendor,
451
451
  statistics: {
@@ -453,7 +453,7 @@ describe OpenFlow::Protocol::StatisticsReply do
453
453
  body: [1, 2, 3, 4].pack('C*')
454
454
  }
455
455
  )
456
- expect(msg.version).to eq(OpenFlow::Protocol::Message::OFP_VERSION)
456
+ expect(msg.version).to eq(Message::OFP_VERSION)
457
457
  expect(msg.type).to eq(:statistics_reply)
458
458
  expect(msg.len).to eq(20)
459
459
  expect(msg.xid).to eq(1)