pio 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/README.md +24 -11
  4. data/Rakefile +0 -2
  5. data/examples/features_new.rb +17 -6
  6. data/features/packet_data/aggregate_stats_reply.raw +0 -0
  7. data/features/packet_data/aggregate_stats_request.raw +0 -0
  8. data/features/packet_data/barrier_reply.raw +0 -0
  9. data/features/packet_data/barrier_request.raw +0 -0
  10. data/features/packet_data/desc_stats_reply.raw +0 -0
  11. data/features/packet_data/desc_stats_request.raw +0 -0
  12. data/features/packet_data/echo_reply.raw +0 -0
  13. data/features/packet_data/echo_request.raw +0 -0
  14. data/features/packet_data/error.raw +0 -0
  15. data/features/packet_data/features_reply.raw +0 -0
  16. data/features/packet_data/flow_mod_add.raw +0 -0
  17. data/features/packet_data/flow_mod_delete.raw +0 -0
  18. data/features/packet_data/flow_removed.raw +0 -0
  19. data/features/packet_data/flow_stats_reply.raw +0 -0
  20. data/features/packet_data/flow_stats_request.raw +0 -0
  21. data/features/packet_data/get_config_reply.raw +0 -0
  22. data/features/packet_data/get_config_request.raw +0 -0
  23. data/features/packet_data/hello.raw +0 -0
  24. data/features/packet_data/packet_in.raw +0 -0
  25. data/features/packet_data/packet_out.raw +0 -0
  26. data/features/packet_data/port_mod.raw +0 -0
  27. data/features/packet_data/port_stats_reply.raw +0 -0
  28. data/features/packet_data/port_stats_request.raw +0 -0
  29. data/features/packet_data/port_status.raw +0 -0
  30. data/features/packet_data/queue_get_config_reply.raw +0 -0
  31. data/features/packet_data/queue_get_config_request.raw +0 -0
  32. data/features/packet_data/set_config.raw +0 -0
  33. data/features/packet_data/table_stats_reply.raw +0 -0
  34. data/features/packet_data/table_stats_request.raw +0 -0
  35. data/features/packet_data/vendor.raw +0 -0
  36. data/features/packet_data/vendor_stats_request.raw +0 -0
  37. data/features/step_definitions/packet_data_steps.rb +0 -2
  38. data/features/step_definitions/pending_steps.rb +0 -2
  39. data/features/support/env.rb +0 -2
  40. data/lib/pio.rb +0 -2
  41. data/lib/pio/arp.rb +0 -2
  42. data/lib/pio/arp/format.rb +0 -2
  43. data/lib/pio/arp/message.rb +14 -22
  44. data/lib/pio/arp/reply.rb +0 -2
  45. data/lib/pio/arp/request.rb +0 -2
  46. data/lib/pio/dhcp.rb +0 -2
  47. data/lib/pio/dhcp/ack.rb +0 -2
  48. data/lib/pio/dhcp/boot_reply.rb +0 -2
  49. data/lib/pio/dhcp/boot_reply_options.rb +0 -2
  50. data/lib/pio/dhcp/boot_request.rb +0 -2
  51. data/lib/pio/dhcp/boot_request_options.rb +0 -2
  52. data/lib/pio/dhcp/client_id.rb +0 -2
  53. data/lib/pio/dhcp/common_options.rb +0 -2
  54. data/lib/pio/dhcp/csum_util.rb +0 -2
  55. data/lib/pio/dhcp/dhcp_field.rb +0 -2
  56. data/lib/pio/dhcp/dhcp_tlv_options.rb +0 -2
  57. data/lib/pio/dhcp/discover.rb +0 -2
  58. data/lib/pio/dhcp/field_util.rb +0 -2
  59. data/lib/pio/dhcp/frame.rb +0 -2
  60. data/lib/pio/dhcp/message.rb +0 -2
  61. data/lib/pio/dhcp/offer.rb +0 -2
  62. data/lib/pio/dhcp/optional_tlv.rb +0 -2
  63. data/lib/pio/dhcp/parameter_list.rb +0 -2
  64. data/lib/pio/dhcp/request.rb +0 -2
  65. data/lib/pio/echo.rb +3 -6
  66. data/lib/pio/echo/format.rb +10 -6
  67. data/lib/pio/echo/message.rb +16 -41
  68. data/lib/pio/echo/reply.rb +8 -7
  69. data/lib/pio/echo/request.rb +6 -6
  70. data/lib/pio/features.rb +15 -9
  71. data/lib/pio/features/reply.rb +79 -44
  72. data/lib/pio/features/request.rb +30 -28
  73. data/lib/pio/hello.rb +17 -29
  74. data/lib/pio/hello/format.rb +8 -8
  75. data/lib/pio/icmp.rb +0 -2
  76. data/lib/pio/icmp/format.rb +0 -2
  77. data/lib/pio/icmp/message.rb +23 -31
  78. data/lib/pio/icmp/options.rb +0 -2
  79. data/lib/pio/icmp/reply.rb +2 -4
  80. data/lib/pio/icmp/request.rb +0 -2
  81. data/lib/pio/ipv4_address.rb +1 -5
  82. data/lib/pio/lldp.rb +0 -2
  83. data/lib/pio/lldp/chassis_id_tlv.rb +0 -2
  84. data/lib/pio/lldp/end_of_lldpdu_value.rb +0 -2
  85. data/lib/pio/lldp/frame.rb +0 -2
  86. data/lib/pio/lldp/management_address_value.rb +0 -2
  87. data/lib/pio/lldp/optional_tlv.rb +0 -2
  88. data/lib/pio/lldp/options.rb +0 -2
  89. data/lib/pio/lldp/organizationally_specific_value.rb +0 -2
  90. data/lib/pio/lldp/port_description_value.rb +0 -2
  91. data/lib/pio/lldp/port_id_tlv.rb +0 -2
  92. data/lib/pio/lldp/system_capabilities_value.rb +0 -2
  93. data/lib/pio/lldp/system_description_value.rb +0 -2
  94. data/lib/pio/lldp/system_name_value.rb +0 -2
  95. data/lib/pio/lldp/ttl_tlv.rb +0 -2
  96. data/lib/pio/mac.rb +2 -6
  97. data/lib/pio/message_type_selector.rb +5 -4
  98. data/lib/pio/open_flow.rb +5 -0
  99. data/lib/pio/open_flow/flags.rb +38 -0
  100. data/lib/pio/open_flow/message.rb +20 -0
  101. data/lib/pio/open_flow/open_flow_header.rb +18 -0
  102. data/lib/pio/open_flow/phy_port.rb +74 -0
  103. data/lib/pio/open_flow/type.rb +12 -0
  104. data/lib/pio/options.rb +0 -2
  105. data/lib/pio/parse_error.rb +0 -2
  106. data/lib/pio/pcap.rb +0 -2
  107. data/lib/pio/type/ethernet_header.rb +0 -2
  108. data/lib/pio/type/ip_address.rb +0 -2
  109. data/lib/pio/type/ipv4_header.rb +2 -2
  110. data/lib/pio/type/mac_address.rb +6 -3
  111. data/lib/pio/type/udp_header.rb +0 -2
  112. data/lib/pio/version.rb +1 -3
  113. data/pio.gemspec +18 -20
  114. data/spec/pio/arp/reply/options_spec.rb +0 -2
  115. data/spec/pio/arp/reply_spec.rb +0 -2
  116. data/spec/pio/arp/request/options_spec.rb +0 -2
  117. data/spec/pio/arp/request_spec.rb +0 -2
  118. data/spec/pio/arp_spec.rb +0 -2
  119. data/spec/pio/dhcp/ack_spec.rb +0 -2
  120. data/spec/pio/dhcp/discover_spec.rb +0 -2
  121. data/spec/pio/dhcp/offer_spec.rb +0 -2
  122. data/spec/pio/dhcp/request_spec.rb +0 -2
  123. data/spec/pio/dhcp_spec.rb +0 -2
  124. data/spec/pio/echo/reply_spec.rb +13 -15
  125. data/spec/pio/echo/request_spec.rb +15 -15
  126. data/spec/pio/echo_spec.rb +5 -7
  127. data/spec/pio/features/reply_spec.rb +47 -17
  128. data/spec/pio/features/request_spec.rb +6 -11
  129. data/spec/pio/features_spec.rb +70 -51
  130. data/spec/pio/hello_spec.rb +1 -3
  131. data/spec/pio/icmp/reply_spec.rb +0 -2
  132. data/spec/pio/icmp/request_spec.rb +0 -2
  133. data/spec/pio/icmp_spec.rb +0 -2
  134. data/spec/pio/ipv4_address_spec.rb +0 -2
  135. data/spec/pio/lldp/options_spec.rb +0 -2
  136. data/spec/pio/lldp_spec.rb +0 -2
  137. data/spec/pio/mac_spec.rb +0 -1
  138. data/spec/pio/open_flow/phy_port_spec.rb +25 -0
  139. data/spec/pio/open_flow/type_spec.rb +5 -0
  140. data/spec/spec_helper.rb +9 -24
  141. metadata +105 -40
  142. data/lib/pio/features/format.rb +0 -18
  143. data/lib/pio/features/message.rb +0 -14
  144. data/lib/pio/type/open_flow.rb +0 -34
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
-
3
- require 'pio'
1
+ require 'pio/features'
4
2
 
