2 * Copyright (c) 2016 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
8 package org.opendaylight.vpnservice.fcapsapp.performancecounter;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13 import java.lang.Integer;
14 import java.lang.String;
15 import java.net.InetAddress;
16 import java.util.ArrayList;
17 import java.util.HashMap;
18 import java.util.HashSet;
21 public class NodeUpdateCounter {
23 private static final Logger LOG = LoggerFactory.getLogger(NodeUpdateCounter.class);
24 private String nodeListEFSCountStr;
25 private static HashSet<String> dpnList = new HashSet<String>();
26 public static final PMAgent pmagent = new PMAgent();
27 Map<String, String> counter_map = new HashMap<String, String>();
29 public NodeUpdateCounter() {
32 public void nodeAddedNotification(String sNode,String hostName) {
34 sendNodeUpdation(dpnList.size(),hostName);
37 public void nodeRemovedNotification(String sNode,String hostName) {
38 dpnList.remove(sNode);
39 sendNodeUpdation(dpnList.size(), hostName);
42 private void sendNodeUpdation(Integer count,String hostName) {
44 if (hostName != null) {
45 nodeListEFSCountStr = "Node_" + hostName + "_NumberOfEFS";
46 LOG.debug("NumberOfEFS:" + nodeListEFSCountStr + " dpnList.size " + count);
48 counter_map.put("NumberOfEFS:" + nodeListEFSCountStr, "" + count);
49 pmagent.connectToPMAgent(counter_map);
51 LOG.error("Hostname is null upon NumberOfEFS counter");
54 public boolean isDpnConnectedLocal(String sNode) {
55 if (dpnList.contains(sNode))