pio 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +4 -0
  4. data/Rakefile +1 -1
  5. data/bin/terminal-notifier +16 -0
  6. data/features/open_flow10/bad_request.feature +35 -0
  7. data/features/open_flow10/bad_request.raw +0 -0
  8. data/features/open_flow10/barrier_reply.feature +4 -4
  9. data/features/open_flow10/barrier_request.feature +4 -4
  10. data/features/open_flow10/echo_reply.feature +13 -13
  11. data/features/open_flow10/echo_request.feature +6 -6
  12. data/features/open_flow10/enqueue.feature +17 -0
  13. data/features/open_flow10/features_reply.feature +2 -2
  14. data/features/open_flow10/features_request.feature +28 -28
  15. data/features/open_flow10/flow_mod.feature +5 -5
  16. data/features/open_flow10/flow_stats_reply.feature +12 -12
  17. data/features/open_flow10/flow_stats_request.feature +3 -3
  18. data/features/open_flow10/hello.feature +8 -15
  19. data/features/open_flow10/hello_failed.feature +69 -0
  20. data/features/open_flow10/hello_failed.raw +0 -0
  21. data/features/open_flow10/nxast_learn.raw +0 -0
  22. data/features/open_flow10/packet_in.feature +2 -2
  23. data/features/open_flow10/packet_out.feature +13 -13
  24. data/features/open_flow10/port_status.feature +1 -1
  25. data/features/open_flow10/send_out_port.feature +106 -0
  26. data/features/open_flow10/set_ether_destination_address.feature +16 -0
  27. data/features/open_flow10/set_ether_source_address.feature +16 -0
  28. data/features/open_flow10/set_ip_destination_address.feature +16 -0
  29. data/features/open_flow10/set_ip_source_address.feature +16 -0
  30. data/features/open_flow10/set_ip_tos.feature +16 -0
  31. data/features/open_flow10/set_transport_destination_port.feature +16 -0
  32. data/features/open_flow10/set_transport_source_port.feature +16 -0
  33. data/features/open_flow10/set_vlan_priority.feature +16 -0
  34. data/features/open_flow10/set_vlan_vid.feature +16 -0
  35. data/features/open_flow10/strip_vlan_header.feature +15 -0
  36. data/features/open_flow10/vendor_action.feature +14 -0
  37. data/features/open_flow13/bad_request.feature +35 -0
  38. data/features/open_flow13/bad_request.raw +0 -0
  39. data/features/open_flow13/echo_reply.feature +7 -7
  40. data/features/open_flow13/echo_request.feature +7 -7
  41. data/features/open_flow13/features_reply.feature +2 -2
  42. data/features/open_flow13/features_request.feature +28 -28
  43. data/features/open_flow13/flow_mod.feature +24 -24
  44. data/features/open_flow13/hello.feature +5 -5
  45. data/features/open_flow13/hello_failed.feature +69 -0
  46. data/features/open_flow13/hello_failed.raw +0 -0
  47. data/features/open_flow13/packet_in.feature +3 -3
  48. data/features/open_flow13/packet_out.feature +3 -3
  49. data/features/open_flow13/send_out_port.feature +101 -10
  50. data/features/open_flow13/table_stats_reply.raw +0 -0
  51. data/features/open_flow13/table_stats_request.raw +0 -0
  52. data/features/open_flow_read.feature +6 -0
  53. data/features/step_definitions/Gemfile +9 -0
  54. data/features/step_definitions/Gemfile.lock +76 -0
  55. data/features/step_definitions/Guardfile +4 -0
  56. data/features/step_definitions/LICENSE +675 -0
  57. data/features/step_definitions/README.md +7 -0
  58. data/features/step_definitions/Rakefile +10 -0
  59. data/features/step_definitions/dump_flows_steps.rb +13 -0
  60. data/features/step_definitions/packet_data_steps.rb +4 -0
  61. data/features/step_definitions/rest_api_steps.rb +40 -0
  62. data/features/step_definitions/show_stats_steps.rb +83 -0
  63. data/features/step_definitions/trema_steps.rb +33 -0
  64. data/features/step_definitions/virtual_link_steps.rb +8 -0
  65. data/lib/pio/open_flow.rb +5 -5
  66. data/lib/pio/open_flow/echo.rb +1 -1
  67. data/lib/pio/open_flow/error.rb +19 -0
  68. data/lib/pio/open_flow/format.rb +2 -1
  69. data/lib/pio/open_flow/hello_failed_code.rb +21 -0
  70. data/lib/pio/open_flow/open_flow_header.rb +11 -2
  71. data/lib/pio/open_flow/port.rb +69 -0
  72. data/lib/pio/open_flow10.rb +5 -0
  73. data/lib/pio/open_flow10/actions.rb +8 -6
  74. data/lib/pio/open_flow10/enqueue.rb +13 -13
  75. data/lib/pio/open_flow10/error.rb +28 -0
  76. data/lib/pio/open_flow10/error/bad_request.rb +66 -0
  77. data/lib/pio/open_flow10/error/error_type10.rb +26 -0
  78. data/lib/pio/open_flow10/error/hello_failed.rb +41 -0
  79. data/lib/pio/open_flow10/features.rb +6 -10
  80. data/lib/pio/open_flow10/flow_mod.rb +1 -1
  81. data/lib/pio/open_flow10/flow_stats_request.rb +1 -1
  82. data/lib/pio/open_flow10/hello.rb +2 -2
  83. data/lib/pio/open_flow10/match.rb +2 -2
  84. data/lib/pio/{open_flow/phy_port.rb → open_flow10/phy_port16.rb} +4 -4
  85. data/lib/pio/open_flow10/port16.rb +21 -0
  86. data/lib/pio/open_flow10/port_status.rb +1 -1
  87. data/lib/pio/open_flow10/send_out_port.rb +16 -40
  88. data/lib/pio/open_flow10/set_ether_address.rb +9 -8
  89. data/lib/pio/open_flow10/set_ip_address.rb +4 -4
  90. data/lib/pio/open_flow10/set_ip_tos.rb +4 -4
  91. data/lib/pio/open_flow10/set_transport_port.rb +12 -12
  92. data/lib/pio/open_flow10/set_vlan.rb +4 -4
  93. data/lib/pio/open_flow10/set_vlan_vid.rb +0 -12
  94. data/lib/pio/open_flow10/strip_vlan_header.rb +7 -7
  95. data/lib/pio/open_flow10/vendor_action.rb +33 -0
  96. data/lib/pio/open_flow13.rb +3 -0
  97. data/lib/pio/open_flow13/actions.rb +3 -3
  98. data/lib/pio/open_flow13/error.rb +28 -0
  99. data/lib/pio/open_flow13/error/bad_request.rb +66 -0
  100. data/lib/pio/open_flow13/error/error_type13.rb +37 -0
  101. data/lib/pio/open_flow13/error/hello_failed.rb +42 -0
  102. data/lib/pio/open_flow13/features_reply.rb +33 -33
  103. data/lib/pio/open_flow13/features_request.rb +3 -3
  104. data/lib/pio/open_flow13/flow_mod.rb +2 -2
  105. data/lib/pio/open_flow13/goto_table.rb +2 -0
  106. data/lib/pio/open_flow13/packet_out.rb +1 -1
  107. data/lib/pio/open_flow13/port32.rb +21 -0
  108. data/lib/pio/open_flow13/send_out_port.rb +3 -2
  109. data/lib/pio/version.rb +1 -1
  110. data/pio.gemspec +5 -5
  111. data/spec/pio/open_flow10/enqueue_spec.rb +22 -22
  112. data/spec/pio/open_flow10/error/hello_failed_spec.rb +26 -0
  113. data/spec/pio/open_flow10/flow_mod_spec.rb +6 -6
  114. data/spec/pio/open_flow10/flow_stats_request_spec.rb +1 -1
  115. data/spec/pio/open_flow10/hello_spec.rb +3 -3
  116. data/spec/pio/open_flow10/packet_out_spec.rb +33 -33
  117. data/spec/pio/{open_flow/phy_port_spec.rb → open_flow10/phy_port16_spec.rb} +7 -7
  118. data/spec/pio/open_flow10/send_out_port_spec.rb +28 -28
  119. data/spec/pio/open_flow10/set_ether_destination_address_spec.rb +2 -2
  120. data/spec/pio/open_flow10/set_ether_source_address_spec.rb +2 -2
  121. data/spec/pio/open_flow10/set_ip_destination_address_spec.rb +4 -4
  122. data/spec/pio/open_flow10/set_ip_source_address_spec.rb +4 -4
  123. data/spec/pio/open_flow10/set_ip_tos_spec.rb +4 -4
  124. data/spec/pio/open_flow10/set_transport_destination_port_spec.rb +11 -11
  125. data/spec/pio/open_flow10/set_transport_source_port_spec.rb +11 -11
  126. data/spec/pio/open_flow10/set_vlan_priority_spec.rb +4 -4
  127. data/spec/pio/open_flow10/set_vlan_vid_spec.rb +4 -4
  128. data/spec/pio/open_flow10/strip_vlan_header_spec.rb +6 -6
  129. data/spec/pio/open_flow13/error/bad_request_spec.rb +6 -0
  130. data/spec/pio/open_flow13/error/hello_failed_spec.rb +26 -0
  131. data/spec/pio/open_flow13/hello_spec.rb +3 -3
  132. data/spec/support/shared_examples_for_openflow_messages.rb +40 -27
  133. metadata +106 -16
  134. data/lib/pio/open_flow/port_number.rb +0 -39