5
3
  describe Pio::Features::Request do
6
4
  describe '.new' do
@@ -8,7 +6,7 @@ describe Pio::Features::Request do
8
6
  When(:request) { Pio::Features::Request.new }
9
7
 
10
8
  Then { request.ofp_version == 1 }
11
- Then { request.message_type == Pio::Features::REQUEST }
9
+ Then { request.message_type == Pio::OpenFlow::Type::FEATURES_REQUEST }
12
10
  Then { request.message_length == 8 }
13
11
  Then { request.transaction_id == 0 }
14
12
  Then { request.xid == 0 }
@@ -20,7 +18,7 @@ describe Pio::Features::Request do
20
18
  When(:request) { Pio::Features::Request.new(123) }
21
19
 
22
20
  Then { request.ofp_version == 1 }
23
- Then { request.message_type == Pio::Features::REQUEST }
21
+ Then { request.message_type == Pio::OpenFlow::Type::FEATURES_REQUEST }
24
22
  Then { request.message_length == 8 }
25
23
  Then { request.transaction_id == 123 }
26
24
  Then { request.xid == 123 }
@@ -31,17 +29,14 @@ describe Pio::Features::Request do
31
29
  context 'with 2**32' do
32
30
  When(:result) { Pio::Features::Request.new(2**32) }
