Disconnection improvements.
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / lifecycle / ContextChainHolder.java
1 /*
2  * Copyright (c) 2016 Pantheon Technologies s.r.o. 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 package org.opendaylight.openflowplugin.api.openflow.lifecycle;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
12 import org.opendaylight.openflowplugin.api.openflow.OFPManager;
13 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
14 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
15 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
16 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
17
18 /**
19  * Generic interface for context chain holder, hold all created context chains.
20  */
21 public interface ContextChainHolder extends
22         DeviceConnectedHandler,
23         MastershipChangeListener,
24         DeviceDisconnectedHandler {
25
26     <T extends OFPManager> void addManager(final T manager);
27     ContextChain createContextChain(final ConnectionContext connectionContext);
28     ListenableFuture<Void> connectionLost(final DeviceInfo deviceInfo);
29     void destroyContextChain(final DeviceInfo deviceInfo);
30
31     /**
32      * This method will pair up connection with existing context chain.
33      * If context chain doesn't exist will create context chain a
34      * set this connection as primary to the new created context chain.
35      * If context chain cannot be created close connection and destroy context chain.
36      * @param connectionContext new connection
37      */
38     void pairConnection(final ConnectionContext connectionContext);
39
40     void addSingletonServicesProvider(final ClusterSingletonServiceProvider singletonServicesProvider);
41 }