@@ -1,14 +1,14 @@
1
1
  require 'pio'
2
2
 
3
- describe Pio::OpenFlow::PhyPort do
3
+ describe Pio::OpenFlow10::PhyPort16 do
4
4
  describe '.new' do
5
5
  When(:phy_port) do
6
- Pio::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])
6
+ Pio::OpenFlow10::PhyPort16.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
12
  end
13
13
 
14
14
  Then { phy_port.port_no == 1 }
@@ -6,8 +6,8 @@ describe Pio::OpenFlow10::SendOutPort do
6
6
 
7
7
  context 'with 1' do
8
8
  Given(:options) { 1 }
9
- Then { send_out_port.port_number == 1 }
10
- Then { send_out_port.max_len == 2**16 - 1 }
9
+ Then { send_out_port.port == 1 }
10
+ Then { send_out_port.max_length == 2**16 - 1 }
11
11
 
12
12
  describe '#==' do
13
13
  When(:result) { send_out_port == other }
@@ -28,7 +28,7 @@ describe Pio::OpenFlow10::SendOutPort do
28
28
  Given(:options) { 0 }
29
29
  Then do
30
30
  send_out_port ==
31
- Failure(ArgumentError, 'The port_number should be > 0')
31
+ Failure(ArgumentError, 'The port should be > 0')
32
32
  end
