blob: 04d1911f689aa05c820c65edce76870ce476d513 [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;
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.Port;
27import org.onosproject.net.PortNumber;
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
59
60 /**
61 * Creates a new virtual network for the specified tenant.
62 *
63 * @param tenantId tenant identifier
64 * @return newly created virtual network
65 */
66 VirtualNetwork createVirtualNetwork(TenantId tenantId);
67
68 /**
69 * Removes the specified virtual network and all its devices and links.
70 *
71 * @param networkId network identifier
72 */
73 void removeVirtualNetwork(NetworkId networkId);
74
75
76 /**
77 * Creates a new virtual device within the specified network. The device id
78 * must be unique within the bounds of the network.
79 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -070080 * @param networkId network identifier
81 * @param deviceId device identifier
Brian Stanke7a81b532016-06-14 15:43:51 -040082 * @return newly created virtual device
Thomas Vachuska7b438af2015-07-07 09:52:07 -070083 * @throws org.onlab.util.ItemNotFoundException if no such network found
84 */
Thomas Vachuska33979fd2015-07-31 11:41:14 -070085 VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -070086
87 /**
88 * Removes the specified virtual device and all its ports and affiliated links.
89 *
90 * @param networkId network identifier
91 * @param deviceId device identifier
92 * @throws org.onlab.util.ItemNotFoundException if no such network or device found
93 */
94 void removeVirtualDevice(NetworkId networkId, DeviceId deviceId);
95
Brian Stanke7a81b532016-06-14 15:43:51 -040096 /**
97 * Creates a new virtual host within the specified network. The host id
98 * must be unique within the bounds of the network.
99 *
100 * @param networkId network identifier
101 * @param hostId host identifier
102 * @param mac mac address
103 * @param vlan vlan identifier
104 * @param location host location
105 * @param ips set of ip addresses
106 * @return newly created virtual host
107 * @throws org.onlab.util.ItemNotFoundException if no such network found
108 */
109 VirtualHost createVirtualHost(NetworkId networkId, HostId hostId, MacAddress mac,
110 VlanId vlan, HostLocation location, Set<IpAddress> ips);
111
112 /**
113 * Removes the specified virtual host.
114 *
115 * @param networkId network identifier
116 * @param hostId host identifier
117 * @throws org.onlab.util.ItemNotFoundException if no such network or host found
118 */
119 void removeVirtualHost(NetworkId networkId, HostId hostId);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700120
121 /**
122 * Creates a new virtual link within the specified network.
123 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700124 * @param networkId network identifier
125 * @param src source connection point
126 * @param dst destination connection point
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700127 * @return newly created virtual link
128 * @throws org.onlab.util.ItemNotFoundException if no such network found
129 */
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700130 VirtualLink createVirtualLink(NetworkId networkId,
Brian Stanke9a108972016-04-11 15:25:17 -0400131 ConnectPoint src, ConnectPoint dst);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700132
133 // TODO: Discuss whether we should provide an alternate createVirtualLink
134 // which is backed by a Path instead; I'm leaning towards not doing that.
135
136 /**
137 * Removes the specified virtual link.
138 *
139 * @param networkId network identifier
140 * @param src source connection point
141 * @param dst destination connection point
142 * @throws org.onlab.util.ItemNotFoundException if no such network or link found
143 */
144 void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
145
146 /**
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700147 * Creates a new virtual port on the specified device.
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700148 *
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700149 * @param networkId network identifier
Brian Stanke9a108972016-04-11 15:25:17 -0400150 * @param deviceId virtual device identifier
151 * @param portNumber virtual port number
152 * @param realizedBy underlying physical port using which this virtual port is realized
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700153 * @return newly created port
Brian Stanke9a108972016-04-11 15:25:17 -0400154 * @throws org.onlab.util.ItemNotFoundException if no such network or device is found
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700155 */
156 VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
Thomas Vachuska33979fd2015-07-31 11:41:14 -0700157 PortNumber portNumber, Port realizedBy);
Thomas Vachuska7b438af2015-07-07 09:52:07 -0700158
159 /**
160 * Removes the specified virtual port.
161 *
162 * @param networkId network identifier
163 * @param deviceId device identifier
164 * @param portNumber port number
165 * @throws org.onlab.util.ItemNotFoundException if no such network or port found
166 */
167 void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
168
169}