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