openflow-protocol 0.0.1 → 0.0.2
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/lib/actions/action_set_ip_source.rb +1 -1
- data/lib/helpers/superclass_base.rb +1 -0
- data/lib/openflow-protocol.rb +1 -1
- data/lib/statistics/table_statistics.rb +0 -1
- data/lib/structs/match.rb +3 -5
- data/lib/structs/physical_port.rb +1 -1
- metadata +5 -9
- data/lib/helpers/enum.rb +0 -45
- data/lib/helpers/flags.rb +0 -49
- data/lib/helpers/ip_address.rb +0 -14
- data/lib/helpers/mac_address.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd2320d8d023f99591849dcddf65d34d027d456a
|
4
|
+
data.tar.gz: 6308d93b14a0dc921a31cd2f95ddb077648bf675
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a9d598eb11bdbbb763b4e10f9e33c43f6ec05f39f703f27df273783966cd08f2de81bde050e51b54d04a9d7cb6f5ba4dc13b00b38d9316982b1e22476c69f14
|
7
|
+
data.tar.gz: e01191ffec81b3c5913e28eee27f9f5abc9188f7d331a9717b41e24dd5c074e1abed87e467272c79c2e84e06a322a65ee356392f275cec6130e72db85c207497
|
data/lib/openflow-protocol.rb
CHANGED
data/lib/structs/match.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'English'
|
2
|
-
|
3
|
-
require_relative '../helpers/mac_address'
|
4
|
-
require_relative '../helpers/ip_address'
|
2
|
+
require 'bindata-contrib'
|
5
3
|
require_relative 'port_number'
|
6
4
|
|
7
5
|
class OFMatch < BinData::Record
|
@@ -84,8 +82,8 @@ class OFMatch < BinData::Record
|
|
84
82
|
}, initial_value: 0
|
85
83
|
uint16 :padding2
|
86
84
|
hide :padding2
|
87
|
-
|
88
|
-
|
85
|
+
ipv4_address :ip_source
|
86
|
+
ipv4_address :ip_destination
|
89
87
|
uint16 :source_port, initial_value: 0
|
90
88
|
uint16 :destination_port, initial_value: 0
|
91
89
|
end
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openflow-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Jérémy Pagé
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An OpenFlow Parser/Serializer.
|
14
14
|
email:
|
15
|
-
-
|
15
|
+
- contact@jeremypage.me
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
@@ -32,10 +32,6 @@ files:
|
|
32
32
|
- lib/actions/action_strip_vlan.rb
|
33
33
|
- lib/actions/action_vendor.rb
|
34
34
|
- lib/actions/actions.rb
|
35
|
-
- lib/helpers/enum.rb
|
36
|
-
- lib/helpers/flags.rb
|
37
|
-
- lib/helpers/ip_address.rb
|
38
|
-
- lib/helpers/mac_address.rb
|
39
35
|
- lib/helpers/superclass_base.rb
|
40
36
|
- lib/messages/barrier_reply.rb
|
41
37
|
- lib/messages/barrier_request.rb
|
@@ -93,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
89
|
version: '0'
|
94
90
|
requirements: []
|
95
91
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.4.
|
92
|
+
rubygems_version: 2.4.8
|
97
93
|
signing_key:
|
98
94
|
specification_version: 4
|
99
95
|
summary: OpenFlow Protocol
|
data/lib/helpers/enum.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'bindata'
|
2
|
-
|
3
|
-
def _def_enum(size)
|
4
|
-
eval %(
|
5
|
-
class Enum#{size} < BinData::Primitive
|
6
|
-
mandatory_parameter :list
|
7
|
-
|
8
|
-
endian :big
|
9
|
-
uint#{size} :enum, initial_value: 0
|
10
|
-
|
11
|
-
def get
|
12
|
-
list.invert.fetch(enum)
|
13
|
-
rescue KeyError
|
14
|
-
enum
|
15
|
-
end
|
16
|
-
|
17
|
-
def set(value)
|
18
|
-
self.enum = list.fetch(value)
|
19
|
-
rescue KeyError
|
20
|
-
self.enum = value
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def list
|
26
|
-
list = eval_parameter(:list)
|
27
|
-
case list
|
28
|
-
when Array
|
29
|
-
shift = 0
|
30
|
-
list.each_with_object({}) do |each, result|
|
31
|
-
result[each] = shift
|
32
|
-
shift += 1
|
33
|
-
result
|
34
|
-
end
|
35
|
-
when Hash
|
36
|
-
list
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
)
|
41
|
-
end
|
42
|
-
|
43
|
-
_def_enum 8
|
44
|
-
_def_enum 16
|
45
|
-
_def_enum 32
|
data/lib/helpers/flags.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'bindata'
|
2
|
-
|
3
|
-
def _def_flags(size)
|
4
|
-
eval %(
|
5
|
-
class Flags#{size} < BinData::Primitive
|
6
|
-
mandatory_parameter :list
|
7
|
-
|
8
|
-
endian :big
|
9
|
-
uint#{size} :flags, initial_value: 0
|
10
|
-
|
11
|
-
def get
|
12
|
-
list.each_with_object([]) do |(key, value), result|
|
13
|
-
result << key if (flags & value != 0) || (flags == value)
|
14
|
-
result
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def set(value)
|
19
|
-
value.each do |each|
|
20
|
-
fail "Invalid flag: \#{value}" unless list.keys.include?(each)
|
21
|
-
end
|
22
|
-
self.flags = value.empty? ?
|
23
|
-
0 :
|
24
|
-
value.map { |each| list[each] }.inject(:|)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def list
|
30
|
-
list = eval_parameter(:list)
|
31
|
-
case list
|
32
|
-
when Array
|
33
|
-
shift = 0
|
34
|
-
list.each_with_object({}) do |each, result|
|
35
|
-
result[each] = 1 << shift
|
36
|
-
shift += 1
|
37
|
-
result
|
38
|
-
end
|
39
|
-
when Hash
|
40
|
-
list
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
_def_flags 8
|
48
|
-
_def_flags 16
|
49
|
-
_def_flags 32
|
data/lib/helpers/ip_address.rb
DELETED
data/lib/helpers/mac_address.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'bindata'
|
2
|
-
|
3
|
-
class MacAddress < BinData::Primitive
|
4
|
-
endian :big
|
5
|
-
array :octets, type: :uint8, initial_length: 6
|
6
|
-
|
7
|
-
def get
|
8
|
-
octets.map { |octet| format('%02x', octet) }.join(':')
|
9
|
-
end
|
10
|
-
|
11
|
-
def set(value)
|
12
|
-
self.octets = value.split(':').map(&:hex)
|
13
|
-
end
|
14
|
-
end
|