2 * Copyright (c) 2016 Pantheon Technologies s.r.o. 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
8 package org.opendaylight.openflowplugin.api.openflow.lifecycle;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
13 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
14 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
15 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.ContextChainState;
19 * Chain of contexts, hold references to the contexts
21 public interface ContextChain extends AutoCloseable {
24 * Check if all context are referenced and not null
25 * @return false if reference for some context is missing
30 * Add context to the chain, if reference already exist ignore it
31 * @param context child of OFPContext
33 <T extends OFPContext> void addContext(final T context);
35 void addLifecycleService(final LifecycleService lifecycleService);
38 * Stop the working contexts, but not release them
40 * @param connectionDropped
42 ListenableFuture<Void> stopChain(boolean connectionDropped);
45 * Start the contexts, if some context is missing or cant be started returns failed future
48 ListenableFuture<Void> startChain();
54 * Change connection if connection were drop and rebuild
55 * @param connectionContext
57 void changePrimaryConnection(final ConnectionContext connectionContext);
59 ListenableFuture<Void> connectionDropped();
61 ContextChainState getContextChainState();
63 ConnectionContext getPrimaryConnectionContext();
65 void sleepTheChainAndDropConnection();
67 void registerServices(@NonNull final ClusterSingletonServiceProvider clusterSingletonServiceProvider);
69 void makeDeviceSlave();
71 void closePrimaryConnection();
73 DeviceContext provideDeviceContext();