pio 0.18.2 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +40 -344
  4. data/Rakefile +32 -0
  5. data/bin/_guard-core +16 -0
  6. data/bin/byebug +16 -0
  7. data/bin/cc-tddium-post-worker +16 -0
  8. data/bin/cdiff +16 -0
  9. data/bin/coderay +16 -0
  10. data/bin/colortab +16 -0
  11. data/bin/coveralls +16 -0
  12. data/bin/cucumber +16 -0
  13. data/bin/decolor +16 -0
  14. data/bin/flay +16 -0
  15. data/bin/flog +16 -0
  16. data/bin/guard +16 -0
  17. data/bin/htmldiff +16 -0
  18. data/bin/inch +16 -0
  19. data/bin/ldiff +16 -0
  20. data/bin/listen +16 -0
  21. data/bin/minitar +16 -0
  22. data/bin/pry +16 -0
  23. data/bin/rake +16 -0
  24. data/bin/reek +16 -0
  25. data/bin/relish +16 -0
  26. data/bin/restclient +16 -0
  27. data/bin/rspec +16 -0
  28. data/bin/rubocop +16 -0
  29. data/bin/ruby-parse +16 -0
  30. data/bin/ruby-rewrite +16 -0
  31. data/bin/ruby_parse +16 -0
  32. data/bin/ruby_parse_extract_error +16 -0
  33. data/bin/sparkr +16 -0
  34. data/bin/term_display +16 -0
  35. data/bin/term_mandel +16 -0
  36. data/bin/thor +16 -0
  37. data/bin/unparser +16 -0
  38. data/bin/yard +16 -0
  39. data/bin/yardoc +16 -0
  40. data/bin/yri +16 -0
  41. data/features/arp.feature +61 -0
  42. data/features/dhcp.feature +4 -0
  43. data/features/icmp.feature +130 -0
  44. data/features/lldp.feature +47 -0
  45. data/features/open_flow10/echo_reply.feature +95 -0
  46. data/features/open_flow10/echo_request.feature +95 -0
  47. data/features/open_flow10/exact_match.feature +36 -0
  48. data/features/{features_read.feature → open_flow10/features_reply.feature} +54 -17
  49. data/features/open_flow10/features_request.feature +79 -0
  50. data/features/{flow_mod_read.feature → open_flow10/flow_mod.feature} +16 -21
  51. data/features/open_flow10/hello.feature +79 -0
  52. data/features/open_flow10/packet_in.feature +58 -0
  53. data/features/{packet_out_read.feature → open_flow10/packet_out.feature} +4 -5
  54. data/features/open_flow10/port_status.feature +23 -0
  55. data/features/open_flow13/echo_reply.feature +115 -0
  56. data/features/open_flow13/echo_request.feature +115 -0
  57. data/features/open_flow13/hello.feature +74 -0
  58. data/features/packet_data/echo13_reply_body.raw +0 -0
  59. data/features/packet_data/echo13_reply_no_body.raw +0 -0
  60. data/features/packet_data/echo13_request_body.raw +0 -0
  61. data/features/packet_data/echo13_request_no_body.raw +0 -0
  62. data/features/packet_data/hello13_no_version_bitmap.raw +0 -0
  63. data/features/packet_data/hello13_version_bitmap.raw +0 -0
  64. data/features/packet_data/udp_no_payload.raw +0 -0
  65. data/features/packet_data/udp_with_payload.raw +0 -0
  66. data/features/step_definitions/packet_data_steps.rb +49 -29
  67. data/features/support/env.rb +3 -0
  68. data/features/{udp_read.feature → udp.feature} +3 -4
  69. data/lib/pio.rb +1 -0
  70. data/lib/pio/echo.rb +67 -0
  71. data/lib/pio/hello13.rb +111 -0
  72. data/lib/pio/open_flow/message.rb +2 -1
  73. data/lib/pio/open_flow/open_flow_header.rb +21 -38
  74. data/lib/pio/open_flow/transaction_id.rb +25 -0
  75. data/lib/pio/version.rb +1 -1
  76. data/pio.gemspec +9 -14
  77. data/spec/pio/flow_mod_spec.rb +1 -1
  78. data/spec/pio/hello13_spec.rb +114 -0
  79. metadata +182 -138
  80. data/examples/arp_new.rb +0 -16
  81. data/examples/arp_read.rb +0 -4
  82. data/examples/dhcp_new.rb +0 -34
  83. data/examples/dhcp_read.rb +0 -4
  84. data/examples/echo_new.rb +0 -9
  85. data/examples/echo_read.rb +0 -4
  86. data/examples/features_new.rb +0 -28
  87. data/examples/features_read.rb +0 -4
  88. data/examples/flow_mod_new.rb +0 -13
  89. data/examples/flow_mod_read.rb +0 -6
  90. data/examples/hello_new.rb +0 -4
  91. data/examples/hello_read.rb +0 -4
  92. data/examples/icmp_new.rb +0 -21
  93. data/examples/icmp_read.rb +0 -4
  94. data/examples/lldp_new.rb +0 -4
  95. data/examples/lldp_read.rb +0 -4
  96. data/examples/packet_in_new.rb +0 -17
  97. data/examples/packet_in_read.rb +0 -5
  98. data/examples/packet_out_new.rb +0 -18
  99. data/examples/packet_out_read.rb +0 -6
  100. data/features/arp_read.feature +0 -10
  101. data/features/dhcp_read.feature +0 -6
  102. data/features/echo_read.feature +0 -29
  103. data/features/exact_match.feature +0 -38
  104. data/features/hello_read.feature +0 -14
  105. data/features/icmp_read.feature +0 -55
  106. data/features/lldp_read.feature +0 -26
  107. data/features/packet_in_read.feature +0 -22
  108. data/features/port_status_read.feature +0 -24
  109. data/features/step_definitions/pending_steps.rb +0 -3
  110. data/spec/pio/echo/reply_spec.rb +0 -135
  111. data/spec/pio/echo/request_spec.rb +0 -137
  112. data/spec/pio/features/reply_spec.rb +0 -137
  113. data/spec/pio/features/request_spec.rb +0 -112
  114. data/spec/pio/hello_spec.rb +0 -106
  115. data/spec/pio/lldp_spec.rb +0 -244
  116. data/spec/pio/packet_in_spec.rb +0 -146