33
33
  end
34
34
 
@@ -36,81 +36,81 @@ describe Pio::OpenFlow10::SendOutPort do
36
36
  Given(:options) { 0xff01 }
37
37
  Then do
38
38
  send_out_port ==
39
- Failure(ArgumentError, 'The port_number should be < 0xff00')
39
+ Failure(ArgumentError, 'The port should be < 0xff00')
40
40
  end
41
41
  end
42
42
 
43
43
  context 'with :in_port' do
44
44
  Given(:options) { :in_port }
45
- Then { send_out_port.port_number == :in_port }
45
+ Then { send_out_port.port == :in_port }
46
46
  end
47
47
 
48
48
  context 'with :table' do
49
49
  Given(:options) { :table }
50
- Then { send_out_port.port_number == :table }
50
+ Then { send_out_port.port == :table }
51
51
  end
52
52
 
53
53
  context 'with :normal' do
54
54
  Given(:options) { :normal }
55
- Then { send_out_port.port_number == :normal }
55
+ Then { send_out_port.port == :normal }
56
56
  end
57
57
 
58
58
  context 'with :flood' do
59
59
  Given(:options) { :flood }
60
- Then { send_out_port.port_number == :flood }
60
+ Then { send_out_port.port == :flood }
61
61
  end
62
62
 
