blob: bade40783b4e1bcb1e9166e769e79b0984ad8c70 [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 Vachuska52f2cd12018-11-08 21:20:04 -080027import org.onosproject.net.TenantId;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070028
29import java.util.Set;
30
31/**
32 * Service for managing the inventory of virtual networks.
33 */
34@Beta
35public interface VirtualNetworkAdminService extends VirtualNetworkService {
36
37 /**
38 * Registers the specified, externally generated tenant identifier.
39 *
40 * @param tenantId tenant identifier
41 */
42 void registerTenantId(TenantId tenantId);
43
44 /**
45 * Unregisters the specified, externally generated tenant identifier.
46 *
47 * @param tenantId tenant identifier
48 * @throws IllegalStateException if there are networks still owned by this tenant
49 */
50 void unregisterTenantId(TenantId tenantId);
51
52 /**
53 * Returns the set of tenant identifiers known to the system.
54 *
55 * @return set of known tenant identifiers
56 */
57 Set<TenantId> getTenantIds();
58
Thomas Vachuska7b438af2015-07-07 09:52:07 -070059 /**
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
Thomas Vachuska7b438af2015-07-07 09:52:07 -070074 /**
75 * Creates a new virtual device within the specified network. The device id
76 * must be unique within the bounds of the network.
77 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -070078 * @param networkId network identifier
79 * @param deviceId device identifier
Brian Stanke7a81b532016-06-14 15:43:51 -040080 * @return newly created virtual device
Thomas Vachuska7b438af2015-07-07 09:52:07 -070081 * @throws org.onlab.util.ItemNotFoundException if no such network found
82 */
Thomas Vachuska33979fd2015-07-31 11:41:14 -070083 VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -070084
85 /**
86 * Removes the specified virtual device and all its ports and affiliated links.
87 *
88 * @param networkId network identifier
89 * @param deviceId device identifier
90 * @throws org.onlab.util.ItemNotFoundException if no such network or device found
91 */
92 void removeVirtualDevice(NetworkId networkId, DeviceId deviceId);
93
Brian Stanke7a81b532016-06-14 15:43:51 -040094 /**
95 * Creates a new virtual host within the specified network. The host id
96 * must be unique within the bounds of the network.
97 *
98 * @param networkId network identifier
99 * @param hostId host identifier
100 * @param mac mac address
101 * @param vlan vlan identifier
102 * @param location host location
103 * @param ips set of ip addresses
104 * @return newly created virtual host
105 * @throws org.onlab.util.ItemNotFoundException if no such network found
106 */
107 VirtualHost createVirtualHost(NetworkId networkId, HostId hostId, MacAddress mac,
108 VlanId vlan, HostLocation location, Set<IpAddress> ips);
109
110 /**
111 * Removes the specified virtual host.
112 *
113 * @param networkId network identifier
114 * @param hostId host identifier
115 * @throws org.onlab.util.ItemNotFoundException if no such network or host found
116 */
117 void removeVirtualHost(NetworkId networkId, HostId hostId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700118
119 /**
120 * Creates a new virtual link within the specified network.
121 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700122 * @param networkId network identifier
123 * @param src source connection point
124 * @param dst destination connection point
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700125 * @return newly created virtual link
126 * @throws org.onlab.util.ItemNotFoundException if no such network found
127 */
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700128 VirtualLink createVirtualLink(NetworkId networkId,
Brian Stanke9a108972016-04-11 15:25:17 -0400129 ConnectPoint src, ConnectPoint dst);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700130
131 // TODO: Discuss whether we should provide an alternate createVirtualLink
132 // which is backed by a Path instead; I'm leaning towards not doing that.
133
134 /**
135 * Removes the specified virtual link.
136 *
137 * @param networkId network identifier
138 * @param src source connection point
139 * @param dst destination connection point
140 * @throws org.onlab.util.ItemNotFoundException if no such network or link found
141 */
142 void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
143
144 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700145 * Creates a new virtual port on the specified device.
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700146 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700147 * @param networkId network identifier
Brian Stanke9a108972016-04-11 15:25:17 -0400148 * @param deviceId virtual device identifier
149 * @param portNumber virtual port number
150 * @param realizedBy underlying physical port using which this virtual port is realized
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700151 * @return newly created port
Brian Stanke9a108972016-04-11 15:25:17 -0400152 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700153 */
154 VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
Yoonseon Han6c603892016-09-01 11:52:21 -0700155 PortNumber portNumber, ConnectPoint realizedBy);
156
157 /**
158 * Binds an existing virtual port on the specified device.
159 *
160 * @param networkId network identifier
161 * @param deviceId virtual device identifier
162 * @param portNumber virtual port number
163 * @param realizedBy underlying physical port using which this virtual port is realized
164 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
165 */
166 void bindVirtualPort(NetworkId networkId, DeviceId deviceId,
167 PortNumber portNumber, ConnectPoint realizedBy);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700168
169 /**
Claudine Chiu579969d2017-10-06 14:32:18 -0400170 * Updates port state of an existing virtual port on the specified device.
171 *
172 * @param networkId network identifier
173 * @param deviceId virtual device identifier
174 * @param portNumber virtual port number
175 * @param isEnabled indicator whether the port is up and active
176 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
177 */
178 void updatePortState(NetworkId networkId, DeviceId deviceId,
179 PortNumber portNumber, boolean isEnabled);
180
181 /**
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700182 * Removes the specified virtual port.
183 *
184 * @param networkId network identifier
185 * @param deviceId device identifier
186 * @param portNumber port number
187 * @throws org.onlab.util.ItemNotFoundException if no such network or port found
188 */
189 void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700190}