blob: 6d8e8879b5b3c04215d0b01acda92e28889e67b4 [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;
Brian Stanke7a81b532016-06-14 15:43:51 -040019import org.onlab.packet.IpAddress;
20import org.onlab.packet.MacAddress;
21import org.onlab.packet.VlanId;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070022import org.onosproject.net.ConnectPoint;
23import org.onosproject.net.DeviceId;
Brian Stanke7a81b532016-06-14 15:43:51 -040024import org.onosproject.net.HostId;
25import org.onosproject.net.HostLocation;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070026import org.onosproject.net.PortNumber;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070027
28import java.util.Set;
29
30/**
31 * Service for managing the inventory of virtual networks.
32 */
33@Beta
34public 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
Thomas Vachuska7b438af2015-07-07 09:52:07 -070058 /**
59 * Creates a new virtual network for the specified tenant.
60 *
61 * @param tenantId tenant identifier
62 * @return newly created virtual network
63 */
64 VirtualNetwork createVirtualNetwork(TenantId tenantId);
65
66 /**
67 * Removes the specified virtual network and all its devices and links.
68 *
69 * @param networkId network identifier
70 */
71 void removeVirtualNetwork(NetworkId networkId);
72
Thomas Vachuska7b438af2015-07-07 09:52:07 -070073 /**
74 * Creates a new virtual device within the specified network. The device id
75 * must be unique within the bounds of the network.
76 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -070077 * @param networkId network identifier
78 * @param deviceId device identifier
Brian Stanke7a81b532016-06-14 15:43:51 -040079 * @return newly created virtual device
Thomas Vachuska7b438af2015-07-07 09:52:07 -070080 * @throws org.onlab.util.ItemNotFoundException if no such network found
81 */
Thomas Vachuska33979fd2015-07-31 11:41:14 -070082 VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -070083
84 /**
85 * Removes the specified virtual device and all its ports and affiliated links.
86 *
87 * @param networkId network identifier
88 * @param deviceId device identifier
89 * @throws org.onlab.util.ItemNotFoundException if no such network or device found
90 */
91 void removeVirtualDevice(NetworkId networkId, DeviceId deviceId);
92
Brian Stanke7a81b532016-06-14 15:43:51 -040093 /**
94 * Creates a new virtual host within the specified network. The host id
95 * must be unique within the bounds of the network.
96 *
97 * @param networkId network identifier
98 * @param hostId host identifier
99 * @param mac mac address
100 * @param vlan vlan identifier
101 * @param location host location
102 * @param ips set of ip addresses
103 * @return newly created virtual host
104 * @throws org.onlab.util.ItemNotFoundException if no such network found
105 */
106 VirtualHost createVirtualHost(NetworkId networkId, HostId hostId, MacAddress mac,
107 VlanId vlan, HostLocation location, Set<IpAddress> ips);
108
109 /**
110 * Removes the specified virtual host.
111 *
112 * @param networkId network identifier
113 * @param hostId host identifier
114 * @throws org.onlab.util.ItemNotFoundException if no such network or host found
115 */
116 void removeVirtualHost(NetworkId networkId, HostId hostId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700117
118 /**
119 * Creates a new virtual link within the specified network.
120 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700121 * @param networkId network identifier
122 * @param src source connection point
123 * @param dst destination connection point
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700124 * @return newly created virtual link
125 * @throws org.onlab.util.ItemNotFoundException if no such network found
126 */
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700127 VirtualLink createVirtualLink(NetworkId networkId,
Brian Stanke9a108972016-04-11 15:25:17 -0400128 ConnectPoint src, ConnectPoint dst);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700129
130 // TODO: Discuss whether we should provide an alternate createVirtualLink
131 // which is backed by a Path instead; I'm leaning towards not doing that.
132
133 /**
134 * Removes the specified virtual link.
135 *
136 * @param networkId network identifier
137 * @param src source connection point
138 * @param dst destination connection point
139 * @throws org.onlab.util.ItemNotFoundException if no such network or link found
140 */
141 void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
142
143 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700144 * Creates a new virtual port on the specified device.
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700145 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700146 * @param networkId network identifier
Brian Stanke9a108972016-04-11 15:25:17 -0400147 * @param deviceId virtual device identifier
148 * @param portNumber virtual port number
149 * @param realizedBy underlying physical port using which this virtual port is realized
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700150 * @return newly created port
Brian Stanke9a108972016-04-11 15:25:17 -0400151 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700152 */
153 VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
Yoonseon Han6c603892016-09-01 11:52:21 -0700154 PortNumber portNumber, ConnectPoint realizedBy);
155
156 /**
157 * Binds an existing virtual port on the specified device.
158 *
159 * @param networkId network identifier
160 * @param deviceId virtual device identifier
161 * @param portNumber virtual port number
162 * @param realizedBy underlying physical port using which this virtual port is realized
163 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
164 */
165 void bindVirtualPort(NetworkId networkId, DeviceId deviceId,
166 PortNumber portNumber, ConnectPoint realizedBy);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700167
168 /**
Claudine Chiu579969d2017-10-06 14:32:18 -0400169 * Updates port state of an existing virtual port on the specified device.
170 *
171 * @param networkId network identifier
172 * @param deviceId virtual device identifier
173 * @param portNumber virtual port number
174 * @param isEnabled indicator whether the port is up and active
175 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
176 */
177 void updatePortState(NetworkId networkId, DeviceId deviceId,
178 PortNumber portNumber, boolean isEnabled);
179
180 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700181 * Removes the specified virtual port.
182 *
183 * @param networkId network identifier
184 * @param deviceId device identifier
185 * @param portNumber port number
186 * @throws org.onlab.util.ItemNotFoundException if no such network or port found
187 */
188 void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700189}