33
31
 
34
- Then do
35
- pending 'check if xid is within 32bit range.'
36
- result == Failure(ArgumentError)
37
- end
32
+ Then { result == Failure(ArgumentError) }
38
33
  end
39
34
 
40
35
  context 'with transaction_id: 123' do
41
36
  When(:request) { Pio::Features::Request.new(transaction_id: 123) }
42
37
 
43
38
  Then { request.ofp_version == 1 }
44
- Then { request.message_type == Pio::Features::REQUEST }
39
+ Then { request.message_type == Pio::OpenFlow::Type::FEATURES_REQUEST }
45
40
  Then { request.message_length == 8 }
46
41
  Then { request.transaction_id == 123 }
47
42
  Then { request.xid == 123 }
@@ -53,7 +48,7 @@ describe Pio::Features::Request do
53
48
  When(:request) { Pio::Features::Request.new(xid: 123) }
54
49
 
55
50
  Then { request.ofp_version == 1 }
56
- Then { request.message_type == Pio::Features::REQUEST }
51
+ Then { request.message_type == Pio::OpenFlow::Type::FEATURES_REQUEST }
57
52
  Then { request.message_length == 8 }
58
53
  Then { request.transaction_id == 123 }
59
54
  Then { request.xid == 123 }
@@ -1,70 +1,86 @@
1
- # encoding: utf-8
2
-
3
- require 'pio'
1
+ require 'pio/features'
4
2
 
5
3
  describe Pio::Features do
6
4
  describe '.read' do
7
5
  context 'with a Features Request message' do
8
- Given(:features_request_dump) { [1, 5, 0, 8, 0, 0, 0, 0].pack('C*') }
6
+ Given(:request_dump) { [1, 5, 0, 8, 0, 0, 0, 0].pack('C*') }
9
7
 
10
- When(:features_request) { Pio::Features.read(features_request_dump) }
8
+ When(:request) { Pio::Features.read(request_dump) }
11
9
 
12
- Then { features_request.class == Pio::Features::Request }
13
- Then { features_request.ofp_version == 1 }
14
- Then { features_request.message_type == Pio::Features::REQUEST }
15
- Then { features_request.message_length == 8 }
16
- Then { features_request.transaction_id == 0 }
17
- Then { features_request.xid == 0 }
18
- Then { features_request.body.empty? }
10
+ Then { request.class == Pio::Features::Request }
11
+ Then { request.ofp_version == 1 }
12
+ Then do
13
+ request.message_type ==
14
+ Pio::OpenFlow::Type::FEATURES_REQUEST
15
+ end
16
+ Then { request.message_length == 8 }
17
+ Then { request.transaction_id == 0 }
18
+ Then { request.xid == 0 }
19
+ Then { request.body.empty? }
19
20
  end
