Thomas Vachuska

Initial sketch of the virtual network constructs.

Change-Id: Ibcdafb9e56edb29fb37b80d7b0da321ad989c564
......@@ -26,7 +26,7 @@ public interface Device extends Element {
* Coarse classification of the type of the infrastructure device.
*/
public enum Type {
SWITCH, ROUTER, ROADM, OTN, ROADM_OTN, FIREWALL, BALANCER, IPS, IDS, CONTROLLER, OTHER
SWITCH, ROUTER, ROADM, OTN, ROADM_OTN, FIREWALL, BALANCER, IPS, IDS, CONTROLLER, VIRTUAL, OTHER
}
/**
......@@ -79,10 +79,4 @@ public interface Device extends Element {
*/
ChassisId chassisId();
// Device realizedBy(); ?
// ports are not provided directly, but rather via DeviceService.getPorts(Device device);
// Set<Behavior> behaviours(); // set of supported behaviours
}
......
......@@ -51,7 +51,12 @@ public interface Link extends Annotated, Provided, NetworkResource {
/**
* Signifies that this link is realized by fiber (either single channel or WDM).
*/
OPTICAL
OPTICAL,
/**
* Signifies that this link is a virtual link or a pseudo-wire.
*/
VIRTUAL
}
/**
......
......@@ -53,7 +53,12 @@ public interface Port extends Annotated {
* Signifies optical fiber-based WDM port (called W-port).
* Optical Multiplexing Section (See ITU G.709).
*/
OMS
OMS,
/**
* Signifies virtual port.
*/
VIRTUAL
}
/**
......
......@@ -17,11 +17,12 @@ package org.onosproject.net.behaviour;
import com.google.common.primitives.UnsignedInteger;
import org.onosproject.net.device.PortDescription;
import org.onosproject.net.driver.HandlerBehaviour;
/**
* Means to configure a logical port at the device.
*/
public interface PortConfig {
public interface PortConfig extends HandlerBehaviour {
/**
* Apply QoS configuration on a device.
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import java.util.Objects;
/**
* Representation of network identity.
*/
@Beta
public final class NetworkId {
/**
* Represents no network, or an unspecified network.
*/
public static final NetworkId NONE = networkId(-1L);
/**
* Represents the underlying physical network.
*/
public static final NetworkId PHYSICAL = networkId(0L);
private final long id;
// Public construction is prohibited
private NetworkId(long id) {
this.id = id;
}
// Default constructor for serialization
protected NetworkId() {
this.id = -1;
}
/**
* Creates a network id using the supplied backing id.
*
* @param id network id
* @return network identifier
*/
public static NetworkId networkId(long id) {
return new NetworkId(id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof NetworkId) {
final NetworkId that = (NetworkId) obj;
return this.getClass() == that.getClass() && this.id == that.id;
}
return false;
}
@Override
public String toString() {
return Long.toString(id);
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkArgument;
/**
* Representation of network tenant.
*/
@Beta
public final class TenantId {
/**
* Represents no tenant, or an unspecified tenant.
*/
public static final TenantId NONE = new TenantId();
private final String id;
// Public construction is prohibited
private TenantId(String id) {
checkArgument(id != null && id.length() > 0, "Tenant ID cannot be null or empty");
this.id = id;
}
// Default constructor for serialization
protected TenantId() {
this.id = "";
}
/**
* Creates a tenant id using the supplied backing id.
*
* @param id network id
* @return network identifier
*/
public static TenantId tenantId(String id) {
return new TenantId(id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TenantId) {
final TenantId that = (TenantId) obj;
return this.getClass() == that.getClass() &&
Objects.equals(this.id, that.id);
}
return false;
}
@Override
public String toString() {
return id;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import org.onosproject.net.Device;
/**
* Abstraction of a virtual device.
*/
@Beta
public interface VirtualDevice extends VirtualElement, Device {
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
/**
* Abstraction of a virtual element.
*/
@Beta
public interface VirtualElement {
/**
* Returns the identifier of the tenant to which this virtual element belongs.
*
* @return tenant identifier
*/
TenantId tenantId();
/**
* Returns the network identifier to which this virtual element belongs.
*
* @return network identifier
*/
NetworkId networkId();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import org.onosproject.net.Host;
/**
* Abstraction of a virtual end-station host.
*/
@Beta
public interface VirtualHost extends VirtualElement, Host {
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import org.onosproject.net.Link;
/**
* Abstraction of a virtual link.
*/
@Beta
public interface VirtualLink extends VirtualElement, Link {
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
/**
* Representation of a virtual network.
*/
@Beta
public interface VirtualNetwork {
/**
* Returns the network identifier.
*
* @return network id
*/
NetworkId id();
/**
* Returns the identifier of the tenant to which this virtual network belongs.
*
* @return tenant identifier
*/
TenantId tenantId();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import org.onosproject.incubator.net.tunnel.Tunnel;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceDescription;
import org.onosproject.net.device.PortDescription;
import org.onosproject.net.link.LinkDescription;
import java.util.Set;
/**
* Service for managing the inventory of virtual networks.
*/
@Beta
public interface VirtualNetworkAdminService extends VirtualNetworkService {
/**
* Registers the specified, externally generated tenant identifier.
*
* @param tenantId tenant identifier
*/
void registerTenantId(TenantId tenantId);
/**
* Unregisters the specified, externally generated tenant identifier.
*
* @param tenantId tenant identifier
* @throws IllegalStateException if there are networks still owned by this tenant
*/
void unregisterTenantId(TenantId tenantId);
/**
* Returns the set of tenant identifiers known to the system.
*
* @return set of known tenant identifiers
*/
Set<TenantId> getTenantIds();
/**
* Creates a new virtual network for the specified tenant.
*
* @param tenantId tenant identifier
* @return newly created virtual network
*/
VirtualNetwork createVirtualNetwork(TenantId tenantId);
/**
* Removes the specified virtual network and all its devices and links.
*
* @param networkId network identifier
*/
void removeVirtualNetwork(NetworkId networkId);
/**
* Creates a new virtual device within the specified network. The device id
* must be unique within the bounds of the network.
*
* @param networkId network identifier
* @param description device description
* @return newly created device
* @throws org.onlab.util.ItemNotFoundException if no such network found
*/
VirtualDevice createVirtualDevice(NetworkId networkId, DeviceDescription description);
/**
* Removes the specified virtual device and all its ports and affiliated links.
*
* @param networkId network identifier
* @param deviceId device identifier
* @throws org.onlab.util.ItemNotFoundException if no such network or device found
*/
void removeVirtualDevice(NetworkId networkId, DeviceId deviceId);
/**
* Creates a new virtual link within the specified network.
*
* @param networkId network identifier
* @param description link description
* @param realizedBy tunnel using which this link is realized
* @return newly created virtual link
* @throws org.onlab.util.ItemNotFoundException if no such network found
*/
VirtualLink createVirtualLink(NetworkId networkId, LinkDescription description,
Tunnel realizedBy);
// TODO: Discuss whether we should provide an alternate createVirtualLink
// which is backed by a Path instead; I'm leaning towards not doing that.
/**
* Removes the specified virtual link.
*
* @param networkId network identifier
* @param src source connection point
* @param dst destination connection point
* @throws org.onlab.util.ItemNotFoundException if no such network or link found
*/
void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst);
/**
* Creates a new virtual port on the specified device. Note that the port
* description can only request the resources which the underlying port
* port is capable of providing. It is, however, permissible to request
* only portion of those resources.
*
* @param networkId network identifier
* @param deviceId device identifier
* @param description port description
* @param realizedBy underlying port using which this virtual port is realized
* @return newly created port
* @throws org.onlab.util.ItemNotFoundException if no such network or device found
*/
VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId,
PortDescription description, Port realizedBy);
/**
* Removes the specified virtual port.
*
* @param networkId network identifier
* @param deviceId device identifier
* @param portNumber port number
* @throws org.onlab.util.ItemNotFoundException if no such network or port found
*/
void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import org.onosproject.net.DeviceId;
import java.util.Set;
/**
* Service for querying virtual network inventory.
*/
@Beta
public interface VirtualNetworkService {
/**
* Returns a collection of all virtual networks created on behalf of the
* specified tenant.
*
* @param tenantId tenant identifier
* @return collection of networks
* @throws org.onlab.util.ItemNotFoundException if no such network found
*/
Set<VirtualNetwork> getVirtualNetworks(TenantId tenantId);
/**
* Returns a collection of all virtual devices in the specified network.
*
* @param networkId network identifier
* @return collection of devices
* @throws org.onlab.util.ItemNotFoundException if no such network found
*/
Set<VirtualDevice> getVirtualDevices(NetworkId networkId);
/**
* Returns collection of all virtual links in the specified network.
*
* @param networkId network identifier
* @return collection of links
* @throws org.onlab.util.ItemNotFoundException if no such network found
*/
Set<VirtualLink> getVirtualLinks(NetworkId networkId);
/**
* Returns list of all virtual ports of the specified device.
*
* @param networkId network identifier
* @param deviceId device identifier
* @return list of ports
* @throws org.onlab.util.ItemNotFoundException if no such network found
*/
Set<VirtualPort> getVirtualPorts(NetworkId networkId, DeviceId deviceId);
/**
* Returns implementation of the specified service class for operating
* in the context of the given network.
* <p>
* The following services will be available:
* <ul>
* <li>{@link org.onosproject.net.device.DeviceService}</li>
* <li>{@link org.onosproject.net.link.LinkService}</li>
* <li>{@link org.onosproject.net.host.HostService}</li>
* <li>{@link org.onosproject.net.topology.TopologyService}</li>
* <li>{@link org.onosproject.net.topology.PathService}</li>
* <li>{@link org.onosproject.net.flow.FlowRuleService}</li>
* <li>{@link org.onosproject.net.flowobjective.FlowObjectiveService}</li>
* <li>{@link org.onosproject.net.intent.IntentService}</li>
* </ul>
*
* @param networkId network identifier
* @param serviceClass service class
* @param <T> type of service
* @return implementation class
* @throws org.onlab.util.ItemNotFoundException if no such network found
* @throws org.onlab.osgi.ServiceNotFoundException if no implementation found
*/
<T> T get(NetworkId networkId, Class<T> serviceClass);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import org.onosproject.net.Port;
/**
* Representation of a virtual port.
*/
@Beta
public interface VirtualPort extends Port {
/**
* Returns the underlying port using which this port is realized.
*
* @return underlying port which realizes this virtual port
*/
Port realizedBy();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Network virtualization data models and services.
*/
package org.onosproject.incubator.net.virtual;
\ No newline at end of file