data/bin/ruby-rewrite ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ruby-rewrite' 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('parser', 'ruby-rewrite')
data/bin/ruby_parse ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ruby_parse' 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('ruby_parser', 'ruby_parse')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ruby_parse_extract_error' 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('ruby_parser', 'ruby_parse_extract_error')
data/bin/sparkr ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'sparkr' 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('sparkr', 'sparkr')
data/bin/term_display ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'term_display' 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('term-ansicolor', 'term_display')
data/bin/term_mandel ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'term_mandel' 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('term-ansicolor', 'term_mandel')
data/bin/thor ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'thor' 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('thor', 'thor')
data/bin/unparser ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'unparser' 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('unparser', 'unparser')
data/bin/yard ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'yard' 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('yard', 'yard')
data/bin/yardoc ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'yardoc' 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('yard', 'yardoc')
data/bin/yri ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'yri' 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('yard', 'yri')
@@ -0,0 +1,61 @@
1
+ Feature: ARP
2
+ Scenario: create an ARP request
3
+ When I try to create a packet with:
4
+ """
5
+ Pio::Arp::Request.new(
6
+ source_mac: '00:26:82:eb:ea:d1',
7
+ sender_protocol_address: '192.168.83.3',
8
+ target_protocol_address: '192.168.83.254'
9
+ )
10
+ """
11
+ Then it should finish successfully
12
+ And the packet have the following fields and values:
13
+ | field | value |
14
+ | class | Pio::Arp::Request |
15
+ | destination_mac | ff:ff:ff:ff:ff:ff |
16
+ | source_mac | 00:26:82:eb:ea:d1 |
17
+ | ether_type | 2054 |
18
+ | hardware_type | 1 |
19
+ | protocol_type | 2048 |
20
+ | hardware_length | 6 |
21
+ | protocol_length | 4 |
22
+ | operation | 1 |
23
+ | sender_hardware_address | 00:26:82:eb:ea:d1 |
24
+ | sender_protocol_address | 192.168.83.3 |
25
+ | target_hardware_address | 00:00:00:00:00:00 |
26
+ | target_protocol_address | 192.168.83.254 |
27
+
28
+ Scenario: create an ARP reply
29
+ When I try to create a packet with:
30
+ """
31
+ Pio::Arp::Reply.new(
32
+ source_mac: '00:16:9d:1d:9c:c4',
33
+ destination_mac: '00:26:82:eb:ea:d1',
34
+ sender_protocol_address: '192.168.83.254',
35
+ target_protocol_address: '192.168.83.3'
36
+ )
37
+ """
38
+ Then it should finish successfully
39
+ And the packet have the following fields and values:
40
+ | field | value |
41
+ | class | Pio::Arp::Reply |
42
+ | destination_mac | 00:26:82:eb:ea:d1 |
43
+ | source_mac | 00:16:9d:1d:9c:c4 |
44
+ | ether_type | 2054 |
45
+ | hardware_type | 1 |
46
+ | protocol_type | 2048 |
47
+ | hardware_length | 6 |
48
+ | protocol_length | 4 |
49
+ | operation | 2 |
50
+ | sender_hardware_address | 00:16:9d:1d:9c:c4 |
51
+ | sender_protocol_address | 192.168.83.254 |
52
+ | target_hardware_address | 00:26:82:eb:ea:d1 |
53
+ | target_protocol_address | 192.168.83.3 |
54
+
55
+ Scenario: parse arp.pcap
56
+ When I try to parse a file named "arp.pcap" with "Pio::Arp" class
57
+ Then it should finish successfully
58
+
59
+ Scenario: parse arp-storm.pcap
60
+ When I try to parse a file named "arp-storm.pcap" with "Pio::Arp" class
61
+ Then it should finish successfully
@@ -0,0 +1,4 @@
1
+ Feature: DHCP
2
+ Scenario: dhcp.pcap
3
+ When I try to parse a file named "dhcp.pcap" with "Dhcp" class
4
+ Then it should finish successfully
@@ -0,0 +1,130 @@
1
+ Feature: ICMP
2
+ Scenario: create an ICMP request
3
+ When I try to create a packet with:
4
+ """
5
+ Pio::Icmp::Request.new(
6
+ source_mac: '00:16:9d:1d:9c:c4',
7
+ destination_mac: '00:26:82:eb:ea:d1',
8
+ ip_source_address: '192.168.83.3',
9
+ ip_destination_address: '192.168.83.254'
10
+ )
11
+ """
12
+ Then it should finish successfully
13
+ And the packet have the following fields and values:
14
+ | field | value |
15
+ | class | Pio::Icmp::Request |
16
+ | destination_mac | 00:26:82:eb:ea:d1 |
17
+ | source_mac | 00:16:9d:1d:9c:c4 |
18
+ | ether_type | 2048 |
19
+ | ip_version | 4 |
20
+ | ip_header_length | 5 |
21
+ | ip_type_of_service | 0 |
22
+ | ip_total_length | 50 |
23
+ | ip_identifier | 0 |
24
+ | ip_flag | 0 |
25
+ | ip_fragment | 0 |
26
+ | ip_ttl | 128 |
27
+ | ip_protocol | 1 |
28
+ | ip_header_checksum | 4729 |
29
+ | ip_source_address | 192.168.83.3 |
30
+ | ip_destination_address | 192.168.83.254 |
31
+ | ip_option | |
32
+ | icmp_type | 8 |
33
+ | icmp_code | 0 |
34
+ | icmp_checksum | 63231 |
35
+ | icmp_identifier | 256 |
36
+ | icmp_sequence_number | 0 |
37
+ | echo_data | |
38
+
39
+ Scenario: create an ICMP reply
40
+ When I try to create a packet with:
41
+ """
42
+ Pio::Icmp::Reply.new(
43
+ source_mac: '00:26:82:eb:ea:d1',
44
+ destination_mac: '00:16:9d:1d:9c:c4',
45
+ ip_source_address: '192.168.83.254',
46
+ ip_destination_address: '192.168.83.3',
47
+ identifier: 256,
48
+ sequence_number: 0
49
+ )
50
+ """
51
+ Then it should finish successfully
52
+ And the packet have the following fields and values:
53
+ | field | value |
54
+ | class | Pio::Icmp::Reply |
55
+ | destination_mac | 00:16:9d:1d:9c:c4 |
56
+ | source_mac | 00:26:82:eb:ea:d1 |
57
+ | ether_type | 2048 |
58
+ | ip_version | 4 |
59
+ | ip_header_length | 5 |
60
+ | ip_type_of_service | 0 |
61
+ | ip_total_length | 50 |
62
+ | ip_identifier | 0 |
63
+ | ip_flag | 0 |
64
+ | ip_fragment | 0 |
65
+ | ip_ttl | 128 |
66
+ | ip_protocol | 1 |
67
+ | ip_header_checksum | 4729 |
68
+ | ip_source_address | 192.168.83.254 |
69
+ | ip_destination_address | 192.168.83.3 |
70
+ | ip_option | |
71
+ | icmp_type | 0 |
72
+ | icmp_code | 0 |
73
+ | icmp_checksum | 65279 |
74
+ | icmp_identifier | 256 |
75
+ | icmp_sequence_number | 0 |
76
+ | echo_data | |
77
+
78
+ Scenario: parse icmp.pcap
79
+ When I try to parse a file named "icmp.pcap" with "Pio::Icmp" class
80
+ Then it should finish successfully
81
+ And the message #1 have the following fields and values:
82
+ | field | value |
83
+ | class | Pio::Icmp::Request |
84
+ | destination_mac | 00:13:46:0b:22:ba |
85
+ | source_mac | 00:16:ce:6e:8b:24 |
86
+ | ether_type | 2048 |
87
+ | ip_version | 4 |
88
+ | ip_header_length | 5 |
89
+ | ip_type_of_service | 0 |
90
+ | ip_total_length | 60 |
91
+ | ip_identifier | 36507 |
92
+ | ip_flag | 0 |
93
+ | ip_fragment | 0 |
94
+ | ip_ttl | 128 |
95
+ | ip_protocol | 1 |
96
+ | ip_header_checksum | 10850 |
97
+ | ip_source_address | 192.168.0.114 |
98
+ | ip_destination_address | 192.168.0.1 |
99
+ | ip_option | |
100
+ | icmp_type | 8 |
101
+ | icmp_code | 0 |
102
+ | icmp_checksum | 18780 |
103
+ | icmp_identifier | 768 |
104
+ | icmp_sequence_number | 256 |
105
+ | echo_data | abcdefghijklmnopqrstuvwabcdefghi |
106
+ And the message #2 have the following fields and values:
107
+ | field | value |
108
+ | class | Pio::Icmp::Reply |
109
+ | destination_mac | 00:16:ce:6e:8b:24 |
110
+ | source_mac | 00:13:46:0b:22:ba |
111
+ | ether_type | 2048 |
112
+ | ip_version | 4 |
113
+ | ip_header_length | 5 |
114
+ | ip_type_of_service | 0 |
115
+ | ip_total_length | 60 |
116
+ | ip_identifier | 24150 |
117
+ | ip_flag | 0 |
118
+ | ip_fragment | 0 |
119
+ | ip_ttl | 127 |
120
+ | ip_protocol | 1 |
121
+ | ip_header_checksum | 23463 |
122
+ | ip_source_address | 192.168.0.1 |
123
+ | ip_destination_address | 192.168.0.114 |
124
+ | ip_option | |
125
+ | icmp_type | 0 |
126
+ | icmp_code | 0 |
127
+ | icmp_checksum | 20828 |
128
+ | icmp_identifier | 768 |
129
+ | icmp_sequence_number | 256 |
130
+ | echo_data | abcdefghijklmnopqrstuvwabcdefghi |
@@ -0,0 +1,47 @@
1
+ Feature: LLDP
2
+ Scenario: create
3
+ When I try to create an OpenFlow message with:
4
+ """
5
+ Pio::Lldp.new(dpid: 0x123, port_number: 12, source_mac: '11:22:33:44:55:66')
6
+ """
7
+ Then it should finish successfully
8
+ And the message have the following fields and values:
9
+ | field | value |
10
+ | class | Pio::Lldp |
11
+ | destination_mac | 01:80:c2:00:00:0e |
12
+ | source_mac | 11:22:33:44:55:66 |
13
+ | ether_type | 35020 |
14
+ | chassis_id | 291 |
15
+ | dpid | 291 |
16
+ | port_id | 12 |
17
+ | ttl | 120 |
18
+ | port_description | |
19
+ | system_name | |
20
+ | system_description | |
21
+ | system_capabilities | |
22
+ | management_address | |
23
+ | organizationally_specific | |
24
+
25
+ Scenario: parse
26
+ When I try to parse a file named "lldp.minimal.pcap" with "Lldp" class
27
+ Then it should finish successfully
28
+ Then the message #1 have the following fields and values:
29
+ | field | value |
30
+ | class | Pio::Lldp |
31
+ | destination_mac | 01:80:c2:00:00:0e |
32
+ | source_mac | 00:04:96:1f:a7:26 |
33
+ | ether_type | 35020 |
34
+ | chassis_id | 19698525990 |
35
+ | dpid | 19698525990 |
36
+ | port_id | 1/3 |
37
+ | ttl | 120 |
38
+ | port_description | |
39
+ | system_name | |
40
+ | system_description | |
41
+ | system_capabilities | |
42
+ | management_address | |
43
+ | organizationally_specific | |
44
+
45
+ Scenario: parse 2
46
+ When I try to parse a file named "lldp.detailed.pcap" with "Lldp" class
47
+ Then it should finish successfully