pio 0.27.1 → 0.27.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Rakefile +1 -1
  4. data/bin/{terminal-notifier → code_metrics} +2 -2
  5. data/bin/code_metrics-profile +16 -0
  6. data/features/icmpv6.pcap +0 -0
  7. data/features/open_flow10/aggregate_stats_reply.feature +1 -1
  8. data/features/open_flow10/aggregate_stats_request.feature +2 -2
  9. data/features/open_flow10/bad_request.feature +2 -2
  10. data/features/open_flow10/barrier_reply.feature +3 -18
  11. data/features/open_flow10/barrier_request.feature +3 -18
  12. data/features/open_flow10/description_stats_reply.feature +1 -1
  13. data/features/open_flow10/description_stats_request.feature +3 -3
  14. data/features/open_flow10/echo_reply.feature +4 -47
  15. data/features/open_flow10/echo_request.feature +4 -36
  16. data/features/open_flow10/exact_match.feature +20 -2
  17. data/features/open_flow10/features_reply.feature +65 -72
  18. data/features/open_flow10/features_request.feature +3 -22
  19. data/features/open_flow10/flow_mod.feature +5 -5
  20. data/features/open_flow10/flow_stats_reply.feature +2 -2
  21. data/features/open_flow10/flow_stats_request.feature +3 -4
  22. data/features/open_flow10/hello.feature +4 -20
  23. data/features/open_flow10/hello_failed.feature +4 -4
  24. data/features/open_flow10/packet_in.feature +2 -2
  25. data/features/open_flow10/packet_in_arp_reply.raw +0 -0
  26. data/features/open_flow10/packet_out.feature +1 -1
  27. data/features/open_flow10/port_status.feature +1 -1
  28. data/features/open_flow13/bad_request.feature +2 -2
  29. data/features/open_flow13/echo_reply.feature +5 -37
  30. data/features/open_flow13/echo_request.feature +5 -37
  31. data/features/open_flow13/features_reply.feature +3 -7
  32. data/features/open_flow13/features_request.feature +3 -18
  33. data/features/open_flow13/flow_mod.feature +5 -5
  34. data/features/open_flow13/hello.feature +4 -19
  35. data/features/open_flow13/hello_failed.feature +4 -4
  36. data/features/open_flow13/match.feature +4 -4
  37. data/features/open_flow13/packet_in.feature +3 -3
  38. data/features/open_flow13/packet_out.feature +3 -3
  39. data/features/parser.feature +10 -0
  40. data/lib/pio/arp/format.rb +20 -0
  41. data/lib/pio/ipv4_header.rb +20 -0
  42. data/lib/pio/open_flow.rb +0 -1
  43. data/lib/pio/open_flow/message.rb +51 -57
  44. data/lib/pio/open_flow/open_flow_header.rb +6 -10
  45. data/lib/pio/open_flow10.rb +20 -15
  46. data/lib/pio/open_flow10/aggregate_stats/reply.rb +20 -0
  47. data/lib/pio/open_flow10/aggregate_stats/request.rb +25 -0
  48. data/lib/pio/open_flow10/barrier/reply.rb +14 -0
  49. data/lib/pio/open_flow10/barrier/request.rb +14 -0
  50. data/lib/pio/open_flow10/description_stats/reply.rb +21 -0
  51. data/lib/pio/open_flow10/description_stats/request.rb +19 -0
  52. data/lib/pio/open_flow10/echo/reply.rb +16 -0
  53. data/lib/pio/open_flow10/echo/request.rb +16 -0
  54. data/lib/pio/open_flow10/error/bad_request.rb +27 -49
  55. data/lib/pio/open_flow10/error/hello_failed.rb +6 -28
  56. data/lib/pio/open_flow10/exact_match.rb +4 -39
  57. data/lib/pio/open_flow10/features/reply.rb +48 -72
  58. data/lib/pio/open_flow10/features/request.rb +4 -11
  59. data/lib/pio/open_flow10/flow_mod.rb +21 -51
  60. data/lib/pio/open_flow10/{flow_stats_reply.rb → flow_stats/reply.rb} +7 -23
  61. data/lib/pio/open_flow10/flow_stats/request.rb +25 -0
  62. data/lib/pio/open_flow10/hello.rb +3 -13
  63. data/lib/pio/open_flow10/match.rb +0 -18
  64. data/lib/pio/open_flow10/match10.rb +22 -0
  65. data/lib/pio/open_flow10/packet_in.rb +18 -42
  66. data/lib/pio/open_flow10/packet_out.rb +8 -31
  67. data/lib/pio/open_flow10/port_status.rb +11 -39
  68. data/lib/pio/open_flow10/stats_reply.rb +11 -8
  69. data/lib/pio/open_flow10/stats_request.rb +8 -8
  70. data/lib/pio/open_flow13.rb +13 -6
  71. data/lib/pio/open_flow13/echo/reply.rb +15 -0
  72. data/lib/pio/open_flow13/echo/request.rb +15 -0
  73. data/lib/pio/open_flow13/error/bad_request.rb +32 -49
  74. data/lib/pio/open_flow13/error/hello_failed.rb +7 -30
  75. data/lib/pio/open_flow13/features/reply.rb +27 -51
  76. data/lib/pio/open_flow13/features/request.rb +3 -10
  77. data/lib/pio/open_flow13/flow_mod.rb +29 -52
  78. data/lib/pio/open_flow13/hello.rb +18 -22
  79. data/lib/pio/open_flow13/packet_in.rb +26 -44
  80. data/lib/pio/open_flow13/packet_out.rb +16 -35
  81. data/lib/pio/open_flow13/stats_request.rb +5 -21
  82. data/lib/pio/parser.rb +5 -4
  83. data/lib/pio/version.rb +1 -1
  84. data/pio.gemspec +6 -6
  85. data/spec/pio/open_flow10/{echo_reply_spec.rb → echo/reply_spec.rb} +1 -1
  86. data/spec/pio/open_flow10/{echo_request_spec.rb → echo/request_spec.rb} +1 -1
  87. data/spec/pio/open_flow10/error/hello_failed_spec.rb +2 -2
  88. data/spec/pio/open_flow10/features/request_spec.rb +0 -5
  89. data/spec/pio/open_flow10/flow_mod_spec.rb +2 -4
  90. data/spec/pio/open_flow10/flow_stats_reply_spec.rb +1 -1
  91. data/spec/pio/open_flow10/flow_stats_request_spec.rb +2 -2
  92. data/spec/pio/open_flow10/packet_out_spec.rb +15 -18
  93. data/spec/pio/open_flow13/echo_reply_spec.rb +1 -1
  94. data/spec/pio/open_flow13/echo_request_spec.rb +1 -1
  95. data/spec/pio/open_flow13/error/hello_failed_spec.rb +2 -2
  96. data/spec/pio/open_flow13/features/request_spec.rb +5 -3
  97. data/spec/pio/open_flow13/hello_spec.rb +3 -3
  98. data/spec/support/shared_examples_for_openflow_messages.rb +5 -12
  99. metadata +92 -85
  100. data/lib/pio/open_flow/echo.rb +0 -44
  101. data/lib/pio/open_flow/format.rb +0 -46
  102. data/lib/pio/open_flow10/aggregate_stats_reply.rb +0 -38
  103. data/lib/pio/open_flow10/aggregate_stats_request.rb +0 -42
  104. data/lib/pio/open_flow10/barrier_reply.rb +0 -21
  105. data/lib/pio/open_flow10/barrier_request.rb +0 -22
  106. data/lib/pio/open_flow10/description_stats_reply.rb +0 -35
  107. data/lib/pio/open_flow10/description_stats_request.rb +0 -36
  108. data/lib/pio/open_flow10/echo.rb +0 -20
  109. data/lib/pio/open_flow10/flow_stats_request.rb +0 -64
  110. data/lib/pio/open_flow13/echo.rb +0 -20
  111. data/lib/pio/open_flow13/features.rb +0 -2
