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 | |
| 18 | import org.onosproject.incubator.net.tunnel.TunnelId; |
| 19 | import org.onosproject.net.ConnectPoint; |
| 20 | import org.onosproject.net.DeviceId; |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 21 | import org.onosproject.net.Link; |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 22 | import org.onosproject.net.Port; |
| 23 | import org.onosproject.net.PortNumber; |
| 24 | import org.onosproject.store.Store; |
| 25 | |
| 26 | import java.util.Set; |
| 27 | |
| 28 | /** |
| 29 | * Mechanism for distributing and storing virtual network model information. |
| 30 | */ |
| 31 | public interface VirtualNetworkStore |
| 32 | extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> { |
| 33 | |
| 34 | /** |
| 35 | * Adds a new tenant ID to the store. |
| 36 | * |
| 37 | * @param tenantId tenant identifier |
| 38 | */ |
| 39 | void addTenantId(TenantId tenantId); |
| 40 | |
| 41 | /** |
| 42 | * Removes the specified tenant ID from the store. |
| 43 | * |
| 44 | * @param tenantId tenant identifier |
| 45 | */ |
| 46 | void removeTenantId(TenantId tenantId); |
| 47 | |
| 48 | /** |
| 49 | * Returns set of registered tenant IDs. |
| 50 | * |
| 51 | * @return set of tenant identifiers |
| 52 | */ |
| 53 | Set<TenantId> getTenantIds(); |
| 54 | |
| 55 | /** |
| 56 | * Adds a new virtual network for the specified tenant to the store. |
| 57 | * |
| 58 | * @param tenantId tenant identifier |
| 59 | * @return the virtual network |
| 60 | */ |
| 61 | VirtualNetwork addNetwork(TenantId tenantId); |
| 62 | |
| 63 | /** |
| 64 | * Removes the specified virtual network from the store. |
| 65 | * |
| 66 | * @param networkId network identifier |
| 67 | */ |
| 68 | void removeNetwork(NetworkId networkId); |
| 69 | |
| 70 | /** |
| 71 | * Adds a new virtual device to the store. This device will have no ports. |
| 72 | * |
| 73 | * @param networkId network identifier |
| 74 | * @param deviceId device identifier |
| 75 | * @return the virtual device |
| 76 | */ |
| 77 | VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId); |
| 78 | |
| 79 | /** |
| 80 | * Renmoves the specified virtual device from the given network. |
| 81 | * |
| 82 | * @param networkId network identifier |
| 83 | * @param deviceId device identifier |
| 84 | */ |
| 85 | void removeDevice(NetworkId networkId, DeviceId deviceId); |
| 86 | |
| 87 | /** |
| 88 | * Adds a new virtual link. |
| 89 | * |
| 90 | * @param networkId network identifier |
| 91 | * @param src source end-point of the link |
| 92 | * @param dst destination end-point of the link |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 93 | * @param state link state |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 94 | * @param realizedBy underlying tunnel identifier using which this link is realized |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 95 | * @return the virtual link |
| 96 | */ |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 97 | 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] | 98 | |
| 99 | /** |
| 100 | * Updates the tunnelId in the virtual link. |
| 101 | * |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 102 | * @param virtualLink virtual link |
| 103 | * @param tunnelId tunnel identifier |
| 104 | * @param state link state |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 105 | */ |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 106 | void updateLink(VirtualLink virtualLink, TunnelId tunnelId, Link.State state); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 107 | |
| 108 | /** |
| 109 | * Removes the specified link from the store. |
| 110 | * |
| 111 | * @param networkId network identifier |
| 112 | * @param src source connection point |
| 113 | * @param dst destination connection point |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 114 | * @return the virtual link |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 115 | */ |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 116 | VirtualLink removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * Adds a new virtual port to the network. |
| 120 | * |
| 121 | * @param networkId network identifier |
| 122 | * @param deviceId device identifier |
| 123 | * @param portNumber port number |
| 124 | * @param realizedBy underlying port which realizes the virtual port |
| 125 | * @return the virtual port |
| 126 | */ |
| 127 | VirtualPort addPort(NetworkId networkId, DeviceId deviceId, |
| 128 | PortNumber portNumber, Port realizedBy); |
| 129 | |
| 130 | /** |
| 131 | * Removes the specified port from the given device and network. |
| 132 | * |
| 133 | * @param networkId network identifier |
| 134 | * @param deviceId device identifier |
| 135 | * @param portNumber port number |
| 136 | */ |
| 137 | void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); |
| 138 | |
| 139 | /** |
| 140 | * Returns the list of networks. |
| 141 | * |
| 142 | * @param tenantId tenant identifier |
| 143 | * @return set of virtual networks |
| 144 | */ |
| 145 | Set<VirtualNetwork> getNetworks(TenantId tenantId); |
| 146 | |
| 147 | /** |
| 148 | * Returns the list of devices in the specified virtual network. |
| 149 | * |
| 150 | * @param networkId network identifier |
| 151 | * @return set of virtual devices |
| 152 | */ |
| 153 | Set<VirtualDevice> getDevices(NetworkId networkId); |
| 154 | |
| 155 | /** |
| 156 | * Returns the list of virtual links in the specified virtual network. |
| 157 | * |
| 158 | * @param networkId network identifier |
| 159 | * @return set of virtual links |
| 160 | */ |
| 161 | Set<VirtualLink> getLinks(NetworkId networkId); |
| 162 | |
| 163 | /** |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 164 | * Returns the virtual link matching the network identifier, source connect point, |
| 165 | * and destination connect point. |
| 166 | * |
| 167 | * @param networkId network identifier |
| 168 | * @param src source connect point |
| 169 | * @param dst destination connect point |
| 170 | * @return virtual link |
| 171 | */ |
| 172 | VirtualLink getLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
| 173 | |
| 174 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 175 | * Returns the list of ports of the specified virtual device. |
| 176 | * |
| 177 | * @param networkId network identifier |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 178 | * @param deviceId device identifier |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 179 | * @return set of virtual networks |
| 180 | */ |
| 181 | Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId); |
| 182 | |
| 183 | } |