DeviceState changes
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / lifecycle / LifecycleConductor.java
1 /*
2  * Copyright (c) 2016 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.lifecycle;
10
11 import io.netty.util.Timeout;
12 import io.netty.util.TimerTask;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
14 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
15 import org.opendaylight.openflowplugin.api.openflow.device.DeviceManager;
16 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
17 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
19
20 import javax.annotation.Nonnull;
21 import java.util.concurrent.TimeUnit;
22
23 /**
24  * This class is a binder between all managers
25  * Should be defined in OpenFlowPluginProviderImpl
26  */
27 public interface LifecycleConductor {
28
29     /**
30      * Returns device context from device manager device contexts maps
31      *
32      * @param deviceInfo@return null if context doesn't exists
33      */
34     DeviceContext getDeviceContext(DeviceInfo deviceInfo);
35
36     /**
37      * Registers ont time listener for notify when services rpc, statistics are done stop or start
38      * @param manager service change listener
39      * @param deviceInfo node identification
40      */
41     void addOneTimeListenerWhenServicesChangesDone(final ServiceChangeListener manager, final DeviceInfo deviceInfo);
42
43     /**
44      * Returns device of version
45      * @param deviceInfo node identification
46      * @return null if device context doesn't exists
47      */
48     Short gainVersionSafely(final DeviceInfo deviceInfo);
49
50     /**
51      * Set new timeout for {@link io.netty.util.HashedWheelTimer}
52      * @param task timer task
53      * @param delay delay
54      * @param unit time unit
55      * @return new timeout
56      */
57     Timeout newTimeout(@Nonnull TimerTask task, long delay, @Nonnull TimeUnit unit);
58
59     /**
60      * Returns message intelligence agency
61      * @return MessageIntelligenceAgency set by constructor
62      */
63     MessageIntelligenceAgency getMessageIntelligenceAgency();
64
65     /**
66      * Interrupt connection for the node
67      * @param deviceInfo node identification
68      */
69     void closeConnection(final DeviceInfo deviceInfo);
70
71     /**
72      * Setter for device manager once set it cant be unset or overwritten
73      * @param deviceManager should be set in OpenFlowPluginProviderImpl
74      */
75     void setSafelyDeviceManager(final DeviceManager deviceManager);
76
77     /**
78      * Setter for statistics manager once set it cant be unset or overwritten
79      * @param statisticsManager should be set in OpenFlowPluginProviderImpl
80      */
81     void setSafelyStatisticsManager(final StatisticsManager statisticsManager);
82
83     /**
84      * Xid from outboundqueue
85      * @param deviceInfo
86      * @return
87      */
88     Long reserveXidForDeviceMessage(final DeviceInfo deviceInfo);
89 }