]>
Commit | Line | Data |
---|---|---|
74971473 JG |
1 | /* |
2 | * This file is part of the PCEPlib, a PCEP protocol library. | |
3 | * | |
4 | * Copyright (C) 2020 Volta Networks https://voltanet.io/ | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public License | |
17 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
18 | * | |
19 | * Author : Brady Johnson <brady@voltanet.io> | |
20 | */ | |
21 | ||
1f8031f7 DL |
22 | #ifdef HAVE_CONFIG_H |
23 | #include "config.h" | |
24 | #endif | |
25 | ||
74971473 JG |
26 | #include <stdlib.h> |
27 | ||
28 | #include "pcep_msg_object_error_types.h" | |
29 | #include "pcep_utils_logging.h" | |
30 | ||
31 | /* All of these values were copied from: | |
32 | * https://www.iana.org/assignments/pcep/pcep.xhtml#pcep-error-object | |
33 | * Which was last updated 2020-06-02 */ | |
34 | ||
35 | static const char *error_type_strings[] = { | |
36 | "Reserved", | |
37 | "PCEP session establishment failure", | |
38 | "Capability not supported", | |
39 | "Unknown Object", | |
40 | "Not supported object", | |
41 | "Policy violation", | |
42 | "Mandatory Object missing", | |
43 | "Synchronized path computation request missing", | |
44 | "Unknown request reference", | |
45 | "Attempt to establish a second PCEP session", | |
46 | ||
47 | "Reception of an invalid object", /* 10 */ | |
48 | "Unrecognized EXRS subobject", | |
49 | "Diffserv-aware TE error", | |
50 | "BRPC procedure completion failure", | |
51 | "Unassigned 14", | |
52 | "Global Concurrent Optimization Error", | |
53 | "P2MP Capability Error", | |
54 | "P2MP END-POINTS Error", | |
55 | "P2MP Fragmentation Error", | |
56 | "Invalid Operation", | |
57 | ||
58 | "LSP State Synchronization Error", /* 20 */ | |
59 | "Invalid traffic engineering path setup type", | |
60 | "Unassigned 22", | |
61 | "Bad parameter value", | |
62 | "LSP instantiation error", | |
63 | "PCEP StartTLS failure", | |
64 | "Association Error", | |
65 | "WSON RWA Error", | |
66 | "H-PCE Error", | |
67 | "Path computation failure", | |
68 | "Unassigned 30"}; | |
69 | ||
70 | static const char *error_value_strings[MAX_ERROR_TYPE][MAX_ERROR_VALUE] = { | |
71 | ||
72 | /* 0 Reserved */ | |
73 | {"Unassigned"}, | |
74 | ||
75 | /* 1 PCEP session establishment failure */ | |
76 | { | |
77 | "Unassigned", | |
78 | "reception of an invalid Open message or a non Open message.", | |
79 | "no Open message received before the expiration of the OpenWait timer", | |
80 | "unacceptable and non negotiable session characteristics", | |
81 | "unacceptable but negotiable session characteristics", | |
82 | "reception of a second Open message with still unacceptable session characteristics", | |
83 | "reception of a PCErr message proposing unacceptable session characteristics", | |
84 | "No Keepalive or PCErr message received before the expiration of the KeepWait timer", | |
85 | "PCEP version not supported", | |
86 | }, | |
87 | ||
88 | /* 2 Capability not supported */ | |
89 | {"Unassigned"}, | |
90 | ||
91 | /* 3 Unknown Object */ | |
92 | { | |
93 | "Unassigned", | |
94 | "Unrecognized object class", | |
95 | "Unrecognized object Type", | |
96 | }, | |
97 | ||
98 | /* 4 Not supported object */ | |
99 | { | |
100 | "Unassigned", | |
101 | "Not supported object class", | |
102 | "Not supported object Type", | |
103 | "Unassigned", | |
104 | "Unsupported parameter", | |
105 | "Unsupported network performance constraint", | |
106 | "Bandwidth Object type 3 or 4 not supported", | |
107 | "Unsupported endpoint type in END-POINTS Generalized Endpoint object type", | |
108 | "Unsupported TLV present in END-POINTS Generalized Endpoint object type", | |
109 | "Unsupported granularity in the RP object flags", | |
110 | }, | |
111 | ||
112 | /* 5 Policy violation */ | |
113 | { | |
114 | "Unassigned", | |
115 | "C bit of the METRIC object set (request rejected)", | |
116 | "O bit of the RP object cleared (request rejected)", | |
117 | "objective function not allowed (request rejected)", | |
118 | "OF bit of the RP object set (request rejected)", | |
119 | "Global concurrent optimization not allowed", | |
120 | "Monitoring message supported but rejected due to policy violation", | |
121 | "P2MP Path computation is not allowed", | |
122 | "Not allowed network performance constraint", | |
123 | }, | |
124 | ||
125 | /* 6 Mandatory Object missing */ | |
126 | { | |
127 | "Unassigned", | |
128 | "RP object missing", | |
129 | "RRO missing for a reoptimization request (R bit of the RP object set)", | |
130 | "END-POINTS object missing", | |
131 | "MONITORING object missing", | |
132 | "Unassigned", | |
133 | "Unassigned", | |
134 | "Unassigned", | |
135 | "LSP object missing", | |
136 | "ERO object missing", | |
137 | "SRP object missing", | |
138 | "LSP-IDENTIFIERS TLV missing", | |
139 | "LSP-DB-VERSION TLV missing", | |
140 | "S2LS object missing", | |
141 | "P2MP-LSP-IDENTIFIERS TLV missing", | |
142 | "DISJOINTNESS-CONFIGURATION TLV missing", | |
143 | }, | |
144 | ||
145 | /* 7 Synchronized path computation request missing */ | |
146 | {"Unassigned"}, | |
147 | ||
148 | /* 8 Unknown request reference */ | |
149 | {"Unassigned"}, | |
150 | ||
151 | /* 9 Attempt to establish a second PCEP session */ | |
152 | {"Unassigned"}, | |
153 | ||
154 | /* 10 Reception of an invalid object */ | |
155 | { | |
156 | "Unassigned", | |
157 | "reception of an object with P flag not set although the P-flag must be set according to this specification.", | |
158 | "Bad label value", | |
159 | "Unsupported number of SR-ERO subobjects", | |
160 | "Bad label format", | |
161 | "ERO mixes SR-ERO subobjects with other subobject types", | |
162 | "Both SID and NAI are absent in the SR-ERO subobject", | |
163 | "Both SID and NAI are absent in the SR-RRO subobject", | |
164 | "SYMBOLIC-PATH-NAME TLV missing", | |
165 | "MSD exceeds the default for the PCEP session", | |
166 | "RRO mixes SR-RRO subobjects with other subobject types", | |
167 | "Malformed object", | |
168 | "Missing PCE-SR-CAPABILITY sub-TLV", | |
169 | "Unsupported NAI Type in the SR-ERO/SR-RRO subobject", | |
170 | "Unknown SID", | |
171 | "NAI cannot be resolved to a SID", | |
172 | "Could not find SRGB", | |
173 | "SID index exceeds SRGB size", | |
174 | "Could not find SRLB", | |
175 | "SID index exceeds SRLB size", | |
176 | "Inconsistent SIDs in SR-ERO / SR-RRO subobjects", | |
177 | "MSD must be nonzero", | |
178 | "Mismatch of O field in S2LS and LSP object", | |
179 | "Incompatible OF codes in H-PCE", | |
180 | "Bad Bandwidth Object type 3 (Generalized bandwidth) or 4 (Generalized bandwidth of existing TE-LSP for which a reoptimization is requested)", | |
181 | "Unsupported LSP Protection Flags in PROTECTION-ATTRIBUTE TLV", | |
182 | "Unsupported Secondary LSP Protection Flags in PROTECTION-ATTRIBUTE TLV", | |
183 | "Unsupported Link Protection Type in PROTECTION-ATTRIBUTE TLV", | |
184 | "LABEL-SET TLV present with 0 bit set but without R bit set in RP", | |
185 | "Wrong LABEL-SET TLV present with 0 and L bit set", | |
186 | "Wrong LABEL-SET with O bit set and wrong format", | |
187 | "Missing GMPLS-CAPABILITY TLV", | |
188 | "Incompatible OF code", | |
189 | }, | |
190 | ||
191 | /* 11 Unrecognized EXRS subobject */ | |
192 | {"Unassigned"}, | |
193 | ||
194 | /* 12 Diffserv-aware TE error */ | |
195 | { | |
196 | "Unassigned", | |
197 | "Unsupported class-type", | |
198 | "Invalid class-type", | |
199 | "Class-Type and setup priority do not form a configured TE-class", | |
200 | }, | |
201 | ||
202 | /* 13 BRPC procedure completion failure */ | |
203 | { | |
204 | "Unassigned", | |
205 | "BRPC procedure not supported by one or more PCEs along the domain path", | |
206 | }, | |
207 | ||
208 | /* 14 Unassigned */ | |
209 | {"Unassigned"}, | |
210 | ||
211 | /* 15 Global Concurrent Optimization Error */ | |
212 | { | |
213 | "Unassigned", | |
214 | "Insufficient memory", | |
215 | "Global concurrent optimization not supported", | |
216 | }, | |
217 | ||
218 | /* 16 P2MP Capability Error */ | |
219 | { | |
220 | "Unassigned", | |
221 | "The PCE cannot satisfy the request due to insufficient memory", | |
222 | "The PCE is not capable of P2MP computation", | |
223 | }, | |
224 | ||
225 | /* 17 P2MP END-POINTS Error */ | |
226 | { | |
227 | "Unassigned", | |
228 | "The PCE cannot satisfy the request due to no END-POINTS with leaf type 2", | |
229 | "The PCE cannot satisfy the request due to no END-POINTS with leaf type 3", | |
230 | "The PCE cannot satisfy the request due to no END-POINTS with leaf type 4", | |
231 | "The PCE cannot satisfy the request due to inconsistent END-POINTS", | |
232 | }, | |
233 | ||
234 | /* 18 P2MP Fragmentation Error */ | |
235 | { | |
236 | "Unassigned", | |
237 | "Fragmented request failure", | |
238 | "Fragmented Report failure", | |
239 | "Fragmented Update failure", | |
240 | "Fragmented Instantiation failure", | |
241 | }, | |
242 | ||
243 | /* 19 Invalid Operation */ | |
244 | { | |
245 | "Unassigned", | |
246 | "Attempted LSP Update Request for a non-delegated LSP. The PCEP-ERROR object is followed by the LSP object that identifies the LSP.", | |
247 | "Attempted LSP Update Request if the stateful PCE capability was not advertised.", | |
248 | "Attempted LSP Update Request for an LSP identified by an unknown PLSP-ID.", | |
249 | "Unassigned", | |
250 | "Attempted LSP State Report if active stateful PCE capability was not advertised.", | |
251 | "PCE-initiated LSP limit reached", | |
252 | "Delegation for PCE-initiated LSP cannot be revoked", | |
253 | "Non-zero PLSP-ID in LSP Initiate Request", | |
254 | "LSP is not PCE initiated", | |
255 | "PCE-initiated operation-frequency limit reached", | |
256 | "Attempted LSP State Report for P2MP if stateful PCE capability for P2MP was not advertised", | |
257 | "Attempted LSP Update Request for P2MP if active stateful PCE capability for P2MP was not advertised", | |
258 | "Attempted LSP Instantiation Request for P2MP if stateful PCE instantiation capability for P2MP was not advertised", | |
259 | "Auto-Bandwidth capability was not advertised", | |
260 | }, | |
261 | ||
262 | /* 20 LSP State Synchronization Error */ | |
263 | { | |
264 | "Unassigned", | |
265 | "A PCE indicates to a PCC that it cannot process (an otherwise valid) LSP State Report. The PCEP- ERROR object is followed by the LSP object that identifies the LSP.", | |
266 | "LSP-DB version mismatch.", | |
267 | "Attempt to trigger synchronization before PCE trigger.", | |
268 | "Attempt to trigger a synchronization when the PCE triggered synchronization capability has not been advertised.", | |
269 | "A PCC indicates to a PCE that it cannot complete the State Synchronization.", | |
270 | "Received an invalid LSP-DB Version Number.", | |
271 | "Received an invalid Speaker Entity Identifier.", | |
272 | }, | |
273 | ||
274 | /* 21 Invalid traffic engineering path setup type */ | |
275 | { | |
276 | "Unassigned", | |
277 | "Unsupported path setup type", | |
278 | "Mismatched path setup type", | |
279 | }, | |
280 | ||
281 | /* 22 Unassigned */ | |
282 | {"Unassigned"}, | |
283 | ||
284 | /* 23 Bad parameter value */ | |
285 | { | |
286 | "Unassigned", | |
287 | "SYMBOLIC-PATH-NAME in use", | |
288 | "Speaker identity included for an LSP that is not PCE initiated", | |
289 | }, | |
290 | ||
291 | /* 24 LSP instantiation error */ | |
292 | { | |
293 | "Unassigned", | |
294 | "Unacceptable instantiation parameters", | |
295 | "Internal error", | |
296 | "Signaling error", | |
297 | }, | |
298 | ||
299 | /* 25 PCEP StartTLS failure */ | |
300 | { | |
301 | "Unassigned", | |
302 | "Reception of StartTLS after any PCEP exchange", | |
303 | "Reception of any other message apart from StartTLS, Open, or PCErr", | |
304 | "Failure, connection without TLS is not possible", | |
305 | "Failure, connection without TLS is possible", | |
306 | "No StartTLS message (nor PCErr/Open) before StartTLSWait timer expiry", | |
307 | }, | |
308 | ||
309 | /* 26 Association Error */ | |
310 | { | |
311 | "Unassigned", | |
312 | "Association Type is not supported", | |
313 | "Too many LSPs in the association group", | |
314 | "Too many association groups", | |
315 | "Association unknown", | |
316 | "Operator-configured association information mismatch", | |
317 | "Association information mismatch", | |
318 | "Cannot join the association group", | |
319 | "Association ID not in range", | |
320 | "Tunnel ID or End points mismatch for Path Protection Association", | |
321 | "Attempt to add another working/protection LSP for Path Protection Association", | |
322 | "Protection type is not supported", | |
323 | }, | |
324 | ||
325 | /* 27 WSON RWA Error */ | |
326 | { | |
327 | "Unassigned", | |
328 | "Insufficient Memory", | |
329 | "RWA computation Not supported", | |
330 | "Syntactical Encoding error", | |
331 | }, | |
332 | ||
333 | /* 28 H-PCE Error */ | |
334 | { | |
335 | "Unassigned", | |
336 | "H-PCE Capability not advertised", | |
337 | "Parent PCE Capability cannot be provided", | |
338 | }, | |
339 | ||
340 | /* 29 Path computation failure */ | |
341 | { | |
342 | "Unassigned", | |
343 | "Unacceptable request message", | |
344 | "Generalized bandwidth value not supported", | |
345 | "Label Set constraint could not be met", | |
346 | "Label constraint could not be met", | |
347 | } | |
348 | ||
349 | /* 30-255 Unassigned */ | |
350 | }; | |
351 | ||
352 | ||
353 | const char *get_error_type_str(enum pcep_error_type error_type) | |
354 | { | |
355 | if (error_type < 0 || error_type >= MAX_ERROR_TYPE) { | |
356 | pcep_log( | |
357 | LOG_DEBUG, | |
358 | "%s: get_error_type_str: error_type [%d] out of range [0..%d]", | |
359 | __func__, error_type, MAX_ERROR_TYPE); | |
360 | ||
361 | return NULL; | |
362 | } | |
363 | ||
364 | return error_type_strings[error_type]; | |
365 | } | |
366 | ||
367 | const char *get_error_value_str(enum pcep_error_type error_type, | |
368 | enum pcep_error_value error_value) | |
369 | { | |
370 | if (error_type < 0 || error_type >= MAX_ERROR_TYPE) { | |
371 | pcep_log( | |
372 | LOG_DEBUG, | |
373 | "%s: get_error_value_str: error_type [%d] out of range [0..%d]", | |
374 | __func__, error_type, MAX_ERROR_TYPE); | |
375 | ||
376 | return NULL; | |
377 | } | |
378 | ||
379 | if (error_value < 0 || error_value >= MAX_ERROR_VALUE) { | |
380 | pcep_log( | |
381 | LOG_DEBUG, | |
382 | "%s: get_error_value_str: error_value [%d] out of range [0..%d]", | |
383 | __func__, error_value, MAX_ERROR_VALUE); | |
384 | ||
385 | return NULL; | |
386 | } | |
387 | ||
388 | if (error_value_strings[error_type][error_value] == NULL) { | |
389 | return "Unassigned"; | |
390 | } | |
391 | ||
392 | return error_value_strings[error_type][error_value]; | |
393 | } |