75af85bde6c82a4888f351d14e63d989333b15b2
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / gates / IPCMMError.java
1 /*
2  * Copyright (c) 2015 Cable Television Laboratories, 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
9 package org.pcmm.gates;
10
11 import org.pcmm.base.IPCMMBaseObject;
12
13 /**
14  * The aPacketCable Error object contains information on the type of error that has occurred. The error is generated in
15  * response to a Gate Control command and is contained in Gate-Set-Err, Gate-Info-Err and Gate-Delete-Err messages.
16  */
17 public interface IPCMMError extends IPCMMBaseObject {
18
19         byte STYPE = 1;
20
21         /**
22          * Returns the error code
23          * @return - not null or NA
24          */
25         ErrorCode getErrorCode();
26
27         /**
28          * Returns the error sub-code
29          * @return - not null (mostly will be NA)
30          */
31         ErrorCode getErrorSubcode();
32
33         /**
34          * Returns the error's description
35          * @return - not null
36          */
37         String getDescription();
38
39         /**
40          * The supported PCMM error codes with description.
41          */
42         enum ErrorCode {
43                 NA((short) 0, "NA"),
44                 INSUFF_RES((short) 1, "Insufficient Resources"),
45                 UNK_GATE_ID((short) 2, "Unknown GateID"),
46                 MISSING_REQ_OBJ((short) 6, "Missing Required Object"),
47                 INVALID_OBJ((short) 7, "Invalid Object"),
48                 VOL_USG_LMT((short) 8, "Volume Based Usage Limit Exceeded"),
49                 TIME_USG_LMT((short) 9, "Time Based Usage Limit Exceeded"),
50                 SESSN_CLASS_LMT((short) 10, "Session Class Limit Exceeded"),
51                 UNDEF_SCN_NAME((short) 11, "Undefined Service Class Name"),
52                 INCOMPAT_ENV((short) 12, "Incompatible Envelope"),
53                 INVALID_SUB_ID((short) 13, "Invalid SubscriberID"),
54                 UNAUTH_AMID((short) 14, "Unauthorized AMID"),
55                 NUM_CLASSIFIERS((short) 15, "Number of Classifiers Not Supported"),
56                 POLICY_EXCEPTION((short) 16, "Policy Exception"),
57                 INVALID_FIELD((short) 17, "Invalid Field Value in Object"),
58                 TRANSPORT_ERROR((short) 18, "Transport Error"),
59                 UNK_GATE_CMD((short) 19, "Unknown Gate Command"),
60                 DOCSIS_1_CM((short) 20, "DOCSIS 1.0 CM"),
61                 NUM_CM_SID((short) 21, "Number of SIDs exceeded in CM"),
62                 NUM_CMTS_SID((short) 22, "Number of SIDs exceeded in CMTS"),
63                 UNAUTH_PSID((short) 23, "Unauthorized PSID"),
64                 NO_STATE_PDP((short) 24, "No State for PDP"),
65                 UNSUP_SYNC_TYPE((short) 25, "Unsupported Synch Type"),
66                 STATE_INCMPL((short) 26, "State Data Incomplete"),
67                 UP_DROP_UNSUPPORT((short) 27, "Upstream Drop Unsupported"),
68                 MULTI_GATE_ERR((short) 28, "Multicast Gate Error"),
69                 MULTI_VOL_LIMIT((short) 29, "Multicast Volume Limit Unsupported"),
70                 MULTI_UNCOMMITTED((short) 30, "Uncommitted Multicast Not Supported"),
71                 MULTI_GATE_MOD((short) 31, "Multicast Gate Modification Not Supported"),
72                 MULTI_UP_ERR((short) 32, "Upstream Multicast Not Supported"),
73                 MULTI_GATE_INCOMPAT((short) 33, "Multicast GateSpec incompatibility"),
74                 MULTI_QOS_ERR((short) 34, "Multicast QoS Error"),
75                 MULTI_DN_RESEQ((short) 35, "Multicast Downstream Resequencing mismatch"),
76                 OTHER_UNSPECIFIED((short) 127, "Other, Unspecified Error");
77
78                 private final short code;
79                 private final String description;
80
81                 ErrorCode(short code, String description) {
82                         this.code = code;
83                         this.description = description;
84                 }
85
86                 public String getDescription() {
87                         return description;
88                 }
89
90                 public short getCode() {
91                         return code;
92                 }
93
94                 public static ErrorCode valueOf(final short index) {
95                         switch (index) {
96                                 case 0:
97                                         return NA;
98                                 case 1:
99                                         return INSUFF_RES;
100                                 case 2:
101                                         return UNK_GATE_ID;
102                                 case 6:
103                                         return MISSING_REQ_OBJ;
104                                 case 7:
105                                         return INVALID_OBJ;
106                                 case 8:
107                                         return VOL_USG_LMT;
108                                 case 9:
109                                         return TIME_USG_LMT;
110                                 case 10:
111                                         return SESSN_CLASS_LMT;
112                                 case 11:
113                                         return UNDEF_SCN_NAME;
114                                 case 12:
115                                         return INCOMPAT_ENV;
116                                 case 13:
117                                         return INVALID_SUB_ID;
118                                 case 14:
119                                         return UNAUTH_AMID;
120                                 case 15:
121                                         return NUM_CLASSIFIERS;
122                                 case 16:
123                                         return POLICY_EXCEPTION;
124                                 case 17:
125                                         return INVALID_FIELD;
126                                 case 18:
127                                         return TRANSPORT_ERROR;
128                                 case 19:
129                                         return UNK_GATE_CMD;
130                                 case 20:
131                                         return DOCSIS_1_CM;
132                                 case 21:
133                                         return NUM_CM_SID;
134                                 case 22:
135                                         return NUM_CMTS_SID;
136                                 case 23:
137                                         return UNAUTH_PSID;
138                                 case 24:
139                                         return NO_STATE_PDP;
140                                 case 25:
141                                         return UNSUP_SYNC_TYPE;
142                                 case 26:
143                                         return STATE_INCMPL;
144                                 case 27:
145                                         return UP_DROP_UNSUPPORT;
146                                 case 28:
147                                         return MULTI_GATE_ERR;
148                                 case 29:
149                                         return MULTI_VOL_LIMIT;
150                                 case 30:
151                                         return MULTI_UNCOMMITTED;
152                                 case 31:
153                                         return MULTI_GATE_MOD;
154                                 case 32:
155                                         return MULTI_UP_ERR;
156                                 case 33:
157                                         return MULTI_GATE_INCOMPAT;
158                                 case 34:
159                                         return MULTI_QOS_ERR;
160                                 case 35:
161                                         return MULTI_DN_RESEQ;
162                                 case 127:
163                                         return OTHER_UNSPECIFIED;
164                                 default:
165                                         return null;
166                         }
167                 }
168         }
169
170 }