2 * Copyright (c) 2015 Cisco Systems, Inc. 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.openflowplugin.api.openflow.statistics;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import io.netty.util.Timeout;
13 import java.util.Optional;
14 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
15 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
16 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
17 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
18 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
21 * Context for statistics
23 public interface StatisticsContext extends RequestContextStack, OFPContext {
26 * Gather data from device
27 * @return true if gathering was successful
29 ListenableFuture<Boolean> gatherDynamicData();
32 * Initial data gathering
33 * @return true if gathering was successful
35 ListenableFuture<Boolean> initialGatherDynamicData();
38 * Method has to be called from DeviceInitialization Method, otherwise
39 * we are not able to poll anything. Statistics Context normally initialize
40 * this part by initialization process but we don't have this information
41 * in initialization phase and we have to populate whole list after every
42 * device future collecting. Because device future collecting set DeviceState
43 * and we creating marks for the correct kind of stats from DeviceState.
45 void statListForCollectingInitialization();
48 * @param pollTimeout handle to nearest scheduled statistics poll
50 void setPollTimeout(Timeout pollTimeout);
53 * @return handle to currently scheduled statistics polling
55 Optional<Timeout> getPollTimeout();
58 * @return dedicated item life cycle change listener (per device)
60 ItemLifecycleListener getItemLifeCycleListener();
64 * @param schedulingEnabled true if scheduling should be enabled
66 void setSchedulingEnabled(final boolean schedulingEnabled);
70 * @return true if scheduling is enabled
72 boolean isSchedulingEnabled();
76 * @return device state from device context from lifecycle service
78 DeviceState gainDeviceState();
82 * @return device context from lifecycle service
84 DeviceContext gainDeviceContext();
87 * In case to change mastership to slave or connection interrupted stop the future and release thread
89 void stopGatheringData();