2 * Copyright (c) 2016 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.lifecycle;
11 import javax.annotation.CheckForNull;
12 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
13 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
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.handlers.DeviceRemovedHandler;
17 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
18 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
21 * Service for starting or stopping all services in plugin in cluster
23 public interface LifecycleService extends ClusterSingletonService, OFPContext {
26 * This method registers lifecycle service to the given provider
27 * @param singletonServiceProvider from md-sal binding
29 void registerService(final ClusterSingletonServiceProvider singletonServiceProvider);
32 * This method registers device removed handler what will be executed when device should be removed
34 * @param deviceRemovedHandler device removed handler
36 void registerDeviceRemovedHandler(final @CheckForNull DeviceRemovedHandler deviceRemovedHandler);
39 * Setter for device context
40 * @param deviceContext actual device context created per device
42 void setDeviceContext(final DeviceContext deviceContext);
45 * Setter for rpc context
46 * @param rpcContext actual rpc context created per device
48 void setRpcContext(final RpcContext rpcContext);
51 * Setter for statistics context
52 * @param statContext actual statistics context created per device
54 void setStatContext(final StatisticsContext statContext);
57 * Some services, contexts etc. still need to have access to device context,
58 * instead to push into them, here is the getter
59 * @return device context for this device
61 DeviceContext getDeviceContext();
64 * if some services not started properly need to close connection
66 void closeConnection();