summaryrefslogtreecommitdiff
path: root/tests/ofp-errors.at
blob: da3aca3af0f5a6a0df7955c62c00bd56eba7da61 (plain)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
AT_BANNER([ofp-errors tests])

AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED - OF1.0])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 010100170000000000000001657874726120646174610a], [0], [dnl
OFPT_ERROR (xid=0x0): OFPHFC_EPERM
extra data\012
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED - OF1.1])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 020100170000000000000001657874726120646174610a], [0], [dnl
OFPT_ERROR (OF1.1) (xid=0x0): OFPHFC_EPERM
extra data\012
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR with type OFPET_BAD_REQUEST - OF1.0])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 0101001400000000000100060105ccddeeff0011], [0], [dnl
OFPT_ERROR (xid=0x0): OFPBRC_BAD_LEN
OFPT_FEATURES_REQUEST (xid=0xeeff0011):
(***truncated to 8 bytes from 52445***)
00000000  01 05 cc dd ee ff 00 11-                        |........        |
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR prints type of truncated inner messages])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print "0101004c092529d500010006 \
01 06 00 e0 00 00 00 01 00 00 50 54 00 00 00 01 \
00 00 01 00 02 00 00 00 00 00 00 87 00 00 0f ff \
ff fe 50 54 00 00 00 01 62 72 30 00 00 00 00 00 \
00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01"], [0], [dnl
OFPT_ERROR (xid=0x92529d5): OFPBRC_BAD_LEN
OFPT_FEATURES_REPLY (xid=0x1):
(***truncated to 64 bytes from 224***)
00000000  01 06 00 e0 00 00 00 01-00 00 50 54 00 00 00 01 |..........PT....|
00000010  00 00 01 00 02 00 00 00-00 00 00 87 00 00 0f ff |................|
00000020  ff fe 50 54 00 00 00 01-62 72 30 00 00 00 00 00 |..PT....br0.....|
00000030  00 00 00 00 00 00 00 00-00 00 00 01 00 00 00 01 |................|
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR with code OFPBMC_BAD_PREREQ - OF1.0])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print '0101001c55555555 b0c20000 0000232000010104 0102000811111111'], [0], [dnl
OFPT_ERROR (xid=0x55555555): OFPBMC_BAD_PREREQ
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR with code OFPBMC_BAD_PREREQ - OF1.1])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print '0201001c55555555 b0c20000 0000232000010104 0102000811111111'], [0], [dnl
OFPT_ERROR (OF1.1) (xid=0x55555555): OFPBMC_BAD_PREREQ
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CLEANUP

dnl Error type 3, code 1 is OFPFMFC_OVERLAP in OF1.0
dnl and OFPBIC_UNSUP_INST in OF1.1, so check that value in both versions.
AT_SETUP([OFPT_ERROR with type OFPFMFC_OVERLAP - OF1.0])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 0101001400000000000300010106ccddeeff0011], [0], [dnl
OFPT_ERROR (xid=0x0): OFPFMFC_OVERLAP
OFPT_FEATURES_REPLY (xid=0xeeff0011):
(***truncated to 8 bytes from 52445***)
00000000  01 06 cc dd ee ff 00 11-                        |........        |
])
AT_CLEANUP
AT_SETUP([OFPT_ERROR with type OFPBIC_UNSUP_INST - OF1.1])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 0201001400000000000300010206ccddeeff0011], [0], [dnl
OFPT_ERROR (OF1.1) (xid=0x0): OFPBIC_UNSUP_INST
OFPT_FEATURES_REPLY (OF1.1) (xid=0xeeff0011):
(***truncated to 8 bytes from 52445***)
00000000  02 06 cc dd ee ff 00 11-                        |........        |
])
AT_CLEANUP

AT_SETUP([OFPT_ERROR with type OFPBIC_DUP_INST - OF1.4])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print 0501001400000000000300090206ccddeeff0011], [0], [dnl
OFPT_ERROR (OF1.4) (xid=0x0): OFPBIC_DUP_INST
OFPT_FEATURES_REPLY (OF1.1) (xid=0xeeff0011):
(***truncated to 8 bytes from 52445***)
00000000  02 06 cc dd ee ff 00 11-                        |........        |
])
AT_CLEANUP

dnl OF1.1 had OFPBIC_UNSUP_EXP_INST as 3,5.
dnl OF1.2 broke it into OFPBIC_BAD_EXPERIMENTER as 3,5
dnl                 and OFPBIC_BAD_EXT_TYPE as 3,6.
dnl Thus, for OF1.1 we translate both of the latter error codes into 3,5.
AT_SETUP([encoding OFPBIC_* experimenter errors])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl print-error OFPBIC_BAD_EXPERIMENTER], [0], [dnl
OpenFlow 1.1: vendor 0, type 3, code 5
OpenFlow 1.2: vendor 0, type 3, code 5
OpenFlow 1.3: vendor 0, type 3, code 5
OpenFlow 1.4: vendor 0, type 3, code 5
OpenFlow 1.5: vendor 0, type 3, code 5
])
AT_CHECK([ovs-ofctl print-error OFPBIC_BAD_EXP_TYPE], [0], [dnl
OpenFlow 1.1: vendor 0, type 3, code 5
OpenFlow 1.2: vendor 0, type 3, code 6
OpenFlow 1.3: vendor 0, type 3, code 6
OpenFlow 1.4: vendor 0, type 3, code 6
OpenFlow 1.5: vendor 0, type 3, code 6
])
AT_CLEANUP

