Yuta HIGUCHI | d92b10c | 2014-08-25 09:30:28 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.topology; |
| 2 | |
| 3 | import java.util.Collection; |
| 4 | |
| 5 | import net.floodlightcontroller.util.MACAddress; |
| 6 | import net.onrc.onos.core.util.Dpid; |
| 7 | import net.onrc.onos.core.util.PortNumber; |
| 8 | import net.onrc.onos.core.util.SwitchPort; |
| 9 | |
| 10 | // TODO move to appropriate package. under api?? |
| 11 | /** |
| 12 | * BaseTopology interface common to both {@link ImmutableTopology} and {@link MutableTopology}. |
| 13 | */ |
Yuta HIGUCHI | ab9dc7b | 2014-08-26 22:53:13 -0700 | [diff] [blame] | 14 | public interface BaseTopology extends BaseMastership { |
Yuta HIGUCHI | d92b10c | 2014-08-25 09:30:28 -0700 | [diff] [blame] | 15 | |
| 16 | /** |
| 17 | * Gets the switch for a given switch DPID. |
| 18 | * |
| 19 | * @param dpid the switch dpid. |
| 20 | * @return the switch if found, otherwise null. |
| 21 | */ |
| 22 | public Switch getSwitch(Dpid dpid); |
| 23 | |
| 24 | /** |
| 25 | * Gets all switches in the network. |
| 26 | * |
| 27 | * @return all switches in the network. |
| 28 | */ |
| 29 | public Iterable<Switch> getSwitches(); |
| 30 | |
| 31 | /** |
| 32 | * Gets the port on a switch. |
| 33 | * |
| 34 | * @param dpid the switch DPID. |
| 35 | * @param portNumber the switch port number. |
| 36 | * @return the switch port if found, otherwise null. |
| 37 | */ |
| 38 | public Port getPort(Dpid dpid, PortNumber portNumber); |
| 39 | |
| 40 | /** |
| 41 | * Gets the port on a switch. |
| 42 | * |
| 43 | * @param port port identifier |
| 44 | * @return the switch port if found, otherwise null. |
| 45 | */ |
| 46 | public Port getPort(SwitchPort port); |
| 47 | |
| 48 | /** |
| 49 | * Gets all ports on a switch specified. |
| 50 | * |
| 51 | * @param dpid Switch dpid |
| 52 | * @return ports. |
| 53 | */ |
| 54 | public Collection<Port> getPorts(Dpid dpid); |
| 55 | |
| 56 | /** |
| 57 | * Gets the outgoing link from a switch port. |
| 58 | * <p/> |
| 59 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 60 | * returns it if found, else return whichever link is found first. |
| 61 | * |
| 62 | * @param dpid the switch DPID. |
| 63 | * @param portNumber the switch port number. |
| 64 | * @return the outgoing link if found, otherwise null. |
| 65 | */ |
| 66 | public Link getOutgoingLink(Dpid dpid, PortNumber portNumber); |
| 67 | |
| 68 | /** |
| 69 | * Gets the outgoing link from a switch port. |
| 70 | * |
| 71 | * @param dpid the switch DPID. |
| 72 | * @param portNumber the switch port number. |
| 73 | * @param type type of the link |
| 74 | * @return the outgoing link if found, otherwise null. |
| 75 | */ |
| 76 | public Link getOutgoingLink(Dpid dpid, PortNumber portNumber, String type); |
| 77 | |
| 78 | /** |
| 79 | * Gets the outgoing link from a switch port. |
| 80 | * <p/> |
| 81 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 82 | * returns it if found, else return whichever link is found first. |
| 83 | * |
| 84 | * @param port port identifier |
| 85 | * @return the outgoing link if found, otherwise null. |
| 86 | */ |
| 87 | public Link getOutgoingLink(SwitchPort port); |
| 88 | |
| 89 | /** |
| 90 | * Gets the outgoing link from a switch port. |
| 91 | * |
| 92 | * @param port port identifier |
| 93 | * @param type type of the link |
| 94 | * @return the outgoing link if found, otherwise null. |
| 95 | */ |
| 96 | public Link getOutgoingLink(SwitchPort port, String type); |
| 97 | |
| 98 | /** |
| 99 | * Gets all the outgoing link from a switch port. |
| 100 | * |
| 101 | * @param port port identifier |
| 102 | * @return outgoing links |
| 103 | */ |
| 104 | public Collection<Link> getOutgoingLinks(SwitchPort port); |
| 105 | |
| 106 | /** |
| 107 | * Gets the incoming link to a switch port. |
| 108 | * <p/> |
| 109 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 110 | * returns it if found, else return whichever link is found first. |
| 111 | * |
| 112 | * @param dpid the switch DPID. |
| 113 | * @param portNumber the switch port number. |
| 114 | * @return the incoming link if found, otherwise null. |
| 115 | */ |
| 116 | public Link getIncomingLink(Dpid dpid, PortNumber portNumber); |
| 117 | |
| 118 | /** |
| 119 | * Gets the incoming link to a switch port. |
| 120 | * <p/> |
| 121 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 122 | * returns it if found, else return whichever link is found first. |
| 123 | * |
| 124 | * @param dpid the switch DPID. |
| 125 | * @param portNumber the switch port number. |
| 126 | * @param type type of the link |
| 127 | * @return the incoming link if found, otherwise null. |
| 128 | */ |
| 129 | public Link getIncomingLink(Dpid dpid, PortNumber portNumber, String type); |
| 130 | |
| 131 | /** |
| 132 | * Gets the incoming link to a switch port. |
| 133 | * <p/> |
| 134 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 135 | * returns it if found, else return whichever link is found first. |
| 136 | * |
| 137 | * @param port port identifier |
| 138 | * @return the incoming link if found, otherwise null. |
| 139 | */ |
| 140 | public Link getIncomingLink(SwitchPort port); |
| 141 | |
| 142 | /** |
| 143 | * Gets the incoming link to a switch port. |
| 144 | * |
| 145 | * @param port port identifier |
| 146 | * @param type type of the link |
| 147 | * @return the incoming link if found, otherwise null. |
| 148 | */ |
| 149 | public Link getIncomingLink(SwitchPort port, String type); |
| 150 | |
| 151 | /** |
| 152 | * Gets all the incoming link from a switch port. |
| 153 | * |
| 154 | * @param port port identifier |
| 155 | * @return incoming links |
| 156 | */ |
| 157 | public Collection<Link> getIncomingLinks(SwitchPort port); |
| 158 | |
| 159 | /** |
| 160 | * Gets the outgoing link from a switch and a port to another switch and |
| 161 | * a port. |
| 162 | * |
| 163 | * @param srcDpid the source switch DPID. |
| 164 | * @param srcPortNumber the source switch port number. |
| 165 | * @param dstDpid the destination switch DPID. |
| 166 | * @param dstPortNumber the destination switch port number. |
| 167 | * @return the outgoing link if found, otherwise null. |
| 168 | */ |
| 169 | public Link getLink(Dpid srcDpid, PortNumber srcPortNumber, |
| 170 | Dpid dstDpid, PortNumber dstPortNumber); |
| 171 | |
| 172 | /** |
| 173 | * Gets the outgoing link from a switch and a port to another switch and |
| 174 | * a port. |
| 175 | * |
| 176 | * @param srcDpid the source switch DPID. |
| 177 | * @param srcPortNumber the source switch port number. |
| 178 | * @param dstDpid the destination switch DPID. |
| 179 | * @param dstPortNumber the destination switch port number. |
| 180 | * @param type type of the link |
| 181 | * @return the outgoing link if found, otherwise null. |
| 182 | */ |
| 183 | public Link getLink(Dpid srcDpid, PortNumber srcPortNumber, |
| 184 | Dpid dstDpid, PortNumber dstPortNumber, |
| 185 | String type); |
| 186 | |
| 187 | /** |
| 188 | * Gets all links in the network. |
| 189 | * <p/> |
| 190 | * |
| 191 | * @return all links in the network. |
| 192 | */ |
| 193 | public Iterable<Link> getLinks(); |
| 194 | |
| 195 | /** |
| 196 | * Gets the network device for a given MAC address. |
| 197 | * |
| 198 | * @param address the MAC address to use. |
| 199 | * @return the network device for the MAC address if found, otherwise null. |
| 200 | */ |
| 201 | public Host getHostByMac(MACAddress address); |
| 202 | |
| 203 | /** |
| 204 | * Gets all devices in the network. |
| 205 | * |
| 206 | * @return all devices in the network |
| 207 | */ |
| 208 | public Iterable<Host> getHosts(); |
| 209 | |
| 210 | /** |
| 211 | * Gets all devices on specified port. |
| 212 | * |
| 213 | * @param port port which the device is attached |
| 214 | * @return all devices attached to the port. |
| 215 | */ |
| 216 | public Collection<Host> getHosts(SwitchPort port); |
| 217 | } |