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