dnl The "bad role" error was a Nicira extension in OpenFlow 1.0 and 1.1.
dnl It was adopted as an official error code in OpenFlow 1.2.
AT_SETUP([encoding errors extension that became official])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK(
  [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0100000812345678], [0], [dnl
00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20
00000010  00 01 02 01 01 00 00 08-12 34 56 78
])
AT_CHECK(
  [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0200000812345678], [0], [dnl
00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20
00000010  00 01 02 01 02 00 00 08-12 34 56 78
])
AT_CHECK(
  [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0300000812345678], [0], [dnl
00000000  03 01 00 14 12 34 56 78-00 0b 00 02 03 00 00 08
00000010  12 34 56 78
])
AT_CLEANUP

AT_SETUP([decoding OFPBIC_* experimenter errors])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print '0201001455555555 00030005 0102000811111111'], [0], [dnl
OFPT_ERROR (OF1.1) (xid=0x55555555): OFPBIC_BAD_EXPERIMENTER
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CHECK([ovs-ofctl ofp-print '0301001455555555 00030005 0102000811111111'], [0], [dnl
OFPT_ERROR (OF1.2) (xid=0x55555555): OFPBIC_BAD_EXPERIMENTER
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CHECK([ovs-ofctl ofp-print '0301001455555555 00030006 0102000811111111'], [0], [dnl
OFPT_ERROR (OF1.2) (xid=0x55555555): OFPBIC_BAD_EXP_TYPE
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CLEANUP

AT_SETUP([decoding experimenter errors])
AT_KEYWORDS([ofp-print ofp-errors])
AT_CHECK([ovs-ofctl ofp-print '0101001c55555555 b0c20000 0000232000010203 0102000811111111'], [0], [dnl
OFPT_ERROR (xid=0x55555555): NXBRC_MUST_BE_ZERO
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CHECK([ovs-ofctl ofp-print '0201001c55555555 b0c20000 0000232000010203 0102000811111111'], [0], [dnl
OFPT_ERROR (OF1.1) (xid=0x55555555): NXBRC_MUST_BE_ZERO
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CHECK([ovs-ofctl ofp-print '0301001855555555 ffff0004 00002320 0102000811111111'], [0], [dnl
OFPT_ERROR (OF1.2) (xid=0x55555555): NXBRC_MUST_BE_ZERO
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])

AT_CHECK([ovs-ofctl ofp-print '0301001812345678 ffff0a28 4f4e4600 0300000812345678'], [0], [dnl
OFPT_ERROR (OF1.2) (xid=0x12345678): OFPBIC_DUP_INST
OFPT_HELLO (OF1.2) (xid=0x12345678):
 version bitmap: 0x01, 0x02, 0x03
])
AT_CHECK([ovs-ofctl ofp-print '0401001812345678 ffff0a28 4f4e4600 0400000812345678'], [0], [dnl
OFPT_ERROR (OF1.3) (xid=0x12345678): OFPBIC_DUP_INST
OFPT_HELLO (OF1.3) (xid=0x12345678):
 version bitmap: 0x01, 0x02, 0x03, 0x04
])
AT_CHECK([ovs-ofctl ofp-print '0501001412345678 00030009 0500000812345678'], [0], [dnl
OFPT_ERROR (OF1.4) (xid=0x12345678): OFPBIC_DUP_INST
OFPT_HELLO (OF1.4) (xid=0x12345678):
 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05
])
AT_CLEANUP

AT_SETUP([encoding experimenter errors])
AT_KEYWORDS([ofp-print ofp-errors])
# Demonstrate that a Nicira extension error gets encoded correctly
# using the Nicira error extension format in OF1.0 and OF1.1, and
# correctly using the standard experimenter format in OF1.2.
AT_CHECK(
  [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0100000812345678], [0], [dnl
00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20
00000010  00 01 02 03 01 00 00 08-12 34 56 78
])
AT_CHECK(
  [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0200000812345678], [0], [dnl
00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20
00000010  00 01 02 03 02 00 00 08-12 34 56 78
])
AT_CHECK(
  [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0300000812345678], [0], [dnl
00000000  03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20
00000010  03 00 00 08 12 34 56 78
])

# Check that OFPERR_OFPBIC_DUP_INST is:
#    - not encodable in OF1.0 (OF1.0 doesn't have instructions, after all).
#    - encoded as a Nicira extension in OF1.1.
#    - encoded as an ONF extension in OF1.2 and OF1.3.
#    - encoded in the standard form in OF1.4.
AT_CHECK(
  [ovs-ofctl '-vPATTERN:console:%c|%p|%m' encode-error-reply OFPBIC_DUP_INST 0100000812345678], [0], [dnl
00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20
00000010  00 01 02 09 01 00 00 08-12 34 56 78
], [ofp_errors|ERR|cannot encode OFPBIC_DUP_INST for OpenFlow 1.0
])
AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0200000812345678], [0],
[00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20
00000010  00 03 01 00 02 00 00 08-12 34 56 78
])
AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0300000812345678], [0],
[00000000  03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00
00000010  03 00 00 08 12 34 56 78
])
AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0400000812345678], [0],
[00000000  04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00
00000010  04 00 00 08 12 34 56 78
])
AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0500000812345678], [0],
[00000000  05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08
00000010  12 34 56 78
])
AT_CLEANUP