20
21
 
21
22
  context 'with a Features Reply message' do
22
- Given(:features_reply_dump) do
23
- [0x01, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
24
- 0xe2, 0xfc, 0x0f, 0xae, 0x66, 0x4d, 0x00, 0x00, 0x01, 0x00,
25
- 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00,
26
- 0x0f, 0xff, 0x00, 0x03, 0x82, 0xb0, 0xff, 0x6e, 0x51, 0x44,
27
- 0x76, 0x65, 0x74, 0x68, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
23
+ Given(:reply_dump) do
24
+ [0x01, 0x06, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
25
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
26
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00,
27
+ 0x0f, 0xff, 0x00, 0x02, 0x16, 0x7d, 0xa4, 0x37, 0xba, 0x10,
28
+ 0x74, 0x72, 0x65, 0x6d, 0x61, 0x30, 0x2d, 0x30, 0x00, 0x00,
28
29
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29
30
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00,
30
31
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31
- 0x00, 0x01, 0x9e, 0x49, 0x7d, 0x7c, 0x06, 0x8d, 0x76, 0x65,
32
- 0x74, 0x68, 0x32, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
35
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
36
- 0x12, 0x13, 0xb4, 0x13, 0x4c, 0x19, 0x76, 0x65, 0x74, 0x68,
37
- 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32
+ 0xff, 0xfe, 0x2a, 0xb4, 0xd6, 0x3c, 0x66, 0xba, 0x76, 0x73,
33
+ 0x77, 0x5f, 0x30, 0x78, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
34
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
35
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
36
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
37
+ 0x62, 0x94, 0x3a, 0xf6, 0x40, 0xdb, 0x74, 0x72, 0x65, 0x6d,
38
+ 0x61, 0x31, 0x2d, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38
39
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39
40
  0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x86, 0xbd,
41
- 0xe3, 0xad, 0x3d, 0x73, 0x76, 0x65, 0x74, 0x68, 0x31, 0x62,
42
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44
- 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45
- 0x00, 0x00, 0x00, 0x00, 0xff, 0xfe, 0xe2, 0xfc, 0x0f, 0xae,
46
- 0x66, 0x4d, 0x62, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
47
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50
- 0x00, 0x00].pack('C*')
41
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00].pack('C*')
51
42
  end
52
43
 
53
- When(:features_reply) { Pio::Features.read(features_reply_dump) }
44
+ When(:reply) { Pio::Features.read(reply_dump) }
54
45
 
55
- Then { features_reply.class == Pio::Features::Reply }
56
- Then { features_reply.ofp_version == 1 }
57
- Then { features_reply.message_type == Pio::Features::REPLY }
58
- Then { features_reply.message_length == 272 }
59
- Then { features_reply.transaction_id == 2 }
60
- Then { features_reply.xid == 2 }
61
- Then { !features_reply.body.empty? }
62
- Then { features_reply.datapath_id == 0xe2fc0fae664d }
63
- Then { features_reply.n_buffers == 0x100 }
64
- Then { features_reply.n_tables == 0xfe }
65
- Then { features_reply.capabilities == 0xc7 }
66
- Then { features_reply.actions == 0xfff }
67
- Then { features_reply.ports.size == 7 }
46
+ Then { reply.class == Pio::Features::Reply }
47
+ Then { reply.ofp_version == 1 }
48
+ Then do
49
+ reply.message_type ==
50
+ Pio::OpenFlow::Type::FEATURES_REPLY
51
+ end
52
+ Then { reply.message_length == 176 }
53
+ Then { reply.transaction_id == 2 }
54
+ Then { reply.xid == 2 }
55
+ Then { !reply.body.empty? }
56
+ Then { reply.datapath_id == 1 }
57
+ Then { reply.n_buffers == 0x100 }
58
+ Then { reply.n_tables == 1 }
59
+ Then do
60
+ reply.capabilities ==
61
+ [:flow_stats, :table_stats, :port_stats, :arp_match_ip]
62
+ end
63
+ Then do
64
+ reply.actions ==
65
+ [:output, :set_vlan_vid, :set_vlan_pcp, :strip_vlan,
66
+ :set_dl_src, :set_dl_dst, :set_nw_src, :set_nw_dst,
67
+ :set_nw_tos, :set_tp_src, :set_tp_dst, :enqueue]
68
+ end
69
+ Then { reply.ports.size == 3 }
70
+ Then { reply.ports.all? { |each| each.port_no > 0 } }
71
+ Then do
72
+ reply.ports.all? do |each|
73
+ /^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/i=~
74
+ each.hardware_address.to_s
75
+ end
76
+ end
77
+ Then { reply.ports.all? { |each| !each.name.empty? } }
78
+ Then { reply.ports.any? { |each| each.config == [:port_down] } }
79
+ Then { reply.ports.any? { |each| each.state == [:link_down] } }
80
+ Then { reply.ports.all? { |each| each.curr.include? :port_copper } }
81
+ Then { reply.ports.all? { |each| each.advertised.empty? } }
82
+ Then { reply.ports.all? { |each| each.supported.empty? } }
83
+ Then { reply.ports.all? { |each| each.peer.empty? } }
68
84
  end
