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