63
63
  context 'with :all' do
64
64
  Given(:options) { :all }
65
- Then { send_out_port.port_number == :all }
65
+ Then { send_out_port.port == :all }
66
66
  end
67
67
 
68
68
  context 'with :controller' do
69
69
  Given(:options) { :controller }
70
- Then { send_out_port.port_number == :controller }
70
+ Then { send_out_port.port == :controller }
71
71
  end
72
72
 
73
73
  context 'with :controller' do
74
74
  Given(:options) { :local }
75
- Then { send_out_port.port_number == :local }
75
+ Then { send_out_port.port == :local }
76
76
  end
77
77
 
78
78
  context 'with :controller' do
79
79
  Given(:options) { :none }
80
- Then { send_out_port.port_number == :none }
80
+ Then { send_out_port.port == :none }
81
81
  end
82
82
 
83
- context 'with port_number: NUMBER option' do
84
- Given(:options) { { port_number: 1 } }
85
- Then { send_out_port.port_number == 1 }
83
+ context 'with port: NUMBER option' do
84
+ Given(:options) { { port: 1 } }
85
+ Then { send_out_port.port == 1 }
86
86
  end
87
87
 
88
- context 'with port_number: SYMBOL option' do
89
- Given(:options) { { port_number: :flood } }
90
- Then { send_out_port.port_number == :flood }
88
+ context 'with port: SYMBOL option' do
89
+ Given(:options) { { port: :flood } }
90
+ Then { send_out_port.port == :flood }
91
91
  end
92
92
 
93
- context 'with port_number: and max_len: option' do
94
- Given(:options) { { port_number: 1, max_len: 256 } }
95
- Then { send_out_port.port_number == 1 }
96
- Then { send_out_port.max_len == 256 }
93
+ context 'with port: and max_length: option' do
94
+ Given(:options) { { port: 1, max_length: 256 } }
95
+ Then { send_out_port.port == 1 }
96
+ Then { send_out_port.max_length == 256 }
97
97
  end
98
98
 
99
- context 'with invalid max_len: (-1) option' do
100
- Given(:options) { { port_number: 1, max_len: -1 } }
99
+ context 'with invalid max_length: (-1) option' do
100
+ Given(:options) { { port: 1, max_length: -1 } }
101
101
  Then do
102
102
  send_out_port ==
103
103
  Failure(ArgumentError,
104
- 'The max_len should be an unsigned 16bit integer.')
104
+ 'The max_length should be an unsigned 16bit integer.')
105
105
  end
106
106
  end
107
107
 
108
- context 'with invalid max_len: (2**16) option' do
109
- Given(:options) { { port_number: 1, max_len: 2**16 } }
108
+ context 'with invalid max_length: (2**16) option' do
109
+ Given(:options) { { port: 1, max_length: 2**16 } }
110
110
  Then do
111
111
  send_out_port ==
112
112
  Failure(ArgumentError,
113
- 'The max_len should be an unsigned 16bit integer.')
113
+ 'The max_length should be an unsigned 16bit integer.')
114
114
  end
115
115
  end
116
116
  end
@@ -1,9 +1,9 @@
1
1
  require 'pio/open_flow10/set_ether_address'
2
2
 
3
- describe Pio::SetEtherDestinationAddr do
3
+ describe Pio::SetEtherDestinationAddress do
4
4
  describe '.new' do
5
5
  Given(:set_ether_destination_address) do
6
- Pio::SetEtherDestinationAddr.new(mac_address)
6
+ Pio::SetEtherDestinationAddress.new(mac_address)
7
7
  end
