Development of NETCONF RPCs for tr-069 adapter to
[oam/tr069-adapter.git] / mapper / src / main / java / org / commscope / tr069adapter / mapper / util / FirwareUpgradeErrorCode.java
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : tr-069-adapter
4  * =================================================================================================
5  * Copyright (C) 2020 CommScope Inc Intellectual Property.
6  * =================================================================================================
7  * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
9  * may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ===============LICENSE_END=======================================================================
17  */
18
19 package org.commscope.tr069adapter.mapper.util;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 public class FirwareUpgradeErrorCode {
25   private FirwareUpgradeErrorCode() {}
26
27   private static Map<Integer, String> errorCodes = new HashMap<>();
28   private static final String AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR";
29   private static final String APPLICATION_ERROR = "APPLICATION_ERROR";
30
31   static {
32     errorCodes.put(9019, AUTHENTICATION_ERROR);
33     errorCodes.put(9001, AUTHENTICATION_ERROR);
34     errorCodes.put(9016, AUTHENTICATION_ERROR);
35     errorCodes.put(9012, AUTHENTICATION_ERROR);
36     errorCodes.put(9015, "PROTOCOL_ERROR");
37     errorCodes.put(9002, APPLICATION_ERROR);
38     errorCodes.put(9003, APPLICATION_ERROR);
39     errorCodes.put(9020, "TIMEOUT");
40     errorCodes.put(0, "COMPLETED");
41   }
42
43   public static String getErrorCodeMapping(int errorCode) {
44     return errorCodes.get(errorCode) != null ? errorCodes.get(errorCode) : APPLICATION_ERROR;
45   }
46
47 }