Updated BgpManager for Be
[vpnservice.git] / bgpmanager / bgpmanager-impl / src / main / java / org / opendaylight / bgpmanager / oam / BgpCountersBroadcaster.java
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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.opendaylight.bgpmanager.oam;
10
11 import com.google.common.collect.ImmutableBiMap;
12 import com.google.common.collect.ImmutableMap;
13
14 import javax.management.MBeanNotificationInfo;
15 import javax.management.Notification;
16 import javax.management.NotificationBroadcasterSupport;
17 import java.util.*;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21
22 /**
23  * Created by ECHIAPT on 9/25/2015.
24  */
25 public class BgpCountersBroadcaster extends NotificationBroadcasterSupport implements BgpCountersBroadcasterMBean  {
26     public Map<String, String> bgpCountersMap = new HashMap<String, String>();
27     private static final Logger LOGGER = LoggerFactory.getLogger(BgpCountersBroadcaster.class);
28
29     public Map<String, String> retrieveCounterMap() {
30         LOGGER.trace("Polled retrieveCounterMap");
31         Map<String, String> countersVal = new HashMap<String, String>(bgpCountersMap);
32         Iterator<Map.Entry<String, String>> entries = countersVal.entrySet().iterator();
33         while (entries.hasNext()) {
34             Map.Entry<String, String> entry = entries.next();
35             LOGGER.trace(entry.getKey() + ", Value from MBean= " + entry.getValue());
36         }
37         return countersVal;
38     }
39
40     public void setBgpCountersMap(Map fetchedCountersMap) {
41         LOGGER.trace("putAll");
42         bgpCountersMap.clear();
43         bgpCountersMap.putAll(fetchedCountersMap);
44     }
45 }