pio 0.29.0 → 0.30.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 +8 -0
- data/bin/{code_metrics → terminal-notifier} +2 -2
- data/features/{open_flow10 → open_flow}/nicira_resubmit.feature +0 -1
- data/features/{open_flow10 → open_flow}/nicira_resubmit_table.feature +0 -1
- data/features/open_flow13/nicira_reg_load.feature +56 -0
- data/features/open_flow13/nicira_reg_move.feature +21 -0
- data/features/open_flow13/nicira_send_out_port.feature +20 -0
- data/features/open_flow13/set_metadata.feature +14 -0
- data/lib/pio/open_flow.rb +3 -3
- data/lib/pio/open_flow/nicira_resubmit.rb +18 -0
- data/lib/pio/open_flow/nicira_resubmit_table.rb +15 -0
- data/lib/pio/open_flow10.rb +2 -2
- data/lib/pio/open_flow13.rb +5 -0
- data/lib/pio/open_flow13/goto_table.rb +1 -0
- data/lib/pio/open_flow13/match.rb +348 -58
- data/lib/pio/open_flow13/nicira_reg_load.rb +44 -0
- data/lib/pio/open_flow13/nicira_reg_move.rb +7 -3
- data/lib/pio/open_flow13/nicira_send_out_port.rb +38 -0
- data/lib/pio/open_flow13/set_arp_operation.rb +1 -1
- data/lib/pio/open_flow13/set_arp_sender_hardware_address.rb +1 -1
- data/lib/pio/open_flow13/set_arp_sender_protocol_address.rb +1 -1
- data/lib/pio/open_flow13/set_destination_mac_address.rb +1 -1
- data/lib/pio/open_flow13/set_metadata.rb +21 -0
- data/lib/pio/open_flow13/set_source_mac_address.rb +1 -1
- data/lib/pio/version.rb +1 -1
- data/spec/pio/open_flow13/match_spec.rb +43 -43
- metadata +19 -11
- data/bin/code_metrics-profile +0 -16
- data/lib/pio/open_flow10/nicira_resubmit.rb +0 -20
- data/lib/pio/open_flow10/nicira_resubmit_table.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b5753a6115af1e4780aa485bf53e666cd071903
|
4
|
+
data.tar.gz: 14fa545e8f983b2694dcff0afafb7c1afeb91624
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6db3f9249f15d5fcaec8af17d66fa36af5a222dfb4b8b082049ffb356a871a98572d8edafbd11e9416ed3a7aca21428116ca69200c153f4690487485cf708ef
|
7
|
+
data.tar.gz: 44ccf71fb9db860a33706942d947a110464c2f809263543dca73c977888180ca4cfeb1646297a722cfcb777e027fa40566d80eb08410412ab8d76e4b627ccf75
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## develop (unreleased)
|
4
4
|
|
5
|
+
## 0.30.0 (11/17/2015)
|
6
|
+
### New features
|
7
|
+
* [#281](https://github.com/trema/pio/pull/281): Add `NiciraRegLoad` action.
|
8
|
+
* [#282](https://github.com/trema/pio/pull/282): Add `NiciraResubmit` action.
|
9
|
+
* [#283](https://github.com/trema/pio/pull/283): Add `SetMetadata` action.
|
10
|
+
* [#284](https://github.com/trema/pio/pull/284): Enable masking with reg0-reg7.
|
11
|
+
* [#285](https://github.com/trema/pio/pull/285): Add Nicira `SendOutPort` action.
|
12
|
+
|
5
13
|
|
6
14
|
## 0.29.0 (11/11/2015)
|
7
15
|
### New features
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# This file was generated by Bundler.
|
4
4
|
#
|
5
|
-
# The application '
|
5
|
+
# The application 'terminal-notifier' is installed as part of a gem, and
|
6
6
|
# this file is here to facilitate running it.
|
7
7
|
#
|
8
8
|
|
@@ -13,4 +13,4 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
|
13
13
|
require 'rubygems'
|
14
14
|
require 'bundler/setup'
|
15
15
|
|
16
|
-
load Gem.bin_path('
|
16
|
+
load Gem.bin_path('terminal-notifier', 'terminal-notifier')
|
@@ -0,0 +1,56 @@
|
|
1
|
+
@open_flow13
|
2
|
+
Feature: Pio::NiciraRegLoad
|
3
|
+
|
4
|
+
Scenario: new(0xdeadbeef, :reg0)
|
5
|
+
When I try to create an OpenFlow action with:
|
6
|
+
"""
|
7
|
+
Pio::NiciraRegLoad.new(0xdeadbeef, :reg0)
|
8
|
+
"""
|
9
|
+
Then it should finish successfully
|
10
|
+
And the action has the following fields and values:
|
11
|
+
| field | value |
|
12
|
+
| action_type.to_hex | 0xffff |
|
13
|
+
| action_length | 24 |
|
14
|
+
| experimenter_id.to_hex | 0x2320 |
|
15
|
+
| experimenter_type | 7 |
|
16
|
+
| offset | 0 |
|
17
|
+
| n_bits | 32 |
|
18
|
+
| destination | :reg0 |
|
19
|
+
| destination_internal | 65540 |
|
20
|
+
| value.to_hex | 0xdeadbeef |
|
21
|
+
|
22
|
+
Scenario: new(0xdeadbeef, :metadata)
|
23
|
+
When I try to create an OpenFlow action with:
|
24
|
+
"""
|
25
|
+
Pio::NiciraRegLoad.new(0xdeadbeef, :metadata)
|
26
|
+
"""
|
27
|
+
Then it should finish successfully
|
28
|
+
And the action has the following fields and values:
|
29
|
+
| field | value |
|
30
|
+
| action_type.to_hex | 0xffff |
|
31
|
+
| action_length | 24 |
|
32
|
+
| experimenter_id.to_hex | 0x2320 |
|
33
|
+
| experimenter_type | 7 |
|
34
|
+
| offset | 0 |
|
35
|
+
| n_bits | 64 |
|
36
|
+
| destination | :metadata |
|
37
|
+
| destination_internal | 2147484680 |
|
38
|
+
| value.to_hex | 0xdeadbeef |
|
39
|
+
|
40
|
+
Scenario: new(0xdeadbeef, :metadata, offset: 32, n_bits: 32)
|
41
|
+
When I try to create an OpenFlow action with:
|
42
|
+
"""
|
43
|
+
Pio::NiciraRegLoad.new(0xdeadbeef, :metadata, offset: 32, n_bits: 32)
|
44
|
+
"""
|
45
|
+
Then it should finish successfully
|
46
|
+
And the action has the following fields and values:
|
47
|
+
| field | value |
|
48
|
+
| action_type.to_hex | 0xffff |
|
49
|
+
| action_length | 24 |
|
50
|
+
| experimenter_id.to_hex | 0x2320 |
|
51
|
+
| experimenter_type | 7 |
|
52
|
+
| offset | 32 |
|
53
|
+
| n_bits | 32 |
|
54
|
+
| destination | :metadata |
|
55
|
+
| destination_internal | 2147484680 |
|
56
|
+
| value.to_hex | 0xdeadbeef |
|
@@ -19,3 +19,24 @@ Feature: Pio::NiciraRegMove
|
|
19
19
|
| to | :arp_target_hardware_address |
|
20
20
|
| destination_oxm_field | 25 |
|
21
21
|
| destination_oxm_length | 6 |
|
22
|
+
|
23
|
+
Scenario: new(from: :reg0, to: :reg7)
|
24
|
+
When I try to create an OpenFlow action with:
|
25
|
+
"""
|
26
|
+
Pio::NiciraRegMove.new(from: :reg0, to: :reg7)
|
27
|
+
"""
|
28
|
+
Then it should finish successfully
|
29
|
+
And the action has the following fields and values:
|
30
|
+
| field | value |
|
31
|
+
| action_type.to_hex | 0xffff |
|
32
|
+
| action_length | 24 |
|
33
|
+
| experimenter_id.to_hex | 0x2320 |
|
34
|
+
| experimenter_type | 6 |
|
35
|
+
| from | :reg0 |
|
36
|
+
| source_oxm_class | 1 |
|
37
|
+
| source_oxm_field | 0 |
|
38
|
+
| source_oxm_length | 4 |
|
39
|
+
| to | :reg7 |
|
40
|
+
| destination_oxm_class | 1 |
|
41
|
+
| destination_oxm_field | 7 |
|
42
|
+
| destination_oxm_length | 4 |
|
@@ -0,0 +1,20 @@
|
|
1
|
+
@open_flow13
|
2
|
+
Feature: Pio::NiciraSendOutPort
|
3
|
+
|
4
|
+
Scenario: new(:reg0)
|
5
|
+
When I try to create an OpenFlow action with:
|
6
|
+
"""
|
7
|
+
Pio::NiciraSendOutPort.new(:reg0)
|
8
|
+
"""
|
9
|
+
Then it should finish successfully
|
10
|
+
And the action has the following fields and values:
|
11
|
+
| field | value |
|
12
|
+
| action_type.to_hex | 0xffff |
|
13
|
+
| action_length | 24 |
|
14
|
+
| experimenter_id.to_hex | 0x2320 |
|
15
|
+
| experimenter_type | 15 |
|
16
|
+
| offset | 0 |
|
17
|
+
| source | :reg0 |
|
18
|
+
| max_length | 0 |
|
19
|
+
|
20
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
@open_flow13
|
2
|
+
Feature: Pio::SetMetadata
|
3
|
+
|
4
|
+
Scenario: new(0x123)
|
5
|
+
When I try to create an OpenFlow action with:
|
6
|
+
"""
|
7
|
+
Pio::SetMetadata.new(0x123)
|
8
|
+
"""
|
9
|
+
Then it should finish successfully
|
10
|
+
And the action has the following fields and values:
|
11
|
+
| field | value |
|
12
|
+
| action_type | 25 |
|
13
|
+
| action_length | 16 |
|
14
|
+
| metadata.to_hex | 0x123 |
|
data/lib/pio/open_flow.rb
CHANGED
@@ -19,9 +19,9 @@ module Pio
|
|
19
19
|
:PacketIn, :FlowRemoved, :PacketOut, :SendOutPort,
|
20
20
|
:SetSourceMacAddress, :SetDestinationMacAddress, :PortStatus, :Stats,
|
21
21
|
:FlowStats, :DescriptionStats, :AggregateStats, :TableStats, :PortStats,
|
22
|
-
:QueueStats, :Error, :
|
23
|
-
:
|
24
|
-
:
|
22
|
+
:QueueStats, :Error, :SetArpOperation, :SetArpSenderProtocolAddress,
|
23
|
+
:SetArpSenderHardwareAddress, :NiciraRegMove, :SetMetadata,
|
24
|
+
:NiciraRegLoad, :NiciraSendOutPort].each do |each|
|
25
25
|
set_message_class_name each, version
|
26
26
|
@version = version.to_s
|
27
27
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'pio/open_flow/nicira_action'
|
2
|
+
require 'pio/open_flow10/port16'
|
3
|
+
|
4
|
+
module Pio
|
5
|
+
# NXAST_RESUBMIT action
|
6
|
+
class NiciraResubmit < OpenFlow::NiciraAction
|
7
|
+
nicira_action_header action_type: 0xffff,
|
8
|
+
action_length: 16,
|
9
|
+
subtype: 1
|
10
|
+
port16 :in_port
|
11
|
+
string :padding, length: 4
|
12
|
+
hide :padding
|
13
|
+
|
14
|
+
def initialize(port_number)
|
15
|
+
super(in_port: port_number)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'pio/open_flow/nicira_action'
|
2
|
+
require 'pio/open_flow10/port16'
|
3
|
+
|
4
|
+
module Pio
|
5
|
+
# NXAST_RESUBMIT_TABLE action
|
6
|
+
class NiciraResubmitTable < OpenFlow::NiciraAction
|
7
|
+
nicira_action_header action_type: 0xffff,
|
8
|
+
action_length: 16,
|
9
|
+
subtype: 14
|
10
|
+
port16 :in_port
|
11
|
+
uint8 :table, initial_value: 0xff
|
12
|
+
string :padding, length: 3
|
13
|
+
hide :padding
|
14
|
+
end
|
15
|
+
end
|
data/lib/pio/open_flow10.rb
CHANGED
@@ -27,8 +27,8 @@ require 'pio/open_flow10/stats_request'
|
|
27
27
|
require 'pio/open_flow10/table_stats/request'
|
28
28
|
|
29
29
|
# Actions
|
30
|
-
require 'pio/
|
31
|
-
require 'pio/
|
30
|
+
require 'pio/open_flow/nicira_resubmit'
|
31
|
+
require 'pio/open_flow/nicira_resubmit_table'
|
32
32
|
require 'pio/open_flow10/send_out_port'
|
33
33
|
require 'pio/open_flow10/set_destination_mac_address'
|
34
34
|
require 'pio/open_flow10/set_source_mac_address'
|
data/lib/pio/open_flow13.rb
CHANGED
@@ -13,12 +13,17 @@ require 'pio/open_flow13/packet_out'
|
|
13
13
|
require 'pio/open_flow13/stats_request'
|
14
14
|
|
15
15
|
# Actions
|
16
|
+
require 'pio/open_flow/nicira_resubmit'
|
17
|
+
require 'pio/open_flow/nicira_resubmit_table'
|
18
|
+
require 'pio/open_flow13/nicira_reg_load'
|
16
19
|
require 'pio/open_flow13/nicira_reg_move'
|
20
|
+
require 'pio/open_flow13/nicira_send_out_port'
|
17
21
|
require 'pio/open_flow13/send_out_port'
|
18
22
|
require 'pio/open_flow13/set_arp_operation'
|
19
23
|
require 'pio/open_flow13/set_arp_sender_hardware_address'
|
20
24
|
require 'pio/open_flow13/set_arp_sender_protocol_address'
|
21
25
|
require 'pio/open_flow13/set_destination_mac_address'
|
26
|
+
require 'pio/open_flow13/set_metadata'
|
22
27
|
require 'pio/open_flow13/set_source_mac_address'
|
23
28
|
|
24
29
|
# Instructions
|
@@ -28,6 +28,7 @@ module Pio
|
|
28
28
|
def_delegators :@format, :instruction_length
|
29
29
|
def_delegators :@format, :table_id
|
30
30
|
def_delegators :@format, :to_binary_s
|
31
|
+
def_delegator :@format, :to_binary_s, :to_binary
|
31
32
|
|
32
33
|
def initialize(table_id)
|
33
34
|
@format = Format.new(table_id: table_id)
|
@@ -12,11 +12,23 @@ module Pio
|
|
12
12
|
|
13
13
|
# OpenFlow eXtensible Match (OXM)
|
14
14
|
class Match
|
15
|
-
|
16
|
-
|
15
|
+
# OFPXMC_NXM_1 TLV value
|
16
|
+
class NiciraMatchExtensionValue < BinData::Record
|
17
|
+
OXM_CLASS = 0x1
|
18
|
+
end
|
19
|
+
|
20
|
+
# OFPXMC_OPENFLOW_BASIC TLV value
|
21
|
+
class OpenFlowBasicValue < BinData::Record
|
22
|
+
OXM_CLASS = 0x8000
|
23
|
+
end
|
24
|
+
|
25
|
+
# OFPXMC_EXPERIMENTER TLV value
|
26
|
+
class ExperimenterValue < BinData::Record
|
27
|
+
OXM_CLASS = 0xFFFF
|
28
|
+
end
|
17
29
|
|
18
30
|
# The value of OXM_OF_IN_PORT match field.
|
19
|
-
class InPort <
|
31
|
+
class InPort < OpenFlowBasicValue
|
20
32
|
OXM_FIELD = 0
|
21
33
|
|
22
34
|
endian :big
|
@@ -29,7 +41,7 @@ module Pio
|
|
29
41
|
end
|
30
42
|
|
31
43
|
# The value of OXM_OF_METADATA match field
|
32
|
-
class Metadata <
|
44
|
+
class Metadata < OpenFlowBasicValue
|
33
45
|
OXM_FIELD = 2
|
34
46
|
|
35
47
|
endian :big
|
@@ -42,7 +54,7 @@ module Pio
|
|
42
54
|
end
|
43
55
|
|
44
56
|
# Masked OXM_OF_METADATA match field
|
45
|
-
class MaskedMetadata <
|
57
|
+
class MaskedMetadata < OpenFlowBasicValue
|
46
58
|
endian :big
|
47
59
|
|
48
60
|
uint64 :metadata
|
@@ -54,7 +66,7 @@ module Pio
|
|
54
66
|
end
|
55
67
|
|
56
68
|
# The value of OXM_OF_ETH_DST match field.
|
57
|
-
class DestinationMacAddress <
|
69
|
+
class DestinationMacAddress < OpenFlowBasicValue
|
58
70
|
OXM_FIELD = 3
|
59
71
|
|
60
72
|
endian :big
|
@@ -67,7 +79,7 @@ module Pio
|
|
67
79
|
end
|
68
80
|
|
69
81
|
# The value of OXM_OF_ETH_SRC match field.
|
70
|
-
class SourceMacAddress <
|
82
|
+
class SourceMacAddress < OpenFlowBasicValue
|
71
83
|
OXM_FIELD = 4
|
72
84
|
|
73
85
|
endian :big
|
@@ -80,7 +92,7 @@ module Pio
|
|
80
92
|
end
|
81
93
|
|
82
94
|
# Masked OXM_OF_ETH_DST match field.
|
83
|
-
class MaskedDestinationMacAddress <
|
95
|
+
class MaskedDestinationMacAddress < OpenFlowBasicValue
|
84
96
|
endian :big
|
85
97
|
|
86
98
|
mac_address :destination_mac_address
|
@@ -92,7 +104,7 @@ module Pio
|
|
92
104
|
end
|
93
105
|
|
94
106
|
# Masked OXM_OF_ETH_SRC match field.
|
95
|
-
class MaskedSourceMacAddress <
|
107
|
+
class MaskedSourceMacAddress < OpenFlowBasicValue
|
96
108
|
endian :big
|
97
109
|
|
98
110
|
mac_address :source_mac_address
|
@@ -104,7 +116,7 @@ module Pio
|
|
104
116
|
end
|
105
117
|
|
106
118
|
# The value of OXM_OF_ETH_TYPE match field.
|
107
|
-
class EtherType <
|
119
|
+
class EtherType < OpenFlowBasicValue
|
108
120
|
OXM_FIELD = 5
|
109
121
|
|
110
122
|
endian :big
|
@@ -117,7 +129,7 @@ module Pio
|
|
117
129
|
end
|
118
130
|
|
119
131
|
# The value of OXM_OF_VLAN_VID match field
|
120
|
-
class VlanVid <
|
132
|
+
class VlanVid < OpenFlowBasicValue
|
121
133
|
OXM_FIELD = 6
|
122
134
|
|
123
135
|
endian :big
|
@@ -133,7 +145,7 @@ module Pio
|
|
133
145
|
end
|
134
146
|
|
135
147
|
# The value of OXM_OF_VLAN_PCP match field
|
136
|
-
class VlanPcp <
|
148
|
+
class VlanPcp < OpenFlowBasicValue
|
137
149
|
OXM_FIELD = 7
|
138
150
|
|
139
151
|
endian :big
|
@@ -149,7 +161,7 @@ module Pio
|
|
149
161
|
end
|
150
162
|
|
151
163
|
# The value of OXM_OF_IP_DSCP match field
|
152
|
-
class IpDscp <
|
164
|
+
class IpDscp < OpenFlowBasicValue
|
153
165
|
OXM_FIELD = 8
|
154
166
|
|
155
167
|
endian :big
|
@@ -165,7 +177,7 @@ module Pio
|
|
165
177
|
end
|
166
178
|
|
167
179
|
# The value of OXM_OF_IP_ECN match field
|
168
|
-
class IpEcn <
|
180
|
+
class IpEcn < OpenFlowBasicValue
|
169
181
|
OXM_FIELD = 9
|
170
182
|
|
171
183
|
endian :big
|
@@ -181,7 +193,7 @@ module Pio
|
|
181
193
|
end
|
182
194
|
|
183
195
|
# The value of OXM_OF_IP_PROTO
|
184
|
-
class IpProtocol <
|
196
|
+
class IpProtocol < OpenFlowBasicValue
|
185
197
|
OXM_FIELD = 10
|
186
198
|
|
187
199
|
endian :big
|
@@ -194,7 +206,7 @@ module Pio
|
|
194
206
|
end
|
195
207
|
|
196
208
|
# The value of OXM_OF_IPV4_SRC
|
197
|
-
class Ipv4SourceAddress <
|
209
|
+
class Ipv4SourceAddress < OpenFlowBasicValue
|
198
210
|
OXM_FIELD = 11
|
199
211
|
|
200
212
|
endian :big
|
@@ -207,7 +219,7 @@ module Pio
|
|
207
219
|
end
|
208
220
|
|
209
221
|
# The value of masked OXM_OF_IPV4_SRC
|
210
|
-
class MaskedIpv4SourceAddress <
|
222
|
+
class MaskedIpv4SourceAddress < OpenFlowBasicValue
|
211
223
|
OXM_FIELD = 11
|
212
224
|
|
213
225
|
endian :big
|
@@ -220,7 +232,7 @@ module Pio
|
|
220
232
|
end
|
221
233
|
|
222
234
|
# The value of OXM_OF_IPV4_DST
|
223
|
-
class Ipv4DestinationAddress <
|
235
|
+
class Ipv4DestinationAddress < OpenFlowBasicValue
|
224
236
|
OXM_FIELD = 12
|
225
237
|
|
226
238
|
endian :big
|
@@ -233,7 +245,7 @@ module Pio
|
|
233
245
|
end
|
234
246
|
|
235
247
|
# The value of masked OXM_OF_IPV4_DST
|
236
|
-
class MaskedIpv4DestinationAddress <
|
248
|
+
class MaskedIpv4DestinationAddress < OpenFlowBasicValue
|
237
249
|
OXM_FIELD = 12
|
238
250
|
|
239
251
|
endian :big
|
@@ -246,7 +258,7 @@ module Pio
|
|
246
258
|
end
|
247
259
|
|
248
260
|
# The value of OXM_OF_TCP_SRC
|
249
|
-
class TcpSourcePort <
|
261
|
+
class TcpSourcePort < OpenFlowBasicValue
|
250
262
|
OXM_FIELD = 13
|
251
263
|
|
252
264
|
endian :big
|
@@ -259,7 +271,7 @@ module Pio
|
|
259
271
|
end
|
260
272
|
|
261
273
|
# The value of OXM_OF_TCP_DST
|
262
|
-
class TcpDestinationPort <
|
274
|
+
class TcpDestinationPort < OpenFlowBasicValue
|
263
275
|
OXM_FIELD = 14
|
264
276
|
|
265
277
|
endian :big
|
@@ -272,7 +284,7 @@ module Pio
|
|
272
284
|
end
|
273
285
|
|
274
286
|
# The value of OXM_OF_UDP_SRC
|
275
|
-
class UdpSourcePort <
|
287
|
+
class UdpSourcePort < OpenFlowBasicValue
|
276
288
|
OXM_FIELD = 15
|
277
289
|
|
278
290
|
endian :big
|
@@ -285,7 +297,7 @@ module Pio
|
|
285
297
|
end
|
286
298
|
|
287
299
|
# The value of OXM_OF_UDP_SRC
|
288
|
-
class UdpDestinationPort <
|
300
|
+
class UdpDestinationPort < OpenFlowBasicValue
|
289
301
|
OXM_FIELD = 16
|
290
302
|
|
291
303
|
endian :big
|
@@ -298,7 +310,7 @@ module Pio
|
|
298
310
|
end
|
299
311
|
|
300
312
|
# The value of OXM_OF_SCTP_SRC
|
301
|
-
class SctpSourcePort <
|
313
|
+
class SctpSourcePort < OpenFlowBasicValue
|
302
314
|
OXM_FIELD = 17
|
303
315
|
|
304
316
|
endian :big
|
@@ -311,7 +323,7 @@ module Pio
|
|
311
323
|
end
|
312
324
|
|
313
325
|
# The value of OXM_OF_SCTP_DST
|
314
|
-
class SctpDestinationPort <
|
326
|
+
class SctpDestinationPort < OpenFlowBasicValue
|
315
327
|
OXM_FIELD = 18
|
316
328
|
|
317
329
|
endian :big
|
@@ -324,7 +336,7 @@ module Pio
|
|
324
336
|
end
|
325
337
|
|
326
338
|
# The value of OXM_OF_ICMPV4_TYPE
|
327
|
-
class Icmpv4Type <
|
339
|
+
class Icmpv4Type < OpenFlowBasicValue
|
328
340
|
OXM_FIELD = 19
|
329
341
|
|
330
342
|
endian :big
|
@@ -337,7 +349,7 @@ module Pio
|
|
337
349
|
end
|
338
350
|
|
339
351
|
# The value of OXM_OF_ICMPV4_CODE
|
340
|
-
class Icmpv4Code <
|
352
|
+
class Icmpv4Code < OpenFlowBasicValue
|
341
353
|
OXM_FIELD = 20
|
342
354
|
|
343
355
|
endian :big
|
@@ -350,7 +362,7 @@ module Pio
|
|
350
362
|
end
|
351
363
|
|
352
364
|
# The value of OXM_OF_ARP_OP
|
353
|
-
class ArpOperation <
|
365
|
+
class ArpOperation < OpenFlowBasicValue
|
354
366
|
OXM_FIELD = 21
|
355
367
|
|
356
368
|
endian :big
|
@@ -363,7 +375,7 @@ module Pio
|
|
363
375
|
end
|
364
376
|
|
365
377
|
# The value of OXM_OF_ARP_SPA
|
366
|
-
class ArpSenderProtocolAddress <
|
378
|
+
class ArpSenderProtocolAddress < OpenFlowBasicValue
|
367
379
|
OXM_FIELD = 22
|
368
380
|
|
369
381
|
endian :big
|
@@ -376,7 +388,7 @@ module Pio
|
|
376
388
|
end
|
377
389
|
|
378
390
|
# The value of masked OXM_OF_ARP_SPA
|
379
|
-
class MaskedArpSenderProtocolAddress <
|
391
|
+
class MaskedArpSenderProtocolAddress < OpenFlowBasicValue
|
380
392
|
OXM_FIELD = 22
|
381
393
|
|
382
394
|
endian :big
|
@@ -389,7 +401,7 @@ module Pio
|
|
389
401
|
end
|
390
402
|
|
391
403
|
# The value of OXM_OF_ARP_TPA
|
392
|
-
class ArpTargetProtocolAddress <
|
404
|
+
class ArpTargetProtocolAddress < OpenFlowBasicValue
|
393
405
|
OXM_FIELD = 23
|
394
406
|
|
395
407
|
endian :big
|
@@ -402,7 +414,7 @@ module Pio
|
|
402
414
|
end
|
403
415
|
|
404
416
|
# The value of masked OXM_OF_ARP_TPA
|
405
|
-
class MaskedArpTargetProtocolAddress <
|
417
|
+
class MaskedArpTargetProtocolAddress < OpenFlowBasicValue
|
406
418
|
OXM_FIELD = 23
|
407
419
|
|
408
420
|
endian :big
|
@@ -415,7 +427,7 @@ module Pio
|
|
415
427
|
end
|
416
428
|
|
417
429
|
# The value of OXM_OF_ARP_SHA match field.
|
418
|
-
class ArpSenderHardwareAddress <
|
430
|
+
class ArpSenderHardwareAddress < OpenFlowBasicValue
|
419
431
|
OXM_FIELD = 24
|
420
432
|
|
421
433
|
endian :big
|
@@ -428,7 +440,7 @@ module Pio
|
|
428
440
|
end
|
429
441
|
|
430
442
|
# Masked OXM_OF_ARP_SHA match field.
|
431
|
-
class MaskedArpSenderHardwareAddress <
|
443
|
+
class MaskedArpSenderHardwareAddress < OpenFlowBasicValue
|
432
444
|
OXM_FIELD = 24
|
433
445
|
|
434
446
|
endian :big
|
@@ -442,7 +454,7 @@ module Pio
|
|
442
454
|
end
|
443
455
|
|
444
456
|
# The value of OXM_OF_ARP_THA match field.
|
445
|
-
class ArpTargetHardwareAddress <
|
457
|
+
class ArpTargetHardwareAddress < OpenFlowBasicValue
|
446
458
|
OXM_FIELD = 25
|
447
459
|
|
448
460
|
endian :big
|
@@ -455,7 +467,7 @@ module Pio
|
|
455
467
|
end
|
456
468
|
|
457
469
|
# Masked OXM_OF_ARP_THA match field.
|
458
|
-
class MaskedArpTargetHardwareAddress <
|
470
|
+
class MaskedArpTargetHardwareAddress < OpenFlowBasicValue
|
459
471
|
OXM_FIELD = 25
|
460
472
|
|
461
473
|
endian :big
|
@@ -469,7 +481,7 @@ module Pio
|
|
469
481
|
end
|
470
482
|
|
471
483
|
# The value of OXM_OF_IPV6_SRC
|
472
|
-
class Ipv6SourceAddress <
|
484
|
+
class Ipv6SourceAddress < OpenFlowBasicValue
|
473
485
|
OXM_FIELD = 26
|
474
486
|
|
475
487
|
endian :big
|
@@ -482,7 +494,7 @@ module Pio
|
|
482
494
|
end
|
483
495
|
|
484
496
|
# The value of masked OXM_OF_IPV6_SRC
|
485
|
-
class MaskedIpv6SourceAddress <
|
497
|
+
class MaskedIpv6SourceAddress < OpenFlowBasicValue
|
486
498
|
OXM_FIELD = 26
|
487
499
|
|
488
500
|
endian :big
|
@@ -496,7 +508,7 @@ module Pio
|
|
496
508
|
end
|
497
509
|
|
498
510
|
# The value of OXM_OF_IPV6_DST
|
499
|
-
class Ipv6DestinationAddress <
|
511
|
+
class Ipv6DestinationAddress < OpenFlowBasicValue
|
500
512
|
OXM_FIELD = 27
|
501
513
|
|
502
514
|
endian :big
|
@@ -509,7 +521,7 @@ module Pio
|
|
509
521
|
end
|
510
522
|
|
511
523
|
# The value of OXM_OF_IPV6_DST
|
512
|
-
class MaskedIpv6DestinationAddress <
|
524
|
+
class MaskedIpv6DestinationAddress < OpenFlowBasicValue
|
513
525
|
OXM_FIELD = 27
|
514
526
|
|
515
527
|
endian :big
|
@@ -523,7 +535,7 @@ module Pio
|
|
523
535
|
end
|
524
536
|
|
525
537
|
# The value of OXM_OF_TUNNEL_ID match field
|
526
|
-
class TunnelId <
|
538
|
+
class TunnelId < OpenFlowBasicValue
|
527
539
|
OXM_FIELD = 38
|
528
540
|
|
529
541
|
endian :big
|
@@ -536,7 +548,7 @@ module Pio
|
|
536
548
|
end
|
537
549
|
|
538
550
|
# Masked OXM_OF_TUNNEL_ID match field
|
539
|
-
class MaskedTunnelId <
|
551
|
+
class MaskedTunnelId < OpenFlowBasicValue
|
540
552
|
endian :big
|
541
553
|
|
542
554
|
uint64 :tunnel_id
|
@@ -547,6 +559,206 @@ module Pio
|
|
547
559
|
end
|
548
560
|
end
|
549
561
|
|
562
|
+
# NXM_NX_REG0 match field
|
563
|
+
class Reg0 < NiciraMatchExtensionValue
|
564
|
+
OXM_FIELD = 0
|
565
|
+
|
566
|
+
endian :big
|
567
|
+
|
568
|
+
uint32 :reg0
|
569
|
+
|
570
|
+
def length
|
571
|
+
4
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
# Masked NXM_NX_REG0 match field
|
576
|
+
class MaskedReg0 < NiciraMatchExtensionValue
|
577
|
+
endian :big
|
578
|
+
|
579
|
+
uint32 :reg0
|
580
|
+
uint32 :reg0_mask
|
581
|
+
|
582
|
+
def length
|
583
|
+
8
|
584
|
+
end
|
585
|
+
end
|
586
|
+
|
587
|
+
# NXM_NX_REG1 match field
|
588
|
+
class Reg1 < NiciraMatchExtensionValue
|
589
|
+
OXM_FIELD = 1
|
590
|
+
|
591
|
+
endian :big
|
592
|
+
|
593
|
+
uint32 :reg1
|
594
|
+
|
595
|
+
def length
|
596
|
+
4
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
# Masked NXM_NX_REG1 match field
|
601
|
+
class MaskedReg1 < NiciraMatchExtensionValue
|
602
|
+
endian :big
|
603
|
+
|
604
|
+
uint32 :reg1
|
605
|
+
uint32 :reg1_mask
|
606
|
+
|
607
|
+
def length
|
608
|
+
8
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
# NXM_NX_REG2 match field
|
613
|
+
class Reg2 < NiciraMatchExtensionValue
|
614
|
+
OXM_FIELD = 2
|
615
|
+
|
616
|
+
endian :big
|
617
|
+
|
618
|
+
uint32 :reg2
|
619
|
+
|
620
|
+
def length
|
621
|
+
4
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
# Masked NXM_NX_REG2 match field
|
626
|
+
class MaskedReg2 < NiciraMatchExtensionValue
|
627
|
+
endian :big
|
628
|
+
|
629
|
+
uint32 :reg2
|
630
|
+
uint32 :reg2_mask
|
631
|
+
|
632
|
+
def length
|
633
|
+
8
|
634
|
+
end
|
635
|
+
end
|
636
|
+
|
637
|
+
# NXM_NX_REG3 match field
|
638
|
+
class Reg3 < NiciraMatchExtensionValue
|
639
|
+
OXM_FIELD = 3
|
640
|
+
|
641
|
+
endian :big
|
642
|
+
|
643
|
+
uint32 :reg3
|
644
|
+
|
645
|
+
def length
|
646
|
+
4
|
647
|
+
end
|
648
|
+
end
|
649
|
+
|
650
|
+
# Masked NXM_NX_REG3 match field
|
651
|
+
class MaskedReg3 < NiciraMatchExtensionValue
|
652
|
+
endian :big
|
653
|
+
|
654
|
+
uint32 :reg3
|
655
|
+
uint32 :reg3_mask
|
656
|
+
|
657
|
+
def length
|
658
|
+
8
|
659
|
+
end
|
660
|
+
end
|
661
|
+
|
662
|
+
# NXM_NX_REG4 match field
|
663
|
+
class Reg4 < NiciraMatchExtensionValue
|
664
|
+
OXM_FIELD = 4
|
665
|
+
|
666
|
+
endian :big
|
667
|
+
|
668
|
+
uint32 :reg4
|
669
|
+
|
670
|
+
def length
|
671
|
+
4
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
675
|
+
# Masked NXM_NX_REG4 match field
|
676
|
+
class MaskedReg4 < NiciraMatchExtensionValue
|
677
|
+
endian :big
|
678
|
+
|
679
|
+
uint32 :reg4
|
680
|
+
uint32 :reg4_mask
|
681
|
+
|
682
|
+
def length
|
683
|
+
8
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
# NXM_NX_REG5 match field
|
688
|
+
class Reg5 < NiciraMatchExtensionValue
|
689
|
+
OXM_FIELD = 5
|
690
|
+
|
691
|
+
endian :big
|
692
|
+
|
693
|
+
uint32 :reg5
|
694
|
+
|
695
|
+
def length
|
696
|
+
4
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
# Masked NXM_NX_REG5 match field
|
701
|
+
class MaskedReg5 < NiciraMatchExtensionValue
|
702
|
+
endian :big
|
703
|
+
|
704
|
+
uint32 :reg5
|
705
|
+
uint32 :reg5_mask
|
706
|
+
|
707
|
+
def length
|
708
|
+
8
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
# NXM_NX_REG6 match field
|
713
|
+
class Reg6 < NiciraMatchExtensionValue
|
714
|
+
OXM_FIELD = 6
|
715
|
+
|
716
|
+
endian :big
|
717
|
+
|
718
|
+
uint32 :reg6
|
719
|
+
|
720
|
+
def length
|
721
|
+
4
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
# Masked NXM_NX_REG6 match field
|
726
|
+
class MaskedReg6 < NiciraMatchExtensionValue
|
727
|
+
endian :big
|
728
|
+
|
729
|
+
uint32 :reg6
|
730
|
+
uint32 :reg6_mask
|
731
|
+
|
732
|
+
def length
|
733
|
+
8
|
734
|
+
end
|
735
|
+
end
|
736
|
+
|
737
|
+
# NXM_NX_REG7 match field
|
738
|
+
class Reg7 < NiciraMatchExtensionValue
|
739
|
+
OXM_FIELD = 7
|
740
|
+
|
741
|
+
endian :big
|
742
|
+
|
743
|
+
uint32 :reg7
|
744
|
+
|
745
|
+
def length
|
746
|
+
4
|
747
|
+
end
|
748
|
+
end
|
749
|
+
|
750
|
+
# Masked NXM_NX_REG7 match field
|
751
|
+
class MaskedReg7 < NiciraMatchExtensionValue
|
752
|
+
endian :big
|
753
|
+
|
754
|
+
uint32 :reg7
|
755
|
+
uint32 :reg7_mask
|
756
|
+
|
757
|
+
def length
|
758
|
+
8
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
550
762
|
# OXM format
|
551
763
|
class Oxm < BinData::Record
|
552
764
|
# Experimenter part, data will use oxm_length
|
@@ -564,6 +776,79 @@ module Pio
|
|
564
776
|
end
|
565
777
|
end
|
566
778
|
|
779
|
+
# Nicira match extension
|
780
|
+
class NiciraMatchExtension < BinData::Record
|
781
|
+
endian :big
|
782
|
+
|
783
|
+
bit7 :oxm_field
|
784
|
+
bit1 :oxm_hasmask
|
785
|
+
uint8 :oxm_length, value: -> { tlv_value.length }
|
786
|
+
choice :tlv_value,
|
787
|
+
selection: :choose_tlv_value do
|
788
|
+
reg0 Reg0
|
789
|
+
masked_reg0 MaskedReg0
|
790
|
+
reg1 Reg1
|
791
|
+
masked_reg1 MaskedReg1
|
792
|
+
reg2 Reg2
|
793
|
+
masked_reg2 MaskedReg2
|
794
|
+
reg3 Reg3
|
795
|
+
masked_reg3 MaskedReg3
|
796
|
+
reg4 Reg4
|
797
|
+
masked_reg4 MaskedReg4
|
798
|
+
reg5 Reg5
|
799
|
+
masked_reg5 MaskedReg5
|
800
|
+
reg6 Reg6
|
801
|
+
masked_reg6 MaskedReg6
|
802
|
+
reg7 Reg7
|
803
|
+
masked_reg7 MaskedReg7
|
804
|
+
end
|
805
|
+
|
806
|
+
def length
|
807
|
+
tlv_value.length + 2
|
808
|
+
end
|
809
|
+
|
810
|
+
def masked?
|
811
|
+
oxm_hasmask == 1
|
812
|
+
end
|
813
|
+
|
814
|
+
def method_missing(method, *args, &block)
|
815
|
+
tlv_value.__send__ method, *args, &block
|
816
|
+
end
|
817
|
+
|
818
|
+
private
|
819
|
+
|
820
|
+
# rubocop:disable AbcSize
|
821
|
+
# rubocop:disable CyclomaticComplexity
|
822
|
+
# rubocop:disable PerceivedComplexity
|
823
|
+
# rubocop:disable MethodLength
|
824
|
+
def choose_tlv_value
|
825
|
+
case oxm_field
|
826
|
+
when Reg0::OXM_FIELD
|
827
|
+
masked? ? MaskedReg0 : Reg0
|
828
|
+
when Reg1::OXM_FIELD
|
829
|
+
masked? ? MaskedReg1 : Reg1
|
830
|
+
when Reg2::OXM_FIELD
|
831
|
+
masked? ? MaskedReg2 : Reg2
|
832
|
+
when Reg3::OXM_FIELD
|
833
|
+
masked? ? MaskedReg3 : Reg3
|
834
|
+
when Reg4::OXM_FIELD
|
835
|
+
masked? ? MaskedReg4 : Reg4
|
836
|
+
when Reg5::OXM_FIELD
|
837
|
+
masked? ? MaskedReg5 : Reg5
|
838
|
+
when Reg6::OXM_FIELD
|
839
|
+
masked? ? MaskedReg6 : Reg6
|
840
|
+
when Reg7::OXM_FIELD
|
841
|
+
masked? ? MaskedReg7 : Reg7
|
842
|
+
else
|
843
|
+
fail "Unknown OXM field value: #{oxm_field}"
|
844
|
+
end
|
845
|
+
end
|
846
|
+
# rubocop:enable AbcSize
|
847
|
+
# rubocop:enable CyclomaticComplexity
|
848
|
+
# rubocop:enable PerceivedComplexity
|
849
|
+
# rubocop:enable MethodLength
|
850
|
+
end
|
851
|
+
|
567
852
|
# rubocop:disable ClassLength
|
568
853
|
# OpenflowBasic part, tlv_value will use oxm_field, oxm_hasmask
|
569
854
|
class OpenflowBasic < BinData::Record
|
@@ -727,10 +1012,11 @@ module Pio
|
|
727
1012
|
class MatchField < BinData::Record
|
728
1013
|
endian :big
|
729
1014
|
|
730
|
-
uint16 :oxm_class
|
1015
|
+
uint16 :oxm_class
|
731
1016
|
choice :class_payload, selection: :oxm_class do
|
732
|
-
|
733
|
-
|
1017
|
+
NiciraMatchExtension NiciraMatchExtensionValue::OXM_CLASS
|
1018
|
+
OpenflowBasic OpenFlowBasicValue::OXM_CLASS
|
1019
|
+
Experimenter ExperimenterValue::OXM_CLASS
|
734
1020
|
end
|
735
1021
|
|
736
1022
|
def oxm_field
|
@@ -751,9 +1037,9 @@ module Pio
|
|
751
1037
|
|
752
1038
|
def method_missing(method, *args, &block)
|
753
1039
|
case oxm_class
|
754
|
-
when
|
1040
|
+
when OpenFlowBasicValue::OXM_CLASS
|
755
1041
|
return class_payload.tlv_value.__send__(method, *args, &block)
|
756
|
-
when
|
1042
|
+
when ExperimenterValue::OXM_CLASS
|
757
1043
|
return class_payload.__send__(method, *args, &block)
|
758
1044
|
else
|
759
1045
|
fail NoMethodError, method.to_s
|
@@ -777,9 +1063,10 @@ module Pio
|
|
777
1063
|
end
|
778
1064
|
|
779
1065
|
# rubocop:disable Next
|
1066
|
+
# rubocop:disable LineLength
|
780
1067
|
def method_missing(method, *args, &block)
|
781
1068
|
match_fields.each do |each|
|
782
|
-
if each.oxm_class ==
|
1069
|
+
if each.oxm_class == OpenFlowBasicValue::OXM_CLASS || each.oxm_class == NiciraMatchExtensionValue::OXM_CLASS
|
783
1070
|
next unless each.class_payload.tlv_value.respond_to?(method)
|
784
1071
|
return each.class_payload.tlv_value.__send__(
|
785
1072
|
method, *args, &block)
|
@@ -788,6 +1075,7 @@ module Pio
|
|
788
1075
|
fail NoMethodError, method.to_s
|
789
1076
|
end
|
790
1077
|
# rubocop:enable Next
|
1078
|
+
# rubocop:enable LineLength
|
791
1079
|
|
792
1080
|
private
|
793
1081
|
|
@@ -812,6 +1100,7 @@ module Pio
|
|
812
1100
|
class Options
|
813
1101
|
# rubocop:disable MethodLength
|
814
1102
|
# rubocop:disable AbcSize
|
1103
|
+
# rubocop:disable LineLength
|
815
1104
|
def initialize(user_attrs)
|
816
1105
|
@match_fields = []
|
817
1106
|
|
@@ -822,29 +1111,30 @@ module Pio
|
|
822
1111
|
:icmpv4_type, :icmpv4_code, :arp_operation].each do |each|
|
823
1112
|
next unless user_attrs.key?(each)
|
824
1113
|
klass = Match.const_get(each.to_s.split('_').map(&:capitalize).join)
|
825
|
-
@match_fields << {
|
826
|
-
|
827
|
-
|
1114
|
+
@match_fields << { oxm_class: klass.superclass.const_get(:OXM_CLASS),
|
1115
|
+
class_payload: { oxm_field: klass.const_get(:OXM_FIELD),
|
1116
|
+
tlv_value: { each => user_attrs.fetch(each) } } }
|
828
1117
|
end
|
829
1118
|
|
830
1119
|
[:metadata, :destination_mac_address, :source_mac_address,
|
831
1120
|
:ipv4_source_address, :ipv4_destination_address,
|
832
1121
|
:arp_sender_protocol_address, :arp_target_protocol_address,
|
833
1122
|
:arp_sender_hardware_address, :arp_target_hardware_address,
|
834
|
-
:ipv6_source_address, :ipv6_destination_address,
|
835
|
-
:
|
1123
|
+
:ipv6_source_address, :ipv6_destination_address, :tunnel_id,
|
1124
|
+
:reg0, :reg1, :reg2, :reg3, :reg4, :reg5, :reg6, :reg7].each do |each|
|
836
1125
|
next unless user_attrs.key?(each)
|
837
1126
|
klass = Match.const_get(each.to_s.split('_').map(&:capitalize).join)
|
838
1127
|
mask_key = "#{each}_mask".to_sym
|
839
|
-
@match_fields << {
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
1128
|
+
@match_fields << { oxm_class: klass.superclass.const_get(:OXM_CLASS),
|
1129
|
+
class_payload: { oxm_field: klass.const_get(:OXM_FIELD),
|
1130
|
+
oxm_hasmask: user_attrs.key?(mask_key) ? 1 : 0,
|
1131
|
+
tlv_value: { each => user_attrs[each],
|
1132
|
+
mask_key => user_attrs[mask_key] } } }
|
844
1133
|
end
|
845
1134
|
end
|
846
1135
|
# rubocop:enable MethodLength
|
847
1136
|
# rubocop:enable AbcSize
|
1137
|
+
# rubocop:enable LineLength
|
848
1138
|
|
849
1139
|
def to_hash
|
850
1140
|
{ match_fields: @match_fields }
|