Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.incubator.net.virtual; |
| 17 | |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | import org.onlab.packet.VlanId; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 21 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 22 | import org.onosproject.net.ConnectPoint; |
| 23 | import org.onosproject.net.DeviceId; |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 24 | import org.onosproject.net.HostId; |
| 25 | import org.onosproject.net.HostLocation; |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 26 | import org.onosproject.net.Link; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 27 | import org.onosproject.net.PortNumber; |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 28 | import org.onosproject.net.intent.Intent; |
| 29 | import org.onosproject.net.intent.IntentData; |
| 30 | import org.onosproject.net.intent.IntentState; |
| 31 | import org.onosproject.net.intent.Key; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 32 | import org.onosproject.store.Store; |
| 33 | |
| 34 | import java.util.Set; |
| 35 | |
| 36 | /** |
| 37 | * Mechanism for distributing and storing virtual network model information. |
| 38 | */ |
| 39 | public interface VirtualNetworkStore |
| 40 | extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> { |
| 41 | |
| 42 | /** |
| 43 | * Adds a new tenant ID to the store. |
| 44 | * |
| 45 | * @param tenantId tenant identifier |
| 46 | */ |
| 47 | void addTenantId(TenantId tenantId); |
| 48 | |
| 49 | /** |
| 50 | * Removes the specified tenant ID from the store. |
| 51 | * |
| 52 | * @param tenantId tenant identifier |
| 53 | */ |
| 54 | void removeTenantId(TenantId tenantId); |
| 55 | |
| 56 | /** |
| 57 | * Returns set of registered tenant IDs. |
| 58 | * |
| 59 | * @return set of tenant identifiers |
| 60 | */ |
| 61 | Set<TenantId> getTenantIds(); |
| 62 | |
| 63 | /** |
| 64 | * Adds a new virtual network for the specified tenant to the store. |
| 65 | * |
| 66 | * @param tenantId tenant identifier |
| 67 | * @return the virtual network |
| 68 | */ |
| 69 | VirtualNetwork addNetwork(TenantId tenantId); |
| 70 | |
| 71 | /** |
| 72 | * Removes the specified virtual network from the store. |
| 73 | * |
| 74 | * @param networkId network identifier |
| 75 | */ |
| 76 | void removeNetwork(NetworkId networkId); |
| 77 | |
| 78 | /** |
| 79 | * Adds a new virtual device to the store. This device will have no ports. |
| 80 | * |
| 81 | * @param networkId network identifier |
| 82 | * @param deviceId device identifier |
| 83 | * @return the virtual device |
| 84 | */ |
| 85 | VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId); |
| 86 | |
| 87 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 88 | * Removes the specified virtual device from the given network. |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 89 | * |
| 90 | * @param networkId network identifier |
| 91 | * @param deviceId device identifier |
| 92 | */ |
| 93 | void removeDevice(NetworkId networkId, DeviceId deviceId); |
| 94 | |
| 95 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 96 | * Adds a new virtual host to the store. |
| 97 | * |
| 98 | * @param networkId network identifier |
| 99 | * @param hostId host identifier |
| 100 | * @param mac mac address |
| 101 | * @param vlan vlan identifier |
| 102 | * @param location host location |
| 103 | * @param ips set of ip addresses |
| 104 | * @return the virtual host |
| 105 | */ |
| 106 | VirtualHost addHost(NetworkId networkId, HostId hostId, MacAddress mac, |
| 107 | VlanId vlan, HostLocation location, Set<IpAddress> ips); |
| 108 | |
| 109 | /** |
| 110 | * Removes the specified virtual host from the store. |
| 111 | * |
| 112 | * @param networkId network identifier |
| 113 | * @param hostId host identifier |
| 114 | */ |
| 115 | void removeHost(NetworkId networkId, HostId hostId); |
| 116 | |
| 117 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 118 | * Adds a new virtual link. |
| 119 | * |
| 120 | * @param networkId network identifier |
| 121 | * @param src source end-point of the link |
| 122 | * @param dst destination end-point of the link |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 123 | * @param state link state |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 124 | * @param realizedBy underlying tunnel identifier using which this link is realized |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 125 | * @return the virtual link |
| 126 | */ |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 127 | VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, Link.State state, TunnelId realizedBy); |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 128 | |
| 129 | /** |
| 130 | * Updates the tunnelId in the virtual link. |
| 131 | * |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 132 | * @param virtualLink virtual link |
| 133 | * @param tunnelId tunnel identifier |
| 134 | * @param state link state |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 135 | */ |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 136 | void updateLink(VirtualLink virtualLink, TunnelId tunnelId, Link.State state); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 137 | |
| 138 | /** |
| 139 | * Removes the specified link from the store. |
| 140 | * |
| 141 | * @param networkId network identifier |
| 142 | * @param src source connection point |
| 143 | * @param dst destination connection point |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 144 | * @return the virtual link |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 145 | */ |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 146 | VirtualLink removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * Adds a new virtual port to the network. |
| 150 | * |
| 151 | * @param networkId network identifier |
| 152 | * @param deviceId device identifier |
| 153 | * @param portNumber port number |
| 154 | * @param realizedBy underlying port which realizes the virtual port |
| 155 | * @return the virtual port |
| 156 | */ |
| 157 | VirtualPort addPort(NetworkId networkId, DeviceId deviceId, |
Yoonseon Han | 6c60389 | 2016-09-01 11:52:21 -0700 | [diff] [blame^] | 158 | PortNumber portNumber, ConnectPoint realizedBy); |
| 159 | |
| 160 | /** |
| 161 | * Binds an existing virtual port to the network. |
| 162 | * |
| 163 | * @param networkId network identifier |
| 164 | * @param deviceId device identifier |
| 165 | * @param portNumber port number |
| 166 | * @param realizedBy underlying port which realizes the virtual port |
| 167 | */ |
| 168 | void bindPort(NetworkId networkId, DeviceId deviceId, |
| 169 | PortNumber portNumber, ConnectPoint realizedBy); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 170 | |
| 171 | /** |
| 172 | * Removes the specified port from the given device and network. |
| 173 | * |
| 174 | * @param networkId network identifier |
| 175 | * @param deviceId device identifier |
| 176 | * @param portNumber port number |
| 177 | */ |
| 178 | void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); |
| 179 | |
| 180 | /** |
| 181 | * Returns the list of networks. |
| 182 | * |
| 183 | * @param tenantId tenant identifier |
| 184 | * @return set of virtual networks |
| 185 | */ |
| 186 | Set<VirtualNetwork> getNetworks(TenantId tenantId); |
| 187 | |
| 188 | /** |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 189 | * Returns the virtual network for the given network identifier. |
| 190 | * |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 191 | * @param networkId network identifier |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 192 | * @return the virtual network |
| 193 | */ |
| 194 | VirtualNetwork getNetwork(NetworkId networkId); |
| 195 | |
| 196 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 197 | * Returns the list of devices in the specified virtual network. |
| 198 | * |
| 199 | * @param networkId network identifier |
| 200 | * @return set of virtual devices |
| 201 | */ |
| 202 | Set<VirtualDevice> getDevices(NetworkId networkId); |
| 203 | |
| 204 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 205 | * Returns the list of hosts in the specified virtual network. |
| 206 | * |
| 207 | * @param networkId network identifier |
| 208 | * @return set of virtual hosts |
| 209 | */ |
| 210 | Set<VirtualHost> getHosts(NetworkId networkId); |
| 211 | |
| 212 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 213 | * Returns the list of virtual links in the specified virtual network. |
| 214 | * |
| 215 | * @param networkId network identifier |
| 216 | * @return set of virtual links |
| 217 | */ |
| 218 | Set<VirtualLink> getLinks(NetworkId networkId); |
| 219 | |
| 220 | /** |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 221 | * Returns the virtual link matching the network identifier, source connect point, |
| 222 | * and destination connect point. |
| 223 | * |
| 224 | * @param networkId network identifier |
| 225 | * @param src source connect point |
| 226 | * @param dst destination connect point |
| 227 | * @return virtual link |
| 228 | */ |
| 229 | VirtualLink getLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
| 230 | |
| 231 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 232 | * Returns the list of ports of the specified virtual device. |
| 233 | * |
| 234 | * @param networkId network identifier |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 235 | * @param deviceId device identifier |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 236 | * @return set of virtual networks |
| 237 | */ |
| 238 | Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId); |
| 239 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 240 | /** |
| 241 | * Add or update the intent to the store. |
| 242 | * |
| 243 | * @param intent virtual intent |
| 244 | * @param state intent state |
| 245 | */ |
| 246 | void addOrUpdateIntent(Intent intent, IntentState state); |
| 247 | |
| 248 | /** |
| 249 | * Remove the virtual intent from the store. |
| 250 | * |
| 251 | * @param intentKey intent key |
| 252 | * @return intent data |
| 253 | */ |
| 254 | IntentData removeIntent(Key intentKey); |
| 255 | |
| 256 | /** |
| 257 | * Adds the intent to tunnel identifier mapping to the store. |
| 258 | * |
| 259 | * @param intent intent |
| 260 | * @param tunnelId tunnel identifier |
| 261 | */ |
| 262 | void addTunnelId(Intent intent, TunnelId tunnelId); |
| 263 | |
| 264 | /** |
| 265 | * Return the set of tunnel identifiers store against the intent. |
| 266 | * |
| 267 | * @param intent intent |
| 268 | * @return set of tunnel identifiers |
| 269 | */ |
| 270 | Set<TunnelId> getTunnelIds(Intent intent); |
| 271 | |
| 272 | /** |
| 273 | * Removes the intent to tunnel identifier mapping from the store. |
| 274 | * |
| 275 | * @param intent intent |
| 276 | * @param tunnelId tunnel identifier |
| 277 | */ |
| 278 | void removeTunnelId(Intent intent, TunnelId tunnelId); |
| 279 | |
| 280 | /** |
| 281 | * Return all intents. |
| 282 | * |
| 283 | * @return set of intents |
| 284 | */ |
| 285 | Set<Intent> getIntents(); |
| 286 | |
| 287 | /** |
| 288 | * Return the intent for the specified intent key. |
| 289 | * |
| 290 | * @param key intent key |
| 291 | * @return intent |
| 292 | */ |
| 293 | Intent getIntent(Key key); |
| 294 | |
| 295 | /** |
| 296 | * Return the set of intent data. |
| 297 | * |
| 298 | * @return set of intent data |
| 299 | */ |
| 300 | Set<IntentData> getIntentData(); |
| 301 | |
| 302 | /** |
| 303 | * Return the intent data matching the intent key. |
| 304 | * |
| 305 | * @param key intent key |
| 306 | * @return intent data |
| 307 | */ |
| 308 | IntentData getIntentData(Key key); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 309 | } |