2 * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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
9 package org.opendaylight.bgpmanager.oam;
11 import java.util.HashMap;
15 * Created by echiapt on 7/27/2015.
17 public enum BgpAlarmErrorCodes {
18 CEASE_MAX_PREFIX (1, "BgpMaxPrefixesFailure"),
19 CEASE_PEER_UNCONFIG (3, "BgpPeerUnconfigFailure") ,
20 CEASE_CONNECT_REJECT (5, "BgpConnRejectFailure"),
21 CEASE_COLLISION_RESOLUTION (7, "BgpCollisionResolutionFailure"),
22 CEASE_OUT_OF_RESOURCE (8, "BgpOutOfResourcesFailure"),
23 ERROR_IGNORE (-1,"UnknownErr");
25 private final int error;
26 private final String alarmType;
28 BgpAlarmErrorCodes(int error, String alarmType) {
30 this.alarmType = alarmType;
33 private static final Map<Integer, BgpAlarmErrorCodes> intToTypeMap = new HashMap<Integer, BgpAlarmErrorCodes>();
35 for (BgpAlarmErrorCodes type : BgpAlarmErrorCodes.values()) {
36 intToTypeMap.put(type.error, type);
41 public String getAlarmType() {
42 return this.alarmType;
45 public static BgpAlarmErrorCodes checkErrorSubcode(int i) {
46 BgpAlarmErrorCodes type = intToTypeMap.get(Integer.valueOf(i));
48 return BgpAlarmErrorCodes.ERROR_IGNORE;