blob: aa513ec4315be5fa6b4744579e3be4280fb510eb [file] [log] [blame]
Thomas Vachuska7b438af2015-07-07 09:52:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska7b438af2015-07-07 09:52:07 -07003 *
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 */
16package org.onosproject.incubator.net.virtual;
17
18import com.google.common.annotations.Beta;
yoonseonc6a69272017-01-12 18:22:20 -080019import org.onlab.osgi.ServiceDirectory;
yoonseon322c9c32016-12-07 16:47:02 -080020import org.onosproject.core.ApplicationId;
Yoonseon Han33821fb2017-02-24 13:40:44 +090021import org.onosproject.event.ListenerService;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070022import org.onosproject.net.DeviceId;
23
24import java.util.Set;
25
26/**
27 * Service for querying virtual network inventory.
28 */
29@Beta
Yoonseon Han33821fb2017-02-24 13:40:44 +090030public interface VirtualNetworkService
31 extends ListenerService<VirtualNetworkEvent, VirtualNetworkListener> {
Thomas Vachuska7b438af2015-07-07 09:52:07 -070032
33 /**
Brian Stanke0e5c94e2016-03-08 11:20:04 -050034 * The topic used for obtaining globally unique ids.
35 */
36 String VIRTUAL_NETWORK_TOPIC = "virtual-network-ids";
37
38 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070039 * 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 Vuletac884b692017-11-28 16:52:35 +010049 * 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 Vachuska7b438af2015-07-07 09:52:07 -070067 * 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 Stanke7a81b532016-06-14 15:43:51 -040076 * 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 Vachuska7b438af2015-07-07 09:52:07 -070085 * 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 Stanke612cebf2016-05-02 10:21:33 -040094 * 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 Vachuska7b438af2015-07-07 09:52:07 -070097 *
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-han3c3e99e2017-02-08 15:30:53 +0900106 * 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 Huang3fcf7432017-05-16 16:21:08 +0800111 * @param deviceId the virtual device identifier
sangyun-han3c3e99e2017-02-08 15:30:53 +0900112 * @return collection of the specified device's identifier
113 */
Harold Huang3fcf7432017-05-16 16:21:08 +0800114 Set<DeviceId> getPhysicalDevices(NetworkId networkId, DeviceId deviceId);
sangyun-han3c3e99e2017-02-08 15:30:53 +0900115
116 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700117 * 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>
yoonseon97b9b592017-01-31 14:35:06 -0800127 * <li>{@link org.onosproject.net.packet.PacketService}</li>
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700128 * <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 Hana578d762017-05-08 13:42:02 -0700131 * <li>{@link org.onosproject.mastership.MastershipService}</li>
Harold Huang222c6ec2017-06-02 15:02:49 +0800132 * <li>{@link org.onosproject.mastership.MastershipAdminService}</li>
133 * <li>{@link org.onosproject.mastership.MastershipTermService}</li>
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700134 * </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
yoonseonc6a69272017-01-12 18:22:20 -0800145 /**
146 * Returns service directory.
147 *
148 * @return a service directory
149 */
150 ServiceDirectory getServiceDirectory();
yoonseon322c9c32016-12-07 16:47:02 -0800151
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 Vachuska7b438af2015-07-07 09:52:07 -0700159}