-
Notifications
You must be signed in to change notification settings - Fork 11
/
echo_request.feature
141 lines (130 loc) · 5.52 KB
/
echo_request.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Feature: Pio::Echo::Request
Background:
Given I use OpenFlow 1.3
Scenario: new
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |
Scenario: new(transaction_id: 123)
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(transaction_id: 123)
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |
Scenario: new(xid: 123)
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(xid: 123)
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 123 |
| xid | 123 |
| body | |
| user_data | |
Scenario: new(xid: -1) and error
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(xid: -1)
"""
Then it should fail with "ArgumentError", "Transaction ID should be an unsigned 32-bit integer."
Scenario: new(xid: 2**32) and error
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(xid: 2**32)
"""
Then it should fail with "ArgumentError", "Transaction ID should be an unsigned 32-bit integer."
Scenario: new(body: 'echo request body')
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(body: 'echo request body')
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 25 |
| transaction_id | 0 |
| xid | 0 |
| body | echo request body |
| user_data | echo request body |
Scenario: new(user_data: 'echo request body')
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(user_data: 'echo request body')
"""
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 25 |
| transaction_id | 0 |
| xid | 0 |
| body | echo request body |
| user_data | echo request body |
Scenario: new(unknown_attr: 'foo') and error
When I try to create an OpenFlow message with:
"""
Pio::Echo::Request.new(unknown_attr: 'foo')
"""
Then it should fail with "RuntimeError", "Unknown option: unknown_attr"
Scenario: read (no message body)
When I try to parse a file named "open_flow13/echo_request_no_body.raw" with "Pio::Echo::Request" class
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 8 |
| transaction_id | 0 |
| xid | 0 |
| body | |
| user_data | |
Scenario: read
When I try to parse a file named "open_flow13/echo_request_body.raw" with "Pio::Echo::Request" class
Then it should finish successfully
And the message have the following fields and values:
| field | value |
| class | Pio::Echo::Request |
| ofp_version | 4 |
| message_type | 2 |
| message_length | 28 |
| transaction_id | 0 |
| xid | 0 |
| body | hogehogehogehogehoge |
| user_data | hogehogehogehogehoge |
Scenario: parse error
When I try to parse a file named "open_flow10/features_request.raw" with "Pio::Echo::Request" class
Then it should fail with "Pio::ParseError", "Invalid Echo Request message."