1e3648b5218afa69c7d4943de3ab54dd2cb1ac54
[onosfw.git] /
1 /*
2  * Copyright 2015 Open Networking Laboratory
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;
19 import org.onosproject.incubator.net.tunnel.Tunnel;
20 import org.onosproject.net.ConnectPoint;
21 import org.onosproject.net.DeviceId;
22 import org.onosproject.net.Port;
23 import org.onosproject.net.PortNumber;
24 import org.onosproject.net.device.DeviceDescription;
25 import org.onosproject.net.device.PortDescription;
26 import org.onosproject.net.link.LinkDescription;
27
28 import java.util.Set;
29
30 /**
31  * Service for managing the inventory of virtual networks.
32  */
33 @Beta
34 public interface VirtualNetworkAdminService extends VirtualNetworkService {
35
36     /**
37      * Registers the specified, externally generated tenant identifier.
38      *
39      * @param tenantId tenant identifier
40      */
41     void registerTenantId(TenantId tenantId);
42
43     /**
44      * Unregisters the specified, externally generated tenant identifier.
45      *
46      * @param tenantId tenant identifier
47      * @throws IllegalStateException if there are networks still owned by this tenant
48      */
49     void unregisterTenantId(TenantId tenantId);
50
51     /**
52      * Returns the set of tenant identifiers known to the system.
53      *
54      * @return set of known tenant identifiers
55      */
56     Set<TenantId> getTenantIds();
57
58
59     /**
60      * Creates a new virtual network for the specified tenant.
61      *
62      * @param tenantId tenant identifier
63      * @return newly created virtual network
64      */
65     VirtualNetwork createVirtualNetwork(TenantId tenantId);
66
67     /**
68      * Removes the specified virtual network and all its devices and links.
69      *
70      * @param networkId network identifier
71      */
72     void removeVirtualNetwork(NetworkId networkId);
73
74
75     /**
76      * Creates a new virtual device within the specified network. The device id
77      * must be unique within the bounds of the network.
78      *
79      * @param networkId   network identifier
80      * @param description device description
81      * @return newly created device
82      * @throws org.onlab.util.ItemNotFoundException if no such network found
83      */
84     VirtualDevice createVirtualDevice(NetworkId networkId, DeviceDescription description);
85
86     /**
87      * Removes the specified virtual device and all its ports and affiliated links.
88      *
89      * @param networkId network identifier
90      * @param deviceId  device identifier
91      * @throws org.onlab.util.ItemNotFoundException if no such network or device found
92      */
93     void removeVirtualDevice(NetworkId networkId, DeviceId deviceId);
94
95
96     /**
97      * Creates a new virtual link within the specified network.
98      *
99      * @param networkId   network identifier
100      * @param description link description
101      * @param realizedBy  tunnel using which this link is realized
102      * @return newly created virtual link
103      * @throws org.onlab.util.ItemNotFoundException if no such network found
104      */
105     VirtualLink createVirtualLink(NetworkId networkId, LinkDescription description,
106                                   Tunnel realizedBy);
107
108     // TODO: Discuss whether we should provide an alternate createVirtualLink
109     // which is backed by a Path instead; I'm leaning towards not doing that.
110
111     /**
112      * Removes the specified virtual link.
113      *
114      * @param networkId network identifier
115      * @param src       source connection point
116      * @param dst       destination connection point
117      * @throws org.onlab.util.ItemNotFoundException if no such network or link found
118      */
119     void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
120
121     /**
122      * Creates a new virtual port on the specified device. Note that the port
123      * description can only request the resources which the underlying port
124      * port is capable of providing. It is, however, permissible to request
125      * only portion of those resources.
126      *
127      * @param networkId   network identifier
128      * @param deviceId    device identifier
129      * @param description port description
130      * @param realizedBy  underlying port using which this virtual port is realized
131      * @return newly created port
132      * @throws org.onlab.util.ItemNotFoundException if no such network or device found
133      */
134     VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
135                                   PortDescription description, Port realizedBy);
136
137     /**
138      * Removes the specified virtual port.
139      *
140      * @param networkId  network identifier
141      * @param deviceId   device identifier
142      * @param portNumber port number
143      * @throws org.onlab.util.ItemNotFoundException if no such network or port found
144      */
145     void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
146
147 }