Eliminate the use of CompositeObjectRegistration
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / md / core / session / SessionContext.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 java.util.List;
12 import java.util.Map;
13 import java.util.Map.Entry;
14 import java.util.Set;
15 import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
16 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
17 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
18 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
19 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
23
24 /**
25  * @author mirehak
26  */
27 public interface SessionContext {
28
29     /**
30      * @return primary connection wrapper
31      */
32     ConnectionConductor getPrimaryConductor();
33
34     /**
35      * @return the features of corresponding switch
36      */
37     GetFeaturesOutput getFeatures();
38
39     /**
40      * @param auxiliaryKey key under which the auxiliary conductor is stored
41      * @return list of auxiliary connection wrappers
42      */
43     ConnectionConductor getAuxiliaryConductor(
44             SwitchConnectionDistinguisher auxiliaryKey);
45
46     /**
47      * @return entries of all auxiliary connections wrapped in conductors in this session
48      */
49     Set<Entry<SwitchConnectionDistinguisher, ConnectionConductor>> getAuxiliaryConductors();
50
51     /**
52      * register new auxiliary connection wrapped in {@link ConnectionConductor}
53      *
54      * @param auxiliaryKey
55      * @param conductor
56      */
57     void addAuxiliaryConductor(SwitchConnectionDistinguisher auxiliaryKey,
58                                ConnectionConductor conductor);
59
60     /**
61      * @param connectionCookie
62      * @return removed connectionConductor
63      */
64     ConnectionConductor removeAuxiliaryConductor(
65             SwitchConnectionDistinguisher connectionCookie);
66
67     /**
68      * @return true if this session is valid
69      */
70     boolean isValid();
71
72     /**
73      * @param valid the valid to set
74      */
75     void setValid(boolean valid);
76
77     /**
78      * @return the sessionKey
79      */
80     SwitchSessionKeyOF getSessionKey();
81
82     /**
83      * Returns a map containing all OFPhysicalPorts of this switch.
84      *
85      * @return The Map of OFPhysicalPort
86      */
87     @Deprecated
88     Map<Long, PortGrouping> getPhysicalPorts();
89
90     /**
91      * Returns a map containing all bandwidths for all OFPorts of this switch.
92      *
93      * @return The Map of bandwidths for all OFPorts
94      */
95     @Deprecated
96     Map<Long, Boolean> getPortsBandwidth();
97
98     /**
99      * Returns a Set containing all port IDs of this switch.
100      *
101      * @return The Set of port ID
102      */
103     @Deprecated
104     Set<Long> getPorts();
105
106     /**
107      * Returns OFPhysicalPort of the specified portNumber of this switch.
108      *
109      * @param portNumber The port ID
110      * @return OFPhysicalPort for the specified PortNumber
111      */
112     PortGrouping getPhysicalPort(Long portNumber);
113
114     /**
115      * Returns the bandwidth of the specified portNumber of this switch.
116      *
117      * @param portNumber the port ID
118      * @return bandwidth
119      */
120     Boolean getPortBandwidth(Long portNumber);
121
122     /**
123      * Returns True if the port is enabled,
124      *
125      * @param portNumber
126      * @return True if the port is enabled
127      */
128     boolean isPortEnabled(long portNumber);
129
130     /**
131      * Returns True if the port is enabled.
132      *
133      * @param port
134      * @return True if the port is enabled
135      */
136     boolean isPortEnabled(PortGrouping port);
137
138     /**
139      * Returns a list containing all enabled ports of this switch.
140      *
141      * @return List containing all enabled ports of this switch
142      */
143     List<PortGrouping> getEnabledPorts();
144
145     // TODO:: add listeners here, manager will set them and conductor use them
146
147     /**
148      * get message dispatch service to send the message to switch
149      *
150      * @return the message service
151      */
152     IMessageDispatchService getMessageDispatchService();
153
154     /**
155      * @return the unique xid for this session
156      */
157     Long getNextXid();
158
159     /**
160      * @param registration provider composite registration
161      */
162     void setProviderRegistration(ModelDrivenSwitchRegistration registration);
163
164     /**
165      * @return provider composite registration
166      */
167     ModelDrivenSwitchRegistration getProviderRegistration();
168
169     /**
170      * @return seed value for random operations
171      */
172     int getSeed();
173
174     /**
175      * @return (wrapped) notification enqueue service - {@link NotificationQueueWrapper}
176      */
177     NotificationEnqueuer getNotificationEnqueuer();
178
179     /**
180      * @param roleOnDevice
181      */
182     void setRoleOnDevice(ControllerRole roleOnDevice);
183
184     /**
185      * @return actual role
186      */
187     ControllerRole getRoleOnDevice();
188 }