blob: cc62e82ac86f78eb63c20da7b70833d5786248e7 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001package net.floodlightcontroller.topology;
2
3import java.util.Date;
4import java.util.List;
5import java.util.Set;
6
7import net.floodlightcontroller.core.module.IFloodlightService;
8import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
9
10public interface ITopologyService extends IFloodlightService {
11
12 public void addListener(ITopologyListener listener);
13
14 public Date getLastUpdateTime();
15
16 /**
17 * Query to determine if devices must be learned on a given switch port.
18 */
19 public boolean isAttachmentPointPort(long switchid, short port);
20 public boolean isAttachmentPointPort(long switchid, short port,
21 boolean tunnelEnabled);
22
23 public long getOpenflowDomainId(long switchId);
24 public long getOpenflowDomainId(long switchId, boolean tunnelEnabled);
25
26 /**
27 * Returns the identifier of the L2 domain of a given switch.
28 * @param switchId The DPID of the switch in long form
29 * @return The DPID of the switch that is the key for the cluster
30 */
31 public long getL2DomainId(long switchId);
32 public long getL2DomainId(long switchId, boolean tunnelEnabled);
33
34 /**
35 * Queries whether two switches are in the same cluster.
36 * @param switch1
37 * @param switch2
38 * @return true if the switches are in the same cluster
39 */
40 public boolean inSameOpenflowDomain(long switch1, long switch2);
41 public boolean inSameOpenflowDomain(long switch1, long switch2,
42 boolean tunnelEnabled);
43
44 /**
45 * Queries whether two switches are in the same island.
46 * Currently, island and cluster are the same. In future,
47 * islands could be different than clusters.
48 * @param switch1
49 * @param switch2
50 * @return True of they are in the same island, false otherwise
51 */
52 public boolean inSameL2Domain(long switch1, long switch2);
53 public boolean inSameL2Domain(long switch1, long switch2,
54 boolean tunnelEnabled);
55
56 public boolean isBroadcastDomainPort(long sw, short port);
57 public boolean isBroadcastDomainPort(long sw, short port,
58 boolean tunnelEnabled);
59
60
61 public boolean isAllowed(long sw, short portId);
62 public boolean isAllowed(long sw, short portId, boolean tunnelEnabled);
63
64 /**
65 * Indicates if an attachment point on the new switch port is consistent
66 * with the attachment point on the old switch port or not.
67 */
68 public boolean isConsistent(long oldSw, short oldPort,
69 long newSw, short newPort);
70 public boolean isConsistent(long oldSw, short oldPort,
71 long newSw, short newPort,
72 boolean tunnelEnabled);
73
74 /**
75 * Indicates if the two switch ports are connected to the same
76 * broadcast domain or not.
77 * @param s1
78 * @param p1
79 * @param s2
80 * @param p2
81 * @return
82 */
83 public boolean isInSameBroadcastDomain(long s1, short p1,
84 long s2, short p2);
85 public boolean isInSameBroadcastDomain(long s1, short p1,
86 long s2, short p2,
87 boolean tunnelEnabled);
88
89 /**
90 * Gets a list of ports on a given switch that are known to topology.
91 * @param sw The switch DPID in long
92 * @return The set of ports on this switch
93 */
94 public Set<Short> getPortsWithLinks(long sw);
95 public Set<Short> getPortsWithLinks(long sw, boolean tunnelEnabled);
96
97 /** Get broadcast ports on a target switch for a given attachmentpoint
98 * point port.
99 */
100 public Set<Short> getBroadcastPorts(long targetSw, long src, short srcPort);
101
102 public Set<Short> getBroadcastPorts(long targetSw, long src, short srcPort,
103 boolean tunnelEnabled);
104
105 /**
106 *
107 */
108 public boolean isIncomingBroadcastAllowed(long sw, short portId);
109 public boolean isIncomingBroadcastAllowed(long sw, short portId,
110 boolean tunnelEnabled);
111
112
113 /** Get the proper outgoing switchport for a given pair of src-dst
114 * switchports.
115 */
116 public NodePortTuple getOutgoingSwitchPort(long src, short srcPort,
117 long dst, short dstPort);
118
119
120 public NodePortTuple getOutgoingSwitchPort(long src, short srcPort,
121 long dst, short dstPort,
122 boolean tunnelEnabled);
123
124
125 public NodePortTuple getIncomingSwitchPort(long src, short srcPort,
126 long dst, short dstPort);
127 public NodePortTuple getIncomingSwitchPort(long src, short srcPort,
128 long dst, short dstPort,
129 boolean tunnelEnabled);
130
131 /**
132 * If the dst is not allowed by the higher-level topology,
133 * this method provides the topologically equivalent broadcast port.
134 * @param src
135 * @param dst
136 * @return the allowed broadcast port
137 */
138 public NodePortTuple
139 getAllowedOutgoingBroadcastPort(long src,
140 short srcPort,
141 long dst,
142 short dstPort);
143
144 public NodePortTuple
145 getAllowedOutgoingBroadcastPort(long src,
146 short srcPort,
147 long dst,
148 short dstPort,
149 boolean tunnelEnabled);
150
151 /**
152 * If the src broadcast domain port is not allowed for incoming
153 * broadcast, this method provides the topologically equivalent
154 * incoming broadcast-allowed
155 * src port.
156 * @param src
157 * @param dst
158 * @return the allowed broadcast port
159 */
160 public NodePortTuple
161 getAllowedIncomingBroadcastPort(long src,
162 short srcPort);
163
164 public NodePortTuple
165 getAllowedIncomingBroadcastPort(long src,
166 short srcPort,
167 boolean tunnelEnabled);
168
169
170 /**
171 * Gets the set of ports that belong to a broadcast domain.
172 * @return The set of ports that belong to a broadcast domain.
173 */
174 public Set<NodePortTuple> getBroadcastDomainPorts();
175 public Set<NodePortTuple> getTunnelPorts();
176
177
178 /**
179 * Returns a set of blocked ports. The set of blocked
180 * ports is the union of all the blocked ports across all
181 * instances.
182 * @return
183 */
184 public Set<NodePortTuple> getBlockedPorts();
185
186 /**
187 * ITopologyListener provides topologyChanged notification,
188 * but not *what* the changes were.
189 * This method returns the delta in the linkUpdates between the current and the previous topology instance.
190 * @return
191 */
192 public List<LDUpdate> getLastLinkUpdates();
193
194 /**
195 * Switch methods
196 */
197 public Set<Short> getPorts(long sw);
198}