69
85
 
70
86
  context 'with a Hello message' do
@@ -72,7 +88,10 @@ describe Pio::Features do
72
88
 
73
89
  When(:result) { Pio::Features.read(hello_dump) }
74
90
 
75
- Then { result == Failure(Pio::ParseError) }
91
+ Then do
92
+ result == Failure(Pio::ParseError,
93
+ 'Invalid features request/reply message.')
94
+ end
76
95
  end
77
96
  end
78
97
  end
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
-
3
- require 'pio'
1
+ require 'pio/hello'
4
2
 
5
3
  describe Pio::Hello do
6
4
  describe '.read' do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'pio'
4
2
 
5
3
  describe Pio::ICMP::Reply do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'pio'
4
2
 
5
3
  describe Pio::ICMP::Request do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'pio'
4
2
 
5
3
  describe Pio::ICMP do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'pio/ipv4_address'
4
2
 
5
3
  describe Pio::IPv4Address do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'pio'
4
2
 
5
3
  describe Pio::Lldp::Options, '.new' do
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'pio'
4
2
 
5
3
  describe Pio::LLDP do
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  require 'pio/mac'
3
2
 
4
3
  describe Pio::Mac do
@@ -0,0 +1,25 @@
1
+ require 'pio'
2
+
3
+ describe Pio::Type::OpenFlow::PhyPort do
4
+ describe '.new' do
5
+ When(:phy_port) do
6
+ Pio::Type::OpenFlow::PhyPort.new(port_no: 1,
7
+ hardware_address: '11:22:33:44:55:66',
8
+ name: 'port123',
9
+ config: [:port_down],
10
+ state: [:link_down],
11
+ curr: [:port_10gb_fd, :port_copper])
12
+ end
13
+
14
+ Then { phy_port.port_no == 1 }
15
+ Then { phy_port.hardware_address == '11:22:33:44:55:66' }
16
+ Then { phy_port.name == 'port123' }
17
+ Then { phy_port.config == [:port_down] }
18
+ Then { phy_port.state == [:link_down] }
19
+ Then { phy_port.curr == [:port_10gb_fd, :port_copper] }
20
+ Then { phy_port.advertised.empty? }
21
+ Then { phy_port.supported.empty? }
22
+ Then { phy_port.peer.empty? }
23
+ Then { phy_port.to_binary_s.length > 0 }
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ require 'pio'
2
+
3
+ describe Pio::OpenFlow::Type do
4
+ Then { Pio::OpenFlow::Type.constants.include?(:HELLO) == true }
5
+ end
@@ -1,29 +1,14 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
-
5
- require 'codeclimate-test-reporter'
6
- CodeClimate::TestReporter.start
7
-
8
1
  require 'simplecov'
9
- SimpleCov.start
10
-
11
- require 'rspec'
12
- require 'rspec/given'
2
+ require 'codeclimate-test-reporter'
3
+ require 'coveralls'
13
4
 
14
- RSpec.configure do | config |
15
- config.expect_with :rspec do | c |
16
- c.syntax = :expect
17
- end
5
+ formatters = [SimpleCov::Formatter::HTMLFormatter]
6
+ formatters << Coveralls::SimpleCov::Formatter if ENV['COVERALLS_REPO_TOKEN']
7
+ if ENV['CODECLIMATE_REPO_TOKEN']
8
+ formatters << CodeClimate::TestReporter::Formatter
18
9
  end
