blob: d0e4fd126ee9b117eea5cce648e0da63e246f7fc [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;
Thomas Vachuska52f2cd12018-11-08 21:20:04 -080023import org.onosproject.net.TenantId;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070024
25import java.util.Set;
26
27/**
28 * Service for querying virtual network inventory.
29 */
30@Beta
Yoonseon Han33821fb2017-02-24 13:40:44 +090031public interface VirtualNetworkService
32 extends ListenerService<VirtualNetworkEvent, VirtualNetworkListener> {
Thomas Vachuska7b438af2015-07-07 09:52:07 -070033
34 /**
Brian Stanke0e5c94e2016-03-08 11:20:04 -050035 * The topic used for obtaining globally unique ids.
36 */
37 String VIRTUAL_NETWORK_TOPIC = "virtual-network-ids";
38
39 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070040 * Returns a collection of all virtual networks created on behalf of the
41 * specified tenant.
42 *
43 * @param tenantId tenant identifier
44 * @return collection of networks
45 * @throws org.onlab.util.ItemNotFoundException if no such network found
46 */
47 Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId);
48
49 /**
Jovana Vuletac884b692017-11-28 16:52:35 +010050 * Returns the virtual network matching the network identifier.
51 *
52 * @param networkId virtual network identifier
53 * @return virtual network instance
54 * @throws org.onlab.util.ItemNotFoundException if no such network found
55 */
56 VirtualNetwork getVirtualNetwork(NetworkId networkId);
57
58 /**
59 * Returns {@code tenantId} for specified virtual network id.
60 *
61 * @param networkId virtual network identifier
62 * @return tenantId tenant identifier
63 * @throws org.onlab.util.ItemNotFoundException if no such network found
64 */
65 TenantId getTenantId(NetworkId networkId);
66
67 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070068 * Returns a collection of all virtual devices in the specified network.
69 *
70 * @param networkId network identifier
71 * @return collection of devices
72 * @throws org.onlab.util.ItemNotFoundException if no such network found
73 */
74 Set<VirtualDevice> getVirtualDevices(NetworkId networkId);
75
76 /**
Brian Stanke7a81b532016-06-14 15:43:51 -040077 * Returns a collection of all virtual hosts in the specified network.
78 *
79 * @param networkId network identifier
80 * @return collection of hosts
81 * @throws org.onlab.util.ItemNotFoundException if no such network found
82 */
83 Set<VirtualHost> getVirtualHosts(NetworkId networkId);
84
85 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -070086 * Returns collection of all virtual links in the specified network.
87 *
88 * @param networkId network identifier
89 * @return collection of links
90 * @throws org.onlab.util.ItemNotFoundException if no such network found
91 */
92 Set<VirtualLink> getVirtualLinks(NetworkId networkId);
93
94 /**
Brian Stanke612cebf2016-05-02 10:21:33 -040095 * Returns list of all virtual ports of the specified device. If the
96 * device identifier is null then all of the virtual ports in the specified
97 * network will be returned.
Thomas Vachuska7b438af2015-07-07 09:52:07 -070098 *
99 * @param networkId network identifier
100 * @param deviceId device identifier
101 * @return list of ports
102 * @throws org.onlab.util.ItemNotFoundException if no such network found
103 */
104 Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId);
105
106 /**
sangyun-han3c3e99e2017-02-08 15:30:53 +0900107 * Returns list of physical device identifier mapping with the virtual
108 * device in the specified network. The physical devices are specified by
109 * port mapping mechanism.
110 *
111 * @param networkId network identifier
Harold Huang3fcf7432017-05-16 16:21:08 +0800112 * @param deviceId the virtual device identifier
sangyun-han3c3e99e2017-02-08 15:30:53 +0900113 * @return collection of the specified device's identifier
114 */
Harold Huang3fcf7432017-05-16 16:21:08 +0800115 Set<DeviceId> getPhysicalDevices(NetworkId networkId, DeviceId deviceId);
sangyun-han3c3e99e2017-02-08 15:30:53 +0900116
117 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700118 * Returns implementation of the specified service class for operating
119 * in the context of the given network.
120 * <p>
121 * The following services will be available:
122 * <ul>
123 * <li>{@link org.onosproject.net.device.DeviceService}</li>
124 * <li>{@link org.onosproject.net.link.LinkService}</li>
125 * <li>{@link org.onosproject.net.host.HostService}</li>
126 * <li>{@link org.onosproject.net.topology.TopologyService}</li>
127 * <li>{@link org.onosproject.net.topology.PathService}</li>
yoonseon97b9b592017-01-31 14:35:06 -0800128 * <li>{@link org.onosproject.net.packet.PacketService}</li>
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700129 * <li>{@link org.onosproject.net.flow.FlowRuleService}</li>
130 * <li>{@link org.onosproject.net.flowobjective.FlowObjectiveService}</li>
131 * <li>{@link org.onosproject.net.intent.IntentService}</li>
Yoonseon Hana578d762017-05-08 13:42:02 -0700132 * <li>{@link org.onosproject.mastership.MastershipService}</li>
Harold Huang222c6ec2017-06-02 15:02:49 +0800133 * <li>{@link org.onosproject.mastership.MastershipAdminService}</li>
134 * <li>{@link org.onosproject.mastership.MastershipTermService}</li>
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700135 * </ul>
136 *
137 * @param networkId network identifier
138 * @param serviceClass service class
139 * @param <T> type of service
140 * @return implementation class
141 * @throws org.onlab.util.ItemNotFoundException if no such network found
142 * @throws org.onlab.osgi.ServiceNotFoundException if no implementation found
143 */
144 <T> T get(NetworkId networkId, Class<T> serviceClass);
145
yoonseonc6a69272017-01-12 18:22:20 -0800146 /**
147 * Returns service directory.
148 *
149 * @return a service directory
150 */
151 ServiceDirectory getServiceDirectory();
yoonseon322c9c32016-12-07 16:47:02 -0800152
153 /**
154 * Returns the application identifier for a virtual network.
155 *
156 * @param networkId network identifier
157 * @return an representative application identifier for a virtual network
158 */
159 ApplicationId getVirtualNetworkApplicationId(NetworkId networkId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700160}