8
8
 
9
9
  context "with '11:22:33:44:55:66'" do
@@ -1,9 +1,9 @@
1
1
  require 'pio/open_flow10/set_ether_address'
2
2
 
3
- describe Pio::SetEtherSourceAddr do
3
+ describe Pio::SetEtherSourceAddress do
4
4
  describe '.new' do
5
5
  Given(:set_ether_source_address) do
6
- Pio::SetEtherSourceAddr.new(mac_address)
6
+ Pio::SetEtherSourceAddress.new(mac_address)
7
7
  end
8
8
 
9
9
  context "with '11:22:33:44:55:66'" do
@@ -11,12 +11,12 @@ describe Pio::SetIpDestinationAddress do
11
11
  Then { set_ip_destination_addr.ip_address == '1.2.3.4' }
12
12
  end
13
13
 
14
- describe '#type' do
15
- Then { set_ip_destination_addr.type == 7 }
14
+ describe '#action_type' do
15
+ Then { set_ip_destination_addr.action_type == 7 }
16
16
  end
17
17
 
18
- describe '#message_length' do
19
- Then { set_ip_destination_addr.message_length == 8 }
18
+ describe '#length' do
19
+ Then { set_ip_destination_addr.length == 8 }
20
20
  end
21
21
 
22
22
  describe '#to_binary' do
@@ -9,12 +9,12 @@ describe Pio::SetIpSourceAddress do
9
9
  Then { set_ip_source_addr.ip_address == '1.2.3.4' }
10
10
  end
11
11
 
12
- describe '#type' do
13
- Then { set_ip_source_addr.type == 6 }
12
+ describe '#action_type' do
13
+ Then { set_ip_source_addr.action_type == 6 }
14
14
  end
15
15
 
16
- describe '#message_length' do
17
- Then { set_ip_source_addr.message_length == 8 }
16
+ describe '#length' do
17
+ Then { set_ip_source_addr.length == 8 }
18
18
  end
19
19
 
20
20
  describe '#to_binary' do
@@ -9,12 +9,12 @@ describe Pio::SetIpTos do
9
9
  Then { set_ip_tos.type_of_service == 32 }
10
10
  end
11
11
 
12
- describe '#type' do
13
- Then { set_ip_tos.type == 8 }
12
+ describe '#action_type' do
13
+ Then { set_ip_tos.action_type == 8 }
14
14
  end
15
15
 
16
- describe '#message_length' do
17
- Then { set_ip_tos.message_length == 8 }
16
+ describe '#length' do
17
+ Then { set_ip_tos.length == 8 }
18
18
  end
19
19
 
20
20
  describe '#to_binary' do
@@ -3,22 +3,22 @@ require 'pio/open_flow10/set_transport_port'
3
3
  describe Pio::SetTransportDestinationPort do
4
4
  describe '.new' do
5
5
  When(:set_transport_destination_port) do
6
- Pio::SetTransportDestinationPort.new(port_number)
6
+ Pio::SetTransportDestinationPort.new(port)
7
7
  end
8
8
 
9
9
  context 'with 100' do
10
- When(:port_number) { 100 }
10
+ When(:port) { 100 }
11
11
 
12
- describe '#port_number' do
13
- Then { set_transport_destination_port.port_number == 100 }
12
+ describe '#port' do
13
+ Then { set_transport_destination_port.port == 100 }
14
14
  end
15
15
 
16
- describe '#type' do
17
- Then { set_transport_destination_port.type == 10 }
16
+ describe '#action_type' do
17
+ Then { set_transport_destination_port.action_type == 10 }
18
18
  end
19
19
 
20
- describe '#message_length' do
21
- Then { set_transport_destination_port.message_length == 8 }
20
+ describe '#length' do
21
+ Then { set_transport_destination_port.length == 8 }
22
22
  end
23
23
 
24
24
  describe '#to_binary' do
@@ -27,17 +27,17 @@ describe Pio::SetTransportDestinationPort do
27
27
  end
