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.lifecycle.LifecycleService;
19 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
22 * Context for statistics
24 public interface StatisticsContext extends RequestContextStack, AutoCloseable, OFPContext {
27 * Gather data from device
28 * @return true if gathering was successful
30 ListenableFuture<Boolean> gatherDynamicData();
33 * Initial data gathering
34 * @return true if gathering was successful
36 ListenableFuture<Boolean> initialGatherDynamicData();
39 * Method has to be called from DeviceInitialization Method, otherwise
40 * we are not able to poll anything. Statistics Context normally initialize
41 * this part by initialization process but we don't have this information
42 * in initialization phase and we have to populate whole list after every
43 * device future collecting. Because device future collecting set DeviceState
44 * and we creating marks for the correct kind of stats from DeviceState.
46 void statListForCollectingInitialization();
49 * @param pollTimeout handle to nearest scheduled statistics poll
51 void setPollTimeout(Timeout pollTimeout);
54 * @return handle to currently scheduled statistics polling
56 Optional<Timeout> getPollTimeout();
59 * @return dedicated item life cycle change listener (per device)
61 ItemLifecycleListener getItemLifeCycleListener();
68 * @param schedulingEnabled true if scheduling should be enabled
70 void setSchedulingEnabled(final boolean schedulingEnabled);
74 * @return true if scheduling is enabled
76 boolean isSchedulingEnabled();
80 * @return device state from device context from lifecycle service
82 DeviceState gainDeviceState();
86 * @return device context from lifecycle service
88 DeviceContext gainDeviceContext();
91 * In case to change mastership to slave or connection interrupted stop the future and release thread
93 void stopGatheringData();