@@ -1,44 +0,0 @@
1
- require 'pio/open_flow/format'
2
- require 'pio/open_flow/message'
3
-
4
- module Pio
5
- module OpenFlow
6
- # Base class of Echo Request and Reply.
7
- class Echo < OpenFlow::Message
8
- # rubocop:disable MethodLength
9
- def self.inherited(child)
10
- child.module_eval <<-EOS
11
- class Format < BinData::Record
12
- extend OpenFlow::Format
13
-
14
- header version: :of_version,
15
- message_type: :of_message_type
16
- string :body, read_length: -> { length - header_length }
17
-
18
- def user_data
19
- body
20
- end
21
- end
22
- EOS
23
- end
24
- # rubocop:enable MethodLength
25
-
26
- def self.version(version)
27
- const_get(:Format).tap do |klass|
28
- klass.__send__(:define_method, :of_version) { version }
29
- klass.class_eval { private :of_version }
30
- end
31
- end
32
-
33
- def self.message_type(message_type)
34
- const_get(:Format).tap do |klass|
35
- klass.__send__(:define_method, :of_message_type) { message_type }
36
- klass.class_eval { private :of_message_type }
37
- end
38
- end
39
-
40
- body_option :body
41
- body_option :user_data
42
- end
43
- end
44
- end
@@ -1,46 +0,0 @@
1
- require 'pio/open_flow/open_flow_header'
2
-
3
- module Pio
4
- module OpenFlow
5
- # OpenFlow message definition macros.
6
- module Format
7
- include Forwardable
8
-
9
- # rubocop:disable NestedMethodDefinition
10
- def self.extended(base)
11
- base.module_eval do
12
- def header_length
13
- 8
14
- end
15
-
16
- def method_missing(method, *args, &block)
17
- body.__send__ method, *args, &block
18
- end
19
- end
20
- end
21
- # rubocop:enable NestedMethodDefinition
22
-
23
- # rubocop:disable MethodLength
24
- def header(options)
25
- module_eval do
26
- endian :big
27
-
28
- open_flow_header :header,
29
- ofp_version_value: options.fetch(:version),
30
- message_type_value: options.fetch(:message_type)
31
-
32
- def_delegators :header, :snapshot
33
- def_delegators :snapshot, :ofp_version
34
- def_delegators :snapshot, :message_type
35
- def_delegators :snapshot, :_length
36
- def_delegators :snapshot, :transaction_id
37
- def_delegator :snapshot, :transaction_id, :xid
38
-
39
- alias_method :length, :_length
40
- alias_method :to_binary, :to_binary_s
41
- end
42
- end
43
- # rubocop:enable MethodLength
44
- end
45
- end
46
- end
@@ -1,38 +0,0 @@
1
- require 'pio/open_flow10/stats_type'
2
-
3
- # Base module.
4
- module Pio
5
- # OpenFlow 1.0 messages
6
- module OpenFlow10
7
- # Aggregate Stats messages
8
- module AggregateStats
9
- # Aggregate Stats Reply message
10
- class Reply < OpenFlow::Message
11
- # Message body of Flow Stats Request.
12
- class Body < BinData::Record
13
- endian :big
14
-
15
- stats_type :stats_type, value: -> { :aggregate }
16
- uint16 :flags
17
- uint64 :packet_count
18
- uint64 :byte_count
19
- uint32 :flow_count
20
- string :padding, length: 4
21
- hide :padding
22
-
23
- def length
24
- 24
25
- end
26
- end
27
-
28
- # Aggregate Stats Reply message format.
29
- class Format < BinData::Record
30
- extend OpenFlow::Format
31
-
32
- header version: 1, message_type: 17
33
- body :body
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,42 +0,0 @@
1
- require 'pio/open_flow10/match'
2
- require 'pio/open_flow10/port16'
3
- require 'pio/open_flow10/stats_type'
4
-
5
- # Base module.
6
- module Pio
7
- # OpenFlow 1.0 messages
8
- module OpenFlow10
9
- # OpenFlow 1.0 Aggregate Stats messages
10
- module AggregateStats
11
- # OpenFlow 1.0 Aggregate Stats Request message
12
- class Request < OpenFlow::Message
13
- # Message body of Flow Stats Request.
14
- class Body < BinData::Record
15
- endian :big
16
-
17
- stats_type :stats_type, value: -> { :aggregate }
18
- uint16 :flags
19
- match10 :match
20
- uint8 :table_id, initial_value: 0xff
21
- string :padding, length: 1
22
- hide :padding
23
- port16 :out_port, initial_value: -> { :none }
24
-
25
- def length
26
- 48
27
- end
28
- end
29
-
30
- # OpenFlow 1.0 Aggregate Stats Request message format.
31
- class Format < BinData::Record
32
- extend OpenFlow::Format
33
-
34
- header version: 1, message_type: 16
35
- body :body
36
- end
37
-
38
- body_option :match
39
- end
40
- end
41
- end
42
- end
@@ -1,21 +0,0 @@
1
- require 'pio/open_flow/format'
2
- require 'pio/open_flow/message'
3
-
4
- module Pio
5
- # OpenFlow 1.0 messages
6
- module OpenFlow10
7
- # OpenFlow 1.0 Barrier messages
8
- module Barrier
9
- # OpenFlow 1.0 Barrier Request message
10
- class Reply < OpenFlow::Message
11
- # OpenFlow 1.0 Barrier Request message format
12
- class Format < BinData::Record
13
- extend OpenFlow::Format
14
-
15
- header version: 1, message_type: 19
16
- string :body, value: ''
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,22 +0,0 @@
1
- require 'pio/open_flow/format'
2
- require 'pio/open_flow/message'
3
-
4
- # Base module.
5
- module Pio
6
- # OpenFlow 1.0 messages
7
- module OpenFlow10
8
- # OpenFlow 1.0 Barrier messages
9
- module Barrier
10
- # OpenFlow 1.0 Barrier Request message
11
- class Request < OpenFlow::Message
12
- # OpenFlow 1.0 Barrier Request message format
13
- class Format < BinData::Record
14
- extend OpenFlow::Format
15
-
16
- header version: 1, message_type: 18
17
- string :body, value: ''
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,35 +0,0 @@
1
- require 'pio/open_flow10/stats_type'
2
-
3
- # Base module.
4
- module Pio
5
- # OpenFlow 1.0 messages
6
- module OpenFlow10
7
- # OpenFlow 1.0 Description Stats messages
8
- module DescriptionStats
9
- # OpenFlow 1.0 Description Stats Reply message
10
- class Reply < OpenFlow::Message
11
- # Message body of Flow Stats Reply.
12
- class Body < BinData::Record
13
- endian :big
14
-
15
- stats_type :stats_type, value: -> { :description }
16
- uint16 :flags
17
-
18
- stringz :manufacturer, length: 256
19
- stringz :hardware, length: 256
20
- stringz :software, length: 256
21
- stringz :serial_number, length: 32
22
- stringz :datapath, length: 256
23
- end
24
-
25
- # OpenFlow 1.0 Description Stats Reply message format.
26
- class Format < BinData::Record
27
- extend OpenFlow::Format
28
-
29
- header version: 1, message_type: 17
30
- body :body
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,36 +0,0 @@
1
- require 'pio/open_flow10/stats_type'
2
- require 'pio/open_flow/format'
3
- require 'pio/open_flow/message'
4
-
5
- # Base module.
6
- module Pio
7
- # OpenFlow 1.0 messages
8
- module OpenFlow10
9
- # OpenFlow 1.0 Description Stats messages
10
- module DescriptionStats
11
- # OpenFlow 1.0 Description Stats Request message
12
- class Request < OpenFlow::Message
13
- # Message body of Flow Stats Request.
14
- class Body < BinData::Record
15
- endian :big
16
-
17
- stats_type :stats_type, value: -> { :description }
18
- uint16 :flags
19
- string :body, value: ''
20
-
21
- def length
22
- 4
23
- end
24
- end
25
-
26
- # OpenFlow 1.0 Description Stats Request message format.
27
- class Format < BinData::Record
28
- extend OpenFlow::Format
29
-
30
- header version: 1, message_type: 16
31
- body :body
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,20 +0,0 @@
1
- require 'pio/open_flow/echo'
2
-
3
- module Pio
4
- module OpenFlow10
5
- # OpenFlow 1.0 Echo Request and Reply message.
6
- module Echo
7
- # OpenFlow 1.0 Echo Request message.
8
- class Request < OpenFlow::Echo
9
- version 1
10
- message_type 2
11
- end
12
-
13
- # OpenFlow 1.0 Echo Reply message.
14
- class Reply < OpenFlow::Echo
15
- version 1
16
- message_type 3
17
- end
18
- end
19
- end
20
- end
@@ -1,64 +0,0 @@
1
- require 'pio/open_flow10/match'
2
- require 'pio/open_flow10/stats_type'
3
- require 'pio/open_flow/format'
4
- require 'pio/open_flow/message'
5
-
6
- # Base module.
7
- module Pio
8
- # OpenFlow 1.0 messages
9
- module OpenFlow10
10
- # OpenFlow 1.0 FlowStats messages
11
- module FlowStats
12
- # OpenFlow 1.0 Flow Stats Request message
13
- class Request < OpenFlow::Message
14
- # Body for Stats Request of type :flow
15
- class FlowStatsRequestBody < BinData::Record
16
- endian :big
17
-
18
- match10 :match
19
- uint8 :table_id, initial_value: 0xff
20
- string :padding, length: 1
21
- hide :padding
22
- port16 :out_port, initial_value: -> { :none }
23
- end
24
-
25
- # Message body of Flow Stats Request.
26
- class Body < BinData::Record
27
- endian :big
28
-
29
- stats_type :stats_type, value: -> { :flow }
30
- uint16 :flags
31
- choice :stats_request_body, selection: -> { stats_type.to_s } do
32
- flow_stats_request_body 'flow'
33
- string :default
34
- end
35
-
36
- def length
37
- 48
38
- end
39
-
40
- def method_missing(method, *args, &block)
41
- stats_request_body.__send__(method, *args, &block)
42
- end
43
- end
44
-
45
- # OpenFlow 1.0 Flow Stats Request message format.
46
- class Format < BinData::Record
47
- extend OpenFlow::Format
48
-
49
- header version: 1, message_type: 16
50
- body :body
51
- end
52
-
53
- body_option :match
54
-
55
- def initialize(user_options = {})
56
- validate_user_options user_options
57
- header_options = parse_header_options(user_options)
58
- @format = Format.new(header: header_options,
59
- body: { stats_request_body: user_options })
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1,20 +0,0 @@
1
- require 'pio/open_flow/echo'
2
-
3
- # Base module.
4
- module Pio
5
- module OpenFlow13
6
- module Echo
7
- # OpenFlow 1.3 Echo Request message.
8
- class Request < OpenFlow::Echo
9
- version 4
10
- message_type 2
11
- end
12
-
13
- # OpenFlow 1.3 Echo Reply message.
14
- class Reply < OpenFlow::Echo
15
- version 4
16
- message_type 3
17
- end
18
- end
19
- end
20
- end
@@ -1,2 +0,0 @@
1
- require 'pio/open_flow13/features/reply'
2
- require 'pio/open_flow13/features/request'