19
10
 
20
- # Requires supporting files with custom matchers and macros, etc,
21
- # in ./support/ and its subdirectories.
22
- Dir[ "#{File.dirname(__FILE__)}/support/**/*.rb"].each do | each |
23
- require File.expand_path(each)
24
- end
11
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
12
+ SimpleCov.start { add_filter '/vendor/' }
25
13
 
26
- if ENV['TRAVIS']
27
- require 'coveralls'
28
- Coveralls.wear!
29
- end
14
+ require 'rspec/given'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 1.6.2
47
+ version: 1.7.6
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 1.6.2
54
+ version: 1.7.6
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.12.6
61
+ version: 0.10.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 0.9.12.6
68
+ version: 0.10.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 2.6.1
75
+ version: 2.8.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: 2.6.1
82
+ version: 2.8.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: guard-bundler
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,42 +100,42 @@ dependencies:
100
100
  requirements:
101
101
  - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: 1.4.1
103
+ version: 1.5.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 1.4.1
110
+ version: 1.5.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: guard-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 4.2.9
117
+ version: 4.3.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ~>
123
123
  - !ruby/object:Gem::Version
124
- version: 4.2.9
124
+ version: 4.3.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: guard-rubocop
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: 1.1.0
131
+ version: 1.2.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: 1.1.0
138
+ version: 1.2.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rb-fchange
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,98 +170,98 @@ dependencies:
170
170
  requirements:
171
171
  - - ~>
172
172
  - !ruby/object:Gem::Version
173
- version: 0.9.3
173
+ version: 0.9.5
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ~>
179
179
  - !ruby/object:Gem::Version
180
- version: 0.9.3
180
+ version: 0.9.5
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: terminal-notifier-guard
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ~>
186
186
  - !ruby/object:Gem::Version
187
- version: 1.5.3
187
+ version: 1.6.4
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ~>
193
193
  - !ruby/object:Gem::Version
194
- version: 1.5.3
194
+ version: 1.6.4
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: inch
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - ~>
200
200
  - !ruby/object:Gem::Version
201
- version: 0.4.6
201
+ version: 0.5.7
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ~>
207
207
  - !ruby/object:Gem::Version
208
- version: 0.4.6
208
+ version: 0.5.7
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: yard
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ~>
214
214
  - !ruby/object:Gem::Version
215
- version: 0.8.7.4
215
+ version: 0.8.7.6
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - ~>
221
221
  - !ruby/object:Gem::Version
222
- version: 0.8.7.4
222
+ version: 0.8.7.6
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: codeclimate-test-reporter
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ~>
228
228
  - !ruby/object:Gem::Version
229
- version: 0.3.0
229
+ version: 0.4.1
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - ~>
235
235
  - !ruby/object:Gem::Version
236
- version: 0.3.0
236
+ version: 0.4.1
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: coveralls
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - ~>
242
242
  - !ruby/object:Gem::Version
243
- version: 0.7.0
243
+ version: 0.7.2
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - ~>
249
249
  - !ruby/object:Gem::Version
250
- version: 0.7.0
250
+ version: 0.7.2
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: cucumber
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - ~>
256
256
  - !ruby/object:Gem::Version
257
- version: 1.3.15
257
+ version: 1.3.17
258
258
  type: :development
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - ~>
263
263
  - !ruby/object:Gem::Version
264
- version: 1.3.15
264
+ version: 1.3.17
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: flay
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -282,42 +282,42 @@ dependencies:
282
282
  requirements:
283
283
  - - ~>
284
284
  - !ruby/object:Gem::Version
285
- version: 4.2.1
285
+ version: 4.3.0
286
286
  type: :development
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - ~>
291
291
  - !ruby/object:Gem::Version
292
- version: 4.2.1
292
+ version: 4.3.0
293
293
  - !ruby/object:Gem::Dependency
294
294
  name: reek
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ~>
298
298
  - !ruby/object:Gem::Version
299
- version: 1.3.7
299
+ version: 1.4.0
300
300
  type: :development
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - ~>
305
305
  - !ruby/object:Gem::Version
306
- version: 1.3.7
306
+ version: 1.4.0
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: rspec
309
309
  requirement: !ruby/object:Gem::Requirement
310
310
  requirements:
311
311
  - - ~>
