2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.pcep.spi;
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;
16 * Possible errors listed in RFC5440, RFC 5455 and stateful draft.
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>
23 public enum PCEPErrors {
26 * Reception of an invalid Open message or a non Open message.
28 NON_OR_INVALID_OPEN_MSG(1, 1),
30 * No Open message received before the expiration of the OpenWait timer.
32 NO_OPEN_BEFORE_EXP_OPENWAIT(1, 2),
34 * Unacceptable and non-negotiable session characteristics.
36 NON_ACC_NON_NEG_SESSION_CHAR(1, 3),
38 * Unacceptable but negotiable session characteristics.
40 NON_ACC_NEG_SESSION_CHAR(1, 4),
42 * Reception of a second Open message with still unacceptable session characteristics.
44 SECOND_OPEN_MSG(1, 5),
46 * Reception of a PCErr message proposing unacceptable session characteristics.
48 PCERR_NON_ACC_SESSION_CHAR(1, 6),
50 * No Keepalive or PCErr message received before the expiration of the KeepWait timer.
52 NO_MSG_BEFORE_EXP_KEEPWAIT(1, 7),
54 * Capability not supported.
56 CAPABILITY_NOT_SUPPORTED(2, 0),
58 * PCEP version not supported.
60 PCEP_VERSION_NOT_SUPPORTED(1, 8),
62 * Unrecognized object class.
64 UNRECOGNIZED_OBJ_CLASS(3, 1),
66 * Unrecognized object Type.
68 UNRECOGNIZED_OBJ_TYPE(3, 2),
70 * Not supported object class.
72 NOT_SUPPORTED_OBJ_CLASS(4, 1),
74 * Not supported object Type.
76 NOT_SUPPORTED_OBJ_TYPE(4, 2),
78 * C bit of the METRIC object set (request rejected).
82 * O bit of the RP object cleared (request rejected).
86 * Objective function not allowed (request rejected).
90 * OF bit of the RP object set (request rejected).
94 * Global concurrent optimization not allowed (GCO extension).
96 GCO_NOT_ALLOWED(5, 5),
98 * P2MP Path computation is not allowed.
100 P2MP_COMPUTATION_NOT_ALLOWED(5, 7),
106 * RRO missing for a reoptimization request (R bit of the RP object set).
110 * END-POINTS object missing.
112 END_POINTS_MISSING(6, 3),
114 * LSP cleanup TLV missing.
116 LSP_CLEANUP_TLV_MISSING(6, 13),
118 * SYMBOLIC-PATH-NAME TLV missing.
120 SYMBOLIC_PATH_NAME_MISSING(6, 14),
122 * Synchronized path computation request missing.
124 SYNC_PATH_COMP_REQ_MISSING(7, 0),
126 * Unknown request reference.
128 UNKNOWN_REQ_REF(8, 0),
130 * Attempt to establish a second PCEP session.
132 ATTEMPT_2ND_SESSION(9, 0),
134 * LSP Object missing.
138 * ERO Object missing for a path in an LSP Update Request where TE-LSP setup is requested.
142 * Srp Object missing for a path in an LSP Update Request where TE-LSP setup is requested.
146 * LSP-IDENTIFIERS TLV missing for a path in an LSP Update Request where TE-LSP setup is requested.
148 LSP_IDENTIFIERS_TLV_MISSING(6, 11),
150 * Reception of an object with P flag not set although the P flag must be set according to this specification.
152 P_FLAG_NOT_SET(10, 1),
154 * Insufficient memory (GCO extension).
156 INSUFFICIENT_MEMORY(15, 1),
158 * Global concurrent optimization not supported (GCO extension).
160 GCO_NOT_SUPPORTED(15, 2),
162 * Diffserv-aware TE error: Unsupported Class-Type.
164 UNSUPPORTED_CT(12, 1),
166 * Diffserv-aware TE error: Invalid Class-Type.
170 * Diffserv-aware TE error: Class-Type and setup priority do not form a configured TE-class.
172 CT_AND_SETUP_PRIORITY_DO_NOT_FORM_TE_CLASS(12, 3),
175 * The PCE cannot satisfy the request due to insufficient memory.
177 CANNOT_SATISFY_P2MP_REQUEST_DUE_TO_INSUFFISIENT_MEMMORY(16, 1),
179 * The PCE is not capable of P2MP computation.
181 NOT_CAPPABLE_P2MP_COMPUTATION(16, 2),
183 * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 2.
185 P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT2(17, 1),
187 * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 3.
189 P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT3(17, 2),
191 * The PCE is not capable to satisfy the request due to no END-POINTS with leaf type 4.
193 P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_LT4(17, 3),
195 * The PCE is not capable to satisfy the request due to inconsistent END-POINTS.
197 P2MP_NOT_CAPPABLE_SATISFY_REQ_DUE_INCONSISTENT_EP(17, 4),
199 * P2MP Fragmented request failure.
201 P2MP_FRAGMENTATION_FAILRUE(18, 1),
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.
206 UPDATE_REQ_FOR_NON_LSP(19, 1),
208 * Attempted LSP Update Request if active stateful PCE capability was not negotiated active PCE.
210 UPDATE_REQ_FOR_NO_STATEFUL(19, 2),
212 * Attempted LSP Update Request for an LSP identified by an unknown PLSP-ID.
214 UNKNOWN_PLSP_ID(19, 3),
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.
219 RESOURCE_LIMIT_EXCEEDED(19, 4),
221 * PCE-initiated LSP limit reached.
223 LSP_LIMIT_EXCEEDED(19, 6),
225 * Delegation for PCE-initiated LSP cannot be revoked.
227 DELEGATION_NON_REVOKABLE(19, 7),
229 * Non-zero PLSP-ID in LSP initiation request.
231 NON_ZERO_PLSPID(19, 8),
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.
236 CANNOT_PROCESS_STATE_REPORT(20, 1),
238 * LSP Database version mismatch.
240 LSP_DB_VERSION_MISMATCH(20, 2),
242 * The LSP-DB-VERSION TLV Missing when State Synchronization Avoidance enabled.
244 DB_VERSION_TLV_MISSING_WHEN_SYNC_ALLOWED(20, 3),
246 * A PCC indicates to a PCE that it can not complete the state synchronization.
248 CANNOT_COMPLETE_STATE_SYNC(20, 5),
250 * SYMBOLIC-PATH-NAME in use.
252 USED_SYMBOLIC_PATH_NAME(23, 1),
254 * LSP instantiation error: Unacceptable instantiation parameters.
256 LSP_UNACC_INST_PARAMS(24, 1),
258 * LSP instantiation error: Internal error.
260 LSP_INTERNAL_ERROR(24, 2),
262 * LSP instantiation error: RSVP signaling error.
264 LSP_RSVP_ERROR(24, 3),
266 * Segment Routing error: ERO subobject with invalid SID value.
268 BAD_LABEL_VALUE(10, 2),
270 * Segment Routing error: Unsupported number of Segment ERO subobjects.
272 UNSUPPORTED_NUMBER_OF_SR_ERO_SUBOBJECTS(10, 3),
274 * Segment Routing error: Bad label format.
276 BAD_LABEL_FORMAT(10, 4),
278 * Segment Routing error: Non-identical ERO subobjects.
280 NON_IDENTICAL_ERO_SUBOBJECTS(10, 5),
282 * Segment Routing error: Both SID and NAI are absent in ERO subobject.
284 SID_AND_NAI_ABSENT_IN_ERO(10, 6),
286 * Segment Routing error: Both SID and NAI are absent in RRO subobject.
288 SID_AND_NAI_ABSENT_IN_RRO(10, 7),
290 * Segment Routing error: Non-identical RRO subobjects.
292 SID_NON_IDENTICAL_RRO_SUBOBJECTS(10, 8),
294 * Invalid traffic engineering path setup type: Unsupported path setup type.
296 UNSUPPORTED_PST(21, 1),
298 * Invalid traffic engineering path setup type: Mismatched path setup type.
300 MISMATCHED_PST(21, 2),
302 * MONITORING object missing.
304 MONITORING_OBJECT_MISSING(6, 4),
306 * Reception of StartTLS after any PCEP exchange.
308 // FIXME: error code to be assigned by IANA
309 STARTTLS_RCVD_INCORRECTLY(30, 1),
311 * Reception of non-StartTLS or non-PCErr message.
313 // FIXME: error code to be assigned by IANA
314 NON_STARTTLS_MSG_RCVD(30, 2),
316 * Failure, connection without TLS not possible.
318 // FIXME: error code to be assigned by IANA
319 NOT_POSSIBLE_WITHOUT_TLS(30, 3),
321 * Failure, connection without TLS possible.
323 // FIXME: error code to be assigned by IANA
324 POSSIBLE_WITHOUT_TLS(30, 4),
326 * No StartTLS message before StartTLSWait timer expired.
328 // FIXME: error code to be assigned by IANA
329 STARTTLS_TIMER_EXP(30, 5),
331 * LSP is not PCE-initiated.
333 LSP_NOT_PCE_INITIATED(19, 9),
335 * LSP-DB-VERSION TLV missing.
337 LSP_DB_VERSION_MISSING(6, 12),
339 * Attempt to trigger a synchronization when the PCE triggered synchronization capability has not been advertised.
341 UNEXPECTED_SYNCHRONIZATION_ATTEMPT(20, 4),
343 * No sufficient LSP change information for incremental LSP state synchronization.
345 NO_SUFFICIENT_LSP_CHANGE(20, 6),
347 * Received an invalid LSP DB Version Number.
349 INVALID_LSP_DB_VERSION(20, 7);
351 private static final ImmutableMap<PCEPErrorIdentifier, PCEPErrors> VALUE_MAP = Maps.uniqueIndex(
352 Arrays.asList(values()), PCEPErrors::getErrorIdentifier);
354 private PCEPErrorIdentifier errorId;
356 public static PCEPErrors forValue(final Uint8 errorType, final Uint8 errorValue) {
357 return VALUE_MAP.get(new PCEPErrorIdentifier(errorType, errorValue));
360 PCEPErrors(final int type, final int value) {
361 this.errorId = new PCEPErrorIdentifier(Uint8.valueOf(type), Uint8.valueOf(value));
364 private PCEPErrorIdentifier getErrorIdentifier() {
368 public Uint8 getErrorType() {
369 return errorId.getType();
372 public Uint8 getErrorValue() {
373 return errorId.getValue();