blob: 07775dd53cf0af0882cdc748653b2470b66ae8d4 [file] [log] [blame]
Thomas Vachuska7b438af2015-07-07 09:52:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
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 /**
49 * Returns a collection of all virtual devices in the specified network.
50 *
51 * @param networkId network identifier
52 * @return collection of devices
53 * @throws org.onlab.util.ItemNotFoundException if no such network found
54 */
55 Set<VirtualDevice> getVirtualDevices(NetworkId networkId);
56
57 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040058 * Returns a collection of all virtual hosts in the specified network.
59 *
60 * @param networkId network identifier
61 * @return collection of hosts
62 * @throws org.onlab.util.ItemNotFoundException if no such network found
63 */
64 Set<VirtualHost> getVirtualHosts(NetworkId networkId);
65
66 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070067 * Returns collection of all virtual links in the specified network.
68 *
69 * @param networkId network identifier
70 * @return collection of links
71 * @throws org.onlab.util.ItemNotFoundException if no such network found
72 */
73 Set<VirtualLink> getVirtualLinks(NetworkId networkId);
74
75 /**
Brian Stanke612cebf2016-05-02 10:21:33 -040076 * Returns list of all virtual ports of the specified device. If the
77 * device identifier is null then all of the virtual ports in the specified
78 * network will be returned.
Thomas Vachuska7b438af2015-07-07 09:52:07 -070079 *
80 * @param networkId network identifier
81 * @param deviceId device identifier
82 * @return list of ports
83 * @throws org.onlab.util.ItemNotFoundException if no such network found
84 */
85 Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId);
86
87 /**
88 * Returns implementation of the specified service class for operating
89 * in the context of the given network.
90 * <p>
91 * The following services will be available:
92 * <ul>
93 * <li>{@link org.onosproject.net.device.DeviceService}</li>
94 * <li>{@link org.onosproject.net.link.LinkService}</li>
95 * <li>{@link org.onosproject.net.host.HostService}</li>
96 * <li>{@link org.onosproject.net.topology.TopologyService}</li>
97 * <li>{@link org.onosproject.net.topology.PathService}</li>
98 * <li>{@link org.onosproject.net.flow.FlowRuleService}</li>
99 * <li>{@link org.onosproject.net.flowobjective.FlowObjectiveService}</li>
100 * <li>{@link org.onosproject.net.intent.IntentService}</li>
101 * </ul>
102 *
103 * @param networkId network identifier
104 * @param serviceClass service class
105 * @param <T> type of service
106 * @return implementation class
107 * @throws org.onlab.util.ItemNotFoundException if no such network found
108 * @throws org.onlab.osgi.ServiceNotFoundException if no implementation found
109 */
110 <T> T get(NetworkId networkId, Class<T> serviceClass);
111
yoonseonc6a69272017-01-12 18:22:20 -0800112 /**
113 * Returns service directory.
114 *
115 * @return a service directory
116 */
117 ServiceDirectory getServiceDirectory();
yoonseon322c9c32016-12-07 16:47:02 -0800118
119 /**
120 * Returns the application identifier for a virtual network.
121 *
122 * @param networkId network identifier
123 * @return an representative application identifier for a virtual network
124 */
125 ApplicationId getVirtualNetworkApplicationId(NetworkId networkId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700126}