28
28
 
29
29
  context 'with -1' do
30
- When(:port_number) { -1 }
30
+ When(:port) { -1 }
31
31
  Then { set_transport_destination_port == Failure(ArgumentError) }
32
32
  end
33
33
 
34
34
  context 'with 2**16' do
35
- When(:port_number) { 2**16 }
35
+ When(:port) { 2**16 }
36
36
  Then { set_transport_destination_port == Failure(ArgumentError) }
37
37
  end
38
38
 
39
39
  context 'with :INVALID_PORT_NUMBER' do
40
- When(:port_number) { :INVALID_PORT_NUMBER }
40
+ When(:port) { :INVALID_PORT_NUMBER }
41
41
  Then { set_transport_destination_port == Failure(TypeError) }
42
42
  end
43
43
  end
@@ -3,22 +3,22 @@ require 'pio/open_flow10/set_transport_port'
3
3
  describe Pio::SetTransportSourcePort do
4
4
  describe '.new' do
5
5
  When(:set_transport_source_port) do
6
- Pio::SetTransportSourcePort.new port_number
6
+ Pio::SetTransportSourcePort.new port
7
7
  end
8
8
 
9
9
  context 'with 100' do
10
- When(:port_number) { 100 }
10
+ When(:port) { 100 }
11
11
 
12
- describe '#port_number' do
13
- Then { set_transport_source_port.port_number == 100 }
12
+ describe '#port' do
13
+ Then { set_transport_source_port.port == 100 }
14
14
  end
15
15
 
16
- describe '#type' do
17
- Then { set_transport_source_port.type == 9 }
16
+ describe '#action_type' do
17
+ Then { set_transport_source_port.action_type == 9 }
18
18
  end
19
19
 
20
- describe '#message_length' do
21
- Then { set_transport_source_port.message_length == 8 }
20
+ describe '#length' do
21
+ Then { set_transport_source_port.length == 8 }
22
22
  end
23
23
 
24
24
  describe '#to_binary' do
@@ -27,17 +27,17 @@ describe Pio::SetTransportSourcePort do
27
27
  end
28
28
 
29
29
  context 'with -1' do
30
- When(:port_number) { -1 }
30
+ When(:port) { -1 }
31
31
  Then { set_transport_source_port == Failure(ArgumentError) }
32
32
  end
33
33
 
34
34
  context 'with 2**16' do
35
- When(:port_number) { 2**16 }
35
+ When(:port) { 2**16 }
36
36
  Then { set_transport_source_port == Failure(ArgumentError) }
37
37
  end
38
38
 
39
39
  context 'with :INVALID_PORT_NUMBER' do
40
- When(:port_number) { :INVALID_PORT_NUMBER }
40
+ When(:port) { :INVALID_PORT_NUMBER }
41
41
  Then { set_transport_source_port == Failure(TypeError) }
42
42
  end
43
43
  end
@@ -11,12 +11,12 @@ describe Pio::SetVlanPriority do
11
11
  Then { set_vlan_priority.vlan_priority == 3 }
12
12
  end
13
13
 
14
- describe '#type' do
15
- Then { set_vlan_priority.type == 2 }
14
+ describe '#action_type' do
15
+ Then { set_vlan_priority.action_type == 2 }
16
16
  end
17
17
 
18
- describe '#message_length' do
19
- Then { set_vlan_priority.message_length == 8 }
18
+ describe '#length' do
19
+ Then { set_vlan_priority.length == 8 }
20
20
  end
21
21
 
22
22
  describe '#to_binary' do
@@ -11,12 +11,12 @@ describe Pio::SetVlanVid do
11
11
  Then { set_vlan_vid.vlan_id == 10 }
12
12
  end
13
13
 
14
- describe '#type' do
15
- Then { set_vlan_vid.type == 1 }
14
+ describe '#action_type' do
15
+ Then { set_vlan_vid.action_type == 1 }
16
16
  end
17
17
 
18
- describe '#message_length' do
19
- Then { set_vlan_vid.message_length == 8 }
18
+ describe '#length' do
19
+ Then { set_vlan_vid.length == 8 }
20
20
  end
21
21
 
22
22
  describe '#to_binary' do
@@ -3,14 +3,14 @@ require 'pio/open_flow10/strip_vlan_header'
3
3
  describe Pio::StripVlanHeader do
4
4
  Given(:strip_vlan_header) { Pio::StripVlanHeader.new }
5
5
 
6
- describe '#type' do
7
- When(:type) { strip_vlan_header.type }
8
- Then { type == 3 }
6
+ describe '#action_type' do
7
+ When(:action_type) { strip_vlan_header.action_type }
8
+ Then { action_type == 3 }
9
9
  end
10
10
 
11
- describe '#message_length' do
12
- When(:message_length) { strip_vlan_header.message_length }
13
- Then { message_length == 8 }
11
+ describe '#length' do
12
+ When(:length) { strip_vlan_header.length }
13
+ Then { length == 8 }
14
14
  end
15
15
 
16
16
  describe '#to_binary' do
@@ -0,0 +1,6 @@
1
+ require 'pio/open_flow13/error/bad_request'
2
+
3
+ describe Pio::OpenFlow13::Error::BadRequest do
4
+ it_should_behave_like('an OpenFlow message',
5
+ Pio::OpenFlow13::Error::BadRequest)
6
+ end
@@ -0,0 +1,26 @@
1
+ require 'pio/open_flow13/error/hello_failed'
2
+
3
+ describe Pio::OpenFlow13::Error::HelloFailed do
4
+ it_should_behave_like('an OpenFlow message',
5
+ Pio::OpenFlow13::Error::HelloFailed)
6
+
7
+ describe '.new' do
8
+ When(:hello_failed) { Pio::OpenFlow13::Error::HelloFailed.new(options) }
9
+
10
+ context 'with {}' do
11
+ Given(:options) { {} }
12
+
13
+ Then { hello_failed.length == 12 }
14
+ Then { hello_failed.error_type == :hello_failed }
15
+ Then { hello_failed.error_code == :incompatible }
16
+ Then { hello_failed.description == '' }
17
+ end
18
+
19
+ context "with description: 'error description'" do
20
+ Given(:options) { { description: 'error description' } }
21
+
22
+ Then { hello_failed.length == 29 }
23
+ Then { hello_failed.description == 'error description' }
24
+ end
25
+ end
26
+ end
@@ -11,7 +11,7 @@ describe Pio::OpenFlow13::Hello do
11
11
  Then { result.class == Pio::OpenFlow13::Hello }
12
12
  Then { result.ofp_version == 4 }
13
13
  Then { result.message_type == 0 }
14
- Then { result.message_length == 8 }
14
+ Then { result.length == 8 }
15
15
  Then { result.transaction_id == 0 }
16
16
  Then { result.xid == 0 }
17
17
  Then { result.supported_versions.empty? }
@@ -25,7 +25,7 @@ describe Pio::OpenFlow13::Hello do
25
25
  Then { result.class == Pio::OpenFlow13::Hello }
26
26
  Then { result.ofp_version == 4 }
27
27
  Then { result.message_type == 0 }
28
- Then { result.message_length == 16 }
28
+ Then { result.length == 16 }
29
29
  Then { result.transaction_id == 0 }
30
30
  Then { result.xid == 0 }
31
31
  Then { result.supported_versions == [:open_flow10, :open_flow13] }
@@ -48,7 +48,7 @@ describe Pio::OpenFlow13::Hello do
48
48
 
49
49
  Then { result.ofp_version == 4 }
50
50
  Then { result.message_type == 0 }
51
- Then { result.message_length == 16 }
51
+ Then { result.length == 16 }
52
52
  Then { result.transaction_id == 0 }
53
53
  Then { result.xid == 0 }
54
54
  Then { result.supported_versions == [:open_flow13] }