2 * Copyright (c) 2013 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.md.core.session;
11 import com.google.common.util.concurrent.ListeningExecutorService;
12 import java.util.Collection;
13 import java.util.List;
15 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
16 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
17 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
18 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
19 import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
20 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
21 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
22 import org.opendaylight.openflowplugin.api.openflow.md.queue.PopListener;
23 import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
25 import org.opendaylight.yangtools.concepts.ListenerRegistration;
26 import org.opendaylight.yangtools.yang.binding.DataContainer;
27 import org.opendaylight.yangtools.yang.binding.DataObject;
29 public interface SessionManager extends AutoCloseable {
33 * @param sessionKey session key
34 * @return corresponding conductor, holding {@link ConnectionAdapter} to
36 SessionContext getSessionContext(SwitchSessionKeyOF sessionKey);
39 * disconnect all underlying {@link ConnectionAdapter}s and notify listeners.
41 * @param sessionKey session key
43 void invalidateSessionContext(SwitchSessionKeyOF sessionKey);
46 * register session context.
48 * @param sessionKey session key
49 * @param context context
51 void addSessionContext(SwitchSessionKeyOF sessionKey, SessionContext context);
53 void setRole(SessionContext context);
56 * disconnect particular auxiliary {@link ConnectionAdapter}, identified by
57 * sessionKey and connectionCookie.
59 * @param sessionKey session key
60 * @param connectionCookie cookie
62 void invalidateAuxiliary(SwitchSessionKeyOF sessionKey,
63 SwitchConnectionDistinguisher connectionCookie);
66 * Invalidate on disconnect.
67 * @param connectionConductor connection conductor.
69 void invalidateOnDisconnect(ConnectionConductor connectionConductor);
73 * @param translatorMapping translators
75 void setTranslatorMapping(
76 Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> translatorMapping);
80 * @return translator mapping
82 Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> getTranslatorMapping();
86 * @param notificationProviderService notofication provider
88 void setNotificationProviderService(NotificationProviderService notificationProviderService);
92 * @return notificationServiceProvider
94 DataBroker getDataBroker();
98 * @param dataBroker databroker
100 void setDataBroker(DataBroker dataBroker);
104 * @return notificationServiceProvider
106 NotificationProviderService getNotificationProviderService();
109 * Session listener registration.
110 * @param listener listener
111 * @return registration
113 ListenerRegistration<SessionListener> registerSessionListener(SessionListener listener);
117 * @return popListener mapping, key=message type; value=collection of listeners
119 Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> getPopListenerMapping();
123 * @param popListenerMapping the popListenerMapping to set
125 void setPopListenerMapping(
126 Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> popListenerMapping);
130 * @param rpcPoolDelegator rpc pool delegator
132 void setRpcPool(ListeningExecutorService rpcPoolDelegator);
136 * @return the rpcPool instance
138 ListeningExecutorService getRpcPool();
142 * @param messageSpy message spy
144 void setMessageSpy(MessageSpy<DataContainer> messageSpy);
148 * @return the messageSpy
150 MessageSpy<DataContainer> getMessageSpy();
154 * @return collection of current sessions
156 Collection<SessionContext> getAllSessions();