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; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 29 | import org.onosproject.store.Store; |
| 30 | |
| 31 | import java.util.Set; |
| 32 | |
| 33 | /** |
| 34 | * Mechanism for distributing and storing virtual network model information. |
| 35 | */ |
| 36 | public interface VirtualNetworkStore |
| 37 | extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> { |
| 38 | |
| 39 | /** |
| 40 | * Adds a new tenant ID to the store. |
| 41 | * |
| 42 | * @param tenantId tenant identifier |
| 43 | */ |
| 44 | void addTenantId(TenantId tenantId); |
| 45 | |
| 46 | /** |
| 47 | * Removes the specified tenant ID from the store. |
| 48 | * |
| 49 | * @param tenantId tenant identifier |
| 50 | */ |
| 51 | void removeTenantId(TenantId tenantId); |
| 52 | |
| 53 | /** |
| 54 | * Returns set of registered tenant IDs. |
| 55 | * |
| 56 | * @return set of tenant identifiers |
| 57 | */ |
| 58 | Set<TenantId> getTenantIds(); |
| 59 | |
| 60 | /** |
| 61 | * Adds a new virtual network for the specified tenant to the store. |
| 62 | * |
| 63 | * @param tenantId tenant identifier |
| 64 | * @return the virtual network |
| 65 | */ |
| 66 | VirtualNetwork addNetwork(TenantId tenantId); |
| 67 | |
| 68 | /** |
| 69 | * Removes the specified virtual network from the store. |
| 70 | * |
| 71 | * @param networkId network identifier |
| 72 | */ |
| 73 | void removeNetwork(NetworkId networkId); |
| 74 | |
| 75 | /** |
| 76 | * Adds a new virtual device to the store. This device will have no ports. |
| 77 | * |
| 78 | * @param networkId network identifier |
| 79 | * @param deviceId device identifier |
| 80 | * @return the virtual device |
| 81 | */ |
| 82 | VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId); |
| 83 | |
| 84 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 85 | * Removes the specified virtual device from the given network. |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 86 | * |
| 87 | * @param networkId network identifier |
| 88 | * @param deviceId device identifier |
| 89 | */ |
| 90 | void removeDevice(NetworkId networkId, DeviceId deviceId); |
| 91 | |
| 92 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 93 | * Adds a new virtual host to the store. |
| 94 | * |
| 95 | * @param networkId network identifier |
| 96 | * @param hostId host identifier |
| 97 | * @param mac mac address |
| 98 | * @param vlan vlan identifier |
| 99 | * @param location host location |
| 100 | * @param ips set of ip addresses |
| 101 | * @return the virtual host |
| 102 | */ |
| 103 | VirtualHost addHost(NetworkId networkId, HostId hostId, MacAddress mac, |
| 104 | VlanId vlan, HostLocation location, Set<IpAddress> ips); |
| 105 | |
| 106 | /** |
| 107 | * Removes the specified virtual host from the store. |
| 108 | * |
| 109 | * @param networkId network identifier |
| 110 | * @param hostId host identifier |
| 111 | */ |
| 112 | void removeHost(NetworkId networkId, HostId hostId); |
| 113 | |
| 114 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 115 | * Adds a new virtual link. |
| 116 | * |
| 117 | * @param networkId network identifier |
| 118 | * @param src source end-point of the link |
| 119 | * @param dst destination end-point of the link |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 120 | * @param state link state |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 121 | * @param realizedBy underlying tunnel identifier using which this link is realized |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 122 | * @return the virtual link |
| 123 | */ |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 124 | 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] | 125 | |
| 126 | /** |
| 127 | * Updates the tunnelId in the virtual link. |
| 128 | * |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 129 | * @param virtualLink virtual link |
| 130 | * @param tunnelId tunnel identifier |
| 131 | * @param state link state |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 132 | */ |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 133 | void updateLink(VirtualLink virtualLink, TunnelId tunnelId, Link.State state); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 134 | |
| 135 | /** |
| 136 | * Removes the specified link from the store. |
| 137 | * |
| 138 | * @param networkId network identifier |
| 139 | * @param src source connection point |
| 140 | * @param dst destination connection point |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 141 | * @return the virtual link |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 142 | */ |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 143 | VirtualLink removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 144 | |
| 145 | /** |
| 146 | * Adds a new virtual port to the network. |
| 147 | * |
| 148 | * @param networkId network identifier |
| 149 | * @param deviceId device identifier |
| 150 | * @param portNumber port number |
| 151 | * @param realizedBy underlying port which realizes the virtual port |
| 152 | * @return the virtual port |
| 153 | */ |
| 154 | VirtualPort addPort(NetworkId networkId, DeviceId deviceId, |
Yoonseon Han | 6c60389 | 2016-09-01 11:52:21 -0700 | [diff] [blame] | 155 | PortNumber portNumber, ConnectPoint realizedBy); |
| 156 | |
| 157 | /** |
| 158 | * Binds an existing virtual port to the network. |
| 159 | * |
| 160 | * @param networkId network identifier |
| 161 | * @param deviceId device identifier |
| 162 | * @param portNumber port number |
| 163 | * @param realizedBy underlying port which realizes the virtual port |
| 164 | */ |
| 165 | void bindPort(NetworkId networkId, DeviceId deviceId, |
| 166 | PortNumber portNumber, ConnectPoint realizedBy); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 167 | |
| 168 | /** |
| 169 | * Removes the specified port from the given device and network. |
| 170 | * |
| 171 | * @param networkId network identifier |
| 172 | * @param deviceId device identifier |
| 173 | * @param portNumber port number |
| 174 | */ |
| 175 | void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); |
| 176 | |
| 177 | /** |
| 178 | * Returns the list of networks. |
| 179 | * |
| 180 | * @param tenantId tenant identifier |
| 181 | * @return set of virtual networks |
| 182 | */ |
| 183 | Set<VirtualNetwork> getNetworks(TenantId tenantId); |
| 184 | |
| 185 | /** |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 186 | * Returns the virtual network for the given network identifier. |
| 187 | * |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 188 | * @param networkId network identifier |
Brian Stanke | 8691428 | 2016-05-25 15:36:50 -0400 | [diff] [blame] | 189 | * @return the virtual network |
| 190 | */ |
| 191 | VirtualNetwork getNetwork(NetworkId networkId); |
| 192 | |
| 193 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 194 | * Returns the list of devices in the specified virtual network. |
| 195 | * |
| 196 | * @param networkId network identifier |
| 197 | * @return set of virtual devices |
| 198 | */ |
| 199 | Set<VirtualDevice> getDevices(NetworkId networkId); |
| 200 | |
| 201 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 202 | * Returns the list of hosts in the specified virtual network. |
| 203 | * |
| 204 | * @param networkId network identifier |
| 205 | * @return set of virtual hosts |
| 206 | */ |
| 207 | Set<VirtualHost> getHosts(NetworkId networkId); |
| 208 | |
| 209 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 210 | * Returns the list of virtual links in the specified virtual network. |
| 211 | * |
| 212 | * @param networkId network identifier |
| 213 | * @return set of virtual links |
| 214 | */ |
| 215 | Set<VirtualLink> getLinks(NetworkId networkId); |
| 216 | |
| 217 | /** |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 218 | * Returns the virtual link matching the network identifier, source connect point, |
| 219 | * and destination connect point. |
| 220 | * |
| 221 | * @param networkId network identifier |
| 222 | * @param src source connect point |
| 223 | * @param dst destination connect point |
| 224 | * @return virtual link |
| 225 | */ |
| 226 | VirtualLink getLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
| 227 | |
| 228 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 229 | * Returns the list of ports of the specified virtual device. |
| 230 | * |
| 231 | * @param networkId network identifier |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 232 | * @param deviceId device identifier |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 233 | * @return set of virtual networks |
| 234 | */ |
| 235 | Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId); |
| 236 | |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 237 | /** |
Brian Stanke | 11f6d53 | 2016-07-05 16:17:59 -0400 | [diff] [blame] | 238 | * Adds the intent to tunnel identifier mapping to the store. |
| 239 | * |
| 240 | * @param intent intent |
| 241 | * @param tunnelId tunnel identifier |
| 242 | */ |
| 243 | void addTunnelId(Intent intent, TunnelId tunnelId); |
| 244 | |
| 245 | /** |
| 246 | * Return the set of tunnel identifiers store against the intent. |
| 247 | * |
| 248 | * @param intent intent |
| 249 | * @return set of tunnel identifiers |
| 250 | */ |
| 251 | Set<TunnelId> getTunnelIds(Intent intent); |
| 252 | |
| 253 | /** |
| 254 | * Removes the intent to tunnel identifier mapping from the store. |
| 255 | * |
| 256 | * @param intent intent |
| 257 | * @param tunnelId tunnel identifier |
| 258 | */ |
| 259 | void removeTunnelId(Intent intent, TunnelId tunnelId); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 260 | } |