Merge "Abstract service NodeId remove"
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / statistics / StatisticsContext.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.api.openflow.statistics;
10
11 import com.google.common.util.concurrent.ListenableFuture;
12 import io.netty.util.Timeout;
13 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
14 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
15 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
16 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
17
18 import java.util.Optional;
19
20 /**
21  * Context for statistics
22  */
23 public interface StatisticsContext extends RequestContextStack, AutoCloseable, OFPContext {
24
25     ListenableFuture<Boolean> gatherDynamicData();
26
27     /**
28      * Method has to be called from DeviceInitialization Method, otherwise
29      * we are not able to poll anything. Statistics Context normally initialize
30      * this part by initialization process but we don't have this information
31      * in initialization phase and we have to populate whole list after every
32      * device future collecting. Because device future collecting set DeviceState
33      * and we creating marks for the correct kind of stats from DeviceState.
34      */
35     void statListForCollectingInitialization();
36
37     /**
38      * @param pollTimeout handle to nearest scheduled statistics poll
39      */
40     void setPollTimeout(Timeout pollTimeout);
41
42     /**
43      * @return handle to currently scheduled statistics polling
44      */
45     Optional<Timeout> getPollTimeout();
46
47     /**
48      * @return dedicated item life cycle change listener (per device)
49      */
50     ItemLifecycleListener getItemLifeCycleListener();
51
52     @Override
53     void close();
54
55     void setSchedulingEnabled(boolean schedulingEnabled);
56     boolean isSchedulingEnabled();
57 }