Merge "Fix table miss flow push"
[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 public interface SessionContext {
25
26     /**
27      * return primary connection wrapper.
28      */
29     ConnectionConductor getPrimaryConductor();
30
31     /**
32      * return the features of corresponding switch.
33      */
34     GetFeaturesOutput getFeatures();
35
36     /**
37      * Auxiliary connections.
38      * @param auxiliaryKey key under which the auxiliary conductor is stored
39      * @return list of auxiliary connection wrappers
40      */
41     ConnectionConductor getAuxiliaryConductor(
42             SwitchConnectionDistinguisher auxiliaryKey);
43
44     /**
45      * return entries of all auxiliary connections wrapped in conductors in this session.
46      */
47     Set<Entry<SwitchConnectionDistinguisher, ConnectionConductor>> getAuxiliaryConductors();
48
49     /**
50      * register new auxiliary connection wrapped in {@link ConnectionConductor}.
51      *
52      * @param auxiliaryKey key
53      * @param conductor connection conductor
54      */
55     void addAuxiliaryConductor(SwitchConnectionDistinguisher auxiliaryKey,
56                                ConnectionConductor conductor);
57
58     /**
59      * Remove conductor.
60      * @param connectionCookie cookie
61      * @return removed connectionConductor
62      */
63     ConnectionConductor removeAuxiliaryConductor(
64             SwitchConnectionDistinguisher connectionCookie);
65
66     /**
67      * return true if this session is valid.
68      */
69     boolean isValid();
70
71     /**
72      * Setter.
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 port number
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 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      * @return  xid
157      */
158     Long getNextXid();
159
160     /**
161      * Setter.
162      * @param registration provider composite registration
163      */
164     void setProviderRegistration(ModelDrivenSwitchRegistration registration);
165
166     /**
167      * return provider composite registration.
168      * @return ModelDrivenSwitchRegistration
169      */
170     ModelDrivenSwitchRegistration getProviderRegistration();
171
172     /**
173      * return seed value for random operations.
174      * @return int
175      */
176     int getSeed();
177
178     /**
179      * return (wrapped) notification enqueue service - {@link NotificationQueueWrapper}.
180      * @return NotificationEnqueuer
181      */
182     NotificationEnqueuer getNotificationEnqueuer();
183
184     /**
185      * Setter.
186      * @param roleOnDevice role
187      */
188     void setRoleOnDevice(ControllerRole roleOnDevice);
189
190     /**
191      * return actual role.
192      * @return role
193      */
194     ControllerRole getRoleOnDevice();
195 }