preparing QueueKeeper and message translation
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / 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.openflow.md.core.session;
10
11 import java.util.List;
12 import java.util.Map;
13 import java.util.Set;
14 import java.util.Map.Entry;
15
16 import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
17 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Port;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatus;
21
22 /**
23  * @author mirehak
24  */
25 public interface SessionContext {
26
27     /**
28      * @return primary connection wrapper
29      */
30     public ConnectionConductor getPrimaryConductor();
31
32     /**
33      * @return the features of corresponding switch
34      */
35     public GetFeaturesOutput getFeatures();
36
37     /**
38      * @param auxiliaryKey
39      *            key under which the auxiliary conductor is stored
40      * @return list of auxiliary connection wrappers
41      */
42     public ConnectionConductor getAuxiliaryConductor(
43             SwitchConnectionDistinguisher auxiliaryKey);
44
45     /**
46      * @return entries of all auxiliary connections wrapped in conductors in this session
47      */
48     public Set<Entry<SwitchConnectionDistinguisher, ConnectionConductor>> getAuxiliaryConductors();
49
50     /**
51      * register new auxiliary connection wrapped in {@link ConnectionConductor}
52      *
53      * @param auxiliaryKey
54      * @param conductor
55      */
56     public void addAuxiliaryConductor(SwitchConnectionDistinguisher auxiliaryKey,
57             ConnectionConductor conductor);
58
59     /**
60      * @param connectionCookie
61      * @return removed connectionConductor
62      */
63     public ConnectionConductor removeAuxiliaryConductor(
64             SwitchConnectionDistinguisher connectionCookie);
65
66     /**
67      * @return true if this session is valid
68      */
69     public boolean isValid();
70
71     /**
72      * @param valid the valid to set
73      */
74     public void setValid(boolean valid);
75
76     /**
77      * @return the sessionKey
78      */
79     public SwitchConnectionDistinguisher getSessionKey();
80
81     /**
82      * Returns a map containing all OFPhysicalPorts of this switch.
83      * @return The Map of OFPhysicalPort
84      */
85     public Map<Long, Port> getPhysicalPorts();
86
87     /**
88      * Returns a Set containing all port IDs of this switch.
89      * @return The Set of port ID
90      */
91     public Set<Long> getPorts();
92
93     /**
94      * Returns OFPhysicalPort of the specified portNumber of this switch.
95      * @param portNumber The port ID
96      * @return OFPhysicalPort for the specified PortNumber
97      */
98     public Port getPhysicalPort(Long portNumber);
99
100     /**
101      * Returns the bandwidth of the specified portNumber of this switch.
102      * @param portNumber the port ID
103      * @return bandwidth
104      */
105     public Boolean getPortBandwidth(Long portNumber);
106
107     /**
108      * Returns True if the port is enabled,
109      * @param portNumber
110      * @return True if the port is enabled
111      */
112     public boolean isPortEnabled(long portNumber);
113
114     /**
115      * Returns True if the port is enabled.
116      * @param port
117      * @return True if the port is enabled
118      */
119     public boolean isPortEnabled(Port port);
120
121     /**
122      * Returns a list containing all enabled ports of this switch.
123      * @return List containing all enabled ports of this switch
124      */
125     public List<Port> getEnabledPorts();
126
127     public void processPortStatusMsg(PortStatus arg0);
128
129
130     // TODO:: add listeners here, manager will set them and conductor use them
131
132     /**
133      *  get message dispatch service to send the message to switch
134      *
135      * @return the message service
136      */
137     public IMessageDispatchService getMessageDispatchService();
138
139    /**
140     * @return the unique xid for this session
141     */
142     public Long getNextXid();
143
144
145
146 }