netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / tests / ofp-errors.at
1 AT_BANNER([ofp-errors tests])
2
3 AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED - OF1.0])
4 AT_KEYWORDS([ofp-print ofp-errors])
5 AT_CHECK([ovs-ofctl ofp-print 010100170000000000000001657874726120646174610a], [0], [dnl
6 OFPT_ERROR (xid=0x0): OFPHFC_EPERM
7 extra data\012
8 ])
9 AT_CLEANUP
10
11 AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED - OF1.1])
12 AT_KEYWORDS([ofp-print ofp-errors])
13 AT_CHECK([ovs-ofctl ofp-print 020100170000000000000001657874726120646174610a], [0], [dnl
14 OFPT_ERROR (OF1.1) (xid=0x0): OFPHFC_EPERM
15 extra data\012
16 ])
17 AT_CLEANUP
18
19 AT_SETUP([OFPT_ERROR with type OFPET_BAD_REQUEST - OF1.0])
20 AT_KEYWORDS([ofp-print ofp-errors])
21 AT_CHECK([ovs-ofctl ofp-print 0101001400000000000100060105ccddeeff0011], [0], [dnl
22 OFPT_ERROR (xid=0x0): OFPBRC_BAD_LEN
23 OFPT_FEATURES_REQUEST (xid=0xeeff0011):
24 (***truncated to 8 bytes from 52445***)
25 00000000  01 05 cc dd ee ff 00 11-                        |........        |
26 ])
27 AT_CLEANUP
28
29 AT_SETUP([OFPT_ERROR prints type of truncated inner messages])
30 AT_KEYWORDS([ofp-print ofp-errors])
31 AT_CHECK([ovs-ofctl ofp-print "0101004c092529d500010006 \
32 01 06 00 e0 00 00 00 01 00 00 50 54 00 00 00 01 \
33 00 00 01 00 02 00 00 00 00 00 00 87 00 00 0f ff \
34 ff fe 50 54 00 00 00 01 62 72 30 00 00 00 00 00 \
35 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01"], [0], [dnl
36 OFPT_ERROR (xid=0x92529d5): OFPBRC_BAD_LEN
37 OFPT_FEATURES_REPLY (xid=0x1):
38 (***truncated to 64 bytes from 224***)
39 00000000  01 06 00 e0 00 00 00 01-00 00 50 54 00 00 00 01 |..........PT....|
40 00000010  00 00 01 00 02 00 00 00-00 00 00 87 00 00 0f ff |................|
41 00000020  ff fe 50 54 00 00 00 01-62 72 30 00 00 00 00 00 |..PT....br0.....|
42 00000030  00 00 00 00 00 00 00 00-00 00 00 01 00 00 00 01 |................|
43 ])
44 AT_CLEANUP
45
46 AT_SETUP([OFPT_ERROR with code OFPBMC_BAD_PREREQ - OF1.0])
47 AT_KEYWORDS([ofp-print ofp-errors])
48 AT_CHECK([ovs-ofctl ofp-print '0101001c55555555 b0c20000 0000232000010104 0102000811111111'], [0], [dnl
49 OFPT_ERROR (xid=0x55555555): OFPBMC_BAD_PREREQ
50 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
51 ])
52 AT_CLEANUP
53
54 AT_SETUP([OFPT_ERROR with code OFPBMC_BAD_PREREQ - OF1.1])
55 AT_KEYWORDS([ofp-print ofp-errors])
56 AT_CHECK([ovs-ofctl ofp-print '0201001c55555555 b0c20000 0000232000010104 0102000811111111'], [0], [dnl
57 OFPT_ERROR (OF1.1) (xid=0x55555555): OFPBMC_BAD_PREREQ
58 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
59 ])
60 AT_CLEANUP
61
62 dnl Error type 3, code 1 is OFPFMFC_OVERLAP in OF1.0
63 dnl and OFPBIC_UNSUP_INST in OF1.1, so check that value in both versions.
64 AT_SETUP([OFPT_ERROR with type OFPFMFC_OVERLAP - OF1.0])
65 AT_KEYWORDS([ofp-print ofp-errors])
66 AT_CHECK([ovs-ofctl ofp-print 0101001400000000000300010106ccddeeff0011], [0], [dnl
67 OFPT_ERROR (xid=0x0): OFPFMFC_OVERLAP
68 OFPT_FEATURES_REPLY (xid=0xeeff0011):
69 (***truncated to 8 bytes from 52445***)
70 00000000  01 06 cc dd ee ff 00 11-                        |........        |
71 ])
72 AT_CLEANUP
73 AT_SETUP([OFPT_ERROR with type OFPBIC_UNSUP_INST - OF1.1])
74 AT_KEYWORDS([ofp-print ofp-errors])
75 AT_CHECK([ovs-ofctl ofp-print 0201001400000000000300010206ccddeeff0011], [0], [dnl
76 OFPT_ERROR (OF1.1) (xid=0x0): OFPBIC_UNSUP_INST
77 OFPT_FEATURES_REPLY (OF1.1) (xid=0xeeff0011):
78 (***truncated to 8 bytes from 52445***)
79 00000000  02 06 cc dd ee ff 00 11-                        |........        |
80 ])
81 AT_CLEANUP
82
83 AT_SETUP([OFPT_ERROR with type OFPBIC_DUP_INST - OF1.4])
84 AT_KEYWORDS([ofp-print ofp-errors])
85 AT_CHECK([ovs-ofctl ofp-print 0501001400000000000300090206ccddeeff0011], [0], [dnl
86 OFPT_ERROR (OF1.4) (xid=0x0): OFPBIC_DUP_INST
87 OFPT_FEATURES_REPLY (OF1.1) (xid=0xeeff0011):
88 (***truncated to 8 bytes from 52445***)
89 00000000  02 06 cc dd ee ff 00 11-                        |........        |
90 ])
91 AT_CLEANUP
92
93 dnl OF1.1 had OFPBIC_UNSUP_EXP_INST as 3,5.
94 dnl OF1.2 broke it into OFPBIC_BAD_EXPERIMENTER as 3,5
95 dnl                 and OFPBIC_BAD_EXT_TYPE as 3,6.
96 dnl Thus, for OF1.1 we translate both of the latter error codes into 3,5.
97 AT_SETUP([encoding OFPBIC_* experimenter errors])
98 AT_KEYWORDS([ofp-print ofp-errors])
99 AT_CHECK([ovs-ofctl print-error OFPBIC_BAD_EXPERIMENTER], [0], [dnl
100 OpenFlow 1.1: vendor 0, type 3, code 5
101 OpenFlow 1.2: vendor 0, type 3, code 5
102 OpenFlow 1.3: vendor 0, type 3, code 5
103 OpenFlow 1.4: vendor 0, type 3, code 5
104 OpenFlow 1.5: vendor 0, type 3, code 5
105 ])
106 AT_CHECK([ovs-ofctl print-error OFPBIC_BAD_EXP_TYPE], [0], [dnl
107 OpenFlow 1.1: vendor 0, type 3, code 5
108 OpenFlow 1.2: vendor 0, type 3, code 6
109 OpenFlow 1.3: vendor 0, type 3, code 6
110 OpenFlow 1.4: vendor 0, type 3, code 6
111 OpenFlow 1.5: vendor 0, type 3, code 6
112 ])
113 AT_CLEANUP
114
115 dnl The "bad role" error was a Nicira extension in OpenFlow 1.0 and 1.1.
116 dnl It was adopted as an official error code in OpenFlow 1.2.
117 AT_SETUP([encoding errors extension that became official])
118 AT_KEYWORDS([ofp-print ofp-errors])
119 AT_CHECK(
120   [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0100000812345678], [0], [dnl
121 00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
122 00000010  00 01 02 01 01 00 00 08-12 34 56 78 @&t@
123 ])
124 AT_CHECK(
125   [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0200000812345678], [0], [dnl
126 00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
127 00000010  00 01 02 01 02 00 00 08-12 34 56 78 @&t@
128 ])
129 AT_CHECK(
130   [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0300000812345678], [0], [dnl
131 00000000  03 01 00 14 12 34 56 78-00 0b 00 02 03 00 00 08 @&t@
132 00000010  12 34 56 78 @&t@
133 ])
134 AT_CLEANUP
135
136 AT_SETUP([decoding OFPBIC_* experimenter errors])
137 AT_KEYWORDS([ofp-print ofp-errors])
138 AT_CHECK([ovs-ofctl ofp-print '0201001455555555 00030005 0102000811111111'], [0], [dnl
139 OFPT_ERROR (OF1.1) (xid=0x55555555): OFPBIC_BAD_EXPERIMENTER
140 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
141 ])
142 AT_CHECK([ovs-ofctl ofp-print '0301001455555555 00030005 0102000811111111'], [0], [dnl
143 OFPT_ERROR (OF1.2) (xid=0x55555555): OFPBIC_BAD_EXPERIMENTER
144 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
145 ])
146 AT_CHECK([ovs-ofctl ofp-print '0301001455555555 00030006 0102000811111111'], [0], [dnl
147 OFPT_ERROR (OF1.2) (xid=0x55555555): OFPBIC_BAD_EXP_TYPE
148 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
149 ])
150 AT_CLEANUP
151
152 AT_SETUP([decoding experimenter errors])
153 AT_KEYWORDS([ofp-print ofp-errors])
154 AT_CHECK([ovs-ofctl ofp-print '0101001c55555555 b0c20000 0000232000010203 0102000811111111'], [0], [dnl
155 OFPT_ERROR (xid=0x55555555): NXBRC_MUST_BE_ZERO
156 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
157 ])
158 AT_CHECK([ovs-ofctl ofp-print '0201001c55555555 b0c20000 0000232000010203 0102000811111111'], [0], [dnl
159 OFPT_ERROR (OF1.1) (xid=0x55555555): NXBRC_MUST_BE_ZERO
160 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
161 ])
162 AT_CHECK([ovs-ofctl ofp-print '0301001855555555 ffff0004 00002320 0102000811111111'], [0], [dnl
163 OFPT_ERROR (OF1.2) (xid=0x55555555): NXBRC_MUST_BE_ZERO
164 OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
165 ])
166
167 AT_CHECK([ovs-ofctl ofp-print '0301001812345678 ffff0a28 4f4e4600 0300000812345678'], [0], [dnl
168 OFPT_ERROR (OF1.2) (xid=0x12345678): OFPBIC_DUP_INST
169 OFPT_HELLO (OF1.2) (xid=0x12345678):
170  version bitmap: 0x01, 0x02, 0x03
171 ])
172 AT_CHECK([ovs-ofctl ofp-print '0401001812345678 ffff0a28 4f4e4600 0400000812345678'], [0], [dnl
173 OFPT_ERROR (OF1.3) (xid=0x12345678): OFPBIC_DUP_INST
174 OFPT_HELLO (OF1.3) (xid=0x12345678):
175  version bitmap: 0x01, 0x02, 0x03, 0x04
176 ])
177 AT_CHECK([ovs-ofctl ofp-print '0501001412345678 00030009 0500000812345678'], [0], [dnl
178 OFPT_ERROR (OF1.4) (xid=0x12345678): OFPBIC_DUP_INST
179 OFPT_HELLO (OF1.4) (xid=0x12345678):
180  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05
181 ])
182 AT_CLEANUP
183
184 AT_SETUP([encoding experimenter errors])
185 AT_KEYWORDS([ofp-print ofp-errors])
186 # Demonstrate that a Nicira extension error gets encoded correctly
187 # using the Nicira error extension format in OF1.0 and OF1.1, and
188 # correctly using the standard experimenter format in OF1.2.
189 AT_CHECK(
190   [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0100000812345678], [0], [dnl
191 00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
192 00000010  00 01 02 03 01 00 00 08-12 34 56 78 @&t@
193 ])
194 AT_CHECK(
195   [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0200000812345678], [0], [dnl
196 00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
197 00000010  00 01 02 03 02 00 00 08-12 34 56 78 @&t@
198 ])
199 AT_CHECK(
200   [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0300000812345678], [0], [dnl
201 00000000  03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20 @&t@
202 00000010  03 00 00 08 12 34 56 78-
203 ])
204
205 # Check that OFPERR_OFPBIC_DUP_INST is:
206 #    - not encodable in OF1.0 (OF1.0 doesn't have instructions, after all).
207 #    - encoded as a Nicira extension in OF1.1.
208 #    - encoded as an ONF extension in OF1.2 and OF1.3.
209 #    - encoded in the standard form in OF1.4.
210 AT_CHECK(
211   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' encode-error-reply OFPBIC_DUP_INST 0100000812345678], [0], [dnl
212 00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
213 00000010  00 01 02 09 01 00 00 08-12 34 56 78 @&t@
214 ], [ofp_errors|ERR|cannot encode OFPBIC_DUP_INST for OpenFlow 1.0
215 ])
216 AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0200000812345678], [0],
217 [00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
218 00000010  00 03 01 00 02 00 00 08-12 34 56 78 @&t@
219 ])
220 AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0300000812345678], [0],
221 [00000000  03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@
222 00000010  03 00 00 08 12 34 56 78-
223 ])
224 AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0400000812345678], [0],
225 [00000000  04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@
226 00000010  04 00 00 08 12 34 56 78-
227 ])
228 AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0500000812345678], [0],
229 [00000000  05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08 @&t@
230 00000010  12 34 56 78 @&t@
231 ])
232 AT_CLEANUP