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