Merge "Bug 4957 Fix methods for change TxChainManager"
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / md / core / session / SessionManager.java
1 /**
2  * Copyright (c) 2013 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.md.core.session;
10
11 import com.google.common.util.concurrent.ListeningExecutorService;
12 import java.util.Collection;
13 import java.util.List;
14 import java.util.Map;
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.statistics.MessageSpy;
22 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
23 import org.opendaylight.openflowplugin.api.openflow.md.queue.PopListener;
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;
28
29 /**
30  * @author mirehak
31  */
32 public interface SessionManager extends AutoCloseable {
33
34     /**
35      * @param sessionKey
36      * @return corresponding conductor, holding {@link ConnectionAdapter} to
37      * primary connection
38      */
39     public SessionContext getSessionContext(SwitchSessionKeyOF sessionKey);
40
41     /**
42      * disconnect all underlying {@link ConnectionAdapter}s and notify listeners
43      *
44      * @param sessionKey
45      */
46     public void invalidateSessionContext(SwitchSessionKeyOF sessionKey);
47
48     /**
49      * register session context
50      *
51      * @param sessionKey
52      * @param context
53      */
54     public void addSessionContext(SwitchSessionKeyOF sessionKey, SessionContext context);
55     public void setRole(SessionContext context);
56
57     /**
58      * disconnect particular auxiliary {@link ConnectionAdapter}, identified by
59      * sessionKey and connectionCookie
60      *
61      * @param sessionKey
62      * @param connectionCookie
63      */
64     public void invalidateAuxiliary(SwitchSessionKeyOF sessionKey,
65                                     SwitchConnectionDistinguisher connectionCookie);
66
67     /**
68      * @param connectionConductor
69      */
70     public void invalidateOnDisconnect(ConnectionConductor connectionConductor);
71
72     /**
73      * @param translatorMapping
74      */
75     public void setTranslatorMapping(Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> translatorMapping);
76
77     /**
78      * @return translator mapping
79      */
80     public Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> getTranslatorMapping();
81
82     /**
83      * @param notificationProviderService
84      */
85     public void setNotificationProviderService(NotificationProviderService notificationProviderService);
86
87     /**
88      * @return notificationServiceProvider
89      */
90     public DataBroker getDataBroker();
91
92     /**
93      * @param dataBroker
94      */
95     public void setDataBroker(DataBroker dataBroker);
96
97     /**
98      * @return notificationServiceProvider
99      */
100     public NotificationProviderService getNotificationProviderService();
101
102     /**
103      * @param listener
104      * @return registration
105      */
106     public ListenerRegistration<SessionListener> registerSessionListener(SessionListener listener);
107
108     /**
109      * @return popListener mapping, key=message type; value=collection of listeners
110      */
111     public Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> getPopListenerMapping();
112
113     /**
114      * @param popListenerMapping the popListenerMapping to set
115      */
116     void setPopListenerMapping(Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> popListenerMapping);
117
118     /**
119      * @param rpcPoolDelegator
120      */
121     void setRpcPool(ListeningExecutorService rpcPoolDelegator);
122
123     /**
124      * @return the rpcPool instance
125      */
126     ListeningExecutorService getRpcPool();
127
128     /**
129      * @param messageSpy
130      */
131     void setMessageSpy(MessageSpy<DataContainer> messageSpy);
132
133     /**
134      * @return the messageSpy
135      */
136     MessageSpy<DataContainer> getMessageSpy();
137
138     /**
139      * @return collection of current sessions
140      */
141     Collection<SessionContext> getAllSessions();
142 }