312
312
  - !ruby/object:Gem::Version
313
- version: 3.0.0
313
+ version: 3.1.0
314
314
  type: :development
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - ~>
319
319
  - !ruby/object:Gem::Version
320
- version: 3.0.0
320
+ version: 3.1.0
321
321
  - !ruby/object:Gem::Dependency
322
322
  name: rspec-given
323
323
  requirement: !ruby/object:Gem::Requirement
@@ -338,14 +338,14 @@ dependencies:
338
338
  requirements:
339
339
  - - ~>
340
340
  - !ruby/object:Gem::Version
341
- version: 0.23.0
341
+ version: 0.27.1
342
342
  type: :development
343
343
  prerelease: false
344
344
  version_requirements: !ruby/object:Gem::Requirement
345
345
  requirements:
346
346
  - - ~>
347
347
  - !ruby/object:Gem::Version
348
- version: 0.23.0
348
+ version: 0.27.1
349
349
  description: Pure ruby packet parser and generator.
350
350
  email:
351
351
  - yasuhito@gmail.com
@@ -383,16 +383,45 @@ files:
383
383
  - features/hello_read.feature
384
384
  - features/icmp_read.feature
385
385
  - features/lldp_read.feature
386
+ - features/packet_data/aggregate_stats_reply.raw
387
+ - features/packet_data/aggregate_stats_request.raw
386
388
  - features/packet_data/arp-storm.pcap
387
389
  - features/packet_data/arp.pcap
390
+ - features/packet_data/barrier_reply.raw
391
+ - features/packet_data/barrier_request.raw
392
+ - features/packet_data/desc_stats_reply.raw
393
+ - features/packet_data/desc_stats_request.raw
388
394
  - features/packet_data/dhcp.pcap
389
395
  - features/packet_data/echo.raw
396
+ - features/packet_data/echo_reply.raw
397
+ - features/packet_data/echo_request.raw
398
+ - features/packet_data/error.raw
390
399
  - features/packet_data/features_reply.raw
391
400
  - features/packet_data/features_request.raw
401
+ - features/packet_data/flow_mod_add.raw
402
+ - features/packet_data/flow_mod_delete.raw
403
+ - features/packet_data/flow_removed.raw
404
+ - features/packet_data/flow_stats_reply.raw
405
+ - features/packet_data/flow_stats_request.raw
406
+ - features/packet_data/get_config_reply.raw
407
+ - features/packet_data/get_config_request.raw
392
408
  - features/packet_data/hello.raw
393
409
  - features/packet_data/icmp.pcap
394
410
  - features/packet_data/lldp.detailed.pcap
395
411
  - features/packet_data/lldp.minimal.pcap
412
+ - features/packet_data/packet_in.raw
413
+ - features/packet_data/packet_out.raw
414
+ - features/packet_data/port_mod.raw
415
+ - features/packet_data/port_stats_reply.raw
416
+ - features/packet_data/port_stats_request.raw
417
+ - features/packet_data/port_status.raw
418
+ - features/packet_data/queue_get_config_reply.raw
419
+ - features/packet_data/queue_get_config_request.raw
420
+ - features/packet_data/set_config.raw
421
+ - features/packet_data/table_stats_reply.raw
422
+ - features/packet_data/table_stats_request.raw
423
+ - features/packet_data/vendor.raw
424
+ - features/packet_data/vendor_stats_request.raw
396
425
  - features/step_definitions/packet_data_steps.rb
397
426
  - features/step_definitions/pending_steps.rb
398
427
  - features/support/env.rb
@@ -427,8 +456,6 @@ files:
427
456
  - lib/pio/echo/reply.rb
428
457
  - lib/pio/echo/request.rb
429
458
  - lib/pio/features.rb
430
- - lib/pio/features/format.rb
431
- - lib/pio/features/message.rb
432
459
  - lib/pio/features/reply.rb
433
460
  - lib/pio/features/request.rb
434
461
  - lib/pio/hello.rb
@@ -456,6 +483,12 @@ files:
456
483
  - lib/pio/lldp/ttl_tlv.rb
457
484
  - lib/pio/mac.rb
458
485
  - lib/pio/message_type_selector.rb
486
+ - lib/pio/open_flow.rb
487
+ - lib/pio/open_flow/flags.rb
488
+ - lib/pio/open_flow/message.rb
489
+ - lib/pio/open_flow/open_flow_header.rb
490
+ - lib/pio/open_flow/phy_port.rb
491
+ - lib/pio/open_flow/type.rb
459
492
  - lib/pio/options.rb
