Bug 5596 Created lifecycle service
[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 java.util.Optional;
14 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
15 import org.opendaylight.openflowplugin.api.openflow.OFPManager;
16 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
17 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
18 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
19
20 /**
21  * Context for statistics
22  */
23 public interface StatisticsContext extends RequestContextStack, AutoCloseable, OFPContext {
24
25     /**
26      * Gather data from device
27      * @return true if gathering was successful
28      */
29     ListenableFuture<Boolean> gatherDynamicData();
30
31     /**
32      * Initial data gathering
33      * @return true if gathering was successful
34      */
35     ListenableFuture<Boolean> initialGatherDynamicData();
36
37     /**
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.
44      */
45     void statListForCollectingInitialization();
46
47     /**
48      * @param pollTimeout handle to nearest scheduled statistics poll
49      */
50     void setPollTimeout(Timeout pollTimeout);
51
52     /**
53      * @return handle to currently scheduled statistics polling
54      */
55     Optional<Timeout> getPollTimeout();
56
57     /**
58      * @return dedicated item life cycle change listener (per device)
59      */
60     ItemLifecycleListener getItemLifeCycleListener();
61
62     @Override
63     void close();
64
65     void setSchedulingEnabled(boolean schedulingEnabled);
66     boolean isSchedulingEnabled();
67 }