pio 0.20.1 → 0.21.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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +1 -0
  4. data/Rakefile +5 -8
  5. data/bin/byebug +16 -0
  6. data/bin/terminal-notifier +16 -0
  7. data/features/open_flow10/flow_mod.feature +5 -5
  8. data/features/open_flow10/packet_in.feature +2 -2
  9. data/features/open_flow10/port_status.feature +1 -1
  10. data/features/open_flow13/action_copy_ttl_in.raw +0 -0
  11. data/features/open_flow13/action_copy_ttl_out.raw +0 -0
  12. data/features/open_flow13/action_dec_mpls_ttl.raw +0 -0
  13. data/features/open_flow13/action_dec_nw_ttl.raw +0 -0
  14. data/features/open_flow13/action_group.raw +0 -0
  15. data/features/open_flow13/action_pop_mpls.raw +0 -0
  16. data/features/open_flow13/action_pop_pbb.raw +0 -0
  17. data/features/open_flow13/action_pop_vlan.raw +0 -0
  18. data/features/open_flow13/action_push_mpls.raw +0 -0
  19. data/features/open_flow13/action_push_pbb.raw +0 -0
  20. data/features/open_flow13/action_push_vlan.raw +0 -0
  21. data/features/open_flow13/action_set_field.raw +0 -0
  22. data/features/open_flow13/action_set_mpls_ttl.raw +0 -0
  23. data/features/open_flow13/action_set_nw_ttl.raw +0 -0
  24. data/features/open_flow13/action_set_queue.raw +0 -0
  25. data/features/open_flow13/apply_actions.feature +43 -0
  26. data/features/open_flow13/apply_actions.raw +0 -0
  27. data/features/open_flow13/flow_add_apply_no_match.raw +0 -0
  28. data/features/open_flow13/flow_mod.feature +146 -0
  29. data/features/open_flow13/flow_mod_add_apply_no_match.raw +0 -0
  30. data/features/open_flow13/flow_mod_no_match_or_instructions.raw +0 -0
  31. data/features/open_flow13/goto_table.feature +26 -0
  32. data/features/open_flow13/instruction_clear_actions.raw +0 -0
  33. data/features/open_flow13/instruction_goto_table.raw +0 -0
  34. data/features/open_flow13/instruction_meter.raw +0 -0
  35. data/features/open_flow13/instruction_write_actions.raw +0 -0
  36. data/features/open_flow13/instruction_write_metadata.raw +0 -0
  37. data/features/open_flow13/match.feature +36 -0
  38. data/features/open_flow13/meter.feature +26 -0
  39. data/features/open_flow13/send_out_port.feature +28 -0
  40. data/features/open_flow13/send_out_port.raw +0 -0
  41. data/features/open_flow13/write_metadata.feature +28 -0
  42. data/features/step_definitions/open_flow_steps.rb +20 -0
  43. data/features/step_definitions/packet_data_steps.rb +5 -15
  44. data/lib/pio/monkey_patch/integer.rb +2 -0
  45. data/lib/pio/monkey_patch/integer/base_conversions.rb +10 -0
  46. data/lib/pio/open_flow.rb +0 -2
  47. data/lib/pio/open_flow10.rb +1 -0
  48. data/lib/pio/{open_flow → open_flow10}/actions.rb +1 -1
  49. data/lib/pio/open_flow10/echo.rb +1 -0
  50. data/lib/pio/{open_flow → open_flow10}/message.rb +1 -0
  51. data/lib/pio/{send_out_port.rb → open_flow10/send_out_port.rb} +0 -0
  52. data/lib/pio/open_flow13.rb +6 -0
  53. data/lib/pio/open_flow13/apply.rb +74 -0
  54. data/lib/pio/open_flow13/flow_mod.rb +195 -0
  55. data/lib/pio/open_flow13/goto_table.rb +33 -0
  56. data/lib/pio/open_flow13/hello.rb +1 -2
  57. data/lib/pio/open_flow13/match.rb +38 -5
  58. data/lib/pio/open_flow13/meter.rb +32 -0
  59. data/lib/pio/open_flow13/send_out_port.rb +48 -0
  60. data/lib/pio/open_flow13/write_metadata.rb +51 -0
  61. data/lib/pio/version.rb +1 -1
  62. data/spec/pio/{send_out_port_spec.rb → open_flow10/send_out_port_spec.rb} +1 -1
  63. data/spec/pio/open_flow13/goto_table_spec.rb +12 -0
  64. data/spec/pio/open_flow13/match_spec.rb +45 -0
  65. data/spec/pio/open_flow13/meter_spec.rb +12 -0
  66. data/spec/pio/open_flow13/write_metadata_spec.rb +28 -0
  67. metadata +185 -108
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 551bcb08d55075cf2011017a19170798d5167746
4
- data.tar.gz: 9e942d01521924f91651b676a907c13fa27def1c
3
+ metadata.gz: e4a2bc0f45a37328d72869a6b04ec3d891afedf6
4
+ data.tar.gz: dd495c7d16475d9f0d1124407eeb932a1ec69acc
5
5
  SHA512:
