Merge "Bug 8873 - Bundle based reconciliation to enable bundling of messages"
[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.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;
28
29 public interface SessionManager extends AutoCloseable {
30
31     /**
32      * primary connection.
33      * @param sessionKey session key
34      * @return corresponding conductor, holding {@link ConnectionAdapter} to
35      */
36     SessionContext getSessionContext(SwitchSessionKeyOF sessionKey);
37
38     /**
39      * disconnect all underlying {@link ConnectionAdapter}s and notify listeners.
40      *
41      * @param sessionKey session key
42      */
43     void invalidateSessionContext(SwitchSessionKeyOF sessionKey);
44
45     /**
46      * register session context.
47      *
48      * @param sessionKey session key
49      * @param context context
50      */
51     void addSessionContext(SwitchSessionKeyOF sessionKey, SessionContext context);
52
53     void setRole(SessionContext context);
54
55     /**
56      * disconnect particular auxiliary {@link ConnectionAdapter}, identified by
57      * sessionKey and connectionCookie.
58      *
59      * @param sessionKey  session key
60      * @param connectionCookie cookie
61      */
62     void invalidateAuxiliary(SwitchSessionKeyOF sessionKey,
63                                     SwitchConnectionDistinguisher connectionCookie);
64
65     /**
66      * Invalidate on disconnect.
67      * @param connectionConductor connection conductor.
68      */
69     void invalidateOnDisconnect(ConnectionConductor connectionConductor);
70
71     /**
72      * Setter.
73      * @param translatorMapping translators
74      */
75     void setTranslatorMapping(
76             Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> translatorMapping);
77
78     /**
79      * Getter.
80      * @return translator mapping
81      */
82     Map<TranslatorKey, Collection<IMDMessageTranslator<OfHeader, List<DataObject>>>> getTranslatorMapping();
83
84     /**
85      * Setter.
86      * @param notificationProviderService notofication provider
87      */
88     void setNotificationProviderService(NotificationProviderService notificationProviderService);
89
90     /**
91      * Getter.
92      * @return notificationServiceProvider
93      */
94     DataBroker getDataBroker();
95
96     /**
97      * Setter.
98      * @param dataBroker databroker
99      */
100     void setDataBroker(DataBroker dataBroker);
101
102     /**
103      * Gatter.
104      * @return notificationServiceProvider
105      */
106     NotificationProviderService getNotificationProviderService();
107
108     /**
109      * Session listener registration.
110      * @param listener listener
111      * @return registration
112      */
113     ListenerRegistration<SessionListener> registerSessionListener(SessionListener listener);
114
115     /**
116      * Getter.
117      * @return popListener mapping, key=message type; value=collection of listeners
118      */
119     Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> getPopListenerMapping();
120
121     /**
122      * Setter.
123      * @param popListenerMapping the popListenerMapping to set
124      */
125     void setPopListenerMapping(
126             Map<Class<? extends DataObject>, Collection<PopListener<DataObject>>> popListenerMapping);
127
128     /**
129      * Setter.
130      * @param rpcPoolDelegator rpc pool delegator
131      */
132     void setRpcPool(ListeningExecutorService rpcPoolDelegator);
133
134     /**
135      * Getter.
136      * @return the rpcPool instance
137      */
138     ListeningExecutorService getRpcPool();
139
140     /**
141      * Setter.
142      * @param messageSpy message spy
143      */
144     void setMessageSpy(MessageSpy<DataContainer> messageSpy);
145
146     /**
147      * Getter.
148      * @return the messageSpy
149      */
150     MessageSpy<DataContainer> getMessageSpy();
151
152     /**
153      * Getter.
154      * @return collection of current sessions
155      */
156     Collection<SessionContext> getAllSessions();
157 }