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.netvirt.bgpmanager.oam;
12 * Created by echiapt on 7/27/2015.
15 import javax.management.*;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 import java.util.ArrayList;
22 public class BgpAlarmBroadcaster extends NotificationBroadcasterSupport implements BgpAlarmBroadcasterMBean {
23 private static final Logger LOGGER = LoggerFactory.getLogger(BgpAlarmBroadcaster.class);
24 private long sequenceNumber;
25 public BgpAlarmBroadcaster () {
26 this.sequenceNumber = 1;
29 public void sendBgpAlarmInfo(String pfx, int code , int subcode) {
31 String alarmAddText, alarmSrc = "BGP";
32 BgpAlarmErrorCodes userAlarm;
33 ArrayList<String> arrayList = new ArrayList<>();
35 userAlarm = BgpAlarmErrorCodes.checkErrorSubcode(subcode);
36 alarmAddText = "Peer=" + pfx;
38 arrayList.add(userAlarm.getAlarmType());
39 arrayList.add(alarmAddText);
40 arrayList.add(alarmSrc);
41 n = new AttributeChangeNotification(this, sequenceNumber++, System.currentTimeMillis(),
42 "raise Alarm Object notified", "raiseAlarmObject",
43 "ArrayList", "", arrayList);
45 LOGGER.info("BGP: Alarm :"+ userAlarm.getAlarmType() + " has been posted.");