blob: 2e852e86f9551b8be2abb4f26c1bc710f8923fac [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;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070020import org.onosproject.net.DeviceId;
21
22import java.util.Set;
23
24/**
25 * Service for querying virtual network inventory.
26 */
27@Beta
28public interface VirtualNetworkService {
29
30 /**
Brian Stanke0e5c94e2016-03-08 11:20:04 -050031 * The topic used for obtaining globally unique ids.
32 */
33 String VIRTUAL_NETWORK_TOPIC = "virtual-network-ids";
34
35 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070036 * Returns a collection of all virtual networks created on behalf of the
37 * specified tenant.
38 *
39 * @param tenantId tenant identifier
40 * @return collection of networks
41 * @throws org.onlab.util.ItemNotFoundException if no such network found
42 */
43 Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId);
44
45 /**
46 * Returns a collection of all virtual devices in the specified network.
47 *
48 * @param networkId network identifier
49 * @return collection of devices
50 * @throws org.onlab.util.ItemNotFoundException if no such network found
51 */
52 Set<VirtualDevice> getVirtualDevices(NetworkId networkId);
53
54 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040055 * Returns a collection of all virtual hosts in the specified network.
56 *
57 * @param networkId network identifier
58 * @return collection of hosts
59 * @throws org.onlab.util.ItemNotFoundException if no such network found
60 */
61 Set<VirtualHost> getVirtualHosts(NetworkId networkId);
62
63 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070064 * Returns collection of all virtual links in the specified network.
65 *
66 * @param networkId network identifier
67 * @return collection of links
68 * @throws org.onlab.util.ItemNotFoundException if no such network found
69 */
70 Set<VirtualLink> getVirtualLinks(NetworkId networkId);
71
72 /**
Brian Stanke612cebf2016-05-02 10:21:33 -040073 * Returns list of all virtual ports of the specified device. If the
74 * device identifier is null then all of the virtual ports in the specified
75 * network will be returned.
Thomas Vachuska7b438af2015-07-07 09:52:07 -070076 *
77 * @param networkId network identifier
78 * @param deviceId device identifier
79 * @return list of ports
80 * @throws org.onlab.util.ItemNotFoundException if no such network found
81 */
82 Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId);
83
84 /**
85 * Returns implementation of the specified service class for operating
86 * in the context of the given network.
87 * <p>
88 * The following services will be available:
89 * <ul>
90 * <li>{@link org.onosproject.net.device.DeviceService}</li>
91 * <li>{@link org.onosproject.net.link.LinkService}</li>
92 * <li>{@link org.onosproject.net.host.HostService}</li>
93 * <li>{@link org.onosproject.net.topology.TopologyService}</li>
94 * <li>{@link org.onosproject.net.topology.PathService}</li>
95 * <li>{@link org.onosproject.net.flow.FlowRuleService}</li>
96 * <li>{@link org.onosproject.net.flowobjective.FlowObjectiveService}</li>
97 * <li>{@link org.onosproject.net.intent.IntentService}</li>
98 * </ul>
99 *
100 * @param networkId network identifier
101 * @param serviceClass service class
102 * @param <T> type of service
103 * @return implementation class
104 * @throws org.onlab.util.ItemNotFoundException if no such network found
105 * @throws org.onlab.osgi.ServiceNotFoundException if no implementation found
106 */
107 <T> T get(NetworkId networkId, Class<T> serviceClass);
108
yoonseonc6a69272017-01-12 18:22:20 -0800109 /**
110 * Returns service directory.
111 *
112 * @return a service directory
113 */
114 ServiceDirectory getServiceDirectory();
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700115}