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