Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -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 com.google.common.annotations.Beta; |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onlab.packet.MacAddress; |
| 21 | import org.onlab.packet.VlanId; |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 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; |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 26 | import org.onosproject.net.PortNumber; |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame^] | 27 | import org.onosproject.net.TenantId; |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 28 | |
| 29 | import java.util.Set; |
| 30 | |
| 31 | /** |
| 32 | * Service for managing the inventory of virtual networks. |
| 33 | */ |
| 34 | @Beta |
| 35 | public interface VirtualNetworkAdminService extends VirtualNetworkService { |
| 36 | |
| 37 | /** |
| 38 | * Registers the specified, externally generated tenant identifier. |
| 39 | * |
| 40 | * @param tenantId tenant identifier |
| 41 | */ |
| 42 | void registerTenantId(TenantId tenantId); |
| 43 | |
| 44 | /** |
| 45 | * Unregisters the specified, externally generated tenant identifier. |
| 46 | * |
| 47 | * @param tenantId tenant identifier |
| 48 | * @throws IllegalStateException if there are networks still owned by this tenant |
| 49 | */ |
| 50 | void unregisterTenantId(TenantId tenantId); |
| 51 | |
| 52 | /** |
| 53 | * Returns the set of tenant identifiers known to the system. |
| 54 | * |
| 55 | * @return set of known tenant identifiers |
| 56 | */ |
| 57 | Set<TenantId> getTenantIds(); |
| 58 | |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 59 | /** |
| 60 | * Creates a new virtual network for the specified tenant. |
| 61 | * |
| 62 | * @param tenantId tenant identifier |
| 63 | * @return newly created virtual network |
| 64 | */ |
| 65 | VirtualNetwork createVirtualNetwork(TenantId tenantId); |
| 66 | |
| 67 | /** |
| 68 | * Removes the specified virtual network and all its devices and links. |
| 69 | * |
| 70 | * @param networkId network identifier |
| 71 | */ |
| 72 | void removeVirtualNetwork(NetworkId networkId); |
| 73 | |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 74 | /** |
| 75 | * Creates a new virtual device within the specified network. The device id |
| 76 | * must be unique within the bounds of the network. |
| 77 | * |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 78 | * @param networkId network identifier |
| 79 | * @param deviceId device identifier |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 80 | * @return newly created virtual device |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 81 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 82 | */ |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 83 | VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId); |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Removes the specified virtual device and all its ports and affiliated links. |
| 87 | * |
| 88 | * @param networkId network identifier |
| 89 | * @param deviceId device identifier |
| 90 | * @throws org.onlab.util.ItemNotFoundException if no such network or device found |
| 91 | */ |
| 92 | void removeVirtualDevice(NetworkId networkId, DeviceId deviceId); |
| 93 | |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 94 | /** |
| 95 | * Creates a new virtual host within the specified network. The host id |
| 96 | * must be unique within the bounds of the network. |
| 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 newly created virtual host |
| 105 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 106 | */ |
| 107 | VirtualHost createVirtualHost(NetworkId networkId, HostId hostId, MacAddress mac, |
| 108 | VlanId vlan, HostLocation location, Set<IpAddress> ips); |
| 109 | |
| 110 | /** |
| 111 | * Removes the specified virtual host. |
| 112 | * |
| 113 | * @param networkId network identifier |
| 114 | * @param hostId host identifier |
| 115 | * @throws org.onlab.util.ItemNotFoundException if no such network or host found |
| 116 | */ |
| 117 | void removeVirtualHost(NetworkId networkId, HostId hostId); |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Creates a new virtual link within the specified network. |
| 121 | * |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 122 | * @param networkId network identifier |
| 123 | * @param src source connection point |
| 124 | * @param dst destination connection point |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 125 | * @return newly created virtual link |
| 126 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 127 | */ |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 128 | VirtualLink createVirtualLink(NetworkId networkId, |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 129 | ConnectPoint src, ConnectPoint dst); |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 130 | |
| 131 | // TODO: Discuss whether we should provide an alternate createVirtualLink |
| 132 | // which is backed by a Path instead; I'm leaning towards not doing that. |
| 133 | |
| 134 | /** |
| 135 | * Removes the specified virtual link. |
| 136 | * |
| 137 | * @param networkId network identifier |
| 138 | * @param src source connection point |
| 139 | * @param dst destination connection point |
| 140 | * @throws org.onlab.util.ItemNotFoundException if no such network or link found |
| 141 | */ |
| 142 | void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); |
| 143 | |
| 144 | /** |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 145 | * Creates a new virtual port on the specified device. |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 146 | * |
Thomas Vachuska | 33979fd | 2015-07-31 11:41:14 -0700 | [diff] [blame] | 147 | * @param networkId network identifier |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 148 | * @param deviceId virtual device identifier |
| 149 | * @param portNumber virtual port number |
| 150 | * @param realizedBy underlying physical port using which this virtual port is realized |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 151 | * @return newly created port |
Brian Stanke | 9a10897 | 2016-04-11 15:25:17 -0400 | [diff] [blame] | 152 | * @throws org.onlab.util.ItemNotFoundException if no such network or device is found |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 153 | */ |
| 154 | VirtualPort createVirtualPort(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 on the specified device. |
| 159 | * |
| 160 | * @param networkId network identifier |
| 161 | * @param deviceId virtual device identifier |
| 162 | * @param portNumber virtual port number |
| 163 | * @param realizedBy underlying physical port using which this virtual port is realized |
| 164 | * @throws org.onlab.util.ItemNotFoundException if no such network or device is found |
| 165 | */ |
| 166 | void bindVirtualPort(NetworkId networkId, DeviceId deviceId, |
| 167 | PortNumber portNumber, ConnectPoint realizedBy); |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 168 | |
| 169 | /** |
Claudine Chiu | 579969d | 2017-10-06 14:32:18 -0400 | [diff] [blame] | 170 | * Updates port state of an existing virtual port on the specified device. |
| 171 | * |
| 172 | * @param networkId network identifier |
| 173 | * @param deviceId virtual device identifier |
| 174 | * @param portNumber virtual port number |
| 175 | * @param isEnabled indicator whether the port is up and active |
| 176 | * @throws org.onlab.util.ItemNotFoundException if no such network or device is found |
| 177 | */ |
| 178 | void updatePortState(NetworkId networkId, DeviceId deviceId, |
| 179 | PortNumber portNumber, boolean isEnabled); |
| 180 | |
| 181 | /** |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 182 | * Removes the specified virtual port. |
| 183 | * |
| 184 | * @param networkId network identifier |
| 185 | * @param deviceId device identifier |
| 186 | * @param portNumber port number |
| 187 | * @throws org.onlab.util.ItemNotFoundException if no such network or port found |
| 188 | */ |
| 189 | void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 190 | } |