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