pio 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +24 -11
- data/Rakefile +0 -2
- data/examples/features_new.rb +17 -6
- data/features/packet_data/aggregate_stats_reply.raw +0 -0
- data/features/packet_data/aggregate_stats_request.raw +0 -0
- data/features/packet_data/barrier_reply.raw +0 -0
- data/features/packet_data/barrier_request.raw +0 -0
- data/features/packet_data/desc_stats_reply.raw +0 -0
- data/features/packet_data/desc_stats_request.raw +0 -0
- data/features/packet_data/echo_reply.raw +0 -0
- data/features/packet_data/echo_request.raw +0 -0
- data/features/packet_data/error.raw +0 -0
- data/features/packet_data/features_reply.raw +0 -0
- data/features/packet_data/flow_mod_add.raw +0 -0
- data/features/packet_data/flow_mod_delete.raw +0 -0
- data/features/packet_data/flow_removed.raw +0 -0
- data/features/packet_data/flow_stats_reply.raw +0 -0
- data/features/packet_data/flow_stats_request.raw +0 -0
- data/features/packet_data/get_config_reply.raw +0 -0
- data/features/packet_data/get_config_request.raw +0 -0
- data/features/packet_data/hello.raw +0 -0
- data/features/packet_data/packet_in.raw +0 -0
- data/features/packet_data/packet_out.raw +0 -0
- data/features/packet_data/port_mod.raw +0 -0
- data/features/packet_data/port_stats_reply.raw +0 -0
- data/features/packet_data/port_stats_request.raw +0 -0
- data/features/packet_data/port_status.raw +0 -0
- data/features/packet_data/queue_get_config_reply.raw +0 -0
- data/features/packet_data/queue_get_config_request.raw +0 -0
- data/features/packet_data/set_config.raw +0 -0
- data/features/packet_data/table_stats_reply.raw +0 -0
- data/features/packet_data/table_stats_request.raw +0 -0
- data/features/packet_data/vendor.raw +0 -0
- data/features/packet_data/vendor_stats_request.raw +0 -0
- data/features/step_definitions/packet_data_steps.rb +0 -2
- data/features/step_definitions/pending_steps.rb +0 -2
- data/features/support/env.rb +0 -2
- data/lib/pio.rb +0 -2
- data/lib/pio/arp.rb +0 -2
- data/lib/pio/arp/format.rb +0 -2
- data/lib/pio/arp/message.rb +14 -22
- data/lib/pio/arp/reply.rb +0 -2
- data/lib/pio/arp/request.rb +0 -2
- data/lib/pio/dhcp.rb +0 -2
- data/lib/pio/dhcp/ack.rb +0 -2
- data/lib/pio/dhcp/boot_reply.rb +0 -2
- data/lib/pio/dhcp/boot_reply_options.rb +0 -2
- data/lib/pio/dhcp/boot_request.rb +0 -2
- data/lib/pio/dhcp/boot_request_options.rb +0 -2
- data/lib/pio/dhcp/client_id.rb +0 -2
- data/lib/pio/dhcp/common_options.rb +0 -2
- data/lib/pio/dhcp/csum_util.rb +0 -2
- data/lib/pio/dhcp/dhcp_field.rb +0 -2
- data/lib/pio/dhcp/dhcp_tlv_options.rb +0 -2
- data/lib/pio/dhcp/discover.rb +0 -2
- data/lib/pio/dhcp/field_util.rb +0 -2
- data/lib/pio/dhcp/frame.rb +0 -2
- data/lib/pio/dhcp/message.rb +0 -2
- data/lib/pio/dhcp/offer.rb +0 -2
- data/lib/pio/dhcp/optional_tlv.rb +0 -2
- data/lib/pio/dhcp/parameter_list.rb +0 -2
- data/lib/pio/dhcp/request.rb +0 -2
- data/lib/pio/echo.rb +3 -6
- data/lib/pio/echo/format.rb +10 -6
- data/lib/pio/echo/message.rb +16 -41
- data/lib/pio/echo/reply.rb +8 -7
- data/lib/pio/echo/request.rb +6 -6
- data/lib/pio/features.rb +15 -9
- data/lib/pio/features/reply.rb +79 -44
- data/lib/pio/features/request.rb +30 -28
- data/lib/pio/hello.rb +17 -29
- data/lib/pio/hello/format.rb +8 -8
- data/lib/pio/icmp.rb +0 -2
- data/lib/pio/icmp/format.rb +0 -2
- data/lib/pio/icmp/message.rb +23 -31
- data/lib/pio/icmp/options.rb +0 -2
- data/lib/pio/icmp/reply.rb +2 -4
- data/lib/pio/icmp/request.rb +0 -2
- data/lib/pio/ipv4_address.rb +1 -5
- data/lib/pio/lldp.rb +0 -2
- data/lib/pio/lldp/chassis_id_tlv.rb +0 -2
- data/lib/pio/lldp/end_of_lldpdu_value.rb +0 -2
- data/lib/pio/lldp/frame.rb +0 -2
- data/lib/pio/lldp/management_address_value.rb +0 -2
- data/lib/pio/lldp/optional_tlv.rb +0 -2
- data/lib/pio/lldp/options.rb +0 -2
- data/lib/pio/lldp/organizationally_specific_value.rb +0 -2
- data/lib/pio/lldp/port_description_value.rb +0 -2
- data/lib/pio/lldp/port_id_tlv.rb +0 -2
- data/lib/pio/lldp/system_capabilities_value.rb +0 -2
- data/lib/pio/lldp/system_description_value.rb +0 -2
- data/lib/pio/lldp/system_name_value.rb +0 -2
- data/lib/pio/lldp/ttl_tlv.rb +0 -2
- data/lib/pio/mac.rb +2 -6
- data/lib/pio/message_type_selector.rb +5 -4
- data/lib/pio/open_flow.rb +5 -0
- data/lib/pio/open_flow/flags.rb +38 -0
- data/lib/pio/open_flow/message.rb +20 -0
- data/lib/pio/open_flow/open_flow_header.rb +18 -0
- data/lib/pio/open_flow/phy_port.rb +74 -0
- data/lib/pio/open_flow/type.rb +12 -0
- data/lib/pio/options.rb +0 -2
- data/lib/pio/parse_error.rb +0 -2
- data/lib/pio/pcap.rb +0 -2
- data/lib/pio/type/ethernet_header.rb +0 -2
- data/lib/pio/type/ip_address.rb +0 -2
- data/lib/pio/type/ipv4_header.rb +2 -2
- data/lib/pio/type/mac_address.rb +6 -3
- data/lib/pio/type/udp_header.rb +0 -2
- data/lib/pio/version.rb +1 -3
- data/pio.gemspec +18 -20
- data/spec/pio/arp/reply/options_spec.rb +0 -2
- data/spec/pio/arp/reply_spec.rb +0 -2
- data/spec/pio/arp/request/options_spec.rb +0 -2
- data/spec/pio/arp/request_spec.rb +0 -2
- data/spec/pio/arp_spec.rb +0 -2
- data/spec/pio/dhcp/ack_spec.rb +0 -2
- data/spec/pio/dhcp/discover_spec.rb +0 -2
- data/spec/pio/dhcp/offer_spec.rb +0 -2
- data/spec/pio/dhcp/request_spec.rb +0 -2
- data/spec/pio/dhcp_spec.rb +0 -2
- data/spec/pio/echo/reply_spec.rb +13 -15
- data/spec/pio/echo/request_spec.rb +15 -15
- data/spec/pio/echo_spec.rb +5 -7
- data/spec/pio/features/reply_spec.rb +47 -17
- data/spec/pio/features/request_spec.rb +6 -11
- data/spec/pio/features_spec.rb +70 -51
- data/spec/pio/hello_spec.rb +1 -3
- data/spec/pio/icmp/reply_spec.rb +0 -2
- data/spec/pio/icmp/request_spec.rb +0 -2
- data/spec/pio/icmp_spec.rb +0 -2
- data/spec/pio/ipv4_address_spec.rb +0 -2
- data/spec/pio/lldp/options_spec.rb +0 -2
- data/spec/pio/lldp_spec.rb +0 -2
- data/spec/pio/mac_spec.rb +0 -1
- data/spec/pio/open_flow/phy_port_spec.rb +25 -0
- data/spec/pio/open_flow/type_spec.rb +5 -0
- data/spec/spec_helper.rb +9 -24
- metadata +105 -40
- data/lib/pio/features/format.rb +0 -18
- data/lib/pio/features/message.rb +0 -14
- data/lib/pio/type/open_flow.rb +0 -34
data/lib/pio/options.rb
CHANGED
data/lib/pio/parse_error.rb
CHANGED
data/lib/pio/pcap.rb
CHANGED
data/lib/pio/type/ip_address.rb
CHANGED
data/lib/pio/type/ipv4_header.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'pio/type/ip_address'
|
4
2
|
|
5
3
|
module Pio
|
@@ -7,6 +5,7 @@ module Pio
|
|
7
5
|
# IP Version 4 Header Format
|
8
6
|
module IPv4Header
|
9
7
|
# rubocop:disable MethodLength
|
8
|
+
# rubocop:disable AbcSize
|
10
9
|
def ipv4_header(options)
|
11
10
|
class_eval do
|
12
11
|
bit4 :ip_version, initial_value: 0x4
|
@@ -25,6 +24,7 @@ module Pio
|
|
25
24
|
ip_address :ip_destination_address
|
26
25
|
end
|
27
26
|
end
|
27
|
+
# rubocop:enable AbcSize
|
28
28
|
# rubocop:enable MethodLength
|
29
29
|
end
|
30
30
|
end
|
data/lib/pio/type/mac_address.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'bindata'
|
4
2
|
require 'pio/mac'
|
5
3
|
|
@@ -10,7 +8,12 @@ module Pio
|
|
10
8
|
array :octets, type: :uint8, initial_length: 6
|
11
9
|
|
12
10
|
def set(value)
|
13
|
-
|
11
|
+
case value
|
12
|
+
when String
|
13
|
+
self.octets = value.split(':').map { |each| ('0x' + each).hex }
|
14
|
+
else
|
15
|
+
self.octets = value.to_a
|
16
|
+
end
|
14
17
|
end
|
15
18
|
|
16
19
|
def get
|
data/lib/pio/type/udp_header.rb
CHANGED
data/lib/pio/version.rb
CHANGED
data/pio.gemspec
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
lib = File.expand_path('../lib', __FILE__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require 'pio/version'
|
@@ -34,37 +32,37 @@ Gem::Specification.new do |gem|
|
|
34
32
|
gem.test_files = Dir.glob('spec/**/*')
|
35
33
|
gem.test_files += Dir.glob('features/**/*')
|
36
34
|
|
37
|
-
gem.required_ruby_version = '>=
|
35
|
+
gem.required_ruby_version = '>= 2.0.0'
|
38
36
|
|
39
37
|
gem.add_dependency 'bindata', '~> 2.1.0'
|
40
38
|
|
41
39
|
gem.add_development_dependency 'rake'
|
42
|
-
gem.add_development_dependency 'bundler', '~> 1.6
|
43
|
-
gem.add_development_dependency 'pry', '~> 0.
|
40
|
+
gem.add_development_dependency 'bundler', '~> 1.7.6'
|
41
|
+
gem.add_development_dependency 'pry', '~> 0.10.1'
|
44
42
|
|
45
43
|
# Guard
|
46
|
-
gem.add_development_dependency 'guard', '~> 2.
|
44
|
+
gem.add_development_dependency 'guard', '~> 2.8.2'
|
47
45
|
gem.add_development_dependency 'guard-bundler', '~> 2.0.0'
|
48
|
-
gem.add_development_dependency 'guard-cucumber', '~> 1.
|
49
|
-
gem.add_development_dependency 'guard-rspec', '~> 4.
|
50
|
-
gem.add_development_dependency 'guard-rubocop', '~> 1.
|
46
|
+
gem.add_development_dependency 'guard-cucumber', '~> 1.5.1'
|
47
|
+
gem.add_development_dependency 'guard-rspec', '~> 4.3.1'
|
48
|
+
gem.add_development_dependency 'guard-rubocop', '~> 1.2.0'
|
51
49
|
gem.add_development_dependency 'rb-fchange', '~> 0.0.6'
|
52
50
|
gem.add_development_dependency 'rb-fsevent', '~> 0.9.4'
|
53
|
-
gem.add_development_dependency 'rb-inotify', '~> 0.9.
|
54
|
-
gem.add_development_dependency 'terminal-notifier-guard', '~> 1.
|
51
|
+
gem.add_development_dependency 'rb-inotify', '~> 0.9.5'
|
52
|
+
gem.add_development_dependency 'terminal-notifier-guard', '~> 1.6.4'
|
55
53
|
|
56
54
|
# Docs
|
57
|
-
gem.add_development_dependency 'inch', '~> 0.
|
58
|
-
gem.add_development_dependency 'yard', '~> 0.8.7.
|
55
|
+
gem.add_development_dependency 'inch', '~> 0.5.7'
|
56
|
+
gem.add_development_dependency 'yard', '~> 0.8.7.6'
|
59
57
|
|
60
58
|
# Test
|
61
|
-
gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.
|
62
|
-
gem.add_development_dependency 'coveralls', '~> 0.7.
|
63
|
-
gem.add_development_dependency 'cucumber', '~> 1.3.
|
59
|
+
gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.1'
|
60
|
+
gem.add_development_dependency 'coveralls', '~> 0.7.2'
|
61
|
+
gem.add_development_dependency 'cucumber', '~> 1.3.17'
|
64
62
|
gem.add_development_dependency 'flay', '~> 2.5.0'
|
65
|
-
gem.add_development_dependency 'flog', '~> 4.
|
66
|
-
gem.add_development_dependency 'reek', '~> 1.
|
67
|
-
gem.add_development_dependency 'rspec', '~> 3.
|
63
|
+
gem.add_development_dependency 'flog', '~> 4.3.0'
|
64
|
+
gem.add_development_dependency 'reek', '~> 1.4.0'
|
65
|
+
gem.add_development_dependency 'rspec', '~> 3.1.0'
|
68
66
|
gem.add_development_dependency 'rspec-given', '~> 3.5.4'
|
69
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
67
|
+
gem.add_development_dependency 'rubocop', '~> 0.27.1'
|
70
68
|
end
|
data/spec/pio/arp/reply_spec.rb
CHANGED
data/spec/pio/arp_spec.rb
CHANGED
data/spec/pio/dhcp/ack_spec.rb
CHANGED
data/spec/pio/dhcp/offer_spec.rb
CHANGED
data/spec/pio/dhcp_spec.rb
CHANGED
data/spec/pio/echo/reply_spec.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'pio'
|
1
|
+
require 'pio/echo'
|
4
2
|
|
5
3
|
describe Pio::Echo::Reply do
|
6
4
|
describe '.new' do
|
@@ -8,11 +6,11 @@ describe Pio::Echo::Reply do
|
|
8
6
|
When(:echo_reply) { Pio::Echo::Reply.new }
|
9
7
|
|
10
8
|
Then { echo_reply.ofp_version == 1 }
|
11
|
-
Then { echo_reply.message_type == Pio::
|
9
|
+
Then { echo_reply.message_type == Pio::OpenFlow::Type::ECHO_REPLY }
|
12
10
|
Then { echo_reply.message_length == 8 }
|
13
11
|
Then { echo_reply.transaction_id == 0 }
|
14
12
|
Then { echo_reply.xid == 0 }
|
15
|
-
Then { echo_reply.
|
13
|
+
Then { echo_reply.user_data == '' }
|
16
14
|
Then { echo_reply.to_binary == [1, 3, 0, 8, 0, 0, 0, 0].pack('C*') }
|
17
15
|
end
|
18
16
|
|
@@ -20,11 +18,11 @@ describe Pio::Echo::Reply do
|
|
20
18
|
When(:echo_reply) { Pio::Echo::Reply.new(123) }
|
21
19
|
|
22
20
|
Then { echo_reply.ofp_version == 1 }
|
23
|
-
Then { echo_reply.message_type == Pio::
|
21
|
+
Then { echo_reply.message_type == Pio::OpenFlow::Type::ECHO_REPLY }
|
24
22
|
Then { echo_reply.message_length == 8 }
|
25
23
|
Then { echo_reply.transaction_id == 123 }
|
26
24
|
Then { echo_reply.xid == 123 }
|
27
|
-
Then { echo_reply.
|
25
|
+
Then { echo_reply.user_data == '' }
|
28
26
|
Then { echo_reply.to_binary == [1, 3, 0, 8, 0, 0, 0, 123].pack('C*') }
|
29
27
|
end
|
30
28
|
|
@@ -41,11 +39,11 @@ describe Pio::Echo::Reply do
|
|
41
39
|
When(:echo_reply) { Pio::Echo::Reply.new(transaction_id: 123) }
|
42
40
|
|
43
41
|
Then { echo_reply.ofp_version == 1 }
|
44
|
-
Then { echo_reply.message_type == Pio::
|
42
|
+
Then { echo_reply.message_type == Pio::OpenFlow::Type::ECHO_REPLY }
|
45
43
|
Then { echo_reply.message_length == 8 }
|
46
44
|
Then { echo_reply.transaction_id == 123 }
|
47
45
|
Then { echo_reply.xid == 123 }
|
48
|
-
Then { echo_reply.
|
46
|
+
Then { echo_reply.user_data == '' }
|
49
47
|
Then { echo_reply.to_binary == [1, 3, 0, 8, 0, 0, 0, 123].pack('C*') }
|
50
48
|
end
|
51
49
|
|
@@ -53,23 +51,23 @@ describe Pio::Echo::Reply do
|
|
53
51
|
When(:echo_reply) { Pio::Echo::Reply.new(xid: 123) }
|
54
52
|
|
55
53
|
Then { echo_reply.ofp_version == 1 }
|
56
|
-
Then { echo_reply.message_type == Pio::
|
54
|
+
Then { echo_reply.message_type == Pio::OpenFlow::Type::ECHO_REPLY }
|
57
55
|
Then { echo_reply.message_length == 8 }
|
58
56
|
Then { echo_reply.transaction_id == 123 }
|
59
57
|
Then { echo_reply.xid == 123 }
|
60
|
-
Then { echo_reply.
|
58
|
+
Then { echo_reply.user_data == '' }
|
61
59
|
Then { echo_reply.to_binary == [1, 3, 0, 8, 0, 0, 0, 123].pack('C*') }
|
62
60
|
end
|
63
61
|
|
64
|
-
context "with transaction_id: 123,
|
65
|
-
When(:echo_reply) { Pio::Echo::Reply.new(xid: 123,
|
62
|
+
context "with transaction_id: 123, user_data: 'foobar'" do
|
63
|
+
When(:echo_reply) { Pio::Echo::Reply.new(xid: 123, user_data: 'foobar') }
|
66
64
|
|
67
65
|
Then { echo_reply.ofp_version == 1 }
|
68
|
-
Then { echo_reply.message_type == Pio::
|
66
|
+
Then { echo_reply.message_type == Pio::OpenFlow::Type::ECHO_REPLY }
|
69
67
|
Then { echo_reply.message_length == 14 }
|
70
68
|
Then { echo_reply.transaction_id == 123 }
|
71
69
|
Then { echo_reply.xid == 123 }
|
72
|
-
Then { echo_reply.
|
70
|
+
Then { echo_reply.user_data == 'foobar' }
|
73
71
|
Then do
|
74
72
|
echo_reply.to_binary ==
|
75
73
|
[1, 3, 0, 14, 0, 0, 0, 123, 102, 111, 111, 98, 97, 114].pack('C*')
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'pio'
|
1
|
+
require 'pio/echo'
|
4
2
|
|
5
3
|
describe Pio::Echo::Request do
|
6
4
|
describe '.new' do
|
@@ -8,11 +6,11 @@ describe Pio::Echo::Request do
|
|
8
6
|
When(:echo_request) { Pio::Echo::Request.new }
|
9
7
|
|
10
8
|
Then { echo_request.ofp_version == 1 }
|
11
|
-
Then { echo_request.message_type == Pio::
|
9
|
+
Then { echo_request.message_type == Pio::OpenFlow::Type::ECHO_REQUEST }
|
12
10
|
Then { echo_request.message_length == 8 }
|
13
11
|
Then { echo_request.transaction_id == 0 }
|
14
12
|
Then { echo_request.xid == 0 }
|
15
|
-
Then { echo_request.
|
13
|
+
Then { echo_request.user_data == '' }
|
16
14
|
Then { echo_request.to_binary == [1, 2, 0, 8, 0, 0, 0, 0].pack('C*') }
|
17
15
|
end
|
18
16
|
|
@@ -20,11 +18,11 @@ describe Pio::Echo::Request do
|
|
20
18
|
When(:echo_request) { Pio::Echo::Request.new(123) }
|
21
19
|
|
22
20
|
Then { echo_request.ofp_version == 1 }
|
23
|
-
Then { echo_request.message_type == Pio::
|
21
|
+
Then { echo_request.message_type == Pio::OpenFlow::Type::ECHO_REQUEST }
|
24
22
|
Then { echo_request.message_length == 8 }
|
25
23
|
Then { echo_request.transaction_id == 123 }
|
26
24
|
Then { echo_request.xid == 123 }
|
27
|
-
Then { echo_request.
|
25
|
+
Then { echo_request.user_data == '' }
|
28
26
|
Then { echo_request.to_binary == [1, 2, 0, 8, 0, 0, 0, 123].pack('C*') }
|
29
27
|
end
|
30
28
|
|
@@ -41,11 +39,11 @@ describe Pio::Echo::Request do
|
|
41
39
|
When(:echo_request) { Pio::Echo::Request.new(transaction_id: 123) }
|
42
40
|
|
43
41
|
Then { echo_request.ofp_version == 1 }
|
44
|
-
Then { echo_request.message_type == Pio::
|
42
|
+
Then { echo_request.message_type == Pio::OpenFlow::Type::ECHO_REQUEST }
|
45
43
|
Then { echo_request.message_length == 8 }
|
46
44
|
Then { echo_request.transaction_id == 123 }
|
47
45
|
Then { echo_request.xid == 123 }
|
48
|
-
Then { echo_request.
|
46
|
+
Then { echo_request.user_data == '' }
|
49
47
|
Then { echo_request.to_binary == [1, 2, 0, 8, 0, 0, 0, 123].pack('C*') }
|
50
48
|
end
|
51
49
|
|
@@ -53,23 +51,25 @@ describe Pio::Echo::Request do
|
|
53
51
|
When(:echo_request) { Pio::Echo::Request.new(xid: 123) }
|
54
52
|
|
55
53
|
Then { echo_request.ofp_version == 1 }
|
56
|
-
Then { echo_request.message_type == Pio::
|
54
|
+
Then { echo_request.message_type == Pio::OpenFlow::Type::ECHO_REQUEST }
|
57
55
|
Then { echo_request.message_length == 8 }
|
58
56
|
Then { echo_request.transaction_id == 123 }
|
59
57
|
Then { echo_request.xid == 123 }
|
60
|
-
Then { echo_request.
|
58
|
+
Then { echo_request.user_data == '' }
|
61
59
|
Then { echo_request.to_binary == [1, 2, 0, 8, 0, 0, 0, 123].pack('C*') }
|
62
60
|
end
|
63
61
|
|
64
|
-
context "with transaction_id: 123,
|
65
|
-
When(:echo_request)
|
62
|
+
context "with transaction_id: 123, user_data: 'foobar'" do
|
63
|
+
When(:echo_request) do
|
64
|
+
Pio::Echo::Request.new(xid: 123, user_data: 'foobar')
|
65
|
+
end
|
66
66
|
|
67
67
|
Then { echo_request.ofp_version == 1 }
|
68
|
-
Then { echo_request.message_type == Pio::
|
68
|
+
Then { echo_request.message_type == Pio::OpenFlow::Type::ECHO_REQUEST }
|
69
69
|
Then { echo_request.message_length == 14 }
|
70
70
|
Then { echo_request.transaction_id == 123 }
|
71
71
|
Then { echo_request.xid == 123 }
|
72
|
-
Then { echo_request.
|
72
|
+
Then { echo_request.user_data == 'foobar' }
|
73
73
|
Then do
|
74
74
|
echo_request.to_binary ==
|
75
75
|
[1, 2, 0, 14, 0, 0, 0, 123, 102, 111, 111, 98, 97, 114].pack('C*')
|
data/spec/pio/echo_spec.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'pio'
|
1
|
+
require 'pio/echo'
|
4
2
|
|
5
3
|
describe Pio::Echo do
|
6
4
|
describe '.read' do
|
@@ -15,10 +13,10 @@ describe Pio::Echo do
|
|
15
13
|
|
16
14
|
Then { echo_request.class == Pio::Echo::Request }
|
17
15
|
Then { echo_request.ofp_version == 1 }
|
18
|
-
Then { echo_request.message_type == Pio::
|
16
|
+
Then { echo_request.message_type == Pio::OpenFlow::Type::ECHO_REQUEST }
|
19
17
|
Then { echo_request.message_length == 8 }
|
20
18
|
Then { echo_request.xid == 0 }
|
21
|
-
Then { echo_request.
|
19
|
+
Then { echo_request.user_data == '' }
|
22
20
|
Then { echo_request.to_binary == echo_request_dump }
|
23
21
|
end
|
24
22
|
|
@@ -33,10 +31,10 @@ describe Pio::Echo do
|
|
33
31
|
|
34
32
|
Then { echo_reply.class == Pio::Echo::Reply }
|
35
33
|
Then { echo_reply.ofp_version == 1 }
|
36
|
-
Then { echo_reply.message_type == Pio::
|
34
|
+
Then { echo_reply.message_type == Pio::OpenFlow::Type::ECHO_REPLY }
|
37
35
|
Then { echo_reply.message_length == 8 }
|
38
36
|
Then { echo_reply.xid == 0 }
|
39
|
-
Then { echo_reply.
|
37
|
+
Then { echo_reply.user_data == '' }
|
40
38
|
Then { echo_reply.to_binary == echo_reply_dump }
|
41
39
|
end
|
42
40
|
|
@@ -1,30 +1,60 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'pio'
|
1
|
+
require 'pio/features'
|
4
2
|
|
5
3
|
describe Pio::Features::Reply do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
Given(:options) do
|
5
|
+
{
|
6
|
+
dpid: 0x123,
|
7
|
+
n_buffers: 0x100,
|
8
|
+
n_tables: 0xfe,
|
9
|
+
capabilities: [:flow_stats, :table_stats, :port_stats, :queue_stats,
|
10
|
+
:arp_match_ip],
|
11
|
+
actions: [:output, :set_vlan_vid, :set_vlan_pcp, :strip_vlan,
|
12
|
+
:set_dl_src, :set_dl_dst, :set_nw_src, :set_nw_dst,
|
13
|
+
:set_nw_tos, :set_tp_src, :set_tp_dst, :enqueue],
|
14
|
+
ports: [{ port_no: 1,
|
15
|
+
hardware_address: '11:22:33:44:55:66',
|
16
|
+
name: 'port123',
|
17
|
+
config: [:port_down],
|
18
|
+
state: [:link_down],
|
19
|
+
curr: [:port_10gb_fd, :port_copper] }]
|
20
|
+
}
|
21
|
+
end
|
16
22
|
|
23
|
+
describe '.new' do
|
17
24
|
When(:features_reply) { Pio::Features::Reply.new(options) }
|
18
25
|
|
19
26
|
Then { features_reply.ofp_version == 1 }
|
20
|
-
Then { features_reply.message_type == Pio::
|
27
|
+
Then { features_reply.message_type == Pio::OpenFlow::Type::FEATURES_REPLY }
|
21
28
|
Then { features_reply.transaction_id == 0 }
|
22
29
|
Then { features_reply.xid == 0 }
|
23
30
|
Then { features_reply.dpid == 0x123 }
|
24
31
|
Then { features_reply.n_buffers == 0x100 }
|
25
32
|
Then { features_reply.n_tables == 0xfe }
|
26
|
-
Then
|
27
|
-
|
28
|
-
|
33
|
+
Then do
|
34
|
+
features_reply.capabilities ==
|
35
|
+
[:flow_stats, :table_stats, :port_stats, :queue_stats, :arp_match_ip]
|
36
|
+
end
|
37
|
+
Then do
|
38
|
+
features_reply.actions ==
|
39
|
+
[:output, :set_vlan_vid, :set_vlan_pcp, :strip_vlan, :set_dl_src,
|
40
|
+
:set_dl_dst, :set_nw_src, :set_nw_dst, :set_nw_tos, :set_tp_src,
|
41
|
+
:set_tp_dst, :enqueue]
|
42
|
+
end
|
43
|
+
Then { features_reply.ports.length == 1 }
|
44
|
+
Then { features_reply.ports[0].port_no == 1 }
|
45
|
+
Then { features_reply.ports[0].hardware_address == '11:22:33:44:55:66' }
|
46
|
+
Then { features_reply.ports[0].name == 'port123' }
|
47
|
+
Then { features_reply.ports[0].config == [:port_down] }
|
48
|
+
Then { features_reply.ports[0].state == [:link_down] }
|
49
|
+
Then { features_reply.ports[0].curr == [:port_10gb_fd, :port_copper] }
|
50
|
+
Then { features_reply.ports[0].advertised.empty? }
|
51
|
+
Then { features_reply.ports[0].supported.empty? }
|
52
|
+
Then { features_reply.ports[0].peer.empty? }
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#to_binary' do
|
56
|
+
When(:binary) { Pio::Features::Reply.new(options).to_binary }
|
57
|
+
|
58
|
+
Then { binary.length > 0 }
|
29
59
|
end
|
30
60
|
end
|