Merge "Fix for openflow devices not connecting to controller"
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / ReconciliationJMXService.java
1 /*
2  * Copyright (c) 2020 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.openflowplugin.applications.frm;
10
11 import java.util.HashMap;
12 import java.util.Map;
13 import javax.inject.Inject;
14 import org.opendaylight.openflowplugin.api.openflow.FlowGroupCacheManager;
15
16 public class ReconciliationJMXService implements ReconciliationJMXServiceMBean {
17     private FlowGroupCacheManager flowGroupCacheManager;
18
19     @Inject
20     public ReconciliationJMXService(final FlowGroupCacheManager floGroupCacheManager) {
21         this.flowGroupCacheManager = floGroupCacheManager;
22     }
23
24     @Override
25     public Map<String, String> acquireReconciliationStates() {
26         Map<String, String> reconciliationStatesMap = new HashMap<>();
27         flowGroupCacheManager.getReconciliationStates().forEach((datapathId, reconciliationState) ->
28                 reconciliationStatesMap.put(datapathId, reconciliationState.toString()));
29         return reconciliationStatesMap;
30     }
31 }