pio 0.27.2 → 0.28.0
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/CHANGELOG.md +17 -0
- data/Rakefile +1 -1
- data/bin/{code_metrics → terminal-notifier} +2 -2
- data/features/dhcp.feature +12 -12
- data/features/icmp.feature +12 -12
- data/features/open_flow10/aggregate_stats_request.feature +10 -10
- data/features/open_flow10/enqueue.feature +7 -7
- data/features/open_flow10/exact_match.feature +15 -15
- data/features/open_flow10/features_reply.feature +40 -40
- data/features/open_flow10/flow_mod.feature +49 -49
- data/features/open_flow10/flow_removed.feature +34 -0
- data/features/open_flow10/flow_stats_reply.feature +14 -14
- data/features/open_flow10/flow_stats_request.feature +15 -15
- data/features/open_flow10/nicira_resubmit.feature +30 -0
- data/features/open_flow10/nicira_resubmit_table.feature +32 -0
- data/features/open_flow10/port_stats_request.feature +48 -0
- data/features/open_flow10/port_stats_request.raw +0 -0
- data/features/open_flow10/queue_stats_request.feature +51 -0
- data/features/open_flow10/queue_stats_request.raw +0 -0
- data/features/open_flow10/send_out_port.feature +40 -40
- data/features/open_flow10/set_destination_mac_address.feature +16 -0
- data/features/open_flow10/set_ip_destination_address.feature +6 -6
- data/features/open_flow10/set_source_ip_address.feature +16 -0
- data/features/open_flow10/set_source_mac_address.feature +16 -0
- data/features/open_flow10/{set_ip_tos.feature → set_tos.feature} +3 -3
- data/features/open_flow10/set_transport_destination_port.feature +6 -6
- data/features/open_flow10/set_transport_source_port.feature +6 -6
- data/features/open_flow10/set_vlan_priority.feature +3 -3
- data/features/open_flow10/set_vlan_vid.feature +6 -6
- data/features/open_flow10/strip_vlan_header.feature +5 -5
- data/features/open_flow10/table_stats_request.feature +31 -0
- data/features/open_flow13/match.feature +33 -33
- data/features/open_flow13/send_out_port.feature +45 -45
- data/features/udp.feature +2 -2
- data/lib/pio/arp/format.rb +5 -5
- data/lib/pio/dhcp/boot_reply_options.rb +6 -6
- data/lib/pio/dhcp/boot_request_options.rb +2 -2
- data/lib/pio/dhcp/common_options.rb +5 -5
- data/lib/pio/dhcp/message.rb +2 -2
- data/lib/pio/icmp/options.rb +2 -2
- data/lib/pio/icmp/reply.rb +6 -6
- data/lib/pio/icmp/request.rb +6 -6
- data/lib/pio/ipv4_header.rb +11 -11
- data/lib/pio/open_flow.rb +5 -2
- data/lib/pio/open_flow/action.rb +41 -0
- data/lib/pio/open_flow/nicira_action.rb +17 -0
- data/lib/pio/open_flow10.rb +12 -1
- data/lib/pio/open_flow10/actions.rb +17 -15
- data/lib/pio/open_flow10/enqueue.rb +27 -46
- data/lib/pio/open_flow10/features/reply.rb +5 -5
- data/lib/pio/open_flow10/flow_removed.rb +40 -0
- data/lib/pio/open_flow10/match.rb +33 -33
- data/lib/pio/open_flow10/nicira_resubmit.rb +20 -0
- data/lib/pio/open_flow10/nicira_resubmit_table.rb +17 -0
- data/lib/pio/open_flow10/port_stats/request.rb +25 -0
- data/lib/pio/open_flow10/queue_stats/request.rb +22 -0
- data/lib/pio/open_flow10/send_out_port.rb +6 -27
- data/lib/pio/open_flow10/set_destination_ip_address.rb +16 -0
- data/lib/pio/open_flow10/set_destination_mac_address.rb +18 -0
- data/lib/pio/open_flow10/set_source_ip_address.rb +16 -0
- data/lib/pio/open_flow10/set_source_mac_address.rb +18 -0
- data/lib/pio/open_flow10/set_tos.rb +24 -0
- data/lib/pio/open_flow10/set_transport_port.rb +32 -48
- data/lib/pio/open_flow10/set_vlan_priority.rb +16 -11
- data/lib/pio/open_flow10/set_vlan_vid.rb +16 -11
- data/lib/pio/open_flow10/stats_request.rb +5 -1
- data/lib/pio/open_flow10/strip_vlan_header.rb +8 -25
- data/lib/pio/open_flow10/table_stats/request.rb +19 -0
- data/lib/pio/open_flow13/actions.rb +1 -1
- data/lib/pio/open_flow13/match.rb +19 -19
- data/lib/pio/open_flow13/send_out_port.rb +9 -28
- data/lib/pio/udp_header.rb +4 -4
- data/lib/pio/version.rb +1 -1
- data/pio.gemspec +3 -2
- data/spec/pio/dhcp/ack_spec.rb +8 -8
- data/spec/pio/dhcp/offer_spec.rb +8 -8
- data/spec/pio/dhcp_spec.rb +16 -16
- data/spec/pio/icmp/reply_spec.rb +4 -4
- data/spec/pio/icmp/request_spec.rb +6 -6
- data/spec/pio/icmp_spec.rb +4 -4
- data/spec/pio/open_flow10/enqueue_spec.rb +13 -11
- data/spec/pio/open_flow10/flow_mod_spec.rb +20 -20
- data/spec/pio/open_flow10/flow_stats_request_spec.rb +4 -4
- data/spec/pio/open_flow10/match_spec.rb +59 -59
- data/spec/pio/open_flow10/packet_out_spec.rb +31 -29
- data/spec/pio/open_flow10/set_destination_ip_address_spec.rb +27 -0
- data/spec/pio/open_flow10/set_destination_mac_address_spec.rb +28 -0
- data/spec/pio/open_flow10/set_source_ip_address_spec.rb +27 -0
- data/spec/pio/open_flow10/set_source_mac_address_spec.rb +28 -0
- data/spec/pio/open_flow10/set_tos_spec.rb +30 -0
- data/spec/pio/open_flow10/set_transport_destination_port_spec.rb +4 -4
- data/spec/pio/open_flow10/set_transport_source_port_spec.rb +4 -4
- data/spec/pio/open_flow10/set_vlan_priority_spec.rb +4 -4
- data/spec/pio/open_flow10/set_vlan_vid_spec.rb +4 -4
- data/spec/pio/open_flow10/strip_vlan_header_spec.rb +5 -5
- data/spec/pio/open_flow10/wildcards_spec.rb +18 -18
- data/spec/pio/open_flow13/match_spec.rb +20 -20
- metadata +73 -37
- data/bin/code_metrics-profile +0 -16
- data/features/open_flow10/set_ether_destination_address.feature +0 -16
- data/features/open_flow10/set_ether_source_address.feature +0 -16
- data/features/open_flow10/set_ip_source_address.feature +0 -16
- data/lib/pio/open_flow10/set_ether_address.rb +0 -53
- data/lib/pio/open_flow10/set_ip_address.rb +0 -49
- data/lib/pio/open_flow10/set_ip_tos.rb +0 -42
- data/lib/pio/open_flow10/set_vlan.rb +0 -37
- data/spec/pio/open_flow10/set_ether_destination_address_spec.rb +0 -28
- data/spec/pio/open_flow10/set_ether_source_address_spec.rb +0 -28
- data/spec/pio/open_flow10/set_ip_destination_address_spec.rb +0 -27
- data/spec/pio/open_flow10/set_ip_source_address_spec.rb +0 -25
- data/spec/pio/open_flow10/set_ip_tos_spec.rb +0 -30
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'pio/open_flow10/packet_out'
|
|
2
2
|
require 'pio/parse_error'
|
|
3
3
|
|
|
4
|
+
# rubocop:disable LineLength
|
|
4
5
|
describe Pio::OpenFlow10::PacketOut do
|
|
5
6
|
Given(:header_dump) do
|
|
6
7
|
[
|
|
@@ -137,7 +138,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
137
138
|
transaction_id: 0x16,
|
|
138
139
|
buffer_id: 0xffffffff,
|
|
139
140
|
in_port: 0xffff,
|
|
140
|
-
actions: Pio::SetVlanVid.new(10),
|
|
141
|
+
actions: Pio::OpenFlow10::SetVlanVid.new(10),
|
|
141
142
|
raw_data: data_dump
|
|
142
143
|
}
|
|
143
144
|
end
|
|
@@ -145,7 +146,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
145
146
|
Then { result.message_length == 0x58 }
|
|
146
147
|
Then { result.actions_len == 0x8 }
|
|
147
148
|
Then { result.actions.length == 1 }
|
|
148
|
-
Then { result.actions[0].is_a? Pio::SetVlanVid }
|
|
149
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetVlanVid }
|
|
149
150
|
Then { result.actions[0].vlan_id == 10 }
|
|
150
151
|
end
|
|
151
152
|
|
|
@@ -155,7 +156,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
155
156
|
transaction_id: 0x16,
|
|
156
157
|
buffer_id: 0xffffffff,
|
|
157
158
|
in_port: 0xffff,
|
|
158
|
-
actions: Pio::SetVlanPriority.new(3),
|
|
159
|
+
actions: Pio::OpenFlow10::SetVlanPriority.new(3),
|
|
159
160
|
raw_data: data_dump
|
|
160
161
|
}
|
|
161
162
|
end
|
|
@@ -163,7 +164,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
163
164
|
Then { result.message_length == 0x58 }
|
|
164
165
|
Then { result.actions_len == 0x8 }
|
|
165
166
|
Then { result.actions.length == 1 }
|
|
166
|
-
Then { result.actions[0].is_a? Pio::SetVlanPriority }
|
|
167
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetVlanPriority }
|
|
167
168
|
Then { result.actions[0].vlan_priority == 3 }
|
|
168
169
|
end
|
|
169
170
|
|
|
@@ -173,7 +174,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
173
174
|
transaction_id: 0x16,
|
|
174
175
|
buffer_id: 0xffffffff,
|
|
175
176
|
in_port: 0xffff,
|
|
176
|
-
actions: Pio::StripVlanHeader.new,
|
|
177
|
+
actions: Pio::OpenFlow10::StripVlanHeader.new,
|
|
177
178
|
raw_data: data_dump
|
|
178
179
|
}
|
|
179
180
|
end
|
|
@@ -181,16 +182,16 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
181
182
|
Then { result.message_length == 0x58 }
|
|
182
183
|
Then { result.actions_len == 0x8 }
|
|
183
184
|
Then { result.actions.length == 1 }
|
|
184
|
-
Then { result.actions[0].is_a? Pio::StripVlanHeader }
|
|
185
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::StripVlanHeader }
|
|
185
186
|
end
|
|
186
187
|
|
|
187
|
-
context 'with a
|
|
188
|
+
context 'with a SetSourceMacAddress action' do
|
|
188
189
|
When(:user_options) do
|
|
189
190
|
{
|
|
190
191
|
transaction_id: 0x16,
|
|
191
192
|
buffer_id: 0xffffffff,
|
|
192
193
|
in_port: 0xffff,
|
|
193
|
-
actions: Pio::
|
|
194
|
+
actions: Pio::OpenFlow10::SetSourceMacAddress.new('11:22:33:44:55:66'),
|
|
194
195
|
raw_data: data_dump
|
|
195
196
|
}
|
|
196
197
|
end
|
|
@@ -198,17 +199,17 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
198
199
|
Then { result.message_length == 0x60 }
|
|
199
200
|
Then { result.actions_len == 0x10 }
|
|
200
201
|
Then { result.actions.length == 1 }
|
|
201
|
-
Then { result.actions[0].is_a? Pio::
|
|
202
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetSourceMacAddress }
|
|
202
203
|
Then { result.actions[0].mac_address == '11:22:33:44:55:66' }
|
|
203
204
|
end
|
|
204
205
|
|
|
205
|
-
context 'with a
|
|
206
|
+
context 'with a SetDestinationMacAddress action' do
|
|
206
207
|
When(:user_options) do
|
|
207
208
|
{
|
|
208
209
|
transaction_id: 0x16,
|
|
209
210
|
buffer_id: 0xffffffff,
|
|
210
211
|
in_port: 0xffff,
|
|
211
|
-
actions: Pio::
|
|
212
|
+
actions: Pio::OpenFlow10::SetDestinationMacAddress.new('11:22:33:44:55:66'),
|
|
212
213
|
raw_data: data_dump
|
|
213
214
|
}
|
|
214
215
|
end
|
|
@@ -216,17 +217,17 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
216
217
|
Then { result.message_length == 0x60 }
|
|
217
218
|
Then { result.actions_len == 0x10 }
|
|
218
219
|
Then { result.actions.length == 1 }
|
|
219
|
-
Then { result.actions[0].is_a? Pio::
|
|
220
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetDestinationMacAddress }
|
|
220
221
|
Then { result.actions[0].mac_address == '11:22:33:44:55:66' }
|
|
221
222
|
end
|
|
222
223
|
|
|
223
|
-
context 'with a
|
|
224
|
+
context 'with a SetSourceIpAddress action' do
|
|
224
225
|
When(:user_options) do
|
|
225
226
|
{
|
|
226
227
|
transaction_id: 0x16,
|
|
227
228
|
buffer_id: 0xffffffff,
|
|
228
229
|
in_port: 0xffff,
|
|
229
|
-
actions: Pio::
|
|
230
|
+
actions: Pio::OpenFlow10::SetSourceIpAddress.new('1.2.3.4'),
|
|
230
231
|
raw_data: data_dump
|
|
231
232
|
}
|
|
232
233
|
end
|
|
@@ -234,17 +235,17 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
234
235
|
Then { result.message_length == 0x58 }
|
|
235
236
|
Then { result.actions_len == 0x8 }
|
|
236
237
|
Then { result.actions.length == 1 }
|
|
237
|
-
Then { result.actions[0].is_a? Pio::
|
|
238
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetSourceIpAddress }
|
|
238
239
|
Then { result.actions[0].ip_address == '1.2.3.4' }
|
|
239
240
|
end
|
|
240
241
|
|
|
241
|
-
context 'with a
|
|
242
|
+
context 'with a SetDestinationIpAddress action' do
|
|
242
243
|
When(:user_options) do
|
|
243
244
|
{
|
|
244
245
|
transaction_id: 0x16,
|
|
245
246
|
buffer_id: 0xffffffff,
|
|
246
247
|
in_port: 0xffff,
|
|
247
|
-
actions: Pio::
|
|
248
|
+
actions: Pio::OpenFlow10::SetDestinationIpAddress.new('1.2.3.4'),
|
|
248
249
|
raw_data: data_dump
|
|
249
250
|
}
|
|
250
251
|
end
|
|
@@ -252,17 +253,17 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
252
253
|
Then { result.message_length == 0x58 }
|
|
253
254
|
Then { result.actions_len == 0x8 }
|
|
254
255
|
Then { result.actions.length == 1 }
|
|
255
|
-
Then { result.actions[0].is_a? Pio::
|
|
256
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetDestinationIpAddress }
|
|
256
257
|
Then { result.actions[0].ip_address == '1.2.3.4' }
|
|
257
258
|
end
|
|
258
259
|
|
|
259
|
-
context 'with a
|
|
260
|
+
context 'with a SetTos action' do
|
|
260
261
|
When(:user_options) do
|
|
261
262
|
{
|
|
262
263
|
transaction_id: 0x16,
|
|
263
264
|
buffer_id: 0xffffffff,
|
|
264
265
|
in_port: 0xffff,
|
|
265
|
-
actions: Pio::
|
|
266
|
+
actions: Pio::OpenFlow10::SetTos.new(32),
|
|
266
267
|
raw_data: data_dump
|
|
267
268
|
}
|
|
268
269
|
end
|
|
@@ -270,7 +271,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
270
271
|
Then { result.message_length == 0x58 }
|
|
271
272
|
Then { result.actions_len == 0x8 }
|
|
272
273
|
Then { result.actions.length == 1 }
|
|
273
|
-
Then { result.actions[0].is_a? Pio::
|
|
274
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetTos }
|
|
274
275
|
Then { result.actions[0].type_of_service == 32 }
|
|
275
276
|
end
|
|
276
277
|
|
|
@@ -280,7 +281,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
280
281
|
transaction_id: 0x16,
|
|
281
282
|
buffer_id: 0xffffffff,
|
|
282
283
|
in_port: 0xffff,
|
|
283
|
-
actions: Pio::SetTransportSourcePort.new(100),
|
|
284
|
+
actions: Pio::OpenFlow10::SetTransportSourcePort.new(100),
|
|
284
285
|
raw_data: data_dump
|
|
285
286
|
}
|
|
286
287
|
end
|
|
@@ -288,7 +289,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
288
289
|
Then { result.message_length == 0x58 }
|
|
289
290
|
Then { result.actions_len == 0x8 }
|
|
290
291
|
Then { result.actions.length == 1 }
|
|
291
|
-
Then { result.actions[0].is_a? Pio::SetTransportSourcePort }
|
|
292
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetTransportSourcePort }
|
|
292
293
|
Then { result.actions[0].port == 100 }
|
|
293
294
|
end
|
|
294
295
|
|
|
@@ -298,7 +299,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
298
299
|
transaction_id: 0x16,
|
|
299
300
|
buffer_id: 0xffffffff,
|
|
300
301
|
in_port: 0xffff,
|
|
301
|
-
actions: Pio::SetTransportDestinationPort.new(100),
|
|
302
|
+
actions: Pio::OpenFlow10::SetTransportDestinationPort.new(100),
|
|
302
303
|
raw_data: data_dump
|
|
303
304
|
}
|
|
304
305
|
end
|
|
@@ -306,7 +307,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
306
307
|
Then { result.message_length == 0x58 }
|
|
307
308
|
Then { result.actions_len == 0x8 }
|
|
308
309
|
Then { result.actions.length == 1 }
|
|
309
|
-
Then { result.actions[0].is_a? Pio::SetTransportDestinationPort }
|
|
310
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::SetTransportDestinationPort }
|
|
310
311
|
Then { result.actions[0].port == 100 }
|
|
311
312
|
end
|
|
312
313
|
|
|
@@ -316,7 +317,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
316
317
|
transaction_id: 0x16,
|
|
317
318
|
buffer_id: 0xffffffff,
|
|
318
319
|
in_port: 0xffff,
|
|
319
|
-
actions: Pio::Enqueue.new(port: 1, queue_id: 2),
|
|
320
|
+
actions: Pio::OpenFlow10::Enqueue.new(port: 1, queue_id: 2),
|
|
320
321
|
raw_data: data_dump
|
|
321
322
|
}
|
|
322
323
|
end
|
|
@@ -324,7 +325,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
324
325
|
Then { result.message_length == 0x60 }
|
|
325
326
|
Then { result.actions_len == 0x10 }
|
|
326
327
|
Then { result.actions.length == 1 }
|
|
327
|
-
Then { result.actions[0].is_a? Pio::Enqueue }
|
|
328
|
+
Then { result.actions[0].is_a? Pio::OpenFlow10::Enqueue }
|
|
328
329
|
Then { result.actions[0].port == 1 }
|
|
329
330
|
Then { result.actions[0].queue_id == 2 }
|
|
330
331
|
end
|
|
@@ -336,7 +337,7 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
336
337
|
buffer_id: 0xffffffff,
|
|
337
338
|
in_port: 0xffff,
|
|
338
339
|
actions: [Pio::OpenFlow10::SendOutPort.new(2),
|
|
339
|
-
Pio::SetVlanVid.new(10)],
|
|
340
|
+
Pio::OpenFlow10::SetVlanVid.new(10)],
|
|
340
341
|
raw_data: data_dump
|
|
341
342
|
}
|
|
342
343
|
end
|
|
@@ -347,8 +348,9 @@ describe Pio::OpenFlow10::PacketOut do
|
|
|
347
348
|
Then { result.actions[0].is_a? Pio::OpenFlow10::SendOutPort }
|
|
348
349
|
Then { result.actions[0].port == 2 }
|
|
349
350
|
Then { result.actions[0].max_length == 2**16 - 1 }
|
|
350
|
-
Then { result.actions[1].is_a? Pio::SetVlanVid }
|
|
351
|
+
Then { result.actions[1].is_a? Pio::OpenFlow10::SetVlanVid }
|
|
351
352
|
Then { result.actions[1].vlan_id == 10 }
|
|
352
353
|
end
|
|
353
354
|
end
|
|
354
355
|
end
|
|
356
|
+
# rubocop:enable LineLength
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'pio/open_flow10/set_destination_ip_address'
|
|
2
|
+
|
|
3
|
+
describe Pio::OpenFlow10::SetDestinationIpAddress do
|
|
4
|
+
describe '.new' do
|
|
5
|
+
context "with '1.2.3.4'" do
|
|
6
|
+
When(:set_destination_ip_addr) do
|
|
7
|
+
Pio::OpenFlow10::SetDestinationIpAddress.new('1.2.3.4')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe '#ip_address' do
|
|
11
|
+
Then { set_destination_ip_addr.ip_address == '1.2.3.4' }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#action_type' do
|
|
15
|
+
Then { set_destination_ip_addr.action_type == 7 }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '#action_length' do
|
|
19
|
+
Then { set_destination_ip_addr.action_length == 8 }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe '#to_binary' do
|
|
23
|
+
Then { set_destination_ip_addr.to_binary.length == 8 }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'pio/open_flow10/set_destination_mac_address'
|
|
2
|
+
|
|
3
|
+
describe Pio::OpenFlow10::SetDestinationMacAddress do
|
|
4
|
+
describe '.new' do
|
|
5
|
+
Given(:set_destination_mac_address) do
|
|
6
|
+
Pio::OpenFlow10::SetDestinationMacAddress.new(mac_address)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
context "with '11:22:33:44:55:66'" do
|
|
10
|
+
When(:mac_address) { '11:22:33:44:55:66' }
|
|
11
|
+
Then { set_destination_mac_address.mac_address == '11:22:33:44:55:66' }
|
|
12
|
+
|
|
13
|
+
describe '#to_binary' do
|
|
14
|
+
Then { set_destination_mac_address.to_binary.length == 16 }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
context 'with 0x112233445566' do
|
|
19
|
+
When(:mac_address) { 0x112233445566 }
|
|
20
|
+
Then { set_destination_mac_address.mac_address == '11:22:33:44:55:66' }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "with Pio::Mac.new('11:22:33:44:55:66')" do
|
|
24
|
+
When(:mac_address) { Pio::Mac.new('11:22:33:44:55:66') }
|
|
25
|
+
Then { set_destination_mac_address.mac_address == '11:22:33:44:55:66' }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'pio/open_flow10/set_source_ip_address'
|
|
2
|
+
|
|
3
|
+
describe Pio::OpenFlow10::SetSourceIpAddress do
|
|
4
|
+
describe '.new' do
|
|
5
|
+
context "with '1.2.3.4'" do
|
|
6
|
+
When(:set_source_ip_addr) do
|
|
7
|
+
Pio::OpenFlow10::SetSourceIpAddress.new('1.2.3.4')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe '#ip_address' do
|
|
11
|
+
Then { set_source_ip_addr.ip_address == '1.2.3.4' }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#action_type' do
|
|
15
|
+
Then { set_source_ip_addr.action_type == 6 }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '#action_length' do
|
|
19
|
+
Then { set_source_ip_addr.action_length == 8 }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe '#to_binary' do
|
|
23
|
+
Then { set_source_ip_addr.to_binary.length == 8 }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'pio/open_flow10/set_source_mac_address'
|
|
2
|
+
|
|
3
|
+
describe Pio::OpenFlow10::SetSourceMacAddress do
|
|
4
|
+
describe '.new' do
|
|
5
|
+
Given(:set_source_mac_address) do
|
|
6
|
+
Pio::OpenFlow10::SetSourceMacAddress.new(mac_address)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
context "with '11:22:33:44:55:66'" do
|
|
10
|
+
When(:mac_address) { '11:22:33:44:55:66' }
|
|
11
|
+
Then { set_source_mac_address.mac_address == '11:22:33:44:55:66' }
|
|
12
|
+
|
|
13
|
+
describe '#to_binary' do
|
|
14
|
+
Then { set_source_mac_address.to_binary.length == 16 }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
context 'with 0x112233445566' do
|
|
19
|
+
When(:mac_address) { 0x112233445566 }
|
|
20
|
+
Then { set_source_mac_address.mac_address == '11:22:33:44:55:66' }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "with Pio::Mac.new('11:22:33:44:55:66')" do
|
|
24
|
+
When(:mac_address) { Pio::Mac.new('11:22:33:44:55:66') }
|
|
25
|
+
Then { set_source_mac_address.mac_address == '11:22:33:44:55:66' }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'pio/open_flow10/set_tos'
|
|
2
|
+
|
|
3
|
+
describe Pio::OpenFlow10::SetTos do
|
|
4
|
+
describe '.new' do
|
|
5
|
+
context 'with 32' do
|
|
6
|
+
When(:set_tos) { Pio::OpenFlow10::SetTos.new(32) }
|
|
7
|
+
|
|
8
|
+
describe '#type_of_service' do
|
|
9
|
+
Then { set_tos.type_of_service == 32 }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe '#action_type' do
|
|
13
|
+
Then { set_tos.action_type == 8 }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe '#action_length' do
|
|
17
|
+
Then { set_tos.action_length == 8 }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#to_binary' do
|
|
21
|
+
Then { set_tos.to_binary.length == 8 }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context 'with 1' do
|
|
26
|
+
When(:set_tos) { Pio::OpenFlow10::SetTos.new(1) }
|
|
27
|
+
Then { set_tos == Failure(ArgumentError) }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'pio/open_flow10/set_transport_port'
|
|
2
2
|
|
|
3
|
-
describe Pio::SetTransportDestinationPort do
|
|
3
|
+
describe Pio::OpenFlow10::SetTransportDestinationPort do
|
|
4
4
|
describe '.new' do
|
|
5
5
|
When(:set_transport_destination_port) do
|
|
6
|
-
Pio::SetTransportDestinationPort.new(port)
|
|
6
|
+
Pio::OpenFlow10::SetTransportDestinationPort.new(port)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
context 'with 100' do
|
|
@@ -17,8 +17,8 @@ describe Pio::SetTransportDestinationPort do
|
|
|
17
17
|
Then { set_transport_destination_port.action_type == 10 }
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
describe '#
|
|
21
|
-
Then { set_transport_destination_port.
|
|
20
|
+
describe '#action_length' do
|
|
21
|
+
Then { set_transport_destination_port.action_length == 8 }
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
describe '#to_binary' do
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'pio/open_flow10/set_transport_port'
|
|
2
2
|
|
|
3
|
-
describe Pio::SetTransportSourcePort do
|
|
3
|
+
describe Pio::OpenFlow10::SetTransportSourcePort do
|
|
4
4
|
describe '.new' do
|
|
5
5
|
When(:set_transport_source_port) do
|
|
6
|
-
Pio::SetTransportSourcePort.new port
|
|
6
|
+
Pio::OpenFlow10::SetTransportSourcePort.new port
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
context 'with 100' do
|
|
@@ -17,8 +17,8 @@ describe Pio::SetTransportSourcePort do
|
|
|
17
17
|
Then { set_transport_source_port.action_type == 9 }
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
describe '#
|
|
21
|
-
Then { set_transport_source_port.
|
|
20
|
+
describe '#action_length' do
|
|
21
|
+
Then { set_transport_source_port.action_length == 8 }
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
describe '#to_binary' do
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'pio/open_flow10/set_vlan_priority'
|
|
2
2
|
|
|
3
|
-
describe Pio::SetVlanPriority do
|
|
3
|
+
describe Pio::OpenFlow10::SetVlanPriority do
|
|
4
4
|
describe '.new' do
|
|
5
|
-
When(:set_vlan_priority) { Pio::SetVlanPriority.new(priority) }
|
|
5
|
+
When(:set_vlan_priority) { Pio::OpenFlow10::SetVlanPriority.new(priority) }
|
|
6
6
|
|
|
7
7
|
context 'with 3' do
|
|
8
8
|
When(:priority) { 3 }
|
|
@@ -15,8 +15,8 @@ describe Pio::SetVlanPriority do
|
|
|
15
15
|
Then { set_vlan_priority.action_type == 2 }
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
describe '#
|
|
19
|
-
Then { set_vlan_priority.
|
|
18
|
+
describe '#action_length' do
|
|
19
|
+
Then { set_vlan_priority.action_length == 8 }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
describe '#to_binary' do
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'pio/open_flow10/set_vlan_vid'
|
|
2
2
|
|
|
3
|
-
describe Pio::SetVlanVid do
|
|
3
|
+
describe Pio::OpenFlow10::SetVlanVid do
|
|
4
4
|
describe '.new' do
|
|
5
|
-
When(:set_vlan_vid) { Pio::SetVlanVid.new(vlan_id) }
|
|
5
|
+
When(:set_vlan_vid) { Pio::OpenFlow10::SetVlanVid.new(vlan_id) }
|
|
6
6
|
|
|
7
7
|
context 'with 10' do
|
|
8
8
|
When(:vlan_id) { 10 }
|
|
@@ -15,8 +15,8 @@ describe Pio::SetVlanVid do
|
|
|
15
15
|
Then { set_vlan_vid.action_type == 1 }
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
describe '#
|
|
19
|
-
Then { set_vlan_vid.
|
|
18
|
+
describe '#action_length' do
|
|
19
|
+
Then { set_vlan_vid.action_length == 8 }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
describe '#to_binary' do
|