460
493
  - lib/pio/parse_error.rb
461
494
  - lib/pio/pcap.rb
@@ -463,7 +496,6 @@ files:
463
496
  - lib/pio/type/ip_address.rb
464
497
  - lib/pio/type/ipv4_header.rb
465
498
  - lib/pio/type/mac_address.rb
466
- - lib/pio/type/open_flow.rb
467
499
  - lib/pio/type/udp_header.rb
468
500
  - lib/pio/version.rb
469
501
  - pio.gemspec
@@ -491,6 +523,8 @@ files:
491
523
  - spec/pio/lldp/options_spec.rb
492
524
  - spec/pio/lldp_spec.rb
493
525
  - spec/pio/mac_spec.rb
526
+ - spec/pio/open_flow/phy_port_spec.rb
527
+ - spec/pio/open_flow/type_spec.rb
494
528
  - spec/spec_helper.rb
495
529
  homepage: http://github.com/trema/pio
496
530
  licenses:
@@ -504,7 +538,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
504
538
  requirements:
505
539
  - - '>='
506
540
  - !ruby/object:Gem::Version
507
- version: 1.9.3
541
+ version: 2.0.0
508
542
  required_rubygems_version: !ruby/object:Gem::Requirement
509
543
  requirements:
510
544
  - - '>='
@@ -541,6 +575,8 @@ test_files:
541
575
  - spec/pio/lldp/options_spec.rb
542
576
  - spec/pio/lldp_spec.rb
543
577
  - spec/pio/mac_spec.rb
578
+ - spec/pio/open_flow/phy_port_spec.rb
579
+ - spec/pio/open_flow/type_spec.rb
544
580
  - spec/spec_helper.rb
545
581
  - features/arp_read.feature
546
582
  - features/dhcp_read.feature
@@ -549,16 +585,45 @@ test_files:
549
585
  - features/hello_read.feature
550
586
  - features/icmp_read.feature
551
587
  - features/lldp_read.feature
588
+ - features/packet_data/aggregate_stats_reply.raw
589
+ - features/packet_data/aggregate_stats_request.raw
552
590
  - features/packet_data/arp-storm.pcap
553
591
  - features/packet_data/arp.pcap
592
+ - features/packet_data/barrier_reply.raw
593
+ - features/packet_data/barrier_request.raw
594
+ - features/packet_data/desc_stats_reply.raw
595
+ - features/packet_data/desc_stats_request.raw
554
596
  - features/packet_data/dhcp.pcap
555
597
  - features/packet_data/echo.raw
598
+ - features/packet_data/echo_reply.raw
599
+ - features/packet_data/echo_request.raw
600
+ - features/packet_data/error.raw
556
601
  - features/packet_data/features_reply.raw
557
602
  - features/packet_data/features_request.raw
603
+ - features/packet_data/flow_mod_add.raw
604
+ - features/packet_data/flow_mod_delete.raw
605
+ - features/packet_data/flow_removed.raw
606
+ - features/packet_data/flow_stats_reply.raw
607
+ - features/packet_data/flow_stats_request.raw
608
+ - features/packet_data/get_config_reply.raw
609
+ - features/packet_data/get_config_request.raw
558
610
  - features/packet_data/hello.raw
559
611
  - features/packet_data/icmp.pcap
560
612
  - features/packet_data/lldp.detailed.pcap
561
613
  - features/packet_data/lldp.minimal.pcap
614
+ - features/packet_data/packet_in.raw
615
+ - features/packet_data/packet_out.raw
616
+ - features/packet_data/port_mod.raw
617
+ - features/packet_data/port_stats_reply.raw
618
+ - features/packet_data/port_stats_request.raw
619
+ - features/packet_data/port_status.raw
620
+ - features/packet_data/queue_get_config_reply.raw
621
+ - features/packet_data/queue_get_config_request.raw
622
+ - features/packet_data/set_config.raw
623
+ - features/packet_data/table_stats_reply.raw
624
+ - features/packet_data/table_stats_request.raw
625
+ - features/packet_data/vendor.raw
626
+ - features/packet_data/vendor_stats_request.raw
562
627
  - features/step_definitions/packet_data_steps.rb
563
628
  - features/step_definitions/pending_steps.rb
564
629
  - features/support/env.rb