Clean up ShortestPathFirst
[bgpcep.git] / pcep / spi / src / main / java / org / opendaylight / protocol / pcep / spi / PCEPErrors.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.pcep.spi;
9
10 import com.google.common.collect.ImmutableMap;
11 import com.google.common.collect.Maps;
12 import java.util.Arrays;
13 import org.opendaylight.yangtools.yang.common.Uint8;
14
15 /**
16  * Possible errors listed in RFC5440, RFC 5455 and stateful draft.
17  *
18  * @see <a href="http://tools.ietf.org/html/rfc5440#section-9.12">PCEP-ERROR Object(RFC5440)</a>
19  * @see <a href="http://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-8.4" >PCEP-ERROR Object</a>
20  * @see <a href="http://tools.ietf.org/html/rfc5455#section-3.6">Error Codes for CLASSTYPE Object(RFC5455)</a>
21  * @see <a href="http://www.ietf.org/id/draft-crabbe-pce-pce-initiated-lsp-00.txt#section-7.1" >PCEP-Error Object</a>
22  */
23 public enum PCEPErrors {
24
25     /**
26      * Reception of an invalid Open message or a non Open message.
27      */
28     NON_OR_INVALID_OPEN_MSG(1, 1),
29     /**
30      * No Open message received before the expiration of the OpenWait timer.
31      */
32     NO_OPEN_BEFORE_EXP_OPENWAIT(1, 2),
33     /**
34      * Unacceptable and non-negotiable session characteristics.
35      */
36     NON_ACC_NON_NEG_SESSION_CHAR(1, 3),
37     /**
38      * Unacceptable but negotiable session characteristics.
39      */
40     NON_ACC_NEG_SESSION_CHAR(1, 4),
41     /**
42      * Reception of a second Open message with still unacceptable session characteristics.
43      */
44     SECOND_OPEN_MSG(1, 5),
45     /**
46      * Reception of a PCErr message proposing unacceptable session characteristics.
47      */
48     PCERR_NON_ACC_SESSION_CHAR(1, 6),
49     /**
50      * No Keepalive or PCErr message received before the expiration of the KeepWait timer.
51      */
52     NO_MSG_BEFORE_EXP_KEEPWAIT(1, 7),
53     /**
54      * Capability not supported.
55      */
56     CAPABILITY_NOT_SUPPORTED(2, 0),
57     /**
58      * PCEP version not supported.
59      */
60     PCEP_VERSION_NOT_SUPPORTED(1, 8),
61     /**
62      * Unrecognized object class.
63      */
64     UNRECOGNIZED_OBJ_CLASS(3, 1),
65     /**
66      * Unrecognized object Type.
67      */
68     UNRECOGNIZED_OBJ_TYPE(3, 2),
69     /**
70      * Not supported object class.
71      */
72     NOT_SUPPORTED_OBJ_CLASS(4, 1),
73     /**
74      * Not supported object Type.
75      */
76     NOT_SUPPORTED_OBJ_TYPE(4, 2),
77     /**
78      * C bit of the METRIC object set (request rejected).
79      */
80     C_BIT_SET(5, 1),
81     /**
82      * O bit of the RP object cleared (request rejected).
83      */
84     O_BIT_SET(5, 2),
85     /**
86      * Objective function not allowed (request rejected).
87      */
88     OF_NOT_ALLOWED(5, 3),
89     /**
90      * OF bit of the RP object set (request rejected).
91      */
92     OF_BIT_SET(5, 4),
93     /**
94      * Global concurrent optimization not allowed (GCO extension).
95      */
96     GCO_NOT_ALLOWED(5, 5),
97     /**
98      * P2MP Path computation is not allowed.
99      */
100     P2MP_COMPUTATION_NOT_ALLOWED(5, 7),
101     /**
102      * RP object missing.
103      */
104     RP_MISSING(6, 1),
105     /**
106      * RRO missing for a reoptimization request (R bit of the RP object set).
107      */
108     RRO_MISSING(6, 2),
109     /**
110      * END-POINTS object missing.
111      */
112     END_POINTS_MISSING(6, 3),
113     /**
114      * LSP cleanup TLV missing.
115      */
116     LSP_CLEANUP_TLV_MISSING(6, 13),
117     /**
118      * SYMBOLIC-PATH-NAME TLV missing.
119      */
120     SYMBOLIC_PATH_NAME_MISSING(6, 14),
121     /**
122      * Synchronized path computation request missing.
123      */
124     SYNC_PATH_COMP_REQ_MISSING(7, 0),
125     /**
126      * Unknown request reference.
127      */
128     UNKNOWN_REQ_REF(8, 0),
129     /**
130      * Attempt to establish a second PCEP session.
131      */
132     ATTEMPT_2ND_SESSION(9, 0),
133     /**
134      * LSP Object missing.
135      */
136     LSP_MISSING(6, 8),
137     /**
138      * ERO Object missing for a path in an LSP Update Request where TE-LSP setup is requested.
139      */
140     ERO_MISSING(6, 9),
141     /**
142      * Srp Object missing for a path in an LSP Update Request where TE-LSP setup is requested.
143      */
144     SRP_MISSING(6, 10),
145     /**
146      * LSP-IDENTIFIERS TLV missing for a path in an LSP Update Request where TE-LSP setup is requested.
147      */
148     LSP_IDENTIFIERS_TLV_MISSING(6, 11),
149     /**
150      * Reception of an object with P flag not set although the P flag must be set according to this specification.
151      */
152     P_FLAG_NOT_SET(10, 1),
153     /**
154      * Insufficient memory (GCO extension).
155      */
156     INSUFFICIENT_MEMORY(15, 1),
157     /**
158      * Global concurrent optimization not supported (GCO extension).
159      */
160     GCO_NOT_SUPPORTED(15, 2),
161     /**
162      * Diffserv-aware TE error: Unsupported Class-Type.
163      */
164     UNSUPPORTED_CT(12, 1),
165     /**
166      * Diffserv-aware TE error: Invalid Class-Type.
167      */
168     INVALID_CT(12, 2),
169     /**
170      * Diffserv-aware TE error: Class-Type and setup priority do not form a configured TE-class.
171      */
172     CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS(12, 3),
173
174     /**
175      * The PCE cannot satisfy the request due to insufficient memory.
176      */
177     CANNOT_SATISFY_P2MP_REQUEST_DUE_TO_INSUFFISIENT_MEMMORY(16, 1),
178     /**
179      * The PCE is not capable of P2MP computation.
180      */
181     NOT_CAPPABLE_P2MP_COMPUTATION(16, 2),
182     /**
183      * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 2.
184      */
185     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT2(17, 1),
186     /**
187      * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 3.
188      */
189     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT3(17, 2),
190     /**
191      * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 4.
192      */
193     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT4(17, 3),
194     /**
195      * The PCE is not capable to satisfy the request due to inconsistent END-POINTS.
196      */
197     P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_INCONSISTENT_EP(17, 4),
198     /**
199      * P2MP Fragmented request failure.
200      */
201     P2MP_FRAGMENTATION_FAILRUE(18, 1),
202     /**
203      * Attempted LSP Update Request for a non- delegated LSP. The PCEP-ERROR Object is followed by the LSP Object that
204      * identifies the LSP.
205      */
206     UPDATE_REQ_FOR_NON_LSP(19, 1),
207     /**
208      * Attempted LSP Update Request if active stateful PCE capability was not negotiated active PCE.
209      */
210     UPDATE_REQ_FOR_NO_STATEFUL(19, 2),
211     /**
212      * Attempted LSP Update Request for an LSP identified by an unknown PLSP-ID.
213      */
214     UNKNOWN_PLSP_ID(19, 3),
215     /**
216      * A PCE indicates to a PCC that it has exceeded the resource limit allocated for its state, and thus it cannot
217      * accept and process its LSP State Report message.
218      */
219     RESOURCE_LIMIT_EXCEEDED(19, 4),
220     /**
221      * PCE-initiated LSP limit reached.
222      */
223     LSP_LIMIT_EXCEEDED(19, 6),
224     /**
225      * Delegation for PCE-initiated LSP cannot be revoked.
226      */
227     DELEGATION_NON_REVOKABLE(19, 7),
228     /**
229      * Non-zero PLSP-ID in LSP initiation request.
230      */
231     NON_ZERO_PLSPID(19, 8),
232     /**
233      * A PCE indicates to a PCC that it can not process (an otherwise valid) LSP State Report. The PCEP-ERROR Object is
234      * followed by the LSP Object that identifies the LSP.
235      */
236     CANNOT_PROCESS_STATE_REPORT(20, 1),
237     /**
238      * LSP Database version mismatch.
239      */
240     LSP_DB_VERSION_MISMATCH(20, 2),
241     /**
242      * The LSP-DB-VERSION TLV Missing when State Synchronization Avoidance enabled.
243      */
244     DB_VERSION_TLV_MISSING_WHEN_SYNC_ALLOWED(20, 3),
245     /**
246      * A PCC indicates to a PCE that it can not complete the state synchronization.
247      */
248     CANNOT_COMPLETE_STATE_SYNC(20, 5),
249     /**
250      * SYMBOLIC-PATH-NAME in use.
251      */
252     USED_SYMBOLIC_PATH_NAME(23, 1),
253     /**
254      * LSP instantiation error: Unacceptable instantiation parameters.
255      */
256     LSP_UNACC_INST_PARAMS(24, 1),
257     /**
258      * LSP instantiation error: Internal error.
259      */
260     LSP_INTERNAL_ERROR(24, 2),
261     /**
262      * LSP instantiation error: RSVP signaling error.
263      */
264     LSP_RSVP_ERROR(24, 3),
265     /**
266      * Segment Routing error: ERO subobject with invalid SID value.
267      */
268     BAD_LABEL_VALUE(10, 2),
269     /**
270      * Segment Routing error: Unsupported number of Segment ERO subobjects.
271      */
272     UNSUPPORTED_NUMBER_OF_SR_ERO_SUBOBJECTS(10, 3),
273     /**
274      * Segment Routing error: Bad label format.
275      */
276     BAD_LABEL_FORMAT(10, 4),
277     /**
278      * Segment Routing error: Non-identical ERO subobjects.
279      */
280     NON_IDENTICAL_ERO_SUBOBJECTS(10, 5),
281     /**
282      * Segment Routing error: Both SID and NAI are absent in ERO subobject.
283      */
284     SID_AND_NAI_ABSENT_IN_ERO(10, 6),
285     /**
286      * Segment Routing error: Both SID and NAI are absent in RRO subobject.
287      */
288     SID_AND_NAI_ABSENT_IN_RRO(10, 7),
289     /**
290      * Segment Routing error: Non-identical RRO subobjects.
291      */
292     SID_NON_IDENTICAL_RRO_SUBOBJECTS(10, 8),
293     /**
294      * Invalid traffic engineering path setup type: Unsupported path setup type.
295      */
296     UNSUPPORTED_PST(21, 1),
297     /**
298      * Invalid traffic engineering path setup type: Mismatched path setup type.
299      */
300     MISMATCHED_PST(21, 2),
301     /**
302      * MONITORING object missing.
303      */
304     MONITORING_OBJECT_MISSING(6, 4),
305     /**
306      * Reception of StartTLS after any PCEP exchange.
307      */
308     // FIXME: error code to be assigned by IANA
309     STARTTLS_RCVD_INCORRECTLY(30, 1),
310     /**
311      * Reception of non-StartTLS or non-PCErr message.
312      */
313     // FIXME: error code to be assigned by IANA
314     NON_STARTTLS_MSG_RCVD(30, 2),
315     /**
316      * Failure, connection without TLS not possible.
317      */
318     // FIXME: error code to be assigned by IANA
319     NOT_POSSIBLE_WITHOUT_TLS(30, 3),
320     /**
321      * Failure, connection without TLS possible.
322      */
323     // FIXME: error code to be assigned by IANA
324     POSSIBLE_WITHOUT_TLS(30, 4),
325     /**
326      * No StartTLS message before StartTLSWait timer expired.
327      */
328     // FIXME: error code to be assigned by IANA
329     STARTTLS_TIMER_EXP(30, 5),
330     /**
331      * LSP is not PCE-initiated.
332      */
333     LSP_NOT_PCE_INITIATED(19, 9),
334     /**
335      * LSP-DB-VERSION TLV missing.
336      */
337     LSP_DB_VERSION_MISSING(6, 12),
338     /**
339      * Attempt to trigger a synchronization when the PCE triggered synchronization capability has not been advertised.
340      */
341     UNEXPECTED_SYNCHRONIZATION_ATTEMPT(20, 4),
342     /**
343      * No sufficient LSP change information for incremental LSP state synchronization.
344      */
345     NO_SUFFICIENT_LSP_CHANGE(20, 6),
346     /**
347      * Received an invalid LSP DB Version Number.
348      */
349     INVALID_LSP_DB_VERSION(20, 7);
350
351     private static final ImmutableMap<PCEPErrorIdentifier, PCEPErrors> VALUE_MAP = Maps.uniqueIndex(
352         Arrays.asList(values()), PCEPErrors::getErrorIdentifier);
353
354     private PCEPErrorIdentifier errorId;
355
356     public static PCEPErrors forValue(final Uint8 errorType, final Uint8 errorValue) {
357         return VALUE_MAP.get(new PCEPErrorIdentifier(errorType, errorValue));
358     }
359
360     PCEPErrors(final int type, final int value) {
361         this.errorId = new PCEPErrorIdentifier(Uint8.valueOf(type), Uint8.valueOf(value));
362     }
363
364     private PCEPErrorIdentifier getErrorIdentifier() {
365         return errorId;
366     }
367
368     public Uint8 getErrorType() {
369         return errorId.getType();
370     }
371
372     public Uint8 getErrorValue() {
373         return errorId.getValue();
374     }
375 }