6
- metadata.gz: 2d2883d13e351d0ab48bad139e84207c22b53ad95a91699dd4dc2e8e43ac7b0546629eed23619156e3ec58b25515987599e88242e6a4ef1a25bbc2c4cccaebe8
7
- data.tar.gz: a1b385371ab740497deb3780db2954df7061ef6a6e9b9116df46ed0e40f970121638d3c6ec4862801b6d38de40814ce0e1a19ad9c866499ca3d2b51a1052126f
6
+ metadata.gz: b47a1e1db39a3408a065677db5d1d7af6410560d5df4ec911c03212e524c202cac3af8fcdc1e1f7d8c50287c231df5589b421ed0b64a950a2776f099ff427910
7
+ data.tar.gz: 138ec261dc4beab21f21dfb0eebdcf800bc7d00c756f274fd2726fe750deabc1d100f7df57c248b2d3a0c5379db101f4ac71d9f4f86dffb62093df08d84cc44b
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
3
3
  ## develop (unreleased)
4
4
 
5
5
 
6
+ ## 0.21.0 (6/19/2015)
7
+ ### New features
8
+ * [#164](https://github.com/trema/pio/pull/164): Add new classes `Pio::FlowMod`, `Pio::Apply`, `Pio::GotoTable`, `Pio::WriteMetadata`, `Pio::Meter` and `Pio::SendOutPort`.
9
+
10
+
6
11
  ## 0.20.1 (6/10/2015)
7
12
  ### Bugs fixed
8
13
  * [#167](https://github.com/trema/pio/pull/167): Fix PacketIn accessor methods (raw_data = VLAN tagged UDP).
data/README.md CHANGED
@@ -35,6 +35,7 @@ supports the following packet formats:
35
35
  - [Echo Reply](https://relishapp.com/trema/pio/docs/open-flow13/pio-echo-reply)
36
36
  - [Features Request](https://relishapp.com/trema/pio/docs/open-flow13/pio-features-request)
37
37
  - [Features Reply](https://relishapp.com/trema/pio/docs/open-flow13/pio-features-reply)
38
+ - [Flow Mod](https://relishapp.com/trema/pio/docs/open-flow13/pio-flowmod)
38
39
 
39
40
  ## Features Overview
40
41
 
data/Rakefile CHANGED
@@ -1,17 +1,14 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
3
  RELISH_PROJECT = 'trema/pio'
4
+ FLAY_THRESHOLD = 300
4
5
 
5
- # rubocop:disable HashSyntax
6
-
7
- task :default => :travis
8
- task :test => [:spec, :cucumber]
9
- task :travis => [:test, :quality, 'coveralls:push']
6
+ task default: :travis
7
+ task test: [:spec, :cucumber]
8
+ task travis: [:test, :quality, 'coveralls:push']
10
9
 
11
10
  desc 'Check for code quality'
12
- task :quality => [:reek, :flog, :flay, :rubocop]
13
-
14
- # rubocop:enable HashSyntax
11
+ task quality: [:reek, :flog, :flay, :rubocop]
15
12
 
16
13
  Dir.glob('tasks/*.rake').each { |each| import each }
17
14
 
data/bin/byebug ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'byebug' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('byebug', 'byebug')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'terminal-notifier' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('terminal-notifier', 'terminal-notifier')
@@ -25,7 +25,7 @@ Feature: Pio::FlowMod
25
25
  | match.transport_source_port | 8 |
26
26
  | match.transport_destination_port | 0 |
27
27
  | cookie | 0 |
28
- | command | add |
28
+ | command | :add |
29
29
  | idle_timeout | 0 |
30
30
  | hard_timeout | 0 |
31
31
  | priority | 65535 |
@@ -62,7 +62,7 @@ Feature: Pio::FlowMod
62
62
  | match.transport_source_port | 8 |
63
63
  | match.transport_destination_port | 0 |
64
64
  | cookie | 0 |
65
- | command | modify |
65
+ | command | :modify |
66
66
  | idle_timeout | 0 |
67
67
  | hard_timeout | 0 |
68
68
  | priority | 65535 |
@@ -99,7 +99,7 @@ Feature: Pio::FlowMod
99
99
  | match.transport_source_port | 8 |
100
100
  | match.transport_destination_port | 0 |
101
101
  | cookie | 0 |
102
- | command | modify_strict |
102
+ | command | :modify_strict |
103
103
  | idle_timeout | 0 |
104
104
  | hard_timeout | 0 |
105
105
  | priority | 65535 |
@@ -136,7 +136,7 @@ Feature: Pio::FlowMod
136
136
  | match.transport_source_port | 8 |
137
137
  | match.transport_destination_port | 0 |
138
138
  | cookie | 0 |
139
- | command | delete |
139
+ | command | :delete |
140
140
  | idle_timeout | 0 |
141
141
  | hard_timeout | 0 |
142
142
  | priority | 65535 |
@@ -171,7 +171,7 @@ Feature: Pio::FlowMod
171
171
  | match.transport_source_port | 8 |
172
172
  | match.transport_destination_port | 0 |
173
173
  | cookie | 1 |
174
- | command | delete_strict |
174
+ | command | :delete_strict |
175
175
  | idle_timeout | 0 |
176
176
  | hard_timeout | 0 |
177
177
  | priority | 65535 |
@@ -29,7 +29,7 @@ Feature: Pio::PacketIn
29
29
  | buffer_id | 4294967040 |
30
30
  | total_len | 60 |
31
31
  | in_port | 1 |
32
- | reason | no_match |
32
+ | reason | :no_match |
33
33
  | raw_data.length | 60 |
34
34
  | source_mac | ac:5d:10:31:37:79 |
35
35
  | source_mac.class | Pio::Mac |
@@ -50,7 +50,7 @@ Feature: Pio::PacketIn
50
50
  | buffer_id | 4294967040 |
51
51
  | total_len | 60 |
52
52
  | in_port | 1 |
53
- | reason | no_match |
53
+ | reason | :no_match |
54
54
  | raw_data.length | 60 |
55
55
  | source_mac | ac:5d:10:31:37:79 |
56
56
  | source_mac.class | Pio::Mac |
@@ -10,7 +10,7 @@ Feature: Pio::PortStatus
10
10
  | message_length | 64 |
11
11
  | transaction_id | 4 |
12
12
  | xid | 4 |
13
- | reason | delete |
13
+ | reason | :delete |
14
14
  | desc.port_no | 65533 |
15
15
  | desc.hardware_address | 01:02:03:04:05:06 |
16
16
  | desc.name | foo |
@@ -0,0 +1,43 @@
1
+ Feature: Apply-Actions instruction.
2
+ Background:
3
+ Given I use OpenFlow 1.3
4
+
5
+ Scenario: new()
6
+ When I try to create an OpenFlow instruction with:
7
+ """
8
+ Pio::Apply.new
9
+ """
10
+ Then it should finish successfully
11
+ And the message have the following fields and values:
12
+ | field | value |
13
+ | class | Pio::Apply |
14
+ | instruction_type | 4 |
15
+ | instruction_length | 8 |
16
+ | actions | [] |
17
+
18
+ Scenario: new(SendOutPort.new(1))
19
+ When I try to create an OpenFlow instruction with:
20
+ """
21
+ Pio::Apply.new(SendOutPort.new(1))
22
+ """
23
+ Then it should finish successfully
24
+ And the message have the following fields and values:
25
+ | field | value |
26
+ | class | Pio::Apply |
27
+ | instruction_type | 4 |
28
+ | instruction_length | 24 |
29
+ | actions.size | 1 |
30
+ | actions.at(0).class | Pio::SendOutPort |
31
+ | actions.at(0).port | 1 |
32
+
33
+ Scenario: read
34
+ When I try to parse a file named "open_flow13/apply_actions.raw" with "Pio::Apply" class
35
+ Then it should finish successfully
36
+ And the message have the following fields and values:
37
+ | field | value |
38
+ | class | Pio::Apply |
39
+ | instruction_type | 4 |
40
+ | instruction_length | 24 |
41
+ | actions.size | 1 |
42
+ | actions.at(0).class | Pio::SendOutPort |
43
+ | actions.at(0).port | 1 |
@@ -0,0 +1,146 @@
1
+ Feature: Pio::FlowMod
2
+ Background:
3
+ Given I use OpenFlow 1.3
4
+
5
+ Scenario: new
6
+ When I try to create an OpenFlow message with:
7
+ """
8
+ Pio::FlowMod.new
9
+ """
10
+ Then it should finish successfully
11
+ And the message have the following fields and values:
12
+ | field | value |
13
+ | class | Pio::FlowMod |
14
+ | ofp_version | 4 |
15
+ | message_type | 14 |
16
+ | message_length | 56 |
17
+ | transaction_id | 0 |
18
+ | xid | 0 |
19
+ | cookie | 0 |
20
+ | cookie_mask | 0 |
21
+ | table_id | 0 |
22
+ | command | :add |
23
+ | idle_timeout | 0 |
24
+ | hard_timeout | 0 |
25
+ | priority.to_hex | 0xffff |
26
+ | buffer_id | :no_buffer |
27
+ | out_port | :any |
28
+ | out_group | :any |
29
+ | flags | [] |
30
+ | match.match_fields | [] |
31
+ | instructions | [] |
32
+
33
+ Scenario: new(instructions: Pio::Apply.new(SendOutPort.new(1)))
34
+ When I try to create an OpenFlow message with:
35
+ """
36
+ Pio::FlowMod.new(instructions: Pio::Apply.new(SendOutPort.new(1)))
37
+ """
38
+ Then it should finish successfully
39
+ And the message have the following fields and values:
40
+ | field | value |
41
+ | class | Pio::FlowMod |
42
+ | ofp_version | 4 |
43
+ | message_type | 14 |
44
+ | message_length | 80 |
45
+ | transaction_id | 0 |
46
+ | xid | 0 |
47
+ | cookie | 0 |
48
+ | cookie_mask | 0 |
49
+ | table_id | 0 |
50
+ | command | :add |
51
+ | idle_timeout | 0 |
52
+ | hard_timeout | 0 |
53
+ | priority.to_hex | 0xffff |
54
+ | buffer_id | :no_buffer |
55
+ | out_port | :any |
56
+ | out_group | :any |
57
+ | flags | [] |
58
+ | match.match_fields | [] |
59
+ | instructions.size | 1 |
60
+ | instructions.at(0).class | Pio::Apply |
61
+ | instructions.at(0).actions.at(0).class | Pio::SendOutPort |
62
+ | instructions.at(0).actions.at(0).port | 1 |
63
+
64
+ Scenario: new(match: Pio::Match.new(in_port: 1), instructions: Pio::Apply.new(SendOutPort.new(1)))
65
+ When I try to create an OpenFlow message with:
66
+ """
67
+ Pio::FlowMod.new(match: Pio::Match.new(in_port: 1), instructions: Pio::Apply.new(SendOutPort.new(1)))
68
+ """
69
+ Then it should finish successfully
70
+ And the message have the following fields and values:
71
+ | field | value |
72
+ | class | Pio::FlowMod |
73
+ | ofp_version | 4 |
74
+ | message_type | 14 |
75
+ | message_length | 88 |
76
+ | transaction_id | 0 |
77
+ | xid | 0 |
78
+ | cookie | 0 |
79
+ | cookie_mask | 0 |
80
+ | table_id | 0 |
81
+ | command | :add |
82
+ | idle_timeout | 0 |
83
+ | hard_timeout | 0 |
84
+ | priority.to_hex | 0xffff |
85
+ | buffer_id | :no_buffer |
86
+ | out_port | :any |
87
+ | out_group | :any |
88
+ | flags | [] |
89
+ | match.in_port | 1 |
90
+ | instructions.size | 1 |
91
+ | instructions.at(0).class | Pio::Apply |
92
+ | instructions.at(0).actions.at(0).class | Pio::SendOutPort |
93
+ | instructions.at(0).actions.at(0).port | 1 |
94
+
95
+ Scenario: read (no match or instructions)
96
+ When I try to parse a file named "open_flow13/flow_mod_no_match_or_instructions.raw" with "Pio::FlowMod" class
97
+ Then it should finish successfully
98
+ And the message have the following fields and values:
99
+ | field | value |
100
+ | class | Pio::FlowMod |
101
+ | ofp_version | 4 |
102
+ | message_type | 14 |
103
+ | message_length | 56 |
104
+ | transaction_id | 0 |
105
+ | xid | 0 |
106
+ | cookie | 0 |
107
+ | cookie_mask | 0 |
108
+ | table_id | 0 |
109
+ | command | :add |
110
+ | idle_timeout | 0 |
111
+ | hard_timeout | 0 |
112
+ | priority.to_hex | 0xffff |
113
+ | buffer_id | :no_buffer |
114
+ | out_port | :any |
115
+ | out_group | :any |
116
+ | flags | [] |
117
+ | match.match_fields | [] |
118
+ | instructions | [] |
119
+
120
+ Scenario: read (instruction = apply, action = SendOutPort(port: 1))
121
+ When I try to parse a file named "open_flow13/flow_mod_add_apply_no_match.raw" with "Pio::FlowMod" class
122
+ Then it should finish successfully
123
+ And the message have the following fields and values:
124
+ | field | value |
125
+ | class | Pio::FlowMod |
126
+ | ofp_version | 4 |
127
+ | message_type | 14 |
128
+ | message_length | 80 |
129
+ | transaction_id | 0 |
130
+ | xid | 0 |
131
+ | cookie | 0 |
132
+ | cookie_mask | 0 |
133
+ | table_id | 0 |
134
+ | command | :add |
135
+ | idle_timeout | 0 |
136
+ | hard_timeout | 0 |
137
+ | priority.to_hex | 0xffff |
138
+ | buffer_id | :no_buffer |
139
+ | out_port | :any |
140
+ | out_group | :any |
141
+ | flags | [] |
142
+ | match.match_fields | [] |
143
+ | instructions.size | 1 |
144
+ | instructions.at(0).class | Pio::Apply |
145
+ | instructions.at(0).actions.at(0).class | Pio::SendOutPort |
146
+ | instructions.at(0).actions.at(0).port | 1 |
@@ -0,0 +1,26 @@
1
+ Feature: Pio::GotoTable
2
+ Background:
3
+ Given I use OpenFlow 1.3
4
+
5
+ Scenario: new(1)
6
+ When I try to create an OpenFlow instruction with:
7
+ """
8
+ Pio::GotoTable.new(1)
9
+ """
10
+ Then it should finish successfully
11
+ And the message have the following fields and values:
12
+ | field | value |
13
+ | class | Pio::GotoTable |
14
+ | instruction_type | 1 |
15
+ | instruction_length | 8 |
16
+ | table_id | 1 |
17
+
18
+ Scenario: read
19
+ When I try to parse a file named "open_flow13/instruction_goto_table.raw" with "Pio::GotoTable" class
20
+ Then it should finish successfully
21
+ And the message have the following fields and values:
22
+ | field | value |
23
+ | class | Pio::GotoTable |
24
+ | instruction_type | 1 |
25
+ | instruction_length | 8 |
26
+ | table_id | 1 |
@@ -22,6 +22,27 @@ Feature: Pio::Match
22
22
  | field | value |
23
23
  | in_port | 1 |
24
24
 
25
+ Scenario: new(metadata: 1)
26
+ When I try to create an OpenFlow message with:
27
+ """
28
+ Pio::Match.new(metadata: 1)
29
+ """
30
+ Then it should finish successfully
31
+ And the message have the following fields and values:
32
+ | field | value |
33
+ | metadata | 1 |
34
+
35
+ Scenario: new(metadata: 1, metadata_mask: 1)
36
+ When I try to create an OpenFlow message with:
37
+ """
38
+ Pio::Match.new(metadata: 1, metadata_mask: 1)
39
+ """
40
+ Then it should finish successfully
41
+ And the message have the following fields and values:
42
+ | field | value |
43
+ | metadata | 1 |
44
+ | metadata_mask | 1 |
45
+
25
46
  Scenario: new(ether_source_address: '01:02:03:04:05:06')
26
47
  When I try to create an OpenFlow message with:
27
48
  """
@@ -228,6 +249,21 @@ Feature: Pio::Match
228
249
  | field | value |
229
250
  | in_port | 1 |
230
251
 
252
+ Scenario: read (file: open_flow13/oxm_metadata_field.raw)
253
+ When I try to parse a file named "open_flow13/oxm_metadata_field.raw" with "Pio::Match" class
254
+ Then it should finish successfully
255
+ And the message have the following fields and values:
256
+ | field | value |
257
+ | metadata | 1 |
258
+
259
+ Scenario: read (file: open_flow13/oxm_metadata_masked_field.raw)
260
+ When I try to parse a file named "open_flow13/oxm_metadata_masked_field.raw" with "Pio::Match" class
261
+ Then it should finish successfully
262
+ And the message have the following fields and values:
263
+ | field | value |
264
+ | metadata | 1 |
265
+ | metadata_mask | 18446744069414584320 |
266
+
231
267
  Scenario: read (file: open_flow13/oxm_ether_destination_field.raw)
232
268
  When I try to parse a file named "open_flow13/oxm_ether_destination_field.raw" with "Pio::Match" class
233
269
  Then it should finish successfully