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; |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 19 | import org.onlab.osgi.ServiceDirectory; |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 20 | import org.onosproject.core.ApplicationId; |
Yoonseon Han | 33821fb | 2017-02-24 13:40:44 +0900 | [diff] [blame] | 21 | import org.onosproject.event.ListenerService; |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 22 | import org.onosproject.net.DeviceId; |
| 23 | |
| 24 | import java.util.Set; |
| 25 | |
| 26 | /** |
| 27 | * Service for querying virtual network inventory. |
| 28 | */ |
| 29 | @Beta |
Yoonseon Han | 33821fb | 2017-02-24 13:40:44 +0900 | [diff] [blame] | 30 | public interface VirtualNetworkService |
| 31 | extends ListenerService<VirtualNetworkEvent, VirtualNetworkListener> { |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
Brian Stanke | 0e5c94e | 2016-03-08 11:20:04 -0500 | [diff] [blame] | 34 | * The topic used for obtaining globally unique ids. |
| 35 | */ |
| 36 | String VIRTUAL_NETWORK_TOPIC = "virtual-network-ids"; |
| 37 | |
| 38 | /** |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 39 | * Returns a collection of all virtual networks created on behalf of the |
| 40 | * specified tenant. |
| 41 | * |
| 42 | * @param tenantId tenant identifier |
| 43 | * @return collection of networks |
| 44 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 45 | */ |
| 46 | Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId); |
| 47 | |
| 48 | /** |
Jovana Vuleta | c884b69 | 2017-11-28 16:52:35 +0100 | [diff] [blame] | 49 | * Returns the virtual network matching the network identifier. |
| 50 | * |
| 51 | * @param networkId virtual network identifier |
| 52 | * @return virtual network instance |
| 53 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 54 | */ |
| 55 | VirtualNetwork getVirtualNetwork(NetworkId networkId); |
| 56 | |
| 57 | /** |
| 58 | * Returns {@code tenantId} for specified virtual network id. |
| 59 | * |
| 60 | * @param networkId virtual network identifier |
| 61 | * @return tenantId tenant identifier |
| 62 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 63 | */ |
| 64 | TenantId getTenantId(NetworkId networkId); |
| 65 | |
| 66 | /** |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 67 | * Returns a collection of all virtual devices in the specified network. |
| 68 | * |
| 69 | * @param networkId network identifier |
| 70 | * @return collection of devices |
| 71 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 72 | */ |
| 73 | Set<VirtualDevice> getVirtualDevices(NetworkId networkId); |
| 74 | |
| 75 | /** |
Brian Stanke | 7a81b53 | 2016-06-14 15:43:51 -0400 | [diff] [blame] | 76 | * Returns a collection of all virtual hosts in the specified network. |
| 77 | * |
| 78 | * @param networkId network identifier |
| 79 | * @return collection of hosts |
| 80 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 81 | */ |
| 82 | Set<VirtualHost> getVirtualHosts(NetworkId networkId); |
| 83 | |
| 84 | /** |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 85 | * Returns collection of all virtual links in the specified network. |
| 86 | * |
| 87 | * @param networkId network identifier |
| 88 | * @return collection of links |
| 89 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 90 | */ |
| 91 | Set<VirtualLink> getVirtualLinks(NetworkId networkId); |
| 92 | |
| 93 | /** |
Brian Stanke | 612cebf | 2016-05-02 10:21:33 -0400 | [diff] [blame] | 94 | * Returns list of all virtual ports of the specified device. If the |
| 95 | * device identifier is null then all of the virtual ports in the specified |
| 96 | * network will be returned. |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 97 | * |
| 98 | * @param networkId network identifier |
| 99 | * @param deviceId device identifier |
| 100 | * @return list of ports |
| 101 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 102 | */ |
| 103 | Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId); |
| 104 | |
| 105 | /** |
sangyun-han | 3c3e99e | 2017-02-08 15:30:53 +0900 | [diff] [blame] | 106 | * Returns list of physical device identifier mapping with the virtual |
| 107 | * device in the specified network. The physical devices are specified by |
| 108 | * port mapping mechanism. |
| 109 | * |
| 110 | * @param networkId network identifier |
Harold Huang | 3fcf743 | 2017-05-16 16:21:08 +0800 | [diff] [blame] | 111 | * @param deviceId the virtual device identifier |
sangyun-han | 3c3e99e | 2017-02-08 15:30:53 +0900 | [diff] [blame] | 112 | * @return collection of the specified device's identifier |
| 113 | */ |
Harold Huang | 3fcf743 | 2017-05-16 16:21:08 +0800 | [diff] [blame] | 114 | Set<DeviceId> getPhysicalDevices(NetworkId networkId, DeviceId deviceId); |
sangyun-han | 3c3e99e | 2017-02-08 15:30:53 +0900 | [diff] [blame] | 115 | |
| 116 | /** |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 117 | * Returns implementation of the specified service class for operating |
| 118 | * in the context of the given network. |
| 119 | * <p> |
| 120 | * The following services will be available: |
| 121 | * <ul> |
| 122 | * <li>{@link org.onosproject.net.device.DeviceService}</li> |
| 123 | * <li>{@link org.onosproject.net.link.LinkService}</li> |
| 124 | * <li>{@link org.onosproject.net.host.HostService}</li> |
| 125 | * <li>{@link org.onosproject.net.topology.TopologyService}</li> |
| 126 | * <li>{@link org.onosproject.net.topology.PathService}</li> |
yoonseon | 97b9b59 | 2017-01-31 14:35:06 -0800 | [diff] [blame] | 127 | * <li>{@link org.onosproject.net.packet.PacketService}</li> |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 128 | * <li>{@link org.onosproject.net.flow.FlowRuleService}</li> |
| 129 | * <li>{@link org.onosproject.net.flowobjective.FlowObjectiveService}</li> |
| 130 | * <li>{@link org.onosproject.net.intent.IntentService}</li> |
Yoonseon Han | a578d76 | 2017-05-08 13:42:02 -0700 | [diff] [blame] | 131 | * <li>{@link org.onosproject.mastership.MastershipService}</li> |
Harold Huang | 222c6ec | 2017-06-02 15:02:49 +0800 | [diff] [blame] | 132 | * <li>{@link org.onosproject.mastership.MastershipAdminService}</li> |
| 133 | * <li>{@link org.onosproject.mastership.MastershipTermService}</li> |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 134 | * </ul> |
| 135 | * |
| 136 | * @param networkId network identifier |
| 137 | * @param serviceClass service class |
| 138 | * @param <T> type of service |
| 139 | * @return implementation class |
| 140 | * @throws org.onlab.util.ItemNotFoundException if no such network found |
| 141 | * @throws org.onlab.osgi.ServiceNotFoundException if no implementation found |
| 142 | */ |
| 143 | <T> T get(NetworkId networkId, Class<T> serviceClass); |
| 144 | |
yoonseon | c6a6927 | 2017-01-12 18:22:20 -0800 | [diff] [blame] | 145 | /** |
| 146 | * Returns service directory. |
| 147 | * |
| 148 | * @return a service directory |
| 149 | */ |
| 150 | ServiceDirectory getServiceDirectory(); |
yoonseon | 322c9c3 | 2016-12-07 16:47:02 -0800 | [diff] [blame] | 151 | |
| 152 | /** |
| 153 | * Returns the application identifier for a virtual network. |
| 154 | * |
| 155 | * @param networkId network identifier |
| 156 | * @return an representative application identifier for a virtual network |
| 157 | */ |
| 158 | ApplicationId getVirtualNetworkApplicationId(NetworkId networkId); |
Thomas Vachuska | 7b438af | 2015-07-07 09:52:07 -0700 | [diff] [blame] | 159 | } |