pio 0.21.0 → 0.21.1

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +1 -1
  4. data/Rakefile +1 -1
  5. data/features/open_flow13/match.feature +74 -0
  6. data/features/open_flow13/oxm_ip_dscp_field.raw +0 -0
  7. data/features/open_flow13/oxm_ip_ecn_field.raw +0 -0
  8. data/features/open_flow13/oxm_vlan_pcp_field.raw +0 -0
  9. data/features/open_flow13/oxm_vlan_vid_field.raw +0 -0
  10. data/lib/pio/open_flow10/actions.rb +8 -8
  11. data/lib/pio/{enqueue.rb → open_flow10/enqueue.rb} +0 -0
  12. data/lib/pio/{set_ether_address.rb → open_flow10/set_ether_address.rb} +0 -0
  13. data/lib/pio/{set_ip_address.rb → open_flow10/set_ip_address.rb} +0 -0
  14. data/lib/pio/{set_ip_tos.rb → open_flow10/set_ip_tos.rb} +0 -0
  15. data/lib/pio/{set_transport_port.rb → open_flow10/set_transport_port.rb} +0 -0
  16. data/lib/pio/{set_vlan.rb → open_flow10/set_vlan.rb} +0 -0
  17. data/lib/pio/{set_vlan_priority.rb → open_flow10/set_vlan_priority.rb} +1 -1
  18. data/lib/pio/{set_vlan_vid.rb → open_flow10/set_vlan_vid.rb} +1 -1
  19. data/lib/pio/{strip_vlan_header.rb → open_flow10/strip_vlan_header.rb} +0 -0
  20. data/lib/pio/open_flow13/match.rb +86 -10
  21. data/lib/pio/version.rb +1 -1
  22. data/spec/pio/{enqueue_spec.rb → open_flow10/enqueue_spec.rb} +1 -1
  23. data/spec/pio/{flow_mod_spec.rb → open_flow10/flow_mod_spec.rb} +0 -0
  24. data/spec/pio/{match_spec.rb → open_flow10/match_spec.rb} +0 -0
  25. data/spec/pio/{packet_out_spec.rb → open_flow10/packet_out_spec.rb} +0 -0
  26. data/spec/pio/{set_ether_destination_address_spec.rb → open_flow10/set_ether_destination_address_spec.rb} +1 -1
  27. data/spec/pio/{set_ether_source_address_spec.rb → open_flow10/set_ether_source_address_spec.rb} +1 -1
  28. data/spec/pio/{set_ip_destination_address_spec.rb → open_flow10/set_ip_destination_address_spec.rb} +1 -1
  29. data/spec/pio/{set_ip_source_address_spec.rb → open_flow10/set_ip_source_address_spec.rb} +1 -1
  30. data/spec/pio/{set_ip_tos_spec.rb → open_flow10/set_ip_tos_spec.rb} +1 -1
  31. data/spec/pio/{set_transport_destination_port_spec.rb → open_flow10/set_transport_destination_port_spec.rb} +1 -1
  32. data/spec/pio/{set_transport_source_port_spec.rb → open_flow10/set_transport_source_port_spec.rb} +1 -1
  33. data/spec/pio/{set_vlan_priority_spec.rb → open_flow10/set_vlan_priority_spec.rb} +1 -1
  34. data/spec/pio/{set_vlan_vid_spec.rb → open_flow10/set_vlan_vid_spec.rb} +1 -1
  35. data/spec/pio/{strip_vlan_header_spec.rb → open_flow10/strip_vlan_header_spec.rb} +1 -1
  36. data/spec/pio/{wildcards_spec.rb → open_flow10/wildcards_spec.rb} +0 -0
  37. data/spec/pio/open_flow13/match_spec.rb +171 -0
  38. metadata +49 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4a2bc0f45a37328d72869a6b04ec3d891afedf6
4
- data.tar.gz: dd495c7d16475d9f0d1124407eeb932a1ec69acc
3
+ metadata.gz: d143e0e583d6916c1375465b6add97ae65ff1436
4
+ data.tar.gz: ea651e9a42b7cd0df2077047e5d2c45dc985ef01
5
5
  SHA512:
6
- metadata.gz: b47a1e1db39a3408a065677db5d1d7af6410560d5df4ec911c03212e524c202cac3af8fcdc1e1f7d8c50287c231df5589b421ed0b64a950a2776f099ff427910
7
- data.tar.gz: 138ec261dc4beab21f21dfb0eebdcf800bc7d00c756f274fd2726fe750deabc1d100f7df57c248b2d3a0c5379db101f4ac71d9f4f86dffb62093df08d84cc44b
6
+ metadata.gz: dbb88254d9e82879c3b95ef23b29b146253bea2084b02500181cd170d78cbd7dc14f84c6e2affef58bc66b136f6319966f2f450a2bdc0c7ffb5db122f060306c
7
+ data.tar.gz: 9e9a071f4e4d3970773b11ccfaaf0d11128389eedd960d033f8383964d324b077755e2825107b2b793ce0ef158ec8d473237bd155603d47cacffc5698045676b
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
3
3
  ## develop (unreleased)
4
4
 
5
5
 
6
+ ## 0.21.1 (6/24/2015)
7
+ ### Bugs fixed
8
+ * [#179](https://github.com/trema/pio/pull/179): Fix wrong OXM length.
9
+
10
+
6
11
  ## 0.21.0 (6/19/2015)
7
12
  ### New features
8
13
  * [#164](https://github.com/trema/pio/pull/164): Add new classes `Pio::FlowMod`, `Pio::Apply`, `Pio::GotoTable`, `Pio::WriteMetadata`, `Pio::Meter` and `Pio::SendOutPort`.
data/README.md CHANGED
@@ -70,7 +70,7 @@ bundle
70
70
  ## Team
71
71
 
72
72
  - [Yasuhito Takamiya](https://github.com/yasuhito) ([@yasuhito](https://twitter.com/yasuhito))
73
- - [Eishun Kondoh](https://github.com/shun159) ([@Eishun\_Kondoh](https://twitter.com/Eishun_Kondoh))
73
+ - [Eishun Kondoh](https://github.com/shun159) ([@shunichigokew](https://twitter.com/shunichigokew))
74
74
 
75
75
  ### Contributors
76
76
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
3
  RELISH_PROJECT = 'trema/pio'
4
- FLAY_THRESHOLD = 300
4
+ FLAY_THRESHOLD = 346
5
5
 
6
6
  task default: :travis
7
7
  task test: [:spec, :cucumber]
@@ -95,6 +95,49 @@ Feature: Pio::Match
95
95
  | field | value |
96
96
  | ether_type | 2048 |
97
97
 
98
+ Scenario: new(vlan_vid: 10)
99
+ When I try to create an OpenFlow message with:
100
+ """
101
+ Pio::Match.new(vlan_vid: 10)
102
+ """
103
+ Then it should finish successfully
104
+ And the message have the following fields and values:
105
+ | field | value |
106
+ | vlan_vid | 10 |
107
+
108
+ Scenario: new(vlan_vid: 10, vlan_pcp: 5)
109
+ When I try to create an OpenFlow message with:
110
+ """
111
+ Pio::Match.new(vlan_vid: 10, vlan_pcp: 5)
112
+ """
113
+ Then it should finish successfully
114
+ And the message have the following fields and values:
115
+ | field | value |
116
+ | vlan_vid | 10 |
117
+ | vlan_pcp | 5 |
118
+
119
+ Scenario: new(eth_type: 2048, ip_dscp: 46)
120
+ When I try to create an OpenFlow message with:
121
+ """
122
+ Pio::Match.new(ether_type: 2048, ip_dscp: 46)
123
+ """
124
+ Then it should finish successfully
125
+ And the message have the following fields and values:
126
+ | field | value |
127
+ | ether_type | 2048 |
128
+ | ip_dscp | 46 |
129
+
130
+ Scenario: new(eth_type: 2048, ip_ecn: 3)
131
+ When I try to create an OpenFlow message with:
132
+ """
133
+ Pio::Match.new(ether_type: 2048, ip_ecn: 46)
134
+ """
135
+ Then it should finish successfully
136
+ And the message have the following fields and values:
137
+ | field | value |
138
+ | ether_type | 2048 |
139
+ | ip_ecn | 3 |
140
+
98
141
  Scenario: new(ether_type: 0x0800, ipv4_source_address: '192.168.0.1')
99
142
  When I try to create an OpenFlow message with:
100
143
  """
@@ -301,6 +344,37 @@ Feature: Pio::Match
301
344
  | field | value |
302
345
  | ether_type | 0 |
303
346
 
347
+ Scenario: read (file: open_flow13/oxm_vlan_vid_field.raw)
348
+ When I try to parse a file named "open_flow13/oxm_vlan_vid_field.raw" with "Pio::Match" class
349
+ Then it should finish successfully
350
+ And the message have the following fields and values:
351
+ | field | value |
352
+ | vlan_vid | 10 |
353
+
354
+ Scenario: read (file: open_flow13/oxm_vlan_pcp_field.raw)
355
+ When I try to parse a file named "open_flow13/oxm_vlan_pcp_field.raw" with "Pio::Match" class
356
+ Then it should finish successfully
357
+ And the message have the following fields and values:
358
+ | field | value |
359
+ | vlan_vid | 10 |
360
+ | vlan_pcp | 5 |
361
+
362
+ Scenario: read (file: open_flow13/oxm_ip_dscp_field.raw)
363
+ When I try to parse a file named "open_flow13/oxm_ip_dscp_field.raw" with "Pio::Match" class
364
+ Then it should finish successfully
365
+ And the message have the following fields and values:
366
+ | field | value |
367
+ | ether_type | 2048 |
368
+ | ip_dscp | 46 |
369
+
370
+ Scenario: read (file: open_flow13/oxm_ip_ecn_field.raw)
371
+ When I try to parse a file named "open_flow13/oxm_ip_ecn_field.raw" with "Pio::Match" class
372
+ Then it should finish successfully
373
+ And the message have the following fields and values:
374
+ | field | value |
375
+ | ether_type | 2048 |
376
+ | ip_ecn | 3 |
377
+
304
378
  Scenario: read (file: open_flow13/oxm_ipv4_source_field.raw)
305
379
  When I try to parse a file named "open_flow13/oxm_ipv4_source_field.raw" with "Pio::Match" class
306
380
  Then it should finish successfully
@@ -1,13 +1,13 @@
1
1
  require 'bindata'
2
- require 'pio/enqueue'
2
+ require 'pio/open_flow10/enqueue'
3
3
  require 'pio/open_flow10/send_out_port'
4
- require 'pio/set_ether_address'
5
- require 'pio/set_ip_address'
6
- require 'pio/set_ip_tos'
7
- require 'pio/set_transport_port'
8
- require 'pio/set_vlan_priority'
9
- require 'pio/set_vlan_vid'
10
- require 'pio/strip_vlan_header'
4
+ require 'pio/open_flow10/set_ether_address'
5
+ require 'pio/open_flow10/set_ip_address'
6
+ require 'pio/open_flow10/set_ip_tos'
7
+ require 'pio/open_flow10/set_transport_port'
8
+ require 'pio/open_flow10/set_vlan_priority'
9
+ require 'pio/open_flow10/set_vlan_vid'
10
+ require 'pio/open_flow10/strip_vlan_header'
11
11
 
12
12
  module Pio
13
13
  module OpenFlow
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- require 'pio/set_vlan'
1
+ require 'pio/open_flow10/set_vlan'
2
2
 
3
3
  module Pio
4
4
  # An action to modify the VLAN priority of a packet.
@@ -1,4 +1,4 @@
1
- require 'pio/set_vlan'
1
+ require 'pio/open_flow10/set_vlan'
2
2
 
3
3
  module Pio
4
4
  # An action to modify the VLAN ID of a packet.
@@ -115,6 +115,70 @@ module Pio
115
115
  end
116
116
  end
117
117
 
118
+ # The value of OXM_OF_VLAN_VID match field
119
+ class VlanVid < BinData::Record
120
+ OXM_FIELD = 6
121
+
122
+ endian :big
123
+
124
+ bit3 :padding
125
+ bit13 :vlan_vid
126
+
127
+ hide :padding
128
+
129
+ def length
130
+ 2
131
+ end
132
+ end
133
+
134
+ # The value of OXM_OF_VLAN_PCP match field
135
+ class VlanPcp < BinData::Record
136
+ OXM_FIELD = 7
137
+
138
+ endian :big
139
+
140
+ bit5 :padding
141
+ bit3 :vlan_pcp
142
+
143
+ hide :padding
144
+
145
+ def length
146
+ 1
147
+ end
148
+ end
149
+
150
+ # The value of OXM_OF_IP_DSCP match field
151
+ class IpDscp < BinData::Record
152
+ OXM_FIELD = 8
153
+
154
+ endian :big
155
+
156
+ bit2 :padding
157
+ bit6 :ip_dscp
158
+
159
+ hide :padding
160
+
161
+ def length
162
+ 1
163
+ end
164
+ end
165
+
166
+ # The value of OXM_OF_IP_ECN match field
167
+ class IpEcn < BinData::Record
168
+ OXM_FIELD = 9
169
+
170
+ endian :big
171
+
172
+ bit6 :padding
173
+ bit2 :ip_ecn
174
+
175
+ hide :padding
176
+
177
+ def length
178
+ 1
179
+ end
180
+ end
181
+
118
182
  # The value of OXM_OF_IP_PROTO
119
183
  class IpProtocol < BinData::Record
120
184
  OXM_FIELD = 10
@@ -189,7 +253,7 @@ module Pio
189
253
  uint16 :tcp_source_port
190
254
 
191
255
  def length
192
- 16
256
+ 2
193
257
  end
194
258
  end
195
259
 
@@ -202,7 +266,7 @@ module Pio
202
266
  uint16 :tcp_destination_port
203
267
 
204
268
  def length
205
- 16
269
+ 2
206
270
  end
207
271
  end
208
272
 
@@ -215,7 +279,7 @@ module Pio
215
279
  uint16 :udp_source_port
216
280
 
217
281
  def length
218
- 16
282
+ 2
219
283
  end
220
284
  end
221
285
 
@@ -228,7 +292,7 @@ module Pio
228
292
  uint16 :udp_destination_port
229
293
 
230
294
  def length
231
- 16
295
+ 2
232
296
  end
233
297
  end
234
298
 
@@ -241,7 +305,7 @@ module Pio
241
305
  ipv6_address :ipv6_source_address
242
306
 
243
307
  def length
244
- 128
308
+ 16
245
309
  end
246
310
  end
247
311
 
@@ -255,7 +319,7 @@ module Pio
255
319
  ipv6_address :ipv6_source_address_mask
256
320
 
257
321
  def length
258
- 256
322
+ 32
259
323
  end
260
324
  end
261
325
 
@@ -268,7 +332,7 @@ module Pio
268
332
  ipv6_address :ipv6_destination_address
269
333
 
270
334
  def length
271
- 128
335
+ 16
272
336
  end
273
337
  end
274
338
 
@@ -282,7 +346,7 @@ module Pio
282
346
  ipv6_address :ipv6_destination_address_mask
283
347
 
284
348
  def length
285
- 256
349
+ 32
286
350
  end
287
351
  end
288
352
 
@@ -307,6 +371,10 @@ module Pio
307
371
  ether_source_address EtherSourceAddress
308
372
  masked_ether_source_address MaskedEtherSourceAddress
309
373
  ether_type EtherType
374
+ vlan_vid VlanVid
375
+ vlan_pcp VlanPcp
376
+ ip_dscp IpDscp
377
+ ip_ecn IpEcn
310
378
  ipv4_source_address Ipv4SourceAddress
311
379
  masked_ipv4_source_address MaskedIpv4SourceAddress
312
380
  ipv4_destination_address Ipv4DestinationAddress
@@ -352,6 +420,14 @@ module Pio
352
420
  masked? ? MaskedEtherSourceAddress : EtherSourceAddress
353
421
  when EtherType::OXM_FIELD
354
422
  EtherType
423
+ when VlanVid::OXM_FIELD
424
+ VlanVid
425
+ when VlanPcp::OXM_FIELD
426
+ VlanPcp
427
+ when IpDscp::OXM_FIELD
428
+ IpDscp
429
+ when IpEcn::OXM_FIELD
430
+ IpEcn
355
431
  when Ipv4SourceAddress::OXM_FIELD
356
432
  masked? ? MaskedIpv4SourceAddress : Ipv4SourceAddress
357
433
  when Ipv4DestinationAddress::OXM_FIELD
@@ -429,8 +505,8 @@ module Pio
429
505
  def initialize(user_attrs)
430
506
  @match_fields = []
431
507
 
432
- [:in_port, :ether_type, :ip_protocol,
433
- :tcp_source_port, :tcp_destination_port,
508
+ [:in_port, :ether_type, :ip_protocol, :vlan_vid, :vlan_pcp,
509
+ :ip_dscp, :ip_ecn, :tcp_source_port, :tcp_destination_port,
434
510
  :udp_source_port, :udp_destination_port].each do |each|
435
511
  next unless user_attrs.key?(each)
436
512
  klass = Match.const_get(each.to_s.split('_').map(&:capitalize).join)
data/lib/pio/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Base module.
2
2
  module Pio
3
3
  # gem version.
4
- VERSION = '0.21.0'.freeze
4
+ VERSION = '0.21.1'.freeze
5
5
  end
@@ -1,4 +1,4 @@
1
- require 'pio/enqueue'
1
+ require 'pio/open_flow10/enqueue'
2
2
 
3
3
  describe Pio::Enqueue do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_ether_address'
1
+ require 'pio/open_flow10/set_ether_address'
2
2
 
3
3
  describe Pio::SetEtherDestinationAddr do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_ether_address'
1
+ require 'pio/open_flow10/set_ether_address'
2
2
 
3
3
  describe Pio::SetEtherSourceAddr do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_ip_address'
1
+ require 'pio/open_flow10/set_ip_address'
2
2
 
3
3
  describe Pio::SetIpDestinationAddress do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_ip_address'
1
+ require 'pio/open_flow10/set_ip_address'
2
2
 
3
3
  describe Pio::SetIpSourceAddress do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_ip_tos'
1
+ require 'pio/open_flow10/set_ip_tos'
2
2
 
3
3
  describe Pio::SetIpTos do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_transport_port'
1
+ require 'pio/open_flow10/set_transport_port'
2
2
 
3
3
  describe Pio::SetTransportDestinationPort do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_transport_port'
1
+ require 'pio/open_flow10/set_transport_port'
2
2
 
3
3
  describe Pio::SetTransportSourcePort do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_vlan_priority'
1
+ require 'pio/open_flow10/set_vlan_priority'
2
2
 
3
3
  describe Pio::SetVlanPriority do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/set_vlan_vid'
1
+ require 'pio/open_flow10/set_vlan_vid'
2
2
 
3
3
  describe Pio::SetVlanVid do
4
4
  describe '.new' do
@@ -1,4 +1,4 @@
1
- require 'pio/strip_vlan_header'
1
+ require 'pio/open_flow10/strip_vlan_header'
2
2
 
3
3
  describe Pio::StripVlanHeader do
4
4
  Given(:strip_vlan_header) { Pio::StripVlanHeader.new }
@@ -141,6 +141,89 @@ describe Pio::OpenFlow13::Match do
141
141
  And { match.match_fields[0].oxm_length == 2 }
142
142
  end
143
143
 
144
+ context 'with vlan_vid: 10' do
145
+ When(:match) { Pio::OpenFlow13::Match.new(vlan_vid: 10) }
146
+ Then { match.vlan_vid == 10 }
147
+ And { match.class == Pio::OpenFlow13::Match }
148
+ And { match.length == 16 }
149
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
150
+ And { match.match_length == 10 }
151
+ And { match.match_fields.size == 1 }
152
+ And do
153
+ match.match_fields[0].oxm_class ==
154
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
155
+ end
156
+ And do
157
+ match.match_fields[0].oxm_field ==
158
+ Pio::OpenFlow13::Match::VlanVid::OXM_FIELD
159
+ end
160
+ And { match.match_fields[0].masked? == false }
161
+ And { match.match_fields[0].oxm_length == 2 }
162
+ end
163
+
164
+ context 'with vlan_vid: 10, vlan_pcp: 5' do
165
+ When(:match) { Pio::OpenFlow13::Match.new(vlan_vid: 10, vlan_pcp: 5) }
166
+ Then { match.vlan_vid == 10 }
167
+ Then { match.vlan_pcp == 5 }
168
+ And { match.class == Pio::OpenFlow13::Match }
169
+ And { match.length == 16 }
170
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
171
+ And { match.match_length == 15 }
172
+ And { match.match_fields.size == 2 }
173
+ And do
174
+ match.match_fields[1].oxm_class ==
175
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
176
+ end
177
+ And do
178
+ match.match_fields[1].oxm_field ==
179
+ Pio::OpenFlow13::Match::VlanPcp::OXM_FIELD
180
+ end
181
+ And { match.match_fields[1].masked? == false }
182
+ And { match.match_fields[0].oxm_length == 2 }
183
+ end
184
+
185
+ context 'with ether_type: 0x0800, ip_dscp: 0x2e' do
186
+ When(:match) { Pio::OpenFlow13::Match.new(ether_type: 0x0800, ip_dscp: 0x2e) }
187
+ Then { match.ether_type == 0x0800 }
188
+ Then { match.ip_dscp == 0x2e }
189
+ And { match.class == Pio::OpenFlow13::Match }
190
+ And { match.length == 16 }
191
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
192
+ And { match.match_length == 15 }
193
+ And { match.match_fields.size == 2 }
194
+ And do
195
+ match.match_fields[1].oxm_class ==
196
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
197
+ end
198
+ And do
199
+ match.match_fields[1].oxm_field ==
200
+ Pio::OpenFlow13::Match::IpDscp::OXM_FIELD
201
+ end
202
+ And { match.match_fields[1].masked? == false }
203
+ And { match.match_fields[0].oxm_length == 2 }
204
+ end
205
+
206
+ context 'with ether_type: 0x0800, ip_ecn: 3' do
207
+ When(:match) { Pio::OpenFlow13::Match.new(ether_type: 0x0800, ip_ecn: 3) }
208
+ Then { match.ether_type == 0x0800 }
209
+ Then { match.ip_ecn == 3 }
210
+ And { match.class == Pio::OpenFlow13::Match }
211
+ And { match.length == 16 }
212
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
213
+ And { match.match_length == 15 }
214
+ And { match.match_fields.size == 2 }
215
+ And do
216
+ match.match_fields[1].oxm_class ==
217
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
218
+ end
219
+ And do
220
+ match.match_fields[1].oxm_field ==
221
+ Pio::OpenFlow13::Match::IpEcn::OXM_FIELD
222
+ end
223
+ And { match.match_fields[1].masked? == false }
224
+ And { match.match_fields[0].oxm_length == 2 }
225
+ end
226
+
144
227
  context "with ether_type: 0x0800, ipv4_source_address: '1.2.3.4'" do
145
228
  When(:match) do
146
229
  Pio::OpenFlow13::Match.new(ether_type: 0x0800,
@@ -362,6 +445,94 @@ describe Pio::OpenFlow13::Match do
362
445
  And { match.match_fields[0].oxm_length == 2 }
363
446
  end
364
447
 
448
+ context 'with file "features/open_flow13/oxm_vlan_vid_field.raw"' do
449
+ Given(:raw_data) do
450
+ read_raw_data_file 'features/open_flow13/oxm_vlan_vid_field.raw'
451
+ end
452
+ Then { match.vlan_vid == 10 }
453
+ And { match.class == Pio::OpenFlow13::Match }
454
+ And { match.length == 16 }
455
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
456
+ And { match.match_length == 10 }
457
+ And { match.match_fields.size == 1 }
458
+ And do
459
+ match.match_fields[0].oxm_class ==
460
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
461
+ end
462
+ And do
463
+ match.match_fields[0].oxm_field ==
464
+ Pio::OpenFlow13::Match::VlanVid::OXM_FIELD
465
+ end
466
+ And { match.match_fields[0].masked? == false }
467
+ And { match.match_fields[0].oxm_length == 2 }
468
+ end
469
+
470
+ context 'with file "features/open_flow13/oxm_vlan_pcp_field.raw"' do
471
+ Given(:raw_data) do
472
+ read_raw_data_file 'features/open_flow13/oxm_vlan_pcp_field.raw'
473
+ end
474
+ Then { match.vlan_pcp == 5 }
475
+ And { match.class == Pio::OpenFlow13::Match }
476
+ And { match.length == 16 }
477
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
478
+ And { match.match_length == 15 }
479
+ And { match.match_fields.size == 2 }
480
+ And do
481
+ match.match_fields[0].oxm_class ==
482
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
483
+ end
484
+ And do
485
+ match.match_fields[0].oxm_field ==
486
+ Pio::OpenFlow13::Match::VlanVid::OXM_FIELD
487
+ end
488
+ And { match.match_fields[0].masked? == false }
489
+ And { match.match_fields[0].oxm_length == 2 }
490
+ end
491
+
492
+ context 'with file "features/open_flow13/oxm_ip_dscp_field.raw"' do
493
+ Given(:raw_data) do
494
+ read_raw_data_file 'features/open_flow13/oxm_ip_dscp_field.raw'
495
+ end
496
+ Then { match.ip_dscp == 0x2e }
497
+ And { match.class == Pio::OpenFlow13::Match }
498
+ And { match.length == 16 }
499
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
500
+ And { match.match_length == 15 }
501
+ And { match.match_fields.size == 2 }
502
+ And do
503
+ match.match_fields[1].oxm_class ==
504
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
505
+ end
506
+ And do
507
+ match.match_fields[1].oxm_field ==
508
+ Pio::OpenFlow13::Match::IpDscp::OXM_FIELD
509
+ end
510
+ And { match.match_fields[0].masked? == false }
511
+ And { match.match_fields[0].oxm_length == 2 }
512
+ end
513
+
514
+ context 'with file "features/open_flow13/oxm_ip_ecn_field.raw"' do
515
+ Given(:raw_data) do
516
+ read_raw_data_file 'features/open_flow13/oxm_ip_ecn_field.raw'
517
+ end
518
+ Then { match.ip_ecn == 3 }
519
+ And { match.class == Pio::OpenFlow13::Match }
520
+ And { match.length == 16 }
521
+ And { match.match_type == Pio::OpenFlow13::MATCH_TYPE_OXM }
522
+ And { match.match_length == 15 }
523
+ And { match.match_fields.size == 2 }
524
+ And do
525
+ match.match_fields[1].oxm_class ==
526
+ Pio::OpenFlow13::Match::OXM_CLASS_OPENFLOW_BASIC
527
+ end
528
+ And do
529
+ match.match_fields[1].oxm_field ==
530
+ Pio::OpenFlow13::Match::IpEcn::OXM_FIELD
531
+ end
532
+ And { match.match_fields[0].masked? == false }
533
+ And { match.match_fields[0].oxm_length == 2 }
534
+ end
535
+
365
536
  context 'with file "features/open_flow13/oxm_ipv4_source_field.raw"' do
366
537
  Given(:raw_data) do
367
538
  read_raw_data_file 'features/open_flow13/oxm_ipv4_source_field.raw'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-19 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -516,6 +516,8 @@ files:
516
516
  - features/open_flow13/oxm_ether_type_field.raw
517
517
  - features/open_flow13/oxm_in_phy_port_field.raw
518
518
  - features/open_flow13/oxm_in_port_field.raw
519
+ - features/open_flow13/oxm_ip_dscp_field.raw
520
+ - features/open_flow13/oxm_ip_ecn_field.raw
519
521
  - features/open_flow13/oxm_ipv4_destination_field.raw
520
522
  - features/open_flow13/oxm_ipv4_source_field.raw
521
523
  - features/open_flow13/oxm_ipv6_destination_field.raw
@@ -535,6 +537,8 @@ files:
535
537
  - features/open_flow13/oxm_udp_destination_field.raw
536
538
  - features/open_flow13/oxm_udp_field.raw
537
539
  - features/open_flow13/oxm_udp_source_field.raw
540
+ - features/open_flow13/oxm_vlan_pcp_field.raw
541
+ - features/open_flow13/oxm_vlan_vid_field.raw
538
542
  - features/open_flow13/send_out_port.feature
539
543
  - features/open_flow13/send_out_port.raw
540
544
  - features/open_flow13/write_metadata.feature
@@ -568,7 +572,6 @@ files:
568
572
  - lib/pio/dhcp/optional_tlv.rb
569
573
  - lib/pio/dhcp/parameter_list.rb
570
574
  - lib/pio/dhcp/request.rb
571
- - lib/pio/enqueue.rb
572
575
  - lib/pio/ethernet_header.rb
573
576
  - lib/pio/icmp.rb
574
577
  - lib/pio/icmp/format.rb
@@ -606,6 +609,7 @@ files:
606
609
  - lib/pio/open_flow10.rb
607
610
  - lib/pio/open_flow10/actions.rb
608
611
  - lib/pio/open_flow10/echo.rb
612
+ - lib/pio/open_flow10/enqueue.rb
609
613
  - lib/pio/open_flow10/exact_match.rb
610
614
  - lib/pio/open_flow10/features.rb
611
615
  - lib/pio/open_flow10/flow_mod.rb
@@ -616,6 +620,14 @@ files:
616
620
  - lib/pio/open_flow10/packet_out.rb
617
621
  - lib/pio/open_flow10/port_status.rb
618
622
  - lib/pio/open_flow10/send_out_port.rb
623
+ - lib/pio/open_flow10/set_ether_address.rb
624
+ - lib/pio/open_flow10/set_ip_address.rb
625
+ - lib/pio/open_flow10/set_ip_tos.rb
626
+ - lib/pio/open_flow10/set_transport_port.rb
627
+ - lib/pio/open_flow10/set_vlan.rb
628
+ - lib/pio/open_flow10/set_vlan_priority.rb
629
+ - lib/pio/open_flow10/set_vlan_vid.rb
630
+ - lib/pio/open_flow10/strip_vlan_header.rb
619
631
  - lib/pio/open_flow13.rb
620
632
  - lib/pio/open_flow13/apply.rb
621
633
  - lib/pio/open_flow13/echo.rb
@@ -632,14 +644,6 @@ files:
632
644
  - lib/pio/parse_error.rb
633
645
  - lib/pio/payload.rb
634
646
  - lib/pio/pcap.rb
635
- - lib/pio/set_ether_address.rb
636
- - lib/pio/set_ip_address.rb
637
- - lib/pio/set_ip_tos.rb
638
- - lib/pio/set_transport_port.rb
639
- - lib/pio/set_vlan.rb
640
- - lib/pio/set_vlan_priority.rb
641
- - lib/pio/set_vlan_vid.rb
642
- - lib/pio/strip_vlan_header.rb
643
647
  - lib/pio/type/ip_address.rb
644
648
  - lib/pio/type/ipv6_address.rb
645
649
  - lib/pio/type/mac_address.rb
@@ -657,35 +661,35 @@ files:
657
661
  - spec/pio/dhcp/offer_spec.rb
658
662
  - spec/pio/dhcp/request_spec.rb
659
663
  - spec/pio/dhcp_spec.rb
660
- - spec/pio/enqueue_spec.rb
661
- - spec/pio/flow_mod_spec.rb
662
664
  - spec/pio/icmp/reply_spec.rb
663
665
  - spec/pio/icmp/request_spec.rb
664
666
  - spec/pio/icmp_spec.rb
665
667
  - spec/pio/ipv4_address_spec.rb
666
668
  - spec/pio/lldp/options_spec.rb
667
669
  - spec/pio/mac_spec.rb
668
- - spec/pio/match_spec.rb
669
670
  - spec/pio/open_flow/phy_port_spec.rb
670
671
  - spec/pio/open_flow/type_spec.rb
672
+ - spec/pio/open_flow10/enqueue_spec.rb
673
+ - spec/pio/open_flow10/flow_mod_spec.rb
674
+ - spec/pio/open_flow10/match_spec.rb
675
+ - spec/pio/open_flow10/packet_out_spec.rb
671
676
  - spec/pio/open_flow10/send_out_port_spec.rb
677
+ - spec/pio/open_flow10/set_ether_destination_address_spec.rb
678
+ - spec/pio/open_flow10/set_ether_source_address_spec.rb
679
+ - spec/pio/open_flow10/set_ip_destination_address_spec.rb
680
+ - spec/pio/open_flow10/set_ip_source_address_spec.rb
681
+ - spec/pio/open_flow10/set_ip_tos_spec.rb
682
+ - spec/pio/open_flow10/set_transport_destination_port_spec.rb
683
+ - spec/pio/open_flow10/set_transport_source_port_spec.rb
684
+ - spec/pio/open_flow10/set_vlan_priority_spec.rb
685
+ - spec/pio/open_flow10/set_vlan_vid_spec.rb
686
+ - spec/pio/open_flow10/strip_vlan_header_spec.rb
687
+ - spec/pio/open_flow10/wildcards_spec.rb
672
688
  - spec/pio/open_flow13/goto_table_spec.rb
673
689
  - spec/pio/open_flow13/hello_spec.rb
674
690
  - spec/pio/open_flow13/match_spec.rb
675
691
  - spec/pio/open_flow13/meter_spec.rb
676
692
  - spec/pio/open_flow13/write_metadata_spec.rb
677
- - spec/pio/packet_out_spec.rb
678
- - spec/pio/set_ether_destination_address_spec.rb
679
- - spec/pio/set_ether_source_address_spec.rb
680
- - spec/pio/set_ip_destination_address_spec.rb
681
- - spec/pio/set_ip_source_address_spec.rb
682
- - spec/pio/set_ip_tos_spec.rb
683
- - spec/pio/set_transport_destination_port_spec.rb
684
- - spec/pio/set_transport_source_port_spec.rb
685
- - spec/pio/set_vlan_priority_spec.rb
686
- - spec/pio/set_vlan_vid_spec.rb
687
- - spec/pio/strip_vlan_header_spec.rb
688
- - spec/pio/wildcards_spec.rb
689
693
  - spec/spec_helper.rb
690
694
  homepage: http://github.com/trema/pio
691
695
  licenses:
@@ -722,35 +726,35 @@ test_files:
722
726
  - spec/pio/dhcp/offer_spec.rb
723
727
  - spec/pio/dhcp/request_spec.rb
724
728
  - spec/pio/dhcp_spec.rb
725
- - spec/pio/enqueue_spec.rb
726
- - spec/pio/flow_mod_spec.rb
727
729
  - spec/pio/icmp/reply_spec.rb
728
730
  - spec/pio/icmp/request_spec.rb
729
731
  - spec/pio/icmp_spec.rb
730
732
  - spec/pio/ipv4_address_spec.rb
731
733
  - spec/pio/lldp/options_spec.rb
732
734
  - spec/pio/mac_spec.rb
733
- - spec/pio/match_spec.rb
734
735
  - spec/pio/open_flow/phy_port_spec.rb
735
736
  - spec/pio/open_flow/type_spec.rb
737
+ - spec/pio/open_flow10/enqueue_spec.rb
738
+ - spec/pio/open_flow10/flow_mod_spec.rb
739
+ - spec/pio/open_flow10/match_spec.rb
740
+ - spec/pio/open_flow10/packet_out_spec.rb
736
741
  - spec/pio/open_flow10/send_out_port_spec.rb
742
+ - spec/pio/open_flow10/set_ether_destination_address_spec.rb
743
+ - spec/pio/open_flow10/set_ether_source_address_spec.rb
744
+ - spec/pio/open_flow10/set_ip_destination_address_spec.rb
745
+ - spec/pio/open_flow10/set_ip_source_address_spec.rb
746
+ - spec/pio/open_flow10/set_ip_tos_spec.rb
747
+ - spec/pio/open_flow10/set_transport_destination_port_spec.rb
748
+ - spec/pio/open_flow10/set_transport_source_port_spec.rb
749
+ - spec/pio/open_flow10/set_vlan_priority_spec.rb
750
+ - spec/pio/open_flow10/set_vlan_vid_spec.rb
751
+ - spec/pio/open_flow10/strip_vlan_header_spec.rb
752
+ - spec/pio/open_flow10/wildcards_spec.rb
737
753
  - spec/pio/open_flow13/goto_table_spec.rb
738
754
  - spec/pio/open_flow13/hello_spec.rb
739
755
  - spec/pio/open_flow13/match_spec.rb
740
756
  - spec/pio/open_flow13/meter_spec.rb
741
757
  - spec/pio/open_flow13/write_metadata_spec.rb
742
- - spec/pio/packet_out_spec.rb
743
- - spec/pio/set_ether_destination_address_spec.rb
744
- - spec/pio/set_ether_source_address_spec.rb
745
- - spec/pio/set_ip_destination_address_spec.rb
746
- - spec/pio/set_ip_source_address_spec.rb
747
- - spec/pio/set_ip_tos_spec.rb
748
- - spec/pio/set_transport_destination_port_spec.rb
749
- - spec/pio/set_transport_source_port_spec.rb
750
- - spec/pio/set_vlan_priority_spec.rb
751
- - spec/pio/set_vlan_vid_spec.rb
752
- - spec/pio/strip_vlan_header_spec.rb
753
- - spec/pio/wildcards_spec.rb
754
758
  - spec/spec_helper.rb
755
759
  - features/arp-storm.pcap
756
760
  - features/arp.feature
@@ -855,6 +859,8 @@ test_files:
855
859
  - features/open_flow13/oxm_ether_type_field.raw
856
860
  - features/open_flow13/oxm_in_phy_port_field.raw
857
861
  - features/open_flow13/oxm_in_port_field.raw
862
+ - features/open_flow13/oxm_ip_dscp_field.raw
863
+ - features/open_flow13/oxm_ip_ecn_field.raw
858
864
  - features/open_flow13/oxm_ipv4_destination_field.raw
859
865
  - features/open_flow13/oxm_ipv4_source_field.raw
860
866
  - features/open_flow13/oxm_ipv6_destination_field.raw
@@ -874,6 +880,8 @@ test_files:
874
880
  - features/open_flow13/oxm_udp_destination_field.raw
875
881
  - features/open_flow13/oxm_udp_field.raw
876
882
  - features/open_flow13/oxm_udp_source_field.raw
883
+ - features/open_flow13/oxm_vlan_pcp_field.raw
884
+ - features/open_flow13/oxm_vlan_vid_field.raw
877
885
  - features/open_flow13/send_out_port.feature
878
886
  - features/open_flow13/send_out_port.raw
879
887
  - features/open_flow13/write_metadata.feature