pio 0.23.1 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +2 -0
  4. data/Rakefile +1 -1
  5. data/features/open_flow10/barrier_reply.feature +58 -0
  6. data/features/open_flow10/barrier_request.feature +58 -0
  7. data/features/open_flow10/echo_reply.feature +50 -40
  8. data/features/open_flow10/echo_request.feature +54 -51
  9. data/features/open_flow10/features_reply.feature +62 -63
  10. data/features/open_flow10/features_request.feature +2 -19
  11. data/features/open_flow10/flow_mod.feature +1 -0
  12. data/features/open_flow10/hello.feature +38 -44
  13. data/features/open_flow10/packet_in.feature +1 -2
  14. data/features/open_flow10/packet_in.raw +0 -0
  15. data/features/open_flow10/packet_out.feature +14 -14
  16. data/features/open_flow10/port_status.feature +17 -17
  17. data/features/open_flow13/apply_actions.feature +15 -17
  18. data/features/open_flow13/echo_reply.feature +58 -58
  19. data/features/open_flow13/echo_request.feature +58 -58
  20. data/features/open_flow13/features_reply.feature +2 -6
  21. data/features/open_flow13/features_request.feature +3 -23
  22. data/features/open_flow13/flow_mod.feature +86 -93
  23. data/features/open_flow13/goto_table.feature +4 -4
  24. data/features/open_flow13/hello.feature +8 -15
  25. data/features/open_flow13/match.feature +14 -3
  26. data/features/open_flow13/meter.feature +3 -3
  27. data/features/open_flow13/oxm_experimenter_stratos_basic_dot11.raw +0 -0
  28. data/features/open_flow13/oxm_invalid_field.raw +0 -0
  29. data/features/open_flow13/packet_in.feature +15 -20
  30. data/features/open_flow13/packet_out.feature +39 -42
  31. data/features/open_flow13/send_out_port.feature +1 -5
  32. data/features/open_flow13/write_metadata.feature +3 -3
  33. data/features/open_flow_read.feature +43 -0
  34. data/features/open_flow_version.feature +10 -0
  35. data/features/step_definitions/open_flow_steps.rb +10 -2
  36. data/features/step_definitions/packet_data_steps.rb +4 -0
  37. data/features/support/hooks.rb +7 -0
  38. data/lib/pio.rb +1 -1
  39. data/lib/pio/monkey_patch/integer/ranges.rb +4 -0
  40. data/lib/pio/open_flow.rb +54 -16
  41. data/lib/pio/open_flow/datapath_id.rb +26 -0
  42. data/lib/pio/open_flow/echo.rb +44 -0
  43. data/lib/pio/open_flow/format.rb +45 -0
  44. data/lib/pio/open_flow/message.rb +88 -0
  45. data/lib/pio/open_flow/open_flow_header.rb +0 -14
  46. data/lib/pio/open_flow10.rb +3 -8
  47. data/lib/pio/open_flow10/actions.rb +1 -1
  48. data/lib/pio/open_flow10/barrier_reply.rb +21 -0
  49. data/lib/pio/open_flow10/barrier_request.rb +22 -0
  50. data/lib/pio/open_flow10/echo.rb +15 -11
  51. data/lib/pio/open_flow10/features.rb +99 -71
  52. data/lib/pio/open_flow10/flow_mod.rb +73 -66
  53. data/lib/pio/open_flow10/hello.rb +19 -4
  54. data/lib/pio/open_flow10/match.rb +133 -131
  55. data/lib/pio/open_flow10/packet_in.rb +55 -49
  56. data/lib/pio/open_flow10/packet_out.rb +31 -24
  57. data/lib/pio/open_flow10/port_status.rb +54 -27
  58. data/lib/pio/open_flow10/send_out_port.rb +66 -64
  59. data/lib/pio/open_flow13.rb +0 -15
  60. data/lib/pio/open_flow13/echo.rb +11 -68
  61. data/lib/pio/open_flow13/features_reply.rb +48 -77
  62. data/lib/pio/open_flow13/features_request.rb +16 -45
  63. data/lib/pio/open_flow13/flow_mod.rb +125 -148
  64. data/lib/pio/open_flow13/goto_table.rb +1 -0
  65. data/lib/pio/open_flow13/hello.rb +54 -84
  66. data/lib/pio/open_flow13/match.rb +69 -11
  67. data/lib/pio/open_flow13/meter.rb +1 -0
  68. data/lib/pio/open_flow13/packet_in.rb +38 -50
  69. data/lib/pio/open_flow13/packet_out.rb +50 -75
  70. data/lib/pio/open_flow13/send_out_port.rb +34 -34
  71. data/lib/pio/open_flow13/write_metadata.rb +1 -0
  72. data/lib/pio/parser.rb +3 -0
  73. data/lib/pio/version.rb +1 -1
  74. data/pio.gemspec +6 -6
  75. data/spec/pio/open_flow10/echo_reply_spec.rb +7 -0
  76. data/spec/pio/open_flow10/echo_request_spec.rb +7 -0
  77. data/spec/pio/open_flow10/features_reply_spec.rb +8 -0
  78. data/spec/pio/open_flow10/features_request_spec.rb +13 -0
  79. data/spec/pio/open_flow10/flow_mod_spec.rb +17 -16
  80. data/spec/pio/open_flow10/hello_spec.rb +7 -0
  81. data/spec/pio/open_flow10/match_spec.rb +8 -6
  82. data/spec/pio/open_flow10/packet_in_spec.rb +14 -0
  83. data/spec/pio/open_flow10/packet_out_spec.rb +21 -14
  84. data/spec/pio/open_flow10/send_out_port_spec.rb +4 -4
  85. data/spec/pio/open_flow10/wildcards_spec.rb +2 -2
  86. data/spec/pio/open_flow13/echo_reply_spec.rb +7 -0
  87. data/spec/pio/open_flow13/echo_request_spec.rb +7 -0
  88. data/spec/pio/open_flow13/features_reply_spec.rb +8 -0
  89. data/spec/pio/open_flow13/features_request_spec.rb +13 -0
  90. data/spec/pio/open_flow13/hello_spec.rb +14 -59
  91. data/spec/pio/open_flow13/packet_in_spec.rb +14 -0
  92. data/spec/pio/open_flow13/packet_out_spec.rb +7 -0
  93. data/spec/pio/open_flow_spec.rb +34 -0
  94. data/spec/spec_helper.rb +1 -0
  95. data/spec/support/shared_examples_for_openflow_messages.rb +75 -0
  96. metadata +215 -170
  97. data/bin/byebug +0 -16
  98. data/bin/terminal-notifier +0 -16
  99. data/lib/pio/open_flow10/message.rb +0 -78
  100. data/spec/pio/open_flow/type_spec.rb +0 -5
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::GotoTable
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new(1)
6
4
  When I try to create an OpenFlow instruction with:
7
5
  """
@@ -13,6 +11,7 @@ Feature: Pio::GotoTable
13
11
  | class | Pio::GotoTable |
14
12
  | instruction_type | 1 |
15
13
  | instruction_length | 8 |
14
+ | to_binary_s.length | 8 |
16
15
  | table_id | 1 |
17
16
 
18
17
  Scenario: read
@@ -22,5 +21,6 @@ Feature: Pio::GotoTable
22
21
  | field | value |
23
22
  | class | Pio::GotoTable |
24
23
  | instruction_type | 1 |
25
- | instruction_length | 8 |
24
+ | instruction_length | 8 |
25
+ | to_binary_s.length | 8 |
26
26
  | table_id | 1 |
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::Hello
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new
6
4
  When I try to create an OpenFlow message with:
7
5
  """
@@ -10,7 +8,6 @@ Feature: Pio::Hello
10
8
  Then it should finish successfully
11
9
  And the message have the following fields and values:
12
10
  | field | value |
13
- | class | Pio::Hello |
14
11
  | ofp_version | 4 |
15
12
  | message_type | 0 |
16
13
  | message_length | 16 |
@@ -26,7 +23,6 @@ Feature: Pio::Hello
26
23
  Then it should finish successfully
27
24
  And the message have the following fields and values:
28
25
  | field | value |
29
- | class | Pio::Hello |
30
26
  | ofp_version | 4 |
31
27
  | message_type | 0 |
32
28
  | message_length | 16 |
@@ -42,7 +38,6 @@ Feature: Pio::Hello
42
38
  Then it should finish successfully
43
39
  And the message have the following fields and values:
44
40
  | field | value |
45
- | class | Pio::Hello |
46
41
  | ofp_version | 4 |
47
42
  | message_type | 0 |
48
43
  | message_length | 16 |
@@ -54,21 +49,19 @@ Feature: Pio::Hello
54
49
  When I try to parse a file named "open_flow13/hello_no_version_bitmap.raw" with "Pio::Hello" class
55
50
  Then it should finish successfully
56
51
  And the message have the following fields and values:
57
- | field | value |
58
- | class | Pio::Hello |
59
- | ofp_version | 4 |
60
- | message_type | 0 |
61
- | message_length | 8 |
62
- | transaction_id | 0 |
63
- | xid | 0 |
64
- | supported_versions | [] |
52
+ | field | value |
53
+ | ofp_version | 4 |
54
+ | message_type | 0 |
55
+ | message_length | 8 |
56
+ | transaction_id | 0 |
57
+ | xid | 0 |
58
+ | supported_versions | [] |
65
59
 
66
60
  Scenario: read
67
61
  When I try to parse a file named "open_flow13/hello_version_bitmap.raw" with "Pio::Hello" class
68
62
  Then it should finish successfully
69
63
  And the message have the following fields and values:
70
64
  | field | value |
71
- | class | Pio::Hello |
72
65
  | ofp_version | 4 |
73
66
  | message_type | 0 |
74
67
  | message_length | 16 |
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::Match
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new
6
4
  When I try to create an OpenFlow message with:
7
5
  """
@@ -777,3 +775,16 @@ Feature: Pio::Match
777
775
  | field | value |
778
776
  | tunnel_id | 1 |
779
777
  | tunnel_id_mask | 9223372036854775808 |
778
+
779
+ Scenario: read (file: open_flow13/oxm_invalid_field.raw)
780
+ When I try to parse a file named "open_flow13/oxm_invalid_field.raw" with "Pio::Match" class
781
+ Then it should fail with "RuntimeError", "Unknown OXM field value: 40"
782
+
783
+ Scenario: read (file: open_flow13/oxm_experimenter_stratos_basic_dot11.raw)
784
+ When I try to parse a file named "open_flow13/oxm_experimenter_stratos_basic_dot11.raw" with "Pio::Match" class
785
+ Then it should finish successfully
786
+ And the message have the following fields and values:
787
+ | field | value |
788
+ | match_fields.at(0).oxm_field | 0 |
789
+ | match_fields.at(0).experimenter | 4278247501 |
790
+ | match_fields.at(0).data.inspect | "\x00\x01\x01" |
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::Meter
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new(1)
6
4
  When I try to create an OpenFlow instruction with:
7
5
  """
@@ -13,6 +11,7 @@ Feature: Pio::Meter
13
11
  | class | Pio::Meter |
14
12
  | instruction_type | 6 |
15
13
  | instruction_length | 8 |
14
+ | to_binary_s.length | 8 |
16
15
  | meter_id | 1 |
17
16
 
18
17
  Scenario: read
@@ -23,4 +22,5 @@ Feature: Pio::Meter
23
22
  | class | Pio::Meter |
24
23
  | instruction_type | 6 |
25
24
  | instruction_length | 8 |
25
+ | to_binary_s.length | 8 |
26
26
  | meter_id | 1 |
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::PacketIn
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new
6
4
  When I try to create an OpenFlow message with:
7
5
  """
@@ -9,20 +7,19 @@ Feature: Pio::PacketIn
9
7
  """
10
8
  Then it should finish successfully
11
9
  And the message have the following fields and values:
12
- | field | value |
13
- | class | Pio::PacketIn |
14
- | ofp_version | 4 |
15
- | message_type | 10 |
16
- | message_length | 34 |
17
- | transaction_id | 0 |
18
- | xid | 0 |
19
- | buffer_id | 0 |
20
- | total_len | 0 |
21
- | reason | :no_match |
22
- | table_id | 0 |
23
- | cookie | 0 |
24
- | match.match_fields.size | 0 |
25
- | raw_data.length | 0 |
10
+ | field | value |
11
+ | ofp_version | 4 |
12
+ | message_type | 10 |
13
+ | message_length | 34 |
14
+ | transaction_id | 0 |
15
+ | xid | 0 |
16
+ | buffer_id | 0 |
17
+ | total_len | 0 |
18
+ | reason | :no_match |
19
+ | table_id | 0 |
20
+ | cookie | 0 |
21
+ | match.match_fields.size | 0 |
22
+ | raw_data.length | 0 |
26
23
 
27
24
  Scenario: new (raw_data = ARP request)
28
25
  When I try to create an OpenFlow message with:
@@ -41,9 +38,7 @@ Feature: Pio::PacketIn
41
38
  Then it should finish successfully
42
39
  And the message have the following fields and values:
43
40
  | field | value |
44
- | class | Pio::PacketIn |
45
41
  | ofp_version | 4 |
46
- | message_type | 10 |
47
42
  | message_length | 94 |
48
43
  | transaction_id | 0 |
49
44
  | xid | 0 |
@@ -62,7 +57,6 @@ Feature: Pio::PacketIn
62
57
  Then it should finish successfully
63
58
  And the message have the following fields and values:
64
59
  | field | value |
65
- | class | Pio::PacketIn |
66
60
  | ofp_version | 4 |
67
61
  | message_type | 10 |
68
62
  | message_length | 102 |
@@ -70,6 +64,7 @@ Feature: Pio::PacketIn
70
64
  | xid | 123 |
71
65
  | buffer_id.to_hex | 0xcafebabe |
72
66
  | total_len | 60 |
67
+ | in_port | 1 |
73
68
  | reason | :no_match |
74
69
  | table_id | 0 |
75
70
  | cookie | 0 |
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::PacketOut
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new
6
4
  When I try to create an OpenFlow message with:
7
5
  """
@@ -9,17 +7,17 @@ Feature: Pio::PacketOut
9
7
  """
10
8
  Then it should finish successfully
11
9
  And the message have the following fields and values:
12
- | field | value |
13
- | class | Pio::PacketOut |
14
- | ofp_version | 4 |
15
- | message_type | 13 |
16
- | message_length | 24 |
17
- | transaction_id | 0 |
18
- | xid | 0 |
19
- | buffer_id | :no_buffer |
20
- | in_port | 0 |
21
- | actions_length | 0 |
22
- | raw_data.length | 0 |
10
+ | field | value |
11
+ | ofp_version | 4 |
12
+ | message_type | 13 |
13
+ | message_length | 24 |
14
+ | to_binary.length | 24 |
15
+ | transaction_id | 0 |
16
+ | xid | 0 |
17
+ | buffer_id | :no_buffer |
18
+ | in_port | 0 |
19
+ | actions_length | 0 |
20
+ | raw_data.length | 0 |
23
21
 
24
22
  Scenario: new (actions = SendOutPort(1), raw_data = ARP Request)
25
23
  When I try to create an OpenFlow message with:
@@ -38,10 +36,10 @@ Feature: Pio::PacketOut
38
36
  Then it should finish successfully
39
37
  And the message have the following fields and values:
40
38
  | field | value |
41
- | class | Pio::PacketOut |
42
39
  | ofp_version | 4 |
43
40
  | message_type | 13 |
44
41
  | message_length | 100 |
42
+ | to_binary.length | 100 |
45
43
  | transaction_id | 0 |
46
44
  | xid | 0 |
47
45
  | buffer_id | :no_buffer |
@@ -66,31 +64,30 @@ Feature: Pio::PacketOut
66
64
  When I try to parse a file named "open_flow13/packet_out.raw" with "PacketOut" class
67
65
  Then it should finish successfully
68
66
  And the message have the following fields and values:
69
- | field | value |
70
- | class | Pio::PacketOut |
71
- | ofp_version | 4 |
72
- | message_type | 13 |
73
- | message_length | 100 |
74
- | transaction_id | 123 |
75
- | xid | 123 |
76
- | buffer_id | :no_buffer |
77
- | in_port | :controller |
78
- | actions_length | 16 |
79
- | actions.first.class | Pio::SendOutPort |
80
- | actions.first.port | 1 |
81
- | actions.first.max_length | :no_buffer |
82
- | raw_data.length | 60 |
83
- | data.class | Pio::Arp::Request |
84
- | destination_mac | ff:ff:ff:ff:ff:ff |
85
- | source_mac | ac:5d:10:31:37:79 |
86
- | ether_type | 2054 |
87
- | hardware_type | 1 |
88
- | protocol_type | 2048 |
89
- | hardware_length | 6 |
90
- | protocol_length | 4 |
91
- | operation | 1 |
92
- | sender_hardware_address | ac:5d:10:31:37:79 |
93
- | sender_protocol_address | 192.168.2.254 |
94
- | target_hardware_address | ff:ff:ff:ff:ff:ff |
95
- | target_protocol_address | 192.168.2.5 |
67
+ | field | value |
68
+ | ofp_version | 4 |
69
+ | message_type | 13 |
70
+ | message_length | 100 |
71
+ | transaction_id | 123 |
72
+ | xid | 123 |
73
+ | buffer_id | :no_buffer |
74
+ | in_port | :controller |
75
+ | actions_length | 16 |
76
+ | actions.first.class | Pio::OpenFlow13::SendOutPort |
77
+ | actions.first.port | 1 |
78
+ | actions.first.max_length | :no_buffer |
79
+ | raw_data.length | 60 |
80
+ | data.class | Pio::Arp::Request |
81
+ | destination_mac | ff:ff:ff:ff:ff:ff |
82
+ | source_mac | ac:5d:10:31:37:79 |
83
+ | ether_type | 2054 |
84
+ | hardware_type | 1 |
85
+ | protocol_type | 2048 |
86
+ | hardware_length | 6 |
87
+ | protocol_length | 4 |
88
+ | operation | 1 |
89
+ | sender_hardware_address | ac:5d:10:31:37:79 |
90
+ | sender_protocol_address | 192.168.2.254 |
91
+ | target_hardware_address | ff:ff:ff:ff:ff:ff |
92
+ | target_protocol_address | 192.168.2.5 |
96
93
 
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::SendOutPort
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new(1)
6
4
  When I try to create an OpenFlow action with:
7
5
  """
@@ -10,7 +8,6 @@ Feature: Pio::SendOutPort
10
8
  Then it should finish successfully
11
9
  And the message have the following fields and values:
12
10
  | field | value |
13
- | class | Pio::SendOutPort |
14
11
  | action_type | 0 |
15
12
  | action_length | 16 |
16
13
  | port | 1 |
@@ -21,7 +18,6 @@ Feature: Pio::SendOutPort
21
18
  Then it should finish successfully
22
19
  And the message have the following fields and values:
23
20
  | field | value |
24
- | class | Pio::SendOutPort |
25
21
  | action_type | 0 |
26
22
  | action_length | 16 |
27
23
  | port | 1 |
@@ -1,7 +1,5 @@
1
+ @open_flow13
1
2
  Feature: Pio::WriteMetadata
2
- Background:
3
- Given I use OpenFlow 1.3
4
-
5
3
  Scenario: new(metadata: 1)
6
4
  When I try to create an OpenFlow instruction with:
7
5
  """
@@ -13,6 +11,7 @@ Feature: Pio::WriteMetadata
13
11
  | class | Pio::WriteMetadata |
14
12
  | instruction_type | 2 |
15
13
  | instruction_length | 24 |
14
+ | to_binary_s.length | 24 |
16
15
  | metadata | 1 |
17
16
  | metadata_mask | 0 |
18
17
 
@@ -24,5 +23,6 @@ Feature: Pio::WriteMetadata
24
23
  | class | Pio::WriteMetadata |
25
24
  | instruction_type | 2 |
26
25
  | instruction_length | 24 |
26
+ | to_binary_s.length | 24 |
27
27
  | metadata | 1 |
28
28
  | metadata_mask | 1 |
@@ -0,0 +1,43 @@
1
+ Feature: Pio::OpenFlow.read
2
+ Scenario: Hello
3
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
4
+ When I try to parse a file named "open_flow10/hello.raw" with "OpenFlow" class
5
+ Then it should finish successfully
6
+ And the message should be a "Pio::OpenFlow10::Hello"
7
+
8
+ Scenario: Echo::Request
9
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
10
+ When I try to parse a file named "open_flow10/echo_request.raw" with "OpenFlow" class
11
+ Then it should finish successfully
12
+ And the message should be a "Pio::OpenFlow10::Echo::Request"
13
+
14
+ Scenario: Echo::Reply
15
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
16
+ When I try to parse a file named "open_flow10/echo_reply.raw" with "OpenFlow" class
17
+ Then it should finish successfully
18
+ And the message should be a "Pio::OpenFlow10::Echo::Reply"
19
+
20
+ Scenario: Features::Request
21
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
22
+ When I try to parse a file named "open_flow10/features_request.raw" with "OpenFlow" class
23
+ Then it should finish successfully
24
+ And the message should be a "Pio::OpenFlow10::Features::Request"
25
+
26
+ Scenario: Features::Reply
27
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
28
+ When I try to parse a file named "open_flow10/features_reply.raw" with "OpenFlow" class
29
+ Then it should finish successfully
30
+ And the message should be a "Pio::OpenFlow10::Features::Reply"
31
+
32
+ Scenario: PacketIn
33
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
34
+ When I try to parse a file named "open_flow10/packet_in.raw" with "OpenFlow" class
35
+ Then it should finish successfully
36
+ And the message should be a "Pio::OpenFlow10::PacketIn"
37
+
38
+ Scenario: PortStatus
39
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
40
+ When I try to parse a file named "open_flow10/port_status.raw" with "OpenFlow" class
41
+ Then it should finish successfully
42
+ And the message should be a "Pio::OpenFlow10::PortStatus"
43
+
@@ -0,0 +1,10 @@
1
+ Feature: Pio::OpenFlow.version
2
+ Scenario: OpenFlow 1.0
3
+ Given I switch the Pio::OpenFlow version to "OpenFlow10"
4
+ When I get the OpenFlow version string
5
+ Then the version string should be "OpenFlow10"
6
+
7
+ Scenario: OpenFlow 1.3
8
+ Given I switch the Pio::OpenFlow version to "OpenFlow13"
9
+ When I get the OpenFlow version string
10
+ Then the version string should be "OpenFlow13"
@@ -1,5 +1,13 @@
1
- Given(/^I use OpenFlow 1\.3$/) do
2
- require 'pio/open_flow13'
1
+ Given(/^I switch the Pio::OpenFlow version to "([^"]*)"$/) do |version|
2
+ Pio::OpenFlow.switch_version version.to_sym
3
+ end
4
+
5
+ When(/^I get the OpenFlow version string$/) do
6
+ @version = Pio::OpenFlow.version
7
+ end
8
+
9
+ Then(/^the version string should be "([^"]*)"$/) do |expected_version_string|
10
+ expect(@version).to eq(expected_version_string)
3
11
  end
4
12
 
5
13
  When(/^I try to create a packet with:$/) do |ruby_code|
@@ -40,6 +40,10 @@ When(/^I create an exact match from "(.*?)"$/) do |path|
40
40
  @result = Pio::ExactMatch.new(Pio::PacketIn.read(IO.read(full_path)))
41
41
  end
42
42
 
43
+ Then(/^the message should be a "([^"]*)"$/) do |expected_klass|
44
+ expect(@result.class.to_s).to eq(expected_klass)
45
+ end
46
+
43
47
  Then(/^the packet have the following fields and values:$/) do |table|
44
48
  table.hashes.each do |each|
45
49
  output = @result.instance_eval("self.#{each['field']}")
@@ -0,0 +1,7 @@
1
+ Before('@open_flow10') do
2
+ Pio::OpenFlow.switch_version :OpenFlow10
3
+ end
4
+
5
+ Before('@open_flow13') do
6
+ Pio::OpenFlow.switch_version :OpenFlow13
7
+ end