diff options
Diffstat (limited to 'framework/src/onos/incubator/api')
118 files changed, 0 insertions, 8541 deletions
diff --git a/framework/src/onos/incubator/api/pom.xml b/framework/src/onos/incubator/api/pom.xml deleted file mode 100644 index cbb69dc0..00000000 --- a/framework/src/onos/incubator/api/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onosproject</groupId> - <artifactId>onos-incubator</artifactId> - <version>1.4.0-rc1</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>onos-incubator-api</artifactId> - <packaging>bundle</packaging> - - <description>ONOS incubating core API</description> - - <dependencies> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava-testlib</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easymock</groupId> - <artifactId>easymock</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java deleted file mode 100644 index 746961e6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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; - -import com.google.common.annotations.Beta; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.statistic.Load; - -/** - * Service for obtaining statistic information about device ports. - */ -@Beta -public interface PortStatisticsService { - - /** - * Obtain the egress load for the given port. - * - * @param connectPoint the port to query - * @return egress traffic load - */ - Load load(ConnectPoint connectPoint); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java deleted file mode 100644 index deeac765..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.config.basics; - -import com.google.common.annotations.Beta; - -/** - * Signals that an error was encountered while reading/writing configuration. - */ -@Beta -public class ConfigException extends Exception { - - /** - * Constructs a new ConfigException with the given message. - * - * @param message message - */ - public ConfigException(String message) { - super(message); - } - - /** - * Constructs a new ConfigException with the given message and cause. - * - * @param message message - * @param cause cause - */ - public ConfigException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java deleted file mode 100644 index 260d0af4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.config.basics; - -import com.google.common.annotations.Beta; -import org.onosproject.incubator.net.domain.IntentDomainId; -import org.onosproject.net.config.SubjectFactory; - -/** - * Set of subject factories for potential configuration subjects. - */ -@Beta -public final class ExtraSubjectFactories { - - // Construction forbidden - private ExtraSubjectFactories() { - } - - public static final SubjectFactory<IntentDomainId> INTENT_DOMAIN_SUBJECT_FACTORY = - new SubjectFactory<IntentDomainId>(IntentDomainId.class, "domains") { - @Override - public IntentDomainId createSubject(String key) { - return IntentDomainId.valueOf(key); - } - }; - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java deleted file mode 100644 index 5246f313..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.config.basics; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.annotations.Beta; -import com.google.common.collect.Sets; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.incubator.net.intf.Interface; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.config.Config; -import org.onosproject.net.host.InterfaceIpAddress; - -import java.util.Iterator; -import java.util.Set; - -/** - * Configuration for interfaces. - */ -@Beta -public class InterfaceConfig extends Config<ConnectPoint> { - public static final String NAME = "name"; - public static final String IPS = "ips"; - public static final String MAC = "mac"; - public static final String VLAN = "vlan"; - - public static final String CONFIG_VALUE_ERROR = "Error parsing config value"; - - /** - * Retrieves all interfaces configured on this port. - * - * @return set of interfaces - * @throws ConfigException if there is any error in the JSON config - */ - public Set<Interface> getInterfaces() throws ConfigException { - Set<Interface> interfaces = Sets.newHashSet(); - - try { - for (JsonNode intfNode : array) { - String name = intfNode.path(NAME).asText(null); - - Set<InterfaceIpAddress> ips = getIps(intfNode); - - String mac = intfNode.path(MAC).asText(); - MacAddress macAddr = mac.isEmpty() ? null : MacAddress.valueOf(mac); - - VlanId vlan = getVlan(intfNode); - - interfaces.add(new Interface(name, subject, ips, macAddr, vlan)); - } - } catch (IllegalArgumentException e) { - throw new ConfigException(CONFIG_VALUE_ERROR, e); - } - - return interfaces; - } - - /** - * Adds an interface to the config. - * - * @param intf interface to add - */ - public void addInterface(Interface intf) { - ObjectNode intfNode = array.addObject(); - - intfNode.put(NAME, intf.name()); - - if (intf.mac() != null) { - intfNode.put(MAC, intf.mac().toString()); - } - - if (!intf.ipAddresses().isEmpty()) { - intfNode.set(IPS, putIps(intf.ipAddresses())); - } - - if (!intf.vlan().equals(VlanId.NONE)) { - intfNode.put(VLAN, intf.vlan().toString()); - } - } - - /** - * Removes an interface from the config. - * - * @param name name of the interface to remove - */ - public void removeInterface(String name) { - Iterator<JsonNode> it = array.iterator(); - while (it.hasNext()) { - JsonNode node = it.next(); - if (node.path(NAME).asText().equals(name)) { - it.remove(); - break; - } - } - } - - private VlanId getVlan(JsonNode node) { - VlanId vlan = VlanId.NONE; - if (!node.path(VLAN).isMissingNode()) { - vlan = VlanId.vlanId(Short.valueOf(node.path(VLAN).asText())); - } - return vlan; - } - - private Set<InterfaceIpAddress> getIps(JsonNode node) { - Set<InterfaceIpAddress> ips = Sets.newHashSet(); - - JsonNode ipsNode = node.get(IPS); - if (ipsNode != null) { - ipsNode.forEach(jsonNode -> - ips.add(InterfaceIpAddress.valueOf(jsonNode.asText()))); - } - - return ips; - } - - private ArrayNode putIps(Set<InterfaceIpAddress> intfIpAddresses) { - ArrayNode ipArray = mapper.createArrayNode(); - - intfIpAddresses.forEach(i -> ipArray.add(i.toString())); - - return ipArray; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java deleted file mode 100644 index 506f1fc1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Various basic builtin network configurations. - */ -package org.onosproject.incubator.net.config.basics;
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java deleted file mode 100644 index ad5e5d18..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import org.onlab.graph.AbstractEdge; -import org.onosproject.net.ConnectPoint; - -import java.util.Objects; - -/** - * Representation of a connection between an intent domain and a device. This - * must happen using a connect point that is part of both the domain and the - * device. - */ -@Beta -public class DomainEdge extends AbstractEdge<DomainVertex> { - - ConnectPoint connectPoint; - - public DomainEdge(DomainVertex src, DomainVertex dst, ConnectPoint connectPoint) { - super(src, dst); - this.connectPoint = connectPoint; - } - - @Override - public int hashCode() { - return 43 * super.hashCode() + connectPoint.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DomainEdge) { - final DomainEdge other = (DomainEdge) obj; - return super.equals(other) && - Objects.equals(this.connectPoint, other.connectPoint); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("src", src()) - .add("dst", dst()) - .add("connectPoint", connectPoint) - .toString(); - } - - /** - * Returns the connect point associated with the domain edge. - * - * @return this edges connect point - */ - public ConnectPoint connectPoint() { - return connectPoint; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java deleted file mode 100644 index ea1660e7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.domain; - -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.DomainTunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.Path; - -/** - * A variant of intent resource specialized for use on the intra-domain level. It contains a lower level path. - */ -public class DomainIntentResource extends IntentResource { - - private final Path domainPath; - - private final DomainTunnelId domainTunnelId; - - private final IntentDomainId intentDomainId; - - /** - * Constructor for a domain intent resource. - * - * @param primitive the primitive associated with this resource - * @param domainTunnelId the id of this tunnel (used as a sorting mechanism) - * @param domainId the ID of the intent domain containing this tunnel - * @param appId the id of the application which created this tunnel - * @param ingress the fist connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param egress the second connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param path the path followed through the domain - */ - public DomainIntentResource(IntentPrimitive primitive, DomainTunnelId domainTunnelId, IntentDomainId domainId, - ApplicationId appId, ConnectPoint ingress, ConnectPoint egress, Path path) { - super(primitive, appId, ingress, egress); - - this.domainPath = path; - this.domainTunnelId = domainTunnelId; - this.intentDomainId = domainId; - } - - /** - * Returns the domain path associated with this resource at creation. - * - * @return this resource's domain level path or if this resource backs a network tunnel then null. - */ - public Path path() { - return domainPath; - } - - /** - * Returns the tunnel ID associated with this domain at creation. - * - * @return this resource's tunnel ID. - */ - public DomainTunnelId tunnelId() { - return domainTunnelId; - } - - /** - * Returns the domain ID associated with this resource at creation. - * - * @return this resource's domain ID. - */ - public IntentDomainId domainId() { - return intentDomainId; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java deleted file mode 100644 index 7d11a76c..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import org.onlab.graph.Vertex; -import org.onosproject.net.DeviceId; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Representation of the intent domain or a device that is part of the intent - * domain graph. - */ -@Beta -public class DomainVertex implements Vertex { - // FIXME we will want to add a type enum or subclasses for the two different types - - // A domain vertex is either an intent domain or a device: - private final IntentDomainId domainId; - // ----- or ----- - - private final DeviceId deviceId; - - // Serialization constructor - private DomainVertex() { - this.domainId = null; - this.deviceId = null; - } - - public DomainVertex(IntentDomainId id) { - this.domainId = checkNotNull(id, "Intent domain ID cannot be null."); - this.deviceId = null; - } - - public DomainVertex(DeviceId id) { - this.domainId = null; - this.deviceId = checkNotNull(id, "Device ID cannot be null."); - } - - @Override - public String toString() { - if (domainId != null) { - return MoreObjects.toStringHelper(this) - .add("domainId", domainId) - .toString(); - } else if (deviceId != null) { - return MoreObjects.toStringHelper(this) - .add("deviceId", deviceId) - .toString(); - } else { - return MoreObjects.toStringHelper(this) - .toString(); - } - } - - /** - * Returns the device ID of this vertex if it is a device, returns null if it is a domain. - * - * @return the device ID of this vertex if applicable, else null - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns the domain ID of this vertex if it is a domain, returns null if it is a device. - * - * @return the domain ID of this vertex if applicable, else null - */ - public IntentDomainId domainId() { - return domainId; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java deleted file mode 100644 index a52dce69..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Representation of an intent domain which includes the set of internal devices, - * the set of edge ports, and the implementation of the domain provider. - */ -@Beta -public class IntentDomain { - - private final IntentDomainId id; - private String name; - - private Set<DeviceId> internalDevices; - private Set<ConnectPoint> edgePorts; - - private IntentDomainProvider provider; - - public IntentDomain(IntentDomainId id, String name, - Set<DeviceId> internalDevices, - Set<ConnectPoint> edgePorts) { - this.id = id; - this.name = name; - this.internalDevices = internalDevices; - this.edgePorts = edgePorts; - } - - /** - * Returns the id for the intent domain. - * - * @return intent domain id - */ - public IntentDomainId id() { - return id; - } - - /** - * Returns the friendly name for the intent domain. - * - * @return intent domain name - */ - public String name() { - return name; - } - - /** - * Returns the set of internal devices for the intent domain (devices under - * exclusive control of the intent domain). - * - * @return set of internal devices - */ - public Set<DeviceId> internalDevices() { - return internalDevices; - } - - /** - * Returns the set of edge ports for the intent domain. - * - * @return set of edge ports - */ - public Set<ConnectPoint> edgePorts() { - return edgePorts; - } - - /** - * Returns the provider for the intent domain. - * - * @return intent domain provider - */ - public IntentDomainProvider provider() { - return provider; - } - - /** - * Returns the status of the intent domain. An intent domain is active if it - * has an intent domain provider bound, and it is inactive if one is not bound. - * - * @return true if active; false otherwise - */ - public boolean isActive() { - return provider != null; - } - - /** - * Sets the provider for the intent domain if one is not already set. - * - * @param provider new intent domain provider - */ - public void setProvider(IntentDomainProvider provider) { - // TODO consider checkState depending on caller - if (this.provider == null) { - this.provider = provider; - } - } - - /** - * Unsets the provider for the intent domain. - */ - public void unsetProvider() { - this.provider = null; - } - - //TODO add remaining setters (we will probably want to link this to the network config) -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java deleted file mode 100644 index f5ceaa9f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; - -/** - * Administrative interface for the intent domain service. - */ -@Beta -public interface IntentDomainAdminService extends IntentDomainService { - - /** - * Register an application that provides intent domain service. - * - * @param applicationId application id - * @param provider intent domain provider - */ - void registerApplication(ApplicationId applicationId, IntentDomainProvider provider); - - /** - * Unregisters an application that provides intent domain service. - * - * @param applicationId application id - */ - void unregisterApplication(ApplicationId applicationId); - - /* TODO we may be able to accomplish the following through network config: - void createDomain(String domainId); - void removeDomain(String domainId); - - void addInternalDeviceToDomain(IntentDomain domain, DeviceId deviceId); - void addPortToDomain(IntentDomain domain, ConnectPoint port); - - void bindApplicationToDomain(String domain, IntentDomain implementation); - void unbindApplicationToDomain(String domain, IntentDomain implementation); - */ -} - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java deleted file mode 100644 index e903c324..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableSet; -import org.onosproject.net.config.Config; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Configuration for an intent domain including a name, set of internal devices, - * set of edge ports, and the application bound to control the domain. - */ -@Beta -public class IntentDomainConfig extends Config<IntentDomainId> { - - private static final String DOMAIN_NAME = "name"; - private static final String APPLICATION_NAME = "applicationName"; - private static final String INTERNAL_DEVICES = "internalDevices"; - private static final String EDGE_PORTS = "edgePorts"; - - - /** - * Returns the friendly name for the domain. - * - * @return domain name - */ - public String domainName() { - return get(DOMAIN_NAME, subject.toString()); - } - - /** - * Sets the friendly name for the domain. - * - * @param domainName new name for the domain; null to clear - * @return self - */ - public IntentDomainConfig domainName(String domainName) { - return (IntentDomainConfig) setOrClear(DOMAIN_NAME, domainName); - } - - /** - * Returns the friendly name for the domain. - * - * @return domain name - */ - public String applicationName() { - return get(APPLICATION_NAME, "FIXME"); //TODO maybe not null? - } - - /** - * Sets the friendly name for the domain. - * - * @param applicationName new name for the domain; null to clear - * @return self - */ - public IntentDomainConfig applicationName(String applicationName) { - return (IntentDomainConfig) setOrClear(APPLICATION_NAME, applicationName); - } - - /** - * Returns the set of internal devices. - * - * @return set of internal devices - */ - public Set<DeviceId> internalDevices() { - return ImmutableSet.copyOf(getList(INTERNAL_DEVICES, DeviceId::deviceId)); - } - - /** - * Sets the set of internal devices. - * - * @param devices set of devices; null to clear - * @return self - */ - public IntentDomainConfig internalDevices(Set<DeviceId> devices) { - return (IntentDomainConfig) setOrClear(INTERNAL_DEVICES, devices); - } - - /** - * Returns the set of edge ports. - * - * @return set of edge ports - */ - public Set<ConnectPoint> edgePorts() { - return ImmutableSet.copyOf(getList(EDGE_PORTS, ConnectPoint::deviceConnectPoint)); - } - - /** - * Sets the set of edge ports. - * - * @param connectPoints set of edge ports; null to clear - * @return self - */ - public IntentDomainConfig edgePorts(Set<ConnectPoint> connectPoints) { - return (IntentDomainConfig) setOrClear(EDGE_PORTS, connectPoints); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java deleted file mode 100644 index 554702a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Intent domain identifier. - */ -@Beta -public class IntentDomainId { - - private final String id; - - /** - * Creates an intent domain identifier from the specified string representation. - * - * @param value string value - * @return intent identifier - */ - public static IntentDomainId valueOf(String value) { - return new IntentDomainId(value); - } - - /** - * Constructor for serializer. - */ - IntentDomainId() { - this.id = null; - } - - /** - * Constructs the ID corresponding to a given string value. - * - * @param value the underlying value of this ID - */ - IntentDomainId(String value) { - this.id = checkNotNull(value, "Intent domain ID cannot be null."); - } - - @Override - public int hashCode() { - return id.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof IntentDomainId)) { - return false; - } - IntentDomainId that = (IntentDomainId) obj; - return Objects.equals(this.id, that.id); - } - - @Override - public String toString() { - return id; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java deleted file mode 100644 index 04080b20..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; - -/** - * Listener for intent domain events. - */ -@Beta -public interface IntentDomainListener { - //TODO create event types - //extends EventListener<IntentDomainEvent> -}
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java deleted file mode 100644 index a19add60..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; - -import java.util.List; -import java.util.Set; - -/** - * FIXME. - */ -@Beta -public interface IntentDomainProvider { - - /** - * Requests that the provider attempt to satisfy the intent primitive. - * The application must apply the context before the intent resource - * can be used. Request contexts can be explictly cancelled, or they will - * eventually time out so that resources can be reused. - * - * @param domain intent domain for the request - * @param primitive intent primitive - * @return intent resources that specify paths that satisfy the request. - */ - //TODO Consider an iterable and/or holds (only hold one or two reservation(s) at a time) - List<DomainIntentResource> request(IntentDomain domain, IntentPrimitive primitive); - - /** - * Request that the provider attempt to modify an existing resource to satisfy - * a new intent primitive. The application must apply the context before - * the intent resource can be used. - * - * @param oldResource the resource to be replaced - * @param newResource the resource to be applied - * @return request contexts that contain resources to satisfy the intent - */ - DomainIntentResource modify(DomainIntentResource oldResource, DomainIntentResource newResource); - - /** - * Requests that the provider release an intent resource. - * - * @param resource intent resource - */ - void release(DomainIntentResource resource); - - /** - * Requests that the provider apply the path from the intent resource. - * - * @param domainIntentResource request context - * @return intent resource that satisfies the intent - */ - DomainIntentResource apply(DomainIntentResource domainIntentResource); - - /** - * Requests that the provider cancel the path. Requests that are not applied - * will be eventually timed out by the provider. - * - * @param domainIntentResource the intent resource whose path should be cancelled. - */ - void cancel(DomainIntentResource domainIntentResource); - - /** - * Returns all intent resources held by the provider. - * - * @return set of intent resources - */ - Set<DomainIntentResource> getResources(); -} - - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java deleted file mode 100644 index 41508ad3..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import org.onlab.graph.Graph; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Service for that maintains a graph of intent domains and a registry of intent - * domain providers. - */ -@Beta -public interface IntentDomainService { - - /** - * Returns the intent domain for the given id. - * - * @param id id to look up - * @return the intent domain; null if none found - */ - IntentDomain getDomain(IntentDomainId id); - - /** - * Returns a set of all intent domains. - * - * @return set of intent domains - */ - Set<IntentDomain> getDomains(); - - /** - * Returns any network domains associated with the given device id. - * - * @param deviceId device id to look up - * @return set of intent domain - */ - Set<IntentDomain> getDomains(DeviceId deviceId); - - /** - * Returns the graph of intent domains and connection devices. - * - * @return graph of network domains - */ - Graph<DomainVertex, DomainEdge> getDomainGraph(); - - /** - * Adds the specified listener for intent domain events. - * - * @param listener listener to be added - */ - void addListener(IntentDomainListener listener); - - /** - * Removes the specified listener for intent domain events. - * - * @param listener listener to be removed - */ - void removeListener(IntentDomainListener listener); -} - - - - - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java deleted file mode 100644 index ad3081a2..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; - -/** - * Abstract base class for intent primitives. - */ -@Beta -public abstract class IntentPrimitive { - - private final ApplicationId appId; - - public IntentPrimitive(ApplicationId appId) { - this.appId = appId; - } - - /** - * The getter for the application ID associated with the intent primitive upon creation. - * - * @return the application ID associated with the intent primitive - */ - public ApplicationId appId() { - return appId; - } -}
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java deleted file mode 100644 index 627c863f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.ConnectPoint; - - -/** - * The abstract base class for the resource that satisfies an intent primitive. - */ -@Beta -public abstract class IntentResource { - - private final IntentPrimitive primitive; - - private final ApplicationId appId; - private final ConnectPoint ingress; - private final ConnectPoint egress; - - //* QUESTIONABLE ADDITIONS *// - - // TODO add other common fields - //String ingressTag; - //String egressTag; - //etc. - - public IntentResource(IntentPrimitive primitive, ApplicationId appId, - ConnectPoint ingress, ConnectPoint egress) { - this.appId = appId; - this.ingress = ingress; - this.egress = egress; - this.primitive = primitive; - } - - //TODO when is same package tunnelID should be of type tunnelID and netTunnelId not long. - - - /** - * Returns the intent primitive associated with this resource at creation. - * - * @return this resource's intent primitive. - */ - public IntentPrimitive primitive() { - return primitive; - } - - /** - * Returns the application ID associated with this resource at creation. - * - * @return this resource's application ID. - */ - public ApplicationId appId() { - return appId; - } - - /** - * Returns the ingress connect point associated with this resource at creation. - * - * @return this resource's ingress connect point. - */ - public ConnectPoint ingress() { - return ingress; - } - - /** - * Returns the egress connect point associated with this resource at creation. - * - * @return this resource's connect point. - */ - public ConnectPoint egress() { - return egress; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java deleted file mode 100644 index ac4445b4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.domain; - -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.NetworkTunnelId; -import org.onosproject.net.ConnectPoint; - -/** - * A variant of intent resource specialized for use on the inter-domain level. It contains a higher level path. - */ -public class NetworkIntentResource extends IntentResource { - - private final org.onlab.graph.Path<DomainVertex, DomainEdge> netPath; - - private NetworkTunnelId networkTunnelId; - - /** - * Constructor for a network intent resource. - * - * @param primitive the primitive associated with this resource - * @param networkTunnelId the id of this tunnel (used as a sorting mechanism) - * @param appId the id of the application which created this tunnel - * @param ingress the fist connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param egress the second connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param path the path followed through the graph of domain vertices and domain edges - */ - public NetworkIntentResource(IntentPrimitive primitive, NetworkTunnelId networkTunnelId, ApplicationId appId, - ConnectPoint ingress, ConnectPoint egress, - org.onlab.graph.Path<DomainVertex, DomainEdge> path) { - super(primitive, appId, ingress, egress); - - this.networkTunnelId = networkTunnelId; - this.netPath = path; - } - - /** - * Returns the network path associated with this resource at creation. - * - * @return this resource's network lever path or if this resource backs a domain level tunnel then null. - */ - public org.onlab.graph.Path<DomainVertex, DomainEdge> path() { - return netPath; - } - - /** - * Returns ths network ID associated with this network tunnel at creation. - * - * @return thsi resource's tunnel ID. - */ - public NetworkTunnelId tunnelId() { - return this.networkTunnelId; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java deleted file mode 100644 index 2abaab5f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.ConnectPoint; - -/** - * Provides connectivity through a domain. - */ -@Beta -public class TunnelPrimitive extends IntentPrimitive { - - private final ConnectPoint one; - private final ConnectPoint two; - - public TunnelPrimitive(ApplicationId appId, ConnectPoint one, ConnectPoint two) { - super(appId); - this.one = one; - this.two = two; - } - - /** - * The getter for the first connection point associated with a tunnel. - * - * @return the first connection point - */ - public ConnectPoint one() { - return one; - } - - /** - * The getter for the second connection point associated with a tunnel. - * @return the second connection point - */ - public ConnectPoint two() { - return two; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java deleted file mode 100644 index b8340e01..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Subsystem for network intent domains. - */ -package org.onosproject.incubator.net.domain;
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java deleted file mode 100644 index 765fbfef..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright 2014-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.faultmanagement.alarm; - -import org.onosproject.net.DeviceId; - -/** - * Representation of an Alarm. At a given instant there can be only one alarm - * with the same deviceId + description + source combination. - */ -public interface Alarm { - - /** - * Returns the unique alarm id within this ONOS instance. - * - * @return alarm identifier - */ - AlarmId id(); - - /** - * The device to which this alarm is related. - * - * @return a device id - */ - DeviceId deviceId(); - - /** - * Returns a description of alarm. - * <p> - * It may encapsulate Event Type as described by ITU Recommendation X.736 - * ITU, Quoting https://tools.ietf.org/html/rfc3877 these include: other, - * communicationsAlarm, qualityOfServiceAlarm, processingErrorAlarm, - * equipmentAlarm, environmentalAlarm, integrityViolation, - * operationalViolation, physicalViolation, - * securityServiceOrMechanismViolation, timeDomainViolation - * <p> - * It may encapsulate Probable Cause as described by ITU Recommendation - * X.736 ITU, Quoting - * https://www.iana.org/assignments/ianaitualarmtc-mib/ianaitualarmtc-mib - * these include : aIS, callSetUpFailure, degradedSignal, - * farEndReceiverFailure, framingError, and hundreds more constants. - * <p> - * It may encapsulate a vendor-specific description of the underlying fault. - * - * @return description of alarm - */ - String description(); - - /** - * Returns an entity within the context of this alarm's device. It may be - * null if deviceId sufficiently identifies the location. As an example, the - * source may indicate a port number - * - * @return source of alarm within the alarm's referenced Device. - */ - AlarmEntityId source(); - - /** - * Returns the time when raised. - * - * @return time when raised, in milliseconds since start of epoch - */ - long timeRaised(); - - /** - * Returns time at which the alarm was updated most recently, due to some - * change in the device, or ONOS. If the alarm has been cleared, this is the - * time at which the alarm was cleared. - * - * @return time when last updated, in milliseconds since start of epoch - */ - long timeUpdated(); - - /** - * Returns the time when cleared. Null indicated no clear time, i.e. the - * alarm is still active. - * - * @return time when cleared, in milliseconds since start of epoch or null - * if uncleared. - */ - Long timeCleared(); - - /** - * Returns the severity. Note, that cleared alarms may have EITHER - * SeverityLevel = CLEARED, or may be not present; both scenarios should be - * handled. - * - * @return severity of the alarm - */ - SeverityLevel severity(); - - /** - * Returns true if alarm is service affecting Note: Whilst X.733 combines - * service-affecting state with severity (where severities of critical and - * major are deemed service-affecting) ONOS keeps these attributes separate. - * - * @return whether service affecting (true indicates it is) - */ - boolean serviceAffecting(); - - /** - * Returns a flag to indicate if this alarm has been acknowledged. All - * alarms are unacknowledged until and unless an ONOS user takes action to - * indicate so. - * - * @return whether alarm is currently acknowledged (true indicates it is) - */ - boolean acknowledged(); - - /** - * Returns a flag to indicate if this alarm is manually-cleared by a user action within ONOS. Some stateless events - * e.g. backup-failure or upgrade-failure, may be mapped by ONOS to alarms, and these may be deemed manually- - * clearable. The more typical case is that an alarm represents a persistent fault on or related to a device and - * such alarms are never manually clearable, i.e. a configuration or operational state must occur for the alarm to - * clear. - * - * @return whether it may be cleared by a user action (true indicates it is) - */ - boolean manuallyClearable(); - - /** - * Returns the user to whom this alarm is assigned; this is for future use - * and always returns null in this release. It is anticipated that in future ONOS - * releases, the existing JAAS user/key/role configuration will be extended - * to include a mechanism whereby some groups of users may allocate alarms - * to other users for bookkeeping and administrative purposes, and that ONOS - * will additionally provide a REST based mechanism, to retrieve from JAAS, - * the set of users to whom alarm assignment is possible for the current - * user. - * - * @return the assigned user; always null in this release. - */ - String assignedUser(); - - /** - * Represents the severity level on an alarm, as per ITU-T X.733 - * specifications. - * <p> - * The precedence is as follows for : Critical > Major > Minor > Warning. - */ - enum SeverityLevel { - - /** - * From X.733: This indicates the clearing of one or more previously - * reported alarms. This alarm clears all alarms for this managed object - * that have the same Alarm type, Probable cause and Specific problems - * (if given). Multiple associated notifications may be cleared by using - * the Correlated notifications parameter (defined below). This - * Recommendation | International Standard does not require that the - * clearing of previously reported alarms be reported. Therefore, a - * managing system cannot assume that the absence of an alarm with the - * Cleared severity level means that the condition that caused the - * generation of previous alarms is still present. Managed object - * definers shall state if, and under which conditions, the Cleared - * severity level is used. - */ - CLEARED, - /** - * From X.733: This indicates that the severity level cannot be - * determined. - */ - INDETERMINATE, - /** - * From X.733: This indicates that a service affecting condition has - * occurred and an immediate corrective action is required. Such a - * severity can be reported, for example, when a managed object becomes - * totally out of service and its capability must be restored. - */ - CRITICAL, - /** - * X.733 definition: This indicates that a service affecting condition - * has developed and an urgent corrective action is required. Such a - * severity can be reported, for example, when there is a severe - * degradation in the capability of the managed object and its full - * capability must be restored. - */ - MAJOR, - /** - * From X.733: This indicates the existence of a non-service affecting - * fault condition and that corrective action should be taken in order - * to prevent a more serious (for example, service affecting) fault. - * Such a severity can be reported, for example, when the detected alarm - * condition is not currently degrading the capacity of the managed - * object. - */ - MINOR, - /** - * From X.733: This indicates the detection of a potential or impending - * service affecting fault, before any significant effects have been - * felt. Action should be taken to further diagnose (if necessary) and - * correct the problem in order to prevent it from becoming a more - * serious service affecting fault. - */ - WARNING; - - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java deleted file mode 100644 index 5bf86749..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2014-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.faultmanagement.alarm; - -import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.collect.ImmutableSet; -import java.net.URI; -import java.util.Objects; -import java.util.Set; - -/** - * Immutable representation of a alarm source. It is meaningful within the - * context of a device. - */ -public final class AlarmEntityId { - - public static final AlarmEntityId NONE = new AlarmEntityId(URI.create("none:none")); - public static final Set<String> SCHEMES = ImmutableSet.of("none", "port", "och", "other"); - - private final URI uri; - - private AlarmEntityId(final URI uri) { - this.uri = uri; - } - - protected AlarmEntityId() { - uri = NONE.uri; - } - - public static AlarmEntityId alarmEntityId(final String string) { - return alarmEntityId(URI.create(string)); - } - - public static AlarmEntityId alarmEntityId(final URI uri) { - checkArgument(SCHEMES.contains(uri.getScheme()), "Unexpected scheme"); - return new AlarmEntityId(uri); - } - - @Override - public String toString() { - return uri.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(uri); - - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof AlarmEntityId) { - final AlarmEntityId other = (AlarmEntityId) obj; - return Objects.equals(this.uri, other.uri); - } - return false; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java deleted file mode 100644 index bbbd993e..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - -import org.onosproject.event.AbstractEvent; - -/** - * Entity that represents Alarm events. - */ -public class AlarmEvent extends AbstractEvent<AlarmEvent.Type, Alarm> { - - - /** - * Creates an event of a given type and for the specified alarm and the - * current time. - * - * @param type topology event type - * @param alarm the alarm - */ - public AlarmEvent(Type type, Alarm alarm) { - super(type, alarm); - } - - /** - * Creates an event of a given type and for the specified alarm and time. - * - * @param type link event type - * @param alarm the alarm - * @param time occurrence time - */ - public AlarmEvent(Type type, Alarm alarm, - long time) { - super(type, alarm, time); - } - - /** - * Type of alarm events. - */ - public enum Type { - /** - * A Raised Alarm. - */ - RAISE, - - /** - * A Cleared Alarm. - */ - CLEAR - } - - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java deleted file mode 100644 index e0107f87..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Alarm identifier suitable as an external key. - * <p> - * This class is immutable.</p> - */ -@Beta -public final class AlarmId { - - private final long id; - - /** - * Instantiates a new Alarm id. - * - * @param id the id - */ - public AlarmId(final long id) { - this.id = id; - } - - /** - * Creates an alarm identifier from the specified long representation. - * - * @param value long value - * @return intent identifier - */ - public static AlarmId valueOf(final long value) { - return new AlarmId(value); - } - - /** - * Returns the backing integer index. - * - * @return backing integer index - */ - public long fingerprint() { - return id; - } - - @Override - public int hashCode() { - return Objects.hash(id); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof AlarmId) { - final AlarmId other = (AlarmId) obj; - return Objects.equals(this.id, other.id); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("id", id).toString(); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java deleted file mode 100644 index c5e82ba5..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - -import org.onosproject.event.EventListener; - - -/** - * Entity capable of receiving Alarm related events. - */ -public interface AlarmListener extends EventListener<AlarmEvent> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java deleted file mode 100644 index 82bcda2a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of a Alarm provider. - */ -public interface AlarmProvider extends Provider { - - /** - * Triggers an asynchronous discovery of the alarms on the specified device, - * intended to refresh internal alarm model for the device. An indirect - * result of this should be invocation of - * {@link org.onosproject.incubator.net.faultmanagement.alarm.AlarmProviderService#updateAlarmList} )} - * at some later point in time. - * - * @param deviceId ID of device to be probed - */ - void triggerProbe(DeviceId deviceId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java deleted file mode 100644 index 618298c0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of a alarm provider registry. - */ -public interface AlarmProviderRegistry extends ProviderRegistry<AlarmProvider, AlarmProviderService> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java deleted file mode 100644 index 727aa281..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -import java.util.Collection; - -/** - * The interface Alarm provider service. - */ -public interface AlarmProviderService extends ProviderService<AlarmProvider> { - - /** - * Sends active alarm list for a device. - * - * @param deviceId identity of the device - * @param alarms list of device alarms - */ - void updateAlarmList(DeviceId deviceId, Collection<Alarm> alarms); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java deleted file mode 100644 index 03c0c7b1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2014-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.faultmanagement.alarm; - -import com.google.common.annotations.Beta; -//import org.onosproject.event.ListenerService; - -import java.util.Set; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; - -/** - * Service for interacting with the alarm handling of devices. Unless stated - * otherwise method return active AND recently-cleared alarms. - */ -@Beta -public interface AlarmService { -// extends ListenerService<AlarmEvent, AlarmListener> { - - /** - * Alarm should be updated in ONOS's internal representation; only - * administration/book-keeping fields may be updated. Attempting to update - * fields which are mapped directly from device is prohibited. - * - * @param replacement alarm with updated book-keeping fields - * @return updated alarm (including any recent device derived changes) - - * @throws java.lang.IllegalStateException if attempt to update not allowed - * fields. - */ - Alarm update(Alarm replacement); - - /** - * Returns the number of ACTIVE alarms on a device. - * - * @param deviceId the device - * @return number of alarms - */ - int getActiveAlarmCount(DeviceId deviceId); - - /** - * Returns the alarm with the specified identifier. - * - * @param alarmId alarm identifier - * @return alarm or null if one with the given identifier is not known - */ - Alarm getAlarm(AlarmId alarmId); - - /** - * Returns all of the alarms. - * - * @return the alarms - */ - Set<Alarm> getAlarms(); - - /** - * Returns all of the ACTIVE alarms. Recently cleared alarms excluded. - * - * @return the alarms - */ - Set<Alarm> getActiveAlarms(); - - /** - * Returns the alarms with the specified severity. - * - * @param severity the alarm severity - * @return the active alarms with a particular severity - */ - Set<Alarm> getAlarms(Alarm.SeverityLevel severity); - - /** - * Returns the alarm for a given device, regardless of source within that - * device. - * - * @param deviceId the device - * @return the alarms - */ - Set<Alarm> getAlarms(DeviceId deviceId); - - /** - * Returns the alarm for a given device and source. - * - * @param deviceId the device - * @param source the source within the device - * @return the alarms - */ - Set<Alarm> getAlarms(DeviceId deviceId, AlarmEntityId source); - - /** - * Returns the alarm affecting a given link. - * - * @param src one end of the link - * @param dst one end of the link - * @return the alarms - */ - Set<Alarm> getAlarmsForLink(ConnectPoint src, ConnectPoint dst); - - /** - * Returns the alarm affecting a given flow. - * - * @param deviceId the device - * @param flowId the flow - * @return the alarms - */ - Set<Alarm> getAlarmsForFlow(DeviceId deviceId, long flowId); - -// Support retrieving alarms affecting other ONOS entity types may be added in future release -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java deleted file mode 100644 index afa366ad..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright 2014-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.faultmanagement.alarm; - -import org.onosproject.net.DeviceId; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Default implementation of an alarm. - */ -public final class DefaultAlarm implements Alarm { - - private final AlarmId id; - - private final DeviceId deviceId; - private final String description; - private final AlarmEntityId source; - private final long timeRaised; - private final long timeUpdated; - private final Long timeCleared; - private final SeverityLevel severity; - private final boolean isServiceAffecting; - private final boolean isAcknowledged; - private final boolean isManuallyClearable; - private final String assignedUser; - - /** - * Instantiates a new Default alarm. - * - * @param id the id - * @param deviceId the device id - * @param description the description - * @param source the source, null indicates none. - * @param timeRaised the time raised. - * @param timeUpdated the time last updated. - * @param timeCleared the time cleared, null indicates uncleared. - * @param severity the severity - * @param isServiceAffecting the service affecting - * @param isAcknowledged the acknowledged - * @param isManuallyClearable the manually clearable - * @param assignedUser the assigned user, `null` indicates none. - */ - private DefaultAlarm(final AlarmId id, - final DeviceId deviceId, - final String description, - final AlarmEntityId source, - final long timeRaised, - final long timeUpdated, - final Long timeCleared, - final SeverityLevel severity, - final boolean isServiceAffecting, - final boolean isAcknowledged, - final boolean isManuallyClearable, - final String assignedUser) { - this.id = id; - this.deviceId = deviceId; - this.description = description; - this.source = source; - this.timeRaised = timeRaised; - this.timeUpdated = timeUpdated; - this.timeCleared = timeCleared; - this.severity = severity; - this.isServiceAffecting = isServiceAffecting; - this.isAcknowledged = isAcknowledged; - this.isManuallyClearable = isManuallyClearable; - this.assignedUser = assignedUser; - } - - @Override - public AlarmId id() { - return id; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - @Override - public String description() { - return description; - } - - @Override - public AlarmEntityId source() { - return source; - } - - @Override - public long timeRaised() { - return timeRaised; - } - - @Override - public long timeUpdated() { - return timeUpdated; - } - - @Override - public Long timeCleared() { - return timeCleared; - } - - @Override - public SeverityLevel severity() { - return severity; - } - - @Override - public boolean serviceAffecting() { - return isServiceAffecting; - } - - @Override - public boolean acknowledged() { - return isAcknowledged; - } - - @Override - public boolean manuallyClearable() { - return isManuallyClearable; - } - - @Override - public String assignedUser() { - return assignedUser; - } - - @Override - public int hashCode() { - return Objects.hash(id, deviceId, description, - source, timeRaised, timeUpdated, timeCleared, severity, - isServiceAffecting, isAcknowledged, - isManuallyClearable, assignedUser); - } - - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final DefaultAlarm other = (DefaultAlarm) obj; - if (!Objects.equals(this.id, other.id)) { - return false; - } - if (!Objects.equals(this.deviceId, other.deviceId)) { - return false; - } - if (!Objects.equals(this.description, other.description)) { - return false; - } - if (!Objects.equals(this.source, other.source)) { - return false; - } - if (this.timeRaised != other.timeRaised) { - return false; - } - if (this.timeUpdated != other.timeUpdated) { - return false; - } - if (!Objects.equals(this.timeCleared, other.timeCleared)) { - return false; - } - if (this.severity != other.severity) { - return false; - } - if (this.isServiceAffecting != other.isServiceAffecting) { - return false; - } - if (this.isAcknowledged != other.isAcknowledged) { - return false; - } - if (this.isManuallyClearable != other.isManuallyClearable) { - return false; - } - if (!Objects.equals(this.assignedUser, other.assignedUser)) { - return false; - } - return true; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("id", id) - .add("deviceId", deviceId) - .add("description", description) - .add("source", source) - .add("timeRaised", timeRaised) - .add("timeUpdated", timeUpdated) - .add("timeCleared", timeCleared) - .add("severity", severity) - .add("serviceAffecting", isServiceAffecting) - .add("acknowledged", isAcknowledged) - .add("manuallyClearable", isManuallyClearable) - .add("assignedUser", assignedUser) - .toString(); - } - - public static class Builder { - - // Manadatory fields .. - private final AlarmId id; - private final DeviceId deviceId; - private final String description; - private final SeverityLevel severity; - private final long timeRaised; - - // Optional fields .. - private AlarmEntityId source = AlarmEntityId.NONE; - private long timeUpdated; - private Long timeCleared = null; - private boolean isServiceAffecting = false; - private boolean isAcknowledged = false; - private boolean isManuallyClearable = false; - private String assignedUser = null; - - public Builder(final Alarm alarm) { - this(alarm.id(), alarm.deviceId(), alarm.description(), alarm.severity(), alarm.timeRaised()); - this.source = AlarmEntityId.NONE; - this.timeUpdated = alarm.timeUpdated(); - this.timeCleared = alarm.timeCleared(); - this.isServiceAffecting = alarm.serviceAffecting(); - this.isAcknowledged = alarm.acknowledged(); - this.isManuallyClearable = alarm.manuallyClearable(); - this.assignedUser = alarm.assignedUser(); - - } - - public Builder(final AlarmId id, final DeviceId deviceId, - final String description, final SeverityLevel severity, final long timeRaised) { - super(); - this.id = id; - this.deviceId = deviceId; - this.description = description; - this.severity = severity; - this.timeRaised = timeRaised; - // Unless specified time-updated is same as raised. - this.timeUpdated = timeRaised; - } - - public Builder forSource(final AlarmEntityId source) { - this.source = source; - return this; - } - - public Builder withTimeUpdated(final long timeUpdated) { - this.timeUpdated = timeUpdated; - return this; - } - - public Builder withTimeCleared(final Long timeCleared) { - this.timeCleared = timeCleared; - return this; - } - - public Builder withServiceAffecting(final boolean isServiceAffecting) { - this.isServiceAffecting = isServiceAffecting; - return this; - } - - public Builder withAcknowledged(final boolean isAcknowledged) { - this.isAcknowledged = isAcknowledged; - return this; - } - - public Builder withManuallyClearable(final boolean isManuallyClearable) { - this.isManuallyClearable = isManuallyClearable; - return this; - } - - public Builder withAssignedUser(final String assignedUser) { - this.assignedUser = assignedUser; - return this; - } - - public DefaultAlarm build() { - checkNotNull(id, "Must specify an alarm id"); - checkNotNull(deviceId, "Must specify a device"); - checkNotNull(description, "Must specify a description"); - checkNotNull(timeRaised, "Must specify a time raised"); - checkNotNull(timeUpdated, "Must specify a time updated"); - checkNotNull(severity, "Must specify a severity"); - - return new DefaultAlarm(id, deviceId, description, source, timeRaised, timeUpdated, timeCleared, - severity, isServiceAffecting, isAcknowledged, isManuallyClearable, assignedUser); - } - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java deleted file mode 100644 index b2b8ec9f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ -/** - * Abstractions for interacting with alarms. An alarm is a persistent indication - * of a fault that clears only when the triggering condition has been resolved. - */ -package org.onosproject.incubator.net.faultmanagement.alarm; diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java deleted file mode 100644 index e2109689..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2014-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.intf; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import com.google.common.collect.Sets; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.host.InterfaceIpAddress; - -import java.util.Objects; -import java.util.Set; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * An Interface maps network configuration information (such as addresses and - * vlans) to a port in the network. - */ -@Beta -public class Interface { - public static final String NO_INTERFACE_NAME = ""; - - private final String name; - private final ConnectPoint connectPoint; - private final Set<InterfaceIpAddress> ipAddresses; - private final MacAddress macAddress; - private final VlanId vlan; - - /** - * Creates new Interface with the provided configuration. - * - * @param name name of the interface - * @param connectPoint the connect point this interface maps to - * @param ipAddresses Set of IP addresses - * @param macAddress MAC address - * @param vlan VLAN ID - */ - public Interface(String name, ConnectPoint connectPoint, - Set<InterfaceIpAddress> ipAddresses, - MacAddress macAddress, VlanId vlan) { - this.name = name == null ? NO_INTERFACE_NAME : name; - this.connectPoint = checkNotNull(connectPoint); - this.ipAddresses = ipAddresses == null ? Sets.newHashSet() : ipAddresses; - this.macAddress = macAddress == null ? MacAddress.NONE : macAddress; - this.vlan = vlan == null ? VlanId.NONE : vlan; - } - - /** - * Creates new Interface with the provided configuration. - * - * @param connectPoint the connect point this interface maps to - * @param ipAddresses Set of IP addresses - * @param macAddress MAC address - * @param vlan VLAN ID - */ - public Interface(ConnectPoint connectPoint, - Set<InterfaceIpAddress> ipAddresses, - MacAddress macAddress, VlanId vlan) { - this(NO_INTERFACE_NAME, connectPoint, ipAddresses, macAddress, vlan); - } - - /** - * Retrieves the name of the interface. - * - * @return name - */ - public String name() { - return name; - } - - /** - * Retrieves the connection point that this interface maps to. - * - * @return the connection point - */ - public ConnectPoint connectPoint() { - return connectPoint; - } - - /** - * Retrieves the set of IP addresses that are assigned to the interface. - * - * @return the set of interface IP addresses - */ - public Set<InterfaceIpAddress> ipAddresses() { - return ipAddresses; - } - - /** - * Retrieves the MAC address that is assigned to the interface. - * - * @return the MAC address - */ - public MacAddress mac() { - return macAddress; - } - - /** - * Retrieves the VLAN ID that is assigned to the interface. - * - * @return the VLAN ID - */ - public VlanId vlan() { - return vlan; - } - - @Override - public boolean equals(Object other) { - if (!(other instanceof Interface)) { - return false; - } - - Interface otherInterface = (Interface) other; - - return Objects.equals(name, otherInterface.name) && - Objects.equals(connectPoint, otherInterface.connectPoint) && - Objects.equals(ipAddresses, otherInterface.ipAddresses) && - Objects.equals(macAddress, otherInterface.macAddress) && - Objects.equals(vlan, otherInterface.vlan); - } - - @Override - public int hashCode() { - return Objects.hash(connectPoint, name, ipAddresses, macAddress, vlan); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()) - .add("name", name) - .add("connectPoint", connectPoint) - .add("ipAddresses", ipAddresses) - .add("macAddress", macAddress) - .add("vlan", vlan) - .toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java deleted file mode 100644 index 32d480d6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.intf; - -import org.onosproject.net.ConnectPoint; - -/** - * Provides a means to modify the interfaces configuration. - */ -public interface InterfaceAdminService { - - /** - * Adds a new interface configuration to the system. - * - * @param intf interface to add - */ - void add(Interface intf); - - /** - * Removes an interface configuration from the system. - * - * @param connectPoint connect point of the interface - * @param name name of the interface - */ - boolean remove(ConnectPoint connectPoint, String name); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java deleted file mode 100644 index b164df93..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.intf; - -import com.google.common.annotations.Beta; -import org.onlab.packet.IpAddress; -import org.onlab.packet.VlanId; -import org.onosproject.net.ConnectPoint; - -import java.util.Set; - -/** - * Service for interacting with interfaces. - */ -@Beta -public interface InterfaceService { - - /** - * Returns the set of all interfaces in the system. - * - * @return set of interfaces - */ - Set<Interface> getInterfaces(); - - /** - * Returns the set of interfaces configured on the given port. - * - * @param port connect point - * @return set of interfaces - */ - Set<Interface> getInterfacesByPort(ConnectPoint port); - - /** - * Returns the set of interfaces with the given IP address. - * - * @param ip IP address - * @return set of interfaces - */ - Set<Interface> getInterfacesByIp(IpAddress ip); - - /** - * Returns the set of interfaces in the given VLAN. - * - * @param vlan VLAN ID of the interfaces - * @return set of interfaces - */ - Set<Interface> getInterfacesByVlan(VlanId vlan); - - /** - * Returns an interface that has an address that is in the same subnet as - * the given IP address. - * - * @param ip IP address to find matching subnet interface for - * @return interface - */ - Interface getMatchingInterface(IpAddress ip); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java deleted file mode 100644 index 6cea24d1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Interface Service. - */ -package org.onosproject.incubator.net.intf; diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java deleted file mode 100644 index 868eec7a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Incubating network model abstractions and APIs. - */ -package org.onosproject.incubator.net;
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java deleted file mode 100644 index 1065503a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.resource.label; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotations; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderId; -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * the implementation of a label resource of a device. - */ -@Beta -public final class DefaultLabelResource implements LabelResource { - - private DeviceId deviceId; - - private LabelResourceId labelResourceId; - - /** - * Initialize a label resource object. - * @param deviceId device identifier - * @param labelResourceId label resource id - */ - public DefaultLabelResource(String deviceId, long labelResourceId) { - this.deviceId = DeviceId.deviceId(deviceId); - this.labelResourceId = LabelResourceId.labelResourceId(labelResourceId); - } - - /** - * Initialize a label resource object. - * @param deviceId device identifier - * @param labelResourceId label resource id - */ - public DefaultLabelResource(DeviceId deviceId, - LabelResourceId labelResourceId) { - this.deviceId = deviceId; - this.labelResourceId = labelResourceId; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - @Override - public LabelResourceId labelResourceId() { - return labelResourceId; - } - - @Override - public Annotations annotations() { - return null; - } - - @Override - public ProviderId providerId() { - return null; - } - - @Override - public int hashCode() { - return Objects.hash(deviceId, labelResourceId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof DefaultLabelResource) { - DefaultLabelResource that = (DefaultLabelResource) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.labelResourceId, - that.labelResourceId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("deviceId", deviceId) - .add("labelResourceId", labelResourceId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java deleted file mode 100644 index 6d5a90be..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotated; -import org.onosproject.net.DeviceId; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Provided; - -/** - * Representation of label resource. - */ -@Beta -public interface LabelResource extends Annotated, Provided, NetworkResource { - /** - * Returns device id. - * @return DeviceId - */ - DeviceId deviceId(); - - /** - * Returns label resource identifier. - * - * @return resource id - */ - LabelResourceId labelResourceId(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java deleted file mode 100644 index a6108bb6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -/** - * Service for managing label resource. - */ -@Beta -public interface LabelResourceAdminService { - /** - * Creates the only label resource of some device id from begin label to end - * label. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Creates the only global label resource pool. - * - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Destroys a label resource pool of a specific device id. - * - * @param deviceId device identifier - * @return success or fail - */ - boolean destroyDevicePool(DeviceId deviceId); - - /** - * Destroys the global label resource pool. - * - * @return success or fail - */ - boolean destroyGlobalPool(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java deleted file mode 100644 index ae88be57..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.store.StoreDelegate; - -/** - * Label resource store delegate. - */ -@Beta -public interface LabelResourceDelegate extends StoreDelegate<LabelResourceEvent> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java deleted file mode 100644 index dd02ae21..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -/** - * Describes label resource event. - */ -@Beta -public final class LabelResourceEvent - extends AbstractEvent<LabelResourceEvent.Type, LabelResourcePool> { - - /** - * Type of label resource event. - */ - public enum Type { - /** - * Signifies that a new pool has been administratively created. - */ - POOL_CREATED, - /** - * Signifies that a new pool has been administratively destroyed. - */ - POOL_DESTROYED, - /** - * Signifies that a new pool has been administratively changed. - */ - POOL_CAPACITY_CHANGED - } - - /** - * Creates an event of a given type and the given LabelResourcePool. - * - * @param type event type - * @param subject pool - */ - public LabelResourceEvent(Type type, LabelResourcePool subject) { - super(type, subject); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java deleted file mode 100644 index 6fe7067d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.resource.ResourceId; - -import java.util.Objects; - -/** - * Representation of a label. - */ -@Beta -public final class LabelResourceId implements ResourceId { - - private long labelId; - - public static LabelResourceId labelResourceId(long labelResourceId) { - return new LabelResourceId(labelResourceId); - } - - // Public construction is prohibited - private LabelResourceId(long labelId) { - this.labelId = labelId; - } - - public long labelId() { - return labelId; - } - - @Override - public int hashCode() { - return Objects.hashCode(labelId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourceId) { - LabelResourceId that = (LabelResourceId) obj; - return Objects.equals(this.labelId, that.labelId); - } - return false; - } - - @Override - public String toString() { - return String.valueOf(this.labelId); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java deleted file mode 100644 index b7f907c6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving label resource related events. - */ -@Beta -public interface LabelResourceListener extends EventListener<LabelResourceEvent> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java deleted file mode 100644 index 75916af0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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.resource.label; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Collections; -import java.util.Objects; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Abstraction of the capacity of device label resource or global label - * resource. It's contiguous range of label resource. When a application apply - * some labels of some device, first catch from Set that store - * available labels, if the size of the Set less than the apply number, then get - * labels by calculating with three attributes, beginLabel,endLabel and - * currentUsedMaxLabelId. - */ -@Beta -public class LabelResourcePool { - - private final DeviceId deviceId; - private final LabelResourceId beginLabel; - private final LabelResourceId endLabel; - private final long totalNum; // capacity of label resource pool - private final long usedNum; // have used label number - private final LabelResourceId currentUsedMaxLabelId; // the maximal label - // number id - private ImmutableSet<LabelResource> releaseLabelId; // Set of released label - - /** - * Creates a pool by device id,begin label id,end label id. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * resource pool - * @param endLabel represents for the last label id in the range of label - * resource pool - */ - public LabelResourcePool(String deviceId, long beginLabel, long endLabel) { - this(deviceId, beginLabel, endLabel, endLabel - beginLabel + 1, 0L, - beginLabel, ImmutableSet.copyOf(Collections.emptySet())); - } - - /** - * Creates a pool by device id,begin label id,end label id. - * Used to update a pool in the store. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * resource pool - * @param endLabel represents for the last label id in the range of label - * resource pool - * @param totalNum capacity of label resource pool - * @param usedNum have used label number - * @param currentUsedMaxLabelId the maximal label number id - * @param releaseLabelId Set of released label - */ - public LabelResourcePool(String deviceId, long beginLabel, long endLabel, - long totalNum, long usedNum, - long currentUsedMaxLabelId, - ImmutableSet<LabelResource> releaseLabelId) { - checkArgument(endLabel >= beginLabel, - "endLabel %s must be greater than or equal to beginLabel %s", - endLabel, beginLabel); - this.deviceId = DeviceId.deviceId(deviceId); - this.beginLabel = LabelResourceId.labelResourceId(beginLabel); - this.endLabel = LabelResourceId.labelResourceId(endLabel); - this.totalNum = totalNum; - this.usedNum = usedNum; - this.currentUsedMaxLabelId = LabelResourceId - .labelResourceId(currentUsedMaxLabelId); - this.releaseLabelId = releaseLabelId; - } - - /** - * Returns a device id. - * - * @return DeviceId - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns a begin Label id. - * - * @return begin Label id - */ - public LabelResourceId beginLabel() { - return beginLabel; - } - - /** - * Returns an end Label id. - * - * @return end Label id - */ - public LabelResourceId endLabel() { - return endLabel; - } - - /** - * Returns a begin Label id. - * - * @return current Used Maximal Label Id - */ - public LabelResourceId currentUsedMaxLabelId() { - return currentUsedMaxLabelId; - } - - /** - * Returns total number. - * - * @return the total label number - */ - public long totalNum() { - return totalNum; - } - - /** - * Returns used number. - * - * @return the used label number - */ - public long usedNum() { - return usedNum; - } - - /** - * Returns the Set of released label before. - * - * @return the Set of LabelResource - */ - public Set<LabelResource> releaseLabelId() { - return releaseLabelId; - } - - @Override - public int hashCode() { - return Objects.hash(this.deviceId, this.beginLabel, this.endLabel, - this.totalNum, this.usedNum, - this.currentUsedMaxLabelId, this.releaseLabelId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourcePool) { - LabelResourcePool that = (LabelResourcePool) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.beginLabel, that.beginLabel) - && Objects.equals(this.endLabel, that.endLabel) - && Objects.equals(this.totalNum, that.totalNum) - && Objects.equals(this.usedNum, that.usedNum) - && Objects.equals(this.currentUsedMaxLabelId, - that.currentUsedMaxLabelId) - && Objects.equals(this.releaseLabelId, that.releaseLabelId); - } - return false; - } - - @Override - public String toString() { - // TODO Auto-generated method stub - return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId) - .add("beginLabel", this.beginLabel) - .add("endLabel", this.endLabel).add("totalNum", this.totalNum) - .add("usedNum", this.usedNum) - .add("currentUsedMaxLabelId", this.currentUsedMaxLabelId) - .add("releaseLabelId", this.releaseLabelId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java deleted file mode 100644 index 821177a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of an entity providing information about label resource - * to the core. - */ -@Beta -public interface LabelResourceProvider extends Provider { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java deleted file mode 100644 index e6234974..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of an label resource provider registry. - */ -@Beta -public interface LabelResourceProviderRegistry - extends ProviderRegistry<LabelResourceProvider, LabelResourceProviderService> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java deleted file mode 100644 index 9a1472d6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -/** - * Means for injecting label information into the core. - */ -@Beta -public interface LabelResourceProviderService extends ProviderService<LabelResourceProvider> { - - /** - * Signals that a device label resource pool has been detected. - * @param deviceId device identifier - * @param beginLabel the begin label number of resource - * @param endLabel the end label number of resource - */ - void deviceLabelResourcePoolDetected(DeviceId deviceId, - LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Signals that an label resource pool has been destroyed. - * @param deviceId device identifier - */ - void deviceLabelResourcePoolDestroyed(DeviceId deviceId); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java deleted file mode 100644 index 9ff6a587..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.resource.label; - -import java.util.Collection; -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Represents for a label request. - */ -@Beta -public class LabelResourceRequest { - - private final DeviceId deviceId; - private final Type type; - private final long applyNum; - private ImmutableSet<LabelResource> releaseCollection; - - /** - * Creates LabelResourceRequest object. - * @param deviceId device identifier - * @param type request type - * @param applyNum apply the number of labels - * @param releaseCollection Set of released label - */ - public LabelResourceRequest(DeviceId deviceId, - Type type, - long applyNum, - ImmutableSet<LabelResource> releaseCollection) { - this.deviceId = deviceId; - this.type = type; - this.applyNum = applyNum; - this.releaseCollection = releaseCollection; - } - /** - * Returns a device id. - * @return DeviceId - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns request type. - * @return Type - */ - public Type type() { - return type; - } - - /** - * Returns apply label number. - * @return label number - */ - public long applyNum() { - return applyNum; - } - - /** - * Returns the collection of release labels. - * @return Collection of DefaultLabelResource - */ - public Collection<LabelResource> releaseCollection() { - return releaseCollection; - } - - /** - * Request type. - */ - public enum Type { - APPLY, //apple label request - RELEASE //release label request - } - - @Override - public int hashCode() { - return Objects.hash(this.deviceId, this.applyNum, this.type, - this.releaseCollection); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourceRequest) { - LabelResourceRequest that = (LabelResourceRequest) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.applyNum, that.applyNum) - && Objects.equals(this.type, that.type) - && Objects.equals(this.releaseCollection, - that.releaseCollection); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId) - .add("applyNum", this.applyNum).add("type", this.type) - .add("releaseCollection", this.releaseCollection).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java deleted file mode 100644 index bb86d475..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.resource.label; - -import java.util.Collection; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.event.ListenerService; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.Multimap; - -/** - * Service for providing label resource allocation. - */ -@Beta -public interface LabelResourceService - extends ListenerService<LabelResourceEvent, LabelResourceListener> { - - /** - * Returns labels from resource pool by a specific device id. - * - * @param deviceId device identifier - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection<LabelResource> applyFromDevicePool(DeviceId deviceId, - long applyNum); - - /** - * Returns labels from the global label resource pool. - * - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection<LabelResource> applyFromGlobalPool(long applyNum); - - /** - * Releases unused labels to device pools . - * - * @param release the collection of releasing labels - * @return success or fail - */ - boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release); - - /** - * Releases unused labels to the global resource pool. - * - * @param release release the collection of releasing labels - * @return success or fail - */ - boolean releaseToGlobalPool(Set<LabelResourceId> release); - - /** - * Judges if the pool of a specific device id is full. - * - * @param deviceId device identifier - * @return yes or no - */ - boolean isDevicePoolFull(DeviceId deviceId); - - /** - * Judges if the global resource pool is full. - * - * @return yes or no - */ - boolean isGlobalPoolFull(); - - /** - * Returns the unused label number of a label resource pool by a specific device - * id. - * - * @param deviceId device identifier - * @return number of unused labels - */ - long getFreeNumOfDevicePool(DeviceId deviceId); - - /** - * Returns the unused label number of a global label resource pool. - * - * @return number of unused labels - */ - long getFreeNumOfGlobalPool(); - - /** - * Returns the label resource pool of a label resource by a specific device - * id. - * - * @param deviceId device identifier - * @return the device label resource pool - */ - LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId); - - /** - * Returns the global label resource pool. - * - * @return the global label resource pool - */ - LabelResourcePool getGlobalLabelResourcePool(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java deleted file mode 100644 index 5322d013..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.resource.label; - -import java.util.Collection; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; -import org.onosproject.store.Store; - -import com.google.common.collect.Multimap; - -/** - * Manages inventory of label; not intended for direct use. - * - */ -@Beta -public interface LabelResourceStore - extends Store<LabelResourceEvent, LabelResourceDelegate> { - - /** - * Creates a label resource of some device id from begin label to end label. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Creates the global label resource pool. - * - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Destroys a label resource pool of a specific device id. - * - * @param deviceId device identifier - * @return success or fail - */ - boolean destroyDevicePool(DeviceId deviceId); - - /** - * Destroys a the global label resource pool. - * - * @return success or fail - */ - boolean destroyGlobalPool(); - - /** - * Returns labels from resource pool by a specific device id. - * - * @param deviceId device identifier - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection<LabelResource> applyFromDevicePool(DeviceId deviceId, - long applyNum); - - /** - * Returns labels from the global label resource pool. - * - * @param applyNum apply the number of labels - * @return collection of labels - */ - Collection<LabelResource> applyFromGlobalPool(long applyNum); - - /** - * Releases unused labels to device pools . - * - * @param release the collection of releasing labels - * @return success or fail - */ - boolean releaseToDevicePool(Multimap<DeviceId, LabelResource> release); - - /** - * Releases unused labels to the global resource pool. - * - * @param release release the collection of releasing labels - * @return success or fail - */ - boolean releaseToGlobalPool(Set<LabelResourceId> release); - - /** - * Judges if the pool of a specific device id is full. - * - * @param deviceId device identifier - * @return yes or no - */ - boolean isDevicePoolFull(DeviceId deviceId); - - /** - * Judges if the global resource pool is full. - * - * @return yes or no - */ - boolean isGlobalPoolFull(); - - /** - * Returns the unused label number of a label resource pool by a specific device - * id. - * - * @param deviceId device identifier - * @return number of unused labels - */ - long getFreeNumOfDevicePool(DeviceId deviceId); - - /** - * Returns the unused number of a global label resource pool. - * - * @return number of unused labels - */ - long getFreeNumOfGlobalPool(); - - /** - * Returns the label resource pool by a specific device id. - * - * @param deviceId device identifier - * @return the device label resource pool - */ - LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId); - - /** - * Returns the global label resource pool. - * - * @return the global label resource pool - */ - LabelResourcePool getGlobalLabelResourcePool(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java deleted file mode 100644 index 9df466e9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Service for reserving labels as network resources. - */ -package org.onosproject.incubator.net.resource.label;
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java deleted file mode 100644 index ae0f5148..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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.tunnel; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; -import java.util.Optional; - -import com.google.common.annotations.Beta; -import org.onosproject.net.AbstractModel; -import org.onosproject.net.Annotations; -import org.onosproject.net.ElementId; -import org.onosproject.net.PortNumber; -import org.onosproject.net.provider.ProviderId; - -/** - * Default optical tunnel point model implementation. - */ -@Beta -public class DefaultOpticalTunnelEndPoint extends AbstractModel implements OpticalTunnelEndPoint { - private final Optional<ElementId> elementId; - private final Optional<PortNumber> portNumber; - private final Optional<OpticalTunnelEndPoint> parentPoint; - private final Type type; - private final OpticalLogicId id; - private final boolean isGlobal; - - /** - * Creates a optical tunnel point attributed to the specified provider (may be null). - * if provider is null, which means the optical tunnel point is not managed by the SB. - * - * @param providerId tunnelProvider Id - * @param elementId parent network element - * @param number port number - * @param parentPoint parent port or parent label - * @param type port type - * @param id LabelId - * @param isGlobal indicator whether the label is global significant or not - * @param annotations optional key/value annotations - */ - public DefaultOpticalTunnelEndPoint(ProviderId providerId, Optional<ElementId> elementId, - Optional<PortNumber> number, Optional<OpticalTunnelEndPoint> parentPoint, - Type type, OpticalLogicId id, boolean isGlobal, Annotations... annotations) { - super(providerId, annotations); - this.elementId = elementId; - this.portNumber = number; - this.parentPoint = parentPoint; - this.id = id; - this.type = type; - this.isGlobal = isGlobal; - } - - @Override - public OpticalLogicId id() { - return id; - } - - @Override - public Optional<ElementId> elementId() { - return elementId; - } - - @Override - public Optional<PortNumber> portNumber() { - return portNumber; - } - - @Override - public Optional<OpticalTunnelEndPoint> parentPoint() { - return parentPoint; - } - - @Override - public boolean isGlobal() { - return isGlobal; - } - - @Override - public Type type() { - return type; - } - - @Override - public int hashCode() { - return Objects.hash(elementId, portNumber, parentPoint, id); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultOpticalTunnelEndPoint) { - final DefaultOpticalTunnelEndPoint other = (DefaultOpticalTunnelEndPoint) obj; - return Objects.equals(this.id, other.id) && - Objects.equals(this.type, other.type) && - Objects.equals(this.isGlobal, other.isGlobal) && - Objects.equals(this.elementId, other.elementId) && - Objects.equals(this.portNumber, other.portNumber) && - Objects.equals(this.parentPoint, other.parentPoint); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("elementId", elementId) - .add("portNumber", portNumber) - .add("parentPoint", parentPoint) - .add("type", type) - .add("id", id) - .add("isGlobal", isGlobal) - .toString(); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java deleted file mode 100755 index 86a790f4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2014-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.tunnel; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.AbstractModel; -import org.onosproject.net.Annotations; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Path; -import org.onosproject.net.provider.ProviderId; - -/** - * The default implementation of an network tunnel. supports for creating a - * tunnel by connect point ,IP address, MAC address, device and so on. - */ -@Beta -public final class DefaultTunnel extends AbstractModel implements Tunnel { - - private final TunnelEndPoint src; // a source point of tunnel. - private final TunnelEndPoint dst; // a destination point of tunnel. - private final State state; - private final Type type; // tunnel type - private final DefaultGroupId groupId; // represent for a group flow table - // which a tunnel match up - // tunnel producer - private final TunnelId tunnelId; // tunnel identify generated by - // ONOS as primary key - private final TunnelName tunnelName; // name of a tunnel - private final Path path; - - /** - * Creates an active infrastructure tunnel using the supplied information. - * - * @param producerName provider identity - * @param src tunnel source - * @param dst tunnel destination - * @param type tunnel type - * @param groupId groupId - * @param tunnelId tunnelId - * @param tunnelName tunnel name - * @param path the path of tunnel - * @param annotations optional key/value annotations - */ - public DefaultTunnel(ProviderId producerName, TunnelEndPoint src, - TunnelEndPoint dst, Type type, DefaultGroupId groupId, - TunnelId tunnelId, TunnelName tunnelName, Path path, - Annotations... annotations) { - this(producerName, src, dst, type, Tunnel.State.ACTIVE, groupId, - tunnelId, tunnelName, path, annotations); - } - - /** - * Creates an tunnel using the supplied information. - * - * @param producerName provider identity - * @param src tunnel source - * @param dst tunnel destination - * @param type tunnel type - * @param state tunnel state - * @param groupId groupId - * @param tunnelId tunnelId - * @param tunnelName tunnel name - * @param path the path of tunnel - * @param annotations optional key/value annotations - */ - public DefaultTunnel(ProviderId producerName, TunnelEndPoint src, - TunnelEndPoint dst, Type type, State state, - DefaultGroupId groupId, TunnelId tunnelId, - TunnelName tunnelName, Path path, Annotations... annotations) { - super(producerName, annotations); - this.src = src; - this.dst = dst; - this.type = type; - this.state = state; - this.groupId = groupId; - this.tunnelId = tunnelId; - this.tunnelName = tunnelName; - this.path = path; - } - - @Override - public TunnelEndPoint src() { - return src; - } - - @Override - public TunnelEndPoint dst() { - return dst; - } - - @Override - public Type type() { - return type; - } - - @Override - public State state() { - return state; - } - - @Override - public NetworkResource resource() { - return null; - } - - @Override - public TunnelId tunnelId() { - return tunnelId; - } - - @Override - public DefaultGroupId groupId() { - return groupId; - } - - @Override - public TunnelName tunnelName() { - return tunnelName; - } - - - @Override - public Path path() { - return path; - } - - @Override - public int hashCode() { - return Objects.hash(src, dst, type, groupId, tunnelId, tunnelName, - state, path); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultTunnel) { - final DefaultTunnel other = (DefaultTunnel) obj; - return Objects.equals(this.src, other.src) - && Objects.equals(this.dst, other.dst) - && Objects.equals(this.type, other.type) - && Objects.equals(this.groupId, other.groupId) - && Objects.equals(this.tunnelId, other.tunnelId) - && Objects.equals(this.tunnelName, other.tunnelName) - && Objects.equals(this.state, other.state) - && Objects.equals(this.path, other.path); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("src", src).add("dst", dst) - .add("type", type).add("state", state).add("groupId", groupId) - .add("producerTunnelId", tunnelId) - .add("tunnelName", tunnelName) - .add("path", path).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java deleted file mode 100755 index 055934a0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.AbstractDescription; -import org.onosproject.net.Path; -import org.onosproject.net.SparseAnnotations; -import org.onosproject.net.provider.ProviderId; - -import com.google.common.base.MoreObjects; - -/** - * Default implementation of immutable tunnel description entity. - */ -@Beta -public class DefaultTunnelDescription extends AbstractDescription - implements TunnelDescription { - - private final TunnelId tunnelId; - private final TunnelEndPoint src; - private final TunnelEndPoint dst; - private final Tunnel.Type type; - private final DefaultGroupId groupId; // represent for a group flow table - // which a tunnel match up - // tunnel producer - private final ProviderId producerName; // tunnel producer name - private final TunnelName tunnelName; // name of a tunnel - private final Path path; - - /** - * Creates a tunnel description using the supplied information. - * - * @param id TunnelId - * @param src TunnelPoint source - * @param dst TunnelPoint destination - * @param type tunnel type - * @param groupId groupId - * @param producerName tunnel producer - * @param tunnelName tunnel name - * @param path the path of tunnel - * @param annotations optional key/value annotations - */ - public DefaultTunnelDescription(TunnelId id, TunnelEndPoint src, - TunnelEndPoint dst, Tunnel.Type type, - DefaultGroupId groupId, - ProviderId producerName, - TunnelName tunnelName, - Path path, - SparseAnnotations... annotations) { - super(annotations); - this.tunnelId = id; - this.src = src; - this.dst = dst; - this.type = type; - this.groupId = groupId; - this.producerName = producerName; - this.tunnelName = tunnelName; - this.path = path; - } - - @Override - public TunnelId id() { - return tunnelId; - } - - @Override - public TunnelEndPoint src() { - return src; - } - - @Override - public TunnelEndPoint dst() { - return dst; - } - - @Override - public Tunnel.Type type() { - return type; - } - - @Override - public DefaultGroupId groupId() { - return groupId; - } - - @Override - public ProviderId producerName() { - return producerName; - } - - @Override - public TunnelName tunnelName() { - return tunnelName; - } - - - @Override - public Path path() { - return path; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("tunnelId", id()) - .add("src", src()) - .add("dst", dst()) - .add("type", type()) - .add("tunnelName", tunnelName()) - .add("producerName", producerName()) - .add("groupId", groupId()) - .add("path", path) - .toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java deleted file mode 100644 index cab9ae43..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; - -import java.time.Duration; -import java.util.List; - -/** - * Default implementation of immutable tunnel statistics. - */ -@Beta -public final class DefaultTunnelStatistics implements TunnelStatistics { - private final TunnelId tunnelId; - private final double bwUtilization; - private final double packetLossRatio; - private final Duration flowDelay; - private final List<String> alarms; - - private DefaultTunnelStatistics(TunnelId tunnelId, - double bwUtilization, - double packetLossRatio, - Duration flowDelay, - List<String> alarms) { - this.tunnelId = tunnelId; - this.bwUtilization = bwUtilization; - this.packetLossRatio = packetLossRatio; - this.flowDelay = flowDelay; - this.alarms = alarms; - } - - private DefaultTunnelStatistics() { - this.tunnelId = null; - this.bwUtilization = 0; - this.packetLossRatio = 0; - this.flowDelay = null; - this.alarms = null; - } - - - @Override - public TunnelId id() { - return this.tunnelId; - } - - @Override - public double bandwidthUtilization() { - return this.bwUtilization; - } - - @Override - public double packetLossRate() { - return this.packetLossRatio; - } - - @Override - public Duration flowDelay() { - return this.flowDelay; - } - - - @Override - public List<String> alarms() { - return this.alarms; - } - - /** - * Builder for tunnelStatistics. - */ - public static final class Builder { - TunnelId tunnelId; - double bwUtilization; - double packetLossRatio; - Duration flowDelay; - List<String> alarms; - - public Builder() { - - } - - /** - * Set tunnel id. - * - * @param tunnelId tunnel id - * @return builder object - */ - public Builder setTunnelId(TunnelId tunnelId) { - this.tunnelId = tunnelId; - - return this; - } - - /** - * set bandwidth utilization. - * - * @param bwUtilization bandwidth utilization - * @return builder object - */ - public Builder setBwUtilization(double bwUtilization) { - this.bwUtilization = bwUtilization; - - return this; - } - - /** - * Set packet loss ratio. - * - * @param packetLossRatio packet loss ratio - * @return builder object - */ - public Builder setPacketLossRatio(double packetLossRatio) { - this.packetLossRatio = packetLossRatio; - - return this; - } - - /** - * Set flow delay. - * - * @param flowDelay flow delay - * @return builder object - */ - public Builder setFlowDelay(Duration flowDelay) { - this.flowDelay = flowDelay; - - return this; - } - - /** - * Set alarms. - * - * @param alarms alarms of a tunnel - * @return builder object - */ - public Builder setAlarms(List<String> alarms) { - this.alarms = alarms; - - return this; - } - - /** - * Creates a TunnelStatistics object. - * - * @return DefaultTunnelStatistics - */ - public DefaultTunnelStatistics build() { - return new DefaultTunnelStatistics(tunnelId, - bwUtilization, - packetLossRatio, - flowDelay, - alarms); - } - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java deleted file mode 100644 index 430823ca..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.tunnel; - -/** - * A wrapper class for a long used to identify domain level tunnels. - */ -public final class DomainTunnelId { - - private final long value; - - /** - * Creates a tunnel identifier from the specified tunnel. - * - * @param value long value - * @return domain tunnel identifier - */ - public static DomainTunnelId valueOf(long value) { - return new DomainTunnelId(value); - } - - /** - * Creates a tunnel identifier from the specified tunnel. - * - * @param value long value as a string - * @return domain tunnel identifier - */ - public static DomainTunnelId valueOf(String value) { - return new DomainTunnelId(Long.parseLong(value)); - } - - /** - * Constructor for serializer. - */ - protected DomainTunnelId() { - this.value = 0; - } - - /** - * Constructs the Domain ID corresponding to a given long value. - * - * @param value the underlying value of this domain ID - */ - public DomainTunnelId(long value) { - this.value = value; - } - - /** - * Returns the backing value of this domain ID. - * - * @return the long value - */ - public long id() { - return value; - } - - @Override - public int hashCode() { - return Long.hashCode(value); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof DomainTunnelId)) { - return false; - } - DomainTunnelId that = (DomainTunnelId) obj; - return this.value == that.value; - } - - @Override - public String toString() { - return "0x" + Long.toHexString(value); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java deleted file mode 100644 index ad41adf6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.tunnel; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onlab.packet.IpAddress; - -import com.google.common.base.MoreObjects; - -/** - * Represent for a tunnel point using ip address. - */ -@Beta -public final class IpTunnelEndPoint implements TunnelEndPoint { - - private final IpAddress ip; - - /** - * Public construction is prohibited. - * @param ip ip address - */ - private IpTunnelEndPoint(IpAddress ip) { - this.ip = ip; - } - - /** - * Create a IP tunnel end point. - * @param ip IP address - * @return IpTunnelEndPoint - */ - public static IpTunnelEndPoint ipTunnelPoint(IpAddress ip) { - return new IpTunnelEndPoint(ip); - } - - /** - * Returns IP address. - * @return IP address - */ - public IpAddress ip() { - return ip; - } - - @Override - public int hashCode() { - return Objects.hash(ip); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IpTunnelEndPoint) { - final IpTunnelEndPoint other = (IpTunnelEndPoint) obj; - return Objects.equals(this.ip, other.ip); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()).add("ip", ip).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java deleted file mode 100644 index a3de7883..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; - -/** - * Representation of a Network Tunnel Id. - */ -@Beta -public final class NetworkTunnelId { - private final long value; - - /** - * Creates an tunnel identifier from the specified tunnel. - * - * @param value long value - * @return tunnel identifier - */ - public static NetworkTunnelId valueOf(long value) { - return new NetworkTunnelId(value); - } - - public static NetworkTunnelId valueOf(String value) { - return new NetworkTunnelId(Long.parseLong(value)); - } - - /** - * Constructor for serializer. - */ - NetworkTunnelId() { - this.value = 0; - } - - /** - * Constructs the ID corresponding to a given long value. - * - * @param value the underlying value of this ID - */ - public NetworkTunnelId(long value) { - this.value = value; - } - - /** - * Returns the backing value. - * - * @return the value - */ - public long id() { - return value; - } - - @Override - public int hashCode() { - return Long.hashCode(value); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof NetworkTunnelId)) { - return false; - } - NetworkTunnelId that = (NetworkTunnelId) obj; - return this.value == that.value; - } - - @Override - public String toString() { - return "0x" + Long.toHexString(value); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java deleted file mode 100644 index d5994863..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.tunnel; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import com.google.common.primitives.UnsignedLongs; - -/** - * Representation of a label Id, a logical port identifier. - */ -@Beta -public final class OpticalLogicId { - /** - * Represents a logical Id. - */ - private final long logicId; - - /** - * Constructor, public creation is prohibited. - */ - private OpticalLogicId(long id) { - this.logicId = id; - } - - /** - * Returns the LabelId representing the specified long value. - * - * @param id identifier as long value - * @return LabelId - */ - public static OpticalLogicId logicId(long id) { - return new OpticalLogicId(id); - } - - public static OpticalLogicId logicId(String string) { - return new OpticalLogicId(UnsignedLongs.decode(string)); - } - - public long toLong() { - return logicId; - } - - @Override - public String toString() { - return UnsignedLongs.toString(logicId); - } - - @Override - public int hashCode() { - return Objects.hashCode(logicId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof OpticalLogicId) { - final OpticalLogicId other = (OpticalLogicId) obj; - return this.logicId == other.logicId; - } - return false; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java deleted file mode 100644 index 7d72398d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.tunnel; - -import java.util.Optional; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotated; -import org.onosproject.net.ElementId; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.PortNumber; -import org.onosproject.net.Provided; - -/** - * Generic representation of a logical port entity in a consistent way, - * it is used to identify e.g., ODUk timeSlot, WDM lambda, etc. - * It supports nested case. - */ -@Beta -public interface OpticalTunnelEndPoint extends TunnelEndPoint, Annotated, Provided, NetworkResource { - - /** Represents coarse tunnel point type classification. */ - public enum Type { - /** - * Signifies optical data unit-based tunnel point. - */ - TIMESLOT, - - /** - * Signifies optical wavelength-based tunnel point. - */ - LAMBDA - } - - /** - * Returns the identifier. - * - * @return identifier - */ - OpticalLogicId id(); - - /** - * Returns the parent network element to which this tunnel point belongs. - * - * @return parent network element - */ - Optional<ElementId> elementId(); - - /** - * Returns the parent network port to which this tunnel point belongs, can not be be null. - * - * @return port number - */ - Optional<PortNumber> portNumber(); - - /** - * Returns the parent tunnel point to which this tunnel point belongs, optional. - * - * @return parent tunnel point, if it is null, the parent is a physical port - */ - Optional<OpticalTunnelEndPoint> parentPoint(); - - /** - * Indicates whether or not the port is global significant. - * - * @return true if the port is global significant - */ - boolean isGlobal(); - - /** - * Returns the tunnel point type. - * - * @return tunnel point type - */ - Type type(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java deleted file mode 100755 index 33af106d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.Annotated; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Path; -import org.onosproject.net.Provided; - -/** - * Abstraction of a generalized Tunnel entity (bandwidth pipe) for either L3/L2 - * networks or L1/L0 networks, representation of e.g., VLAN, GRE tunnel, MPLS - * LSP, L1 ODUk connection, WDM OCH, etc.. Each Tunnel is associated with at - * least two tunnel end point objects that model the logical ports essentially. - * Note that it supports nested case. - */ -@Beta -public interface Tunnel extends Annotated, Provided, NetworkResource { - - /** - * Tunnel technology type. - */ - enum Type { - /** - * Signifies that this is a MPLS tunnel. - */ - MPLS, - /** - * Signifies that this is a L2 tunnel. - */ - VLAN, - /** - * Signifies that this is a DC L2 extension tunnel. - */ - VXLAN, - /** - * Signifies that this is a L3 tunnel. - */ - GRE, - /** - * Signifies that this is a L1 OTN tunnel. - */ - ODUK, - /** - * Signifies that this is a L0 OCH tunnel. - */ - OCH - } - - /** - * Representation of the tunnel state. - */ - public enum State { - /** - * Signifies that a tunnel is currently in a initialized state. - */ - INIT, - /** - * Signifies that a tunnel is currently established but no traffic. - */ - ESTABLISHED, - /** - * Signifies that a tunnel is currently active. This state means that - * this tunnel is available. It can be borrowed by consumer. - */ - ACTIVE, - /** - * Signifies that a tunnel is currently out of service. - */ - FAILED, - /** - * Signifies that a tunnel is currently inactive. This state means that - * this tunnel can not be borrowed by consumer. - */ - INACTIVE - } - - /** - * Returns the tunnel state. - * - * @return tunnel state - */ - State state(); - - /** - * the origin of a tunnel. - * - * @return the origin of a tunnel - */ - TunnelEndPoint src(); - - /** - * the terminal of a tunnel. - * - * @return the terminal of a tunnel - */ - TunnelEndPoint dst(); - - /** - * Returns the tunnel type. - * - * @return tunnel type - */ - Type type(); - - /** - * Returns group flow table id which a tunnel match up. - * - * @return OpenFlowGroupId - */ - DefaultGroupId groupId(); - - /** - * Returns tunnel identify generated by ONOS as primary key. - * - * @return TunnelId - */ - TunnelId tunnelId(); - - /** - * Return the name of a tunnel. - * - * @return Tunnel Name - */ - TunnelName tunnelName(); - - /** - * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag. - * - * @return backing resource - */ - NetworkResource resource(); - - /** - * Returns the path of the tunnel. - * - * @return the path of the tunnel - */ - Path path(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java deleted file mode 100644 index 5165a68e..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Path; -import org.onosproject.net.provider.ProviderId; - -/** - * Service for administering the inventory of provisioned tunnels. - */ -@Beta -public interface TunnelAdminService { - - /** - * Removes the provisioned tunnel. - * - * @param tunnelId tunnel ID - */ - void removeTunnel(TunnelId tunnelId); - - /** - * Removes the provisioned tunnel leading to and from the - * specified labels. - * - * @param src source label - * @param dst destination label - * @param producerName producer name - */ - void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst, ProviderId producerName); - - /** - * Removes all provisioned tunnels leading to and from the - * specified connection point. - * - * @param src source connection point - * @param dst destination connection point - * @param type tunnel type - * @param producerName producer name - */ - void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst, Tunnel.Type type, ProviderId producerName); - - /** - * Invokes the core to update a tunnel based on specified tunnel parameters. - * - * @param tunnel Tunnel - * @param path explicit route (path changed) or null (path not changed) for the tunnel - */ - void updateTunnel(Tunnel tunnel, Path path); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java deleted file mode 100755 index a8408bef..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.net.Annotated; -import org.onosproject.net.Description; -import org.onosproject.net.Path; -import org.onosproject.net.provider.ProviderId; - -/** - * Describes a tunnel. - */ -@Beta -public interface TunnelDescription extends Description, Annotated { - - /** - * Returns the tunnel id. - * - * @return tunnelId - */ - TunnelId id(); - - /** - * Returns the connection point source. - * - * @return tunnel source ConnectionPoint - */ - TunnelEndPoint src(); - - /** - * Returns the connection point destination. - * - * @return tunnel destination - */ - TunnelEndPoint dst(); - - /** - * Returns the tunnel type. - * - * @return tunnel type - */ - Type type(); - - /** - * Returns group flow table id which a tunnel match up. - * - * @return OpenFlowGroupId - */ - DefaultGroupId groupId(); - - /** - * Returns tunnel producer name. - * - * @return producer name - */ - ProviderId producerName(); - - /** - * Return the name of a tunnel. - * - * @return Tunnel Name - */ - TunnelName tunnelName(); - - /** - * Returns the path of the tunnel. - * - * @return the path of the tunnel - */ - Path path(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java deleted file mode 100644 index 55890289..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; - -/** - * Represents for source end point or destination end point of a tunnel. Maybe a tunnel - * based on ConnectPoint, IpAddress, MacAddress and so on is built. - */ -@Beta -public interface TunnelEndPoint { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java deleted file mode 100644 index 57af670c..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.tunnel; - - -import com.google.common.annotations.Beta; -import org.onosproject.ui.table.CellFormatter; -import org.onosproject.ui.table.cell.AbstractCellFormatter; - -/** - * Formats a optical tunnel endpoint as "(type)/(element-id)/(port)". - * Formats a ip tunnel endpoint as "ip". - */ -@Beta -public final class TunnelEndPointFormatter extends AbstractCellFormatter { - //non-instantiable - private TunnelEndPointFormatter() { - } - - @Override - protected String nonNullFormat(Object value) { - - if (value instanceof DefaultOpticalTunnelEndPoint) { - DefaultOpticalTunnelEndPoint cp = (DefaultOpticalTunnelEndPoint) value; - return cp.type() + "/" + cp.elementId().get() + "/" + cp.portNumber().get(); - } else if (value instanceof IpTunnelEndPoint) { - IpTunnelEndPoint cp = (IpTunnelEndPoint) value; - return cp.ip().toString(); - } - return ""; - } - - /** - * An instance of this class. - */ - public static final CellFormatter INSTANCE = new TunnelEndPointFormatter(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java deleted file mode 100644 index 18044ee7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -/** - * Describes tunnel events. - */ -@Beta -public final class TunnelEvent extends AbstractEvent<TunnelEvent.Type, Tunnel> { - - /** - * Type of tunnel events. - */ - public enum Type { - /** - * Signifies that a new tunnel has been added. - */ - TUNNEL_ADDED, - - /** - * Signifies that a tunnel has been updated or changed state. - */ - TUNNEL_UPDATED, - - /** - * Signifies that a tunnel has been removed. - */ - TUNNEL_REMOVED - } - - /** - * Creates an event of a given type and for the specified tunnel. - * - * @param type tunnel event type - * @param tunnel event tunnel subject - */ - public TunnelEvent(Type type, Tunnel tunnel) { - super(type, tunnel); - } - - /** - * Creates an event of a given type and for the specified link and - * the current time. - * - * @param type tunnel event type - * @param tunnel event tunnel subject - * @param time occurrence time - */ - public TunnelEvent(Type type, Tunnel tunnel, long time) { - super(type, tunnel, time); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java deleted file mode 100644 index 5a3f97f2..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; - -/** - * Representation of a Tunnel Id. - */ -@Beta -public final class TunnelId { - private final long value; - - /** - * Creates an tunnel identifier from the specified tunnel. - * - * @param value long value - * @return tunnel identifier - */ - public static TunnelId valueOf(long value) { - return new TunnelId(value); - } - - public static TunnelId valueOf(String value) { - return new TunnelId(Long.parseLong(value)); - } - - /** - * Constructor for serializer. - */ - TunnelId() { - this.value = 0; - } - - /** - * Constructs the ID corresponding to a given long value. - * - * @param value the underlying value of this ID - */ - TunnelId(long value) { - this.value = value; - } - - /** - * Returns the backing value. - * - * @return the value - */ - public long id() { - return value; - } - - @Override - public int hashCode() { - return Long.hashCode(value); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof TunnelId)) { - return false; - } - TunnelId that = (TunnelId) obj; - return this.value == that.value; - } - - @Override - public String toString() { - return "0x" + Long.toHexString(value); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java deleted file mode 100644 index b3a69fd4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving tunnel related events. - */ -@Beta -public interface TunnelListener extends EventListener<TunnelEvent> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java deleted file mode 100644 index 77a8c8e8..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -/** - * Represents for a unique tunnel name. TunnelId is generated by ONOS while - * TunnelName is given by producer. The consumer can borrow tunnels with - * TunnelId or TunnelName. - */ -@Beta -public final class TunnelName { - private final String str; - - // Default constructor for serialization - private TunnelName(String tunnelName) { - this.str = tunnelName; - } - - - /** - * Creates a tunnel name using the supplied URI string. - * - * @param tunnelName tunnel name string - * @return tunnel name object - */ - public static TunnelName tunnelName(String tunnelName) { - return new TunnelName(tunnelName); - } - - /** - * The string of tunnel name. - * - * @return the string of tunnel name - */ - public String value() { - return str; - } - - @Override - public int hashCode() { - return Objects.hash(str); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TunnelName) { - final TunnelName that = (TunnelName) obj; - return this.getClass() == that.getClass() - && Objects.equals(this.str, that.str); - } - return false; - } - - @Override - public String toString() { - return str; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java deleted file mode 100644 index 5677901f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.ElementId; -import org.onosproject.net.Path; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of an entity providing tunnel setup/release services to the core. - */ -@Beta -public interface TunnelProvider extends Provider { - - /** - * Instructs the provider to setup a tunnel. It's used by consumers. - * - * @param tunnel Tunnel - * @param path explicit route or null for the tunnel - */ - void setupTunnel(Tunnel tunnel, Path path); - - /** - * Instructs the provider to setup a tunnel given the respective device. - * It's used by consumers. - * - * @param srcElement device - * @param tunnel Tunnel - * @param path explicit route (not null) for the tunnel - */ - void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path); - - /** - * Instructs the provider to release a tunnel. It's used by consumers. - * - * @param tunnel Tunnel - */ - void releaseTunnel(Tunnel tunnel); - - /** - * Instructs the provider to release a tunnel given the respective device. - * It's used by consumers. - * - * @param srcElement device - * @param tunnel Tunnel - */ - void releaseTunnel(ElementId srcElement, Tunnel tunnel); - - /** - * Instructs the provider to update a tunnel. It's used by consumers. Maybe - * some consumers enable to update a tunnel. - * - * @param tunnel Tunnel - * @param path explicit route (path changed) or null (path not changed) for - * the tunnel - */ - void updateTunnel(Tunnel tunnel, Path path); - - /** - * Instructs the provider to update a tunnel given the respective device. - * It's used by consumers. Maybe some consumers enable to update a tunnel. - * - * @param srcElement device - * @param tunnel Tunnel - * @param path explicit route (path changed) or null (path not changed) for - * the tunnel - */ - void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path); - - /** - * Signals that the provider has added a tunnel. It's used by producers. - * - * @param tunnel tunnel information - * @return tunnel identity - */ - TunnelId tunnelAdded(TunnelDescription tunnel); - - /** - * Signals that the provider has removed a tunnel. It's used by producers. - * - * @param tunnel tunnel information - */ - void tunnelRemoved(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was changed (e.g., sensing changes of - * tunnel).It's used by producers. - * - * @param tunnel tunnel information - */ - void tunnelUpdated(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was queried. - * It's used by producers. - * @param tunnelId tunnel identity - * @return tunnel entity - */ - Tunnel tunnelQueryById(TunnelId tunnelId); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java deleted file mode 100644 index 069455ac..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of an tunnel provider registry. - */ -@Beta -public interface TunnelProviderRegistry - extends ProviderRegistry<TunnelProvider, TunnelProviderService> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java deleted file mode 100644 index bb158bfa..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderService; - -/** - * APIs for tunnel provider to notify the tunnel subSystem. - */ -@Beta -public interface TunnelProviderService extends ProviderService<TunnelProvider> { - - /** - * Signals that the provider has added a tunnel. - * - * @param tunnel tunnel information - * @return tunnel identity - */ - TunnelId tunnelAdded(TunnelDescription tunnel); - - /** - * Signals that the provider has removed a tunnel. - * - * @param tunnel tunnel information - */ - void tunnelRemoved(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was changed (e.g., sensing changes of tunnel). - * - * @param tunnel tunnel information - */ - void tunnelUpdated(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was queried. - * - * @param tunnelId tunnel identity - * @return tunnel entity - */ - Tunnel tunnelQueryById(TunnelId tunnelId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java deleted file mode 100644 index 2a10a4c1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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.tunnel; - -import java.util.Collection; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.event.ListenerService; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.net.Annotations; -import org.onosproject.net.DeviceId; - -/** - * Service for interacting with the inventory of tunnels. - */ -@Beta -public interface TunnelService - extends ListenerService<TunnelEvent, TunnelListener> { - - /** - * Borrows a specific tunnel. Annotations parameter is reserved.If there - * is no tunnel in the store, returns a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by onos - * @param annotations Annotations - * @return Tunnel subscribed tunnel - */ - Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Borrows a specific tunnel by tunnelName. Annotations parameter is reserved.If there - * is no tunnel in the store, return a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations Annotations - * @return collection of subscribed Tunnels - */ - Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelName tunnelName, - Annotations... annotations); - - /** - * Borrows all tunnels between source and destination. Annotations - * parameter is reserved.If there is no any tunnel in the store, return a - * empty collection,and record the tunnel subscription. Where tunnel is created, ONOS - * notifies this consumer actively. Otherwise ONOS core returns all the - * tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param annotations Annotations - * @return collection of subscribed Tunnels - */ - Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Borrows all specified type tunnels between source and destination. - * Annotations parameter is reserved.If there is no any tunnel in the store, - * return a empty collection, and record the tunnel subscription. Where tunnel is - * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns - * all available tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return collection of available Tunnels - */ - Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns back a specific tunnel to store. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by ONOS - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Returns all specific name tunnel back store. Annotations parameter is reserved.if there - * is no tunnel in the store, return a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations Annotations - * @return boolean - */ - boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, - Annotations... annotations); - - /** - * Returns all specific type tunnels between source and destination back - * store. Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns all tunnels between source and destination back the store. - * Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Returns a tunnel by a specific tunnel identity. - * - * @param tunnelId tunnel identify generated by tunnel producer - * @return Tunnel - */ - Tunnel queryTunnel(TunnelId tunnelId); - - /** - * Returns all tunnel subscription record by consumer. - * - * @param consumerId consumer identity - * @return Collection of TunnelSubscription - */ - Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId); - - /** - * Returns all specified type tunnels. - * - * @param type tunnel type - * @return Collection of tunnels - */ - Collection<Tunnel> queryTunnel(Type type); - - /** - * Returns all tunnels between source point and destination point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @return Collection of tunnels - */ - Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst); - - /** - * Returns all tunnels. - * - * @return Collection of tunnels - */ - Collection<Tunnel> queryAllTunnels(); - - /** - * Returns all tunnels. - * - * @return all tunnels - */ - int tunnelCount(); - - /** - * Returns the collection of tunnels applied on the specified device. - * - * @param deviceId device identifier - * @return collection of tunnels - */ - Iterable<Tunnel> getTunnels(DeviceId deviceId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java deleted file mode 100644 index c7c9fd96..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; - -import java.time.Duration; -import java.util.List; - -/** - * Statistics of a tunnel. - */ -@Beta -public interface TunnelStatistics { - - /** - * Returns the tunnel id. - * - * @return tunnelId id of tunnel - */ - TunnelId id(); - - /** - * Returns the bandwidth utilization of a tunnel. - * - * @return bandwidth utilization - */ - double bandwidthUtilization(); - - /** - * Returns the packet loss ratio of a tunnel. - * - * @return tunnel packet loss ratio - */ - double packetLossRate(); - - /** - * Returns the end-to-end traffic flow delay of a tunnel. - * - * @return tunnel flow delay - */ - Duration flowDelay(); - - /** - * Returns the alarms on a tunnel. - * - * @return tunnel alarms - */ - List<String> alarms(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java deleted file mode 100644 index 00ed5776..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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.tunnel; - -import java.util.Collection; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.net.Annotations; -import org.onosproject.net.provider.ProviderId; -import org.onosproject.store.Store; - -/** - * Manages inventory of tunnel; not intended for direct use. - */ -@Beta -public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> { - /** - * Creates or updates a tunnel. - * - * @param tunnel tunnel - * @return tunnel identity - */ - TunnelId createOrUpdateTunnel(Tunnel tunnel); - - /** - * Deletes a tunnel by a specific tunnel identifier. - * - * @param tunnelId tunnel unique identifier generated by ONOS - */ - void deleteTunnel(TunnelId tunnelId); - - /** - * Deletes all tunnels between source point and destination point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param producerName producerName - */ - void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, - ProviderId producerName); - - /** - * Deletes all specific type tunnels between source point and destination - * point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param type tunnel type - * @param producerName producerName - */ - void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, - Tunnel.Type type, ProviderId producerName); - - /** - * Returns a specific tunnel. Annotations parameter is reserved. If there - * is no tunnel in the store, return a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by onos - * @param annotations parameter - * @return Tunnel subscribed tunnel - */ - Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Returns a specific tunnel by tunnelName. Annotations parameter is - * reserved. If there is no tunnel in the store, return a "null" object,and - * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer - * actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations parameter - * @return collection of subscribed Tunnels - */ - Collection<Tunnel> borrowTunnel(ApplicationId consumerId, - TunnelName tunnelName, - Annotations... annotations); - - /** - * Returns all tunnels between source and destination. Annotations - * parameter is reserved. If there is no any tunnel in the store, return a - * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS - * notifies this consumer actively. Otherwise ONOS core returns all the - * tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param annotations parameter - * @return collection of subscribed Tunnels - */ - Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Returns all specified type tunnels between source and destination. - * Annotations parameter is reserved. If there is no any tunnel in the store, - * return a empty collection, and record the tunnel subscription. Where tunnel is - * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns - * all available tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return collection of available Tunnels - */ - Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns back a specific tunnel to store. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by ONOS - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Returns all specific name tunnel back store. Annotations parameter is - * reserved.If there is no tunnel in the store, return a "null" object,and - * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer - * actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations Annotations - * @return boolean - */ - boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, - Annotations... annotations); - - /** - * Returns all specific type tunnels between source and destination back - * store. Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns all tunnels between source and destination back the store. - * Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Returns a tunnel by a specific tunnel identity. - * - * @param tunnelId tunnel identify generated by tunnel producer - * @return Tunnel - */ - Tunnel queryTunnel(TunnelId tunnelId); - - /** - * Returns all tunnel subscription record by consumer. - * - * @param consumerId consumer identity - * @return Collection of TunnelSubscription - */ - Collection<TunnelSubscription> queryTunnelSubscription(ApplicationId consumerId); - - /** - * Returns all specified type tunnels. - * - * @param type tunnel type - * @return Collection of tunnels - */ - Collection<Tunnel> queryTunnel(Type type); - - /** - * Returns all tunnels between source point and destination point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @return Collection of tunnels - */ - Collection<Tunnel> queryTunnel(TunnelEndPoint src, TunnelEndPoint dst); - - /** - * Returns all tunnels. - * - * @return Collection of tunnels - */ - Collection<Tunnel> queryAllTunnels(); - - /** - * Returns all tunnels. - * @return all tunnels - */ - int tunnelCount(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java deleted file mode 100644 index dfbc6ec0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.store.StoreDelegate; - -/** - * Tunnel store delegate abstraction. - */ -@Beta -public interface TunnelStoreDelegate extends StoreDelegate<TunnelEvent> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java deleted file mode 100644 index 336789b1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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.tunnel; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.AbstractAnnotated; -import org.onosproject.net.Annotations; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; - -import com.google.common.base.MoreObjects; - -/** - * Represents for a order that consumer subscribe tunnel. ONOS maintains request - * information, it means ONOS knows how much resource echo consumer uses in the - * ONOS. Although there is no a tunnel that consumer want to use, when producer - * creates a new tunnel, ONOS will notify the consumers that want to use it. - */ -@Beta -public final class TunnelSubscription extends AbstractAnnotated { - private final ApplicationId consumerId; - private final TunnelEndPoint src; - private final TunnelEndPoint dst; - private final Type type; - private final TunnelId tunnelId; - private final TunnelName tunnelName; - - /** - * Creates a TunnelSubscription. - * - * @param consumerId consumer identity - * @param src source tunnel end point of tunnel - * @param dst destination tunnel end point of tunnel - * @param tunnelId tunnel identity - * @param type tunnel type - * @param tunnelName the name of a tunnel - * @param annotations parameter - */ - public TunnelSubscription(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, TunnelId tunnelId, Type type, - TunnelName tunnelName, Annotations... annotations) { - super(annotations); - checkNotNull(consumerId, "consumerId cannot be null"); - this.consumerId = consumerId; - this.src = src; - this.dst = dst; - this.type = type; - this.tunnelId = tunnelId; - this.tunnelName = tunnelName; - } - - /** - * Returns consumer identity. - * - * @return consumerId consumer id - */ - public ApplicationId consumerId() { - return consumerId; - } - - /** - * Returns source point of tunnel. - * - * @return source point - */ - public TunnelEndPoint src() { - return src; - } - - /** - * Returns destination point of tunnel. - * - * @return destination point - */ - public TunnelEndPoint dst() { - return dst; - } - - /** - * Returns tunnel type. - * - * @return tunnel type - */ - public Type type() { - return type; - } - - /** - * Returns tunnel identity. - * - * @return tunnel id - */ - public TunnelId tunnelId() { - return tunnelId; - } - - /** - * Returns tunnel name. - * - * @return tunnel name - */ - public TunnelName tunnelName() { - return tunnelName; - } - - @Override - public int hashCode() { - return Objects.hash(consumerId, src, dst, type, tunnelId, tunnelName); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TunnelSubscription) { - final TunnelSubscription other = (TunnelSubscription) obj; - return Objects.equals(this.src, other.src) - && Objects.equals(this.dst, other.dst) - && Objects.equals(this.consumerId, other.consumerId) - && Objects.equals(this.type, other.type) - && Objects.equals(this.tunnelId, other.tunnelId) - && Objects.equals(this.tunnelName, other.tunnelName); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()) - .add("src", src) - .add("dst", dst) - .add("consumerId", consumerId) - .add("type", type) - .add("tunnelId", tunnelId) - .add("tunnelName", tunnelName).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java deleted file mode 100644 index d31aab55..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Tunnel model related services and providers API definitions. - */ -package org.onosproject.incubator.net.tunnel; diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java deleted file mode 100644 index e3339a9a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 org.onlab.packet.ChassisId; -import org.onosproject.net.DefaultDevice; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderId; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.*; - -/** - * Default representation of a virtual device. - */ -public class DefaultVirtualDevice extends DefaultDevice implements VirtualDevice { - - private static final String VIRTUAL = "virtual"; - private static final ProviderId PID = new ProviderId(VIRTUAL, VIRTUAL); - - private final NetworkId networkId; - - /** - * Creates a network element attributed to the specified provider. - * - * @param networkId network identifier - * @param id device identifier - */ - public DefaultVirtualDevice(NetworkId networkId, DeviceId id) { - super(PID, id, Type.VIRTUAL, VIRTUAL, VIRTUAL, VIRTUAL, VIRTUAL, - new ChassisId(0)); - this.networkId = networkId; - } - - @Override - public NetworkId networkId() { - return networkId; - } - - @Override - public int hashCode() { - return 31 * super.hashCode() + networkId.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultVirtualDevice) { - DefaultVirtualDevice that = (DefaultVirtualDevice) obj; - return super.equals(that) && Objects.equals(this.networkId, that.networkId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("networkId", networkId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java deleted file mode 100644 index c1141912..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Default implementation of the virtual network descriptor. - */ -public class DefaultVirtualNetwork implements VirtualNetwork { - - private final NetworkId id; - private final TenantId tenantId; - - /** - * Creates a new virtual network descriptor. - * - * @param id network identifier - * @param tenantId tenant identifier - */ - public DefaultVirtualNetwork(NetworkId id, TenantId tenantId) { - this.id = id; - this.tenantId = tenantId; - } - - @Override - public NetworkId id() { - return id; - } - - @Override - public TenantId tenantId() { - return tenantId; - } - - @Override - public int hashCode() { - return Objects.hash(id, tenantId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultVirtualNetwork) { - DefaultVirtualNetwork that = (DefaultVirtualNetwork) obj; - return Objects.equals(this.id, that.id) - && Objects.equals(this.tenantId, that.tenantId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("id", id) - .add("tenantId", tenantId) - .toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java deleted file mode 100644 index 27123287..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java deleted file mode 100644 index 196c17d4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 id.hashCode(); - } - - @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; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java deleted file mode 100644 index 59e781a3..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java deleted file mode 100644 index 791b8e24..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 network identifier to which this virtual element belongs. - * - * @return network identifier - */ - NetworkId networkId(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java deleted file mode 100644 index fdea8b61..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java deleted file mode 100644 index ac0063fe..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java deleted file mode 100644 index b28a5d3a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java deleted file mode 100644 index 07c399c0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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.TunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; - -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 deviceId device identifier - * @return newly created device - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId); - - /** - * 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 src source connection point - * @param dst destination connection point - * @param realizedBy identifier of the 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, - ConnectPoint src, ConnectPoint dst, - TunnelId 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. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - * @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, - PortNumber portNumber, 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); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java deleted file mode 100644 index 7e076e09..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 org.onosproject.event.AbstractEvent; - -/** - * Describes virtual network event. - */ -public class VirtualNetworkEvent extends AbstractEvent<VirtualNetworkEvent.Type, NetworkId> { - - /** - * Type of virtual network events. - */ - public enum Type { - /** - * Signifies that a new tenant identifier was registered. - */ - TENANT_REGISTERED, - /** - * Signifies that a tenant identifier was unregistered. - */ - TENANT_UNREGISTERED, - /** - * Signifies that a new virtual network was added. - */ - NETWORK_ADDED, - /** - * Signifies that a virtual network was updated. - */ - NETWORK_UPDATED, - /** - * Signifies that a virtual network was removed. - */ - NETWORK_REMOVED - } - - /** - * Creates an event of a given type and for the specified subject and the - * current time. - * - * @param type event type - * @param subject event subject - */ - public VirtualNetworkEvent(Type type, NetworkId subject) { - super(type, subject); - } - - /** - * Creates an event of a given type and for the specified subject and time. - * - * @param type device event type - * @param subject event subject - * @param time occurrence time - */ - public VirtualNetworkEvent(Type type, NetworkId subject, long time) { - super(type, subject, time); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java deleted file mode 100644 index 707ca8a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 org.onosproject.event.EventListener; - -/** - * Represents entity capable of receiving virtual network events. - */ -public interface VirtualNetworkListener extends EventListener<VirtualNetworkEvent> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java deleted file mode 100644 index bf4a4855..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.onosproject.incubator.net.virtual; - -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.provider.Provider; - -/** - * Entity capable of providing traffic isolation constructs for use in - * implementation of virtual devices and virtual links. - */ -public interface VirtualNetworkProvider extends Provider { - - /** - * Creates a network tunnel for all traffic from the specified source - * connection point to the indicated destination connection point. - * - * @param networkId virtual network identifier - * @param src source connection point - * @param dst destination connection point - * @return new tunnel's id - */ - TunnelId createTunnel(NetworkId networkId, ConnectPoint src, ConnectPoint dst); - - /** - * Destroys the specified network tunnel. - * - * @param networkId virtual network identifier - * @param tunnelId tunnel identifier - */ - void destroyTunnel(NetworkId networkId, TunnelId tunnelId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java deleted file mode 100644 index 4e893165..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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 org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of a virtual network provider registry. - */ -public interface VirtualNetworkProviderRegistry - extends ProviderRegistry<VirtualNetworkProvider, VirtualNetworkProviderService> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java deleted file mode 100644 index cba933c9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.onosproject.incubator.net.virtual; - -import org.onosproject.net.provider.ProviderService; - -/** - * Service through which virtual network providers can inject information into - * the core. - */ -public interface VirtualNetworkProviderService extends ProviderService<VirtualNetworkProvider> { - // TODO: Add methods for notification of core about damaged tunnels, etc. -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java deleted file mode 100644 index 01681ef4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java deleted file mode 100644 index 49ad2f2b..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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 org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; -import org.onosproject.store.Store; - -import java.util.Set; - -/** - * Mechanism for distributing and storing virtual network model information. - */ -public interface VirtualNetworkStore - extends Store<VirtualNetworkEvent, VirtualNetworkStoreDelegate> { - - /** - * Adds a new tenant ID to the store. - * - * @param tenantId tenant identifier - */ - void addTenantId(TenantId tenantId); - - /** - * Removes the specified tenant ID from the store. - * - * @param tenantId tenant identifier - */ - void removeTenantId(TenantId tenantId); - - /** - * Returns set of registered tenant IDs. - * - * @return set of tenant identifiers - */ - Set<TenantId> getTenantIds(); - - /** - * Adds a new virtual network for the specified tenant to the store. - * - * @param tenantId tenant identifier - * @return the virtual network - */ - VirtualNetwork addNetwork(TenantId tenantId); - - /** - * Removes the specified virtual network from the store. - * - * @param networkId network identifier - */ - void removeNetwork(NetworkId networkId); - - /** - * Adds a new virtual device to the store. This device will have no ports. - * - * @param networkId network identifier - * @param deviceId device identifier - * @return the virtual device - */ - VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId); - - /** - * Renmoves the specified virtual device from the given network. - * - * @param networkId network identifier - * @param deviceId device identifier - */ - void removeDevice(NetworkId networkId, DeviceId deviceId); - - /** - * Adds a new virtual link. - * - * @param networkId network identifier - * @param src source end-point of the link - * @param dst destination end-point of the link - * @param realizedBy underlying tunnel using which this link is realized - * @return the virtual link - */ - VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, - TunnelId realizedBy); - - /** - * Removes the specified link from the store. - * - * @param networkId network identifier - * @param src source connection point - * @param dst destination connection point - */ - void removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); - - /** - * Adds a new virtual port to the network. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - * @param realizedBy underlying port which realizes the virtual port - * @return the virtual port - */ - VirtualPort addPort(NetworkId networkId, DeviceId deviceId, - PortNumber portNumber, Port realizedBy); - - /** - * Removes the specified port from the given device and network. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - */ - void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); - - /** - * Returns the list of networks. - * - * @param tenantId tenant identifier - * @return set of virtual networks - */ - Set<VirtualNetwork> getNetworks(TenantId tenantId); - - /** - * Returns the list of devices in the specified virtual network. - * - * @param networkId network identifier - * @return set of virtual devices - */ - Set<VirtualDevice> getDevices(NetworkId networkId); - - /** - * Returns the list of virtual links in the specified virtual network. - * - * @param networkId network identifier - * @return set of virtual links - */ - Set<VirtualLink> getLinks(NetworkId networkId); - - /** - * Returns the list of ports of the specified virtual device. - * - * @param networkId network identifier - * @param deviceId device identifier - * @return set of virtual networks - */ - Set<VirtualPort> getPorts(NetworkId networkId, DeviceId deviceId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java deleted file mode 100644 index e57c3d3a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 org.onosproject.store.StoreDelegate; - -/** - * Network configuration store delegate abstraction. - */ -public interface VirtualNetworkStoreDelegate extends StoreDelegate<VirtualNetworkEvent> { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java deleted file mode 100644 index 179bb2c9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java deleted file mode 100644 index 3a0676a5..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java deleted file mode 100644 index 6aedd3b2..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -/** - * Incubating abstractions and APIs. This subsystem is - * experimental and its interfaces will change in the upcoming release. - */ -package org.onosproject.incubator;
\ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java deleted file mode 100644 index 09c507dd..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.rpc; - -import com.google.common.annotations.Beta; - -// Implementation is expected to be a handler for RPC channel -// and shim-layer to convert Java Service interface calls to/from RPC call -/** - * Context for Remote service. - */ -@Beta -public interface RemoteServiceContext { - - // we may need a method to check connection state? - - /** - * Returns implementation of the specified service class. - * - * @param serviceClass service class - * @param <T> type of service - * @return implementation class - * @throws UnsupportedOperationException if this context does not support it. - */ - <T> T get(Class<T> serviceClass); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java deleted file mode 100644 index 47bbfbc9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.rpc; - -import java.net.URI; - -import org.onosproject.net.provider.Provider; - -import com.google.common.annotations.Beta; - -//Factory to create RemoteServiceContext -/** - * Abstraction of a remote service implementation provider. - */ -@Beta -public interface RemoteServiceContextProvider extends Provider { - - /** - * Returns {@link RemoteServiceContext} for given URI. - * - * @param uri URI for remote end point. - * @return {@link RemoteServiceContext} - */ - RemoteServiceContext get(URI uri); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java deleted file mode 100644 index 42b976c5..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.rpc; - -import org.onosproject.net.provider.ProviderService; - -import com.google.common.annotations.Beta; - -// Not completely sure if we will make use of this at the moment -// added to follow existing {@link ProviderRegistry} pattern -@Beta -public interface RemoteServiceContextProviderService - extends ProviderService<RemoteServiceContextProvider> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java deleted file mode 100644 index 0d2bbc70..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.rpc; - -import java.net.URI; - -import com.google.common.annotations.Beta; - -// This is actually the RPC Service, where consumers get -// RemoteSericeContext (~= RPC Session) for given URI -// expected to be implemented by some Manager class on Lower-side ONOS -/** - * Service for retrieving RPC session handler ({@link RemoteServiceContext}). - */ -@Beta -public interface RemoteServiceDirectory { - - /** - * Returns remote service context. - * - * @param uri URI representing remote end point. e.g., (grpc://hostname:port) - * @return remote service context - * @throws UnsupportedOperationException if URI scheme was not supported. - */ - RemoteServiceContext get(URI uri); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java deleted file mode 100644 index 3b3c3891..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.rpc; - -import org.onosproject.net.provider.ProviderRegistry; - -import com.google.common.annotations.Beta; - -/** - * Abstraction of a remote service provider registry. - */ -@Beta -public interface RemoteServiceProviderRegistry - extends ProviderRegistry<RemoteServiceContextProvider, - RemoteServiceContextProviderService> { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java deleted file mode 100644 index 4ec56ae1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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. - */ - -/** - * Incubating inter-cluster RPC APIs. - */ -package org.onosproject.incubator.rpc; diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java deleted file mode 100644 index f2b15b09..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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.config.basics; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.onosproject.net.config.basics.OpticalPortConfig.TYPE; -import static org.onosproject.net.config.basics.OpticalPortConfig.NAME; -import static org.onosproject.net.config.basics.OpticalPortConfig.PORT; -import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_LAMBDA; -import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_PORT; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.onosproject.net.config.Config; -import org.onosproject.net.config.ConfigApplyDelegate; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.Lists; -import org.onosproject.net.config.basics.OpticalPortConfig; - -public class OpticalPortConfigTest { - private static final String FIELD = "ports"; - private static final String KEY = "opc-test"; - - private static final DeviceId DID = DeviceId.deviceId(KEY); - private static final PortNumber PN = PortNumber.portNumber(100); - private static final ConnectPoint CPT = new ConnectPoint(DID, PN); - private static final String DEMOTREE = "{" + - "\"ports\": [" + - // config entity 0 - "{" + - "\"name\": \"1-10-E1_WPORT\"," + - "\"type\": \"OMS\"" + - "}," + - // config entity 1 - "{" + - "\"type\": \"OCH\"," + - "\"speed\": 0," + - "\"port\": 10" + - "}," + - // config entity 2 - "{" + - "\"name\": \"1-1-E1_LPORT\"," + - "\"type\": \"OCH\"," + - "\"annotations\": {" + - "\"staticLambda\": 1," + - "\"staticPort\": \"1-22-E1_WPORT\"" + - "}" + - "}" + - "]" + - "}"; - - private final ConfigApplyDelegate delegate = new MockCfgDelegate(); - private final ObjectMapper mapper = new ObjectMapper(); - - // one OPC per port in DEMOTREE - private List<OpticalPortConfig> opcl = Lists.newArrayList(); - // JsonNodes representing each port. - private List<JsonNode> testNodes = Lists.newArrayList(); - - @Before - public void setUp() { - try { - JsonNode tree = new ObjectMapper().readTree(DEMOTREE); - Iterator<JsonNode> pitr = tree.get(FIELD).elements(); - while (pitr.hasNext()) { - // initialize a config entity, add to lists - JsonNode jn = pitr.next(); - OpticalPortConfig opc = new OpticalPortConfig(); - ObjectNode node = JsonNodeFactory.instance.objectNode(); - opc.init(CPT, KEY, node, mapper, delegate); - - testNodes.add(jn); - opcl.add(opc); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Test - public void testBaseAttrs() { - // configs 0 and 1 - port with and without alphanumeric names - OpticalPortConfig op0 = opcl.get(0); - OpticalPortConfig op1 = opcl.get(1); - // config 2 - no name - OpticalPortConfig op2 = opcl.get(2); - JsonNode jn0 = testNodes.get(0); - JsonNode jn1 = testNodes.get(1); - - op0.portType(Port.Type.valueOf(jn0.path(TYPE).asText())) - .portName(jn0.path(NAME).asText()); - op1.portType(Port.Type.valueOf(jn1.path(TYPE).asText())) - .portNumberName(jn1.path(PORT).asLong()); - - assertEquals(Port.Type.OMS, op0.type()); - assertEquals(jn0.path(NAME).asText(), op0.name()); - assertEquals(jn1.path(PORT).asText(), op1.numberName()); - assertEquals("", op1.name()); - assertEquals("", op2.name()); - } - - @Test - public void testAdditionalAttrs() { - // config 1 has no annotations, 2 has predefined ones - OpticalPortConfig op1 = opcl.get(1); - OpticalPortConfig op2 = opcl.get(2); - JsonNode jn2 = testNodes.get(2); - Long sl = 1L; - - // see config entity 2 in DEMOTREE - op2.staticLambda(jn2.path("annotations").path(STATIC_LAMBDA).asLong()); - op2.staticPort(jn2.path("annotations").path(STATIC_PORT).asText()); - - assertEquals(sl, op2.staticLambda().get()); - assertFalse(op1.staticLambda().isPresent()); - assertEquals("1-22-E1_WPORT", op2.staticPort()); - assertEquals("", op1.staticPort()); - - op2.staticLambda(null); - assertFalse(op2.staticLambda().isPresent()); - } - - private class MockCfgDelegate implements ConfigApplyDelegate { - - @Override - public void onApply(@SuppressWarnings("rawtypes") Config config) { - config.apply(); - } - - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java deleted file mode 100644 index 55f052ac..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2014-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.faultmanagement.alarm; - -import com.google.common.testing.EqualsTester; -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; -import static org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId.alarmEntityId; - -/** - * Test of the alarm source identifier. - * - */ -public class AlarmEntityIdTest { - - /** - * Checks that the class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(AlarmEntityId.class); - } - - @Test - public void string() { - assertEquals("och:foo", - alarmEntityId("och:foo").toString()); - } - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup( - alarmEntityId("och:foo"), - alarmEntityId("och:foo")) - .addEqualityGroup(alarmEntityId("och:bar")) - .testEquals(); - - } - - @Test - public void validSchemaPermitted() { - alarmEntityId("none:foo"); - alarmEntityId("port:foo"); - alarmEntityId("och:foo"); - alarmEntityId("other:foo"); - - } - - @Test(expected = IllegalArgumentException.class) - public void verifyUnexpectedSchemaRejected() { - alarmEntityId("junk:foo"); - } - - @Test(expected = IllegalArgumentException.class) - public void verifyCorruptSchemaRejected() { - alarmEntityId("other:"); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java deleted file mode 100644 index 74453a42..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * This class tests the immutability, equality, and non-equality of - * {@link AlarmId}. - */ -public class AlarmIdTest { - private static final long ID_A = 1L; - private static final long ID_B = 2L; - private static final long ID_Z = 987654321L; - - /** - * Tests the immutability of {@link AlarmId}. - */ - @Test - public void intentIdFollowsGuidelineForImmutableObject() { - assertThatClassIsImmutable(AlarmId.class); - } - - /** - * Tests equality of {@link AlarmId}. - */ - @Test - public void testEquality() { - final AlarmId id1 = new AlarmId(ID_A); - final AlarmId id2 = new AlarmId(ID_A); - - assertThat(id1, is(id2)); - } - - - /** - * Tests non-equality of {@link AlarmId}. - */ - @Test - public void testNonEquality() { - final AlarmId id1 = new AlarmId(ID_A); - final AlarmId id2 = new AlarmId(ID_B); - - assertThat(id1, is(not(id2))); - } - - @Test - public void valueOf() { - final AlarmId id = new AlarmId(0xdeadbeefL); - assertEquals("incorrect valueOf", id, AlarmId.valueOf(0xdeadbeefL)); - } - - /** - * Tests the equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - final AlarmId id1 = new AlarmId(11111L); - final AlarmId sameAsId1 = new AlarmId(11111L); - final AlarmId id2 = new AlarmId(22222L); - - new EqualsTester() - .addEqualityGroup(id1, sameAsId1) - .addEqualityGroup(id2) - .testEquals(); - } - - /** - * Tests construction of an AlarmId object. - */ - @Test - public void testConstruction() { - final AlarmId id1 = new AlarmId(ID_Z); - assertEquals(id1.fingerprint(), ID_Z); - - // No default constructor so no need to test it ! - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java deleted file mode 100644 index 199ed0d9..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2014 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.faultmanagement.alarm; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; -import org.onosproject.net.DeviceId; - -public class DefaultAlarmTest { - - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultAlarm.class); - } - - /** - * Checks the construction of a DefaultAlarm object. - */ - @Test - public void testConstruction() { - final String nameValue = "name3"; - final DefaultAlarm a = new DefaultAlarm.Builder(AlarmId.valueOf(4), - DeviceId.NONE, nameValue, Alarm.SeverityLevel.CLEARED, 3).build(); - - assertThat(a, is(notNullValue())); - final DefaultAlarm b = new DefaultAlarm.Builder(a).build(); - - assertEquals(a, b); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java deleted file mode 100644 index 1055dbad..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.resource.label; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; - -import com.google.common.testing.EqualsTester; - -/** - * Tests of default label resource. - */ -public class DefaultLabelResourceTest extends AbstractEventTest { - - @Test - public void testEquality() { - String deviceId1 = "of:001"; - String deviceId2 = "of:002"; - long labelResourceId1 = 100; - long labelResourceId2 = 200; - DefaultLabelResource h1 = new DefaultLabelResource(deviceId1, - labelResourceId1); - DefaultLabelResource h2 = new DefaultLabelResource(deviceId1, - labelResourceId1); - DefaultLabelResource h3 = new DefaultLabelResource(deviceId2, - labelResourceId2); - DefaultLabelResource h4 = new DefaultLabelResource(deviceId2, - labelResourceId2); - - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java deleted file mode 100644 index 25ef57f7..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.resource.label; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; - -import com.google.common.testing.EqualsTester; - -/** - * Tests of the label resource pool. - */ -public class LabelResourcePoolTest extends AbstractEventTest { - - @Test - public void testEquality() { - LabelResourcePool h1 = new LabelResourcePool("of:001", 0, 100); - LabelResourcePool h2 = new LabelResourcePool("of:001", 0, 100); - LabelResourcePool h3 = new LabelResourcePool("of:002", 0, 100); - LabelResourcePool h4 = new LabelResourcePool("of:002", 0, 100); - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java deleted file mode 100644 index f41ad289..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.resource.label; - -import java.util.Collections; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.ImmutableSet; -import com.google.common.testing.EqualsTester; - -/** - * Tests of the label resource request. - */ -public class LabelResourceRequestTest extends AbstractEventTest { - - @Test - public void testEquality() { - DeviceId deviceId1 = DeviceId.deviceId("of:0001"); - DeviceId deviceId2 = DeviceId.deviceId("of:0002"); - long apply = 2; - ImmutableSet<LabelResource> releaseCollection = ImmutableSet - .copyOf(Collections.emptySet()); - LabelResourceRequest h1 = new LabelResourceRequest( - deviceId1, - LabelResourceRequest.Type.APPLY, - apply, null); - LabelResourceRequest h2 = new LabelResourceRequest( - deviceId1, - LabelResourceRequest.Type.APPLY, - apply, null); - LabelResourceRequest h3 = new LabelResourceRequest( - deviceId2, - LabelResourceRequest.Type.RELEASE, - 0, releaseCollection); - LabelResourceRequest h4 = new LabelResourceRequest( - deviceId2, - LabelResourceRequest.Type.RELEASE, - 0, releaseCollection); - - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java deleted file mode 100644 index 25ec73d4..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.tunnel; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.provider.ProviderId; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the default tunnel model entity. - */ -public class DefaultTunnelTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultTunnel.class); - } - - @Test - public void testEquality() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(32421)); - DefaultGroupId groupId = new DefaultGroupId(92034); - TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - ProviderId producerName1 = new ProviderId("producer1", "13"); - ProviderId producerName2 = new ProviderId("producer2", "13"); - Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - Tunnel p2 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - Tunnel p3 = new DefaultTunnel(producerName2, src, dst, Tunnel.Type.OCH, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java deleted file mode 100644 index 28669a21..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.provider.ProviderId; - -/** - * Test of a tunnel event. - */ -public class TunnelEventTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelEvent.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testConstructor() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(32421)); - DefaultGroupId groupId = new DefaultGroupId(92034); - TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - ProviderId producerName1 = new ProviderId("producer1", "13"); - Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - TunnelEvent e1 = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, p1); - assertThat(e1, is(notNullValue())); - assertThat(e1.type(), is(TunnelEvent.Type.TUNNEL_ADDED)); - assertThat(e1.subject(), is(p1)); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java deleted file mode 100644 index f4c109f9..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for tunnel id class. - */ -public class TunnelIdTest { - - final TunnelId tunnelId1 = TunnelId.valueOf(1); - final TunnelId sameAstunnelId1 = TunnelId.valueOf(1); - final TunnelId tunnelId2 = TunnelId.valueOf(2); - - /** - * Checks that the TunnelId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelId.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - new EqualsTester() - .addEqualityGroup(tunnelId1, sameAstunnelId1) - .addEqualityGroup(tunnelId2) - .testEquals(); - } - - /** - * Checks the construction of a FlowId object. - */ - @Test - public void testConstruction() { - final long tunnelIdValue = 7777L; - final TunnelId tunnelId = TunnelId.valueOf(tunnelIdValue); - assertThat(tunnelId, is(notNullValue())); - assertThat(tunnelId.id(), is(tunnelIdValue)); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java deleted file mode 100644 index d0fc49c7..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for tunnel name class. - */ -public class TunnelNameTest { - final TunnelName name1 = TunnelName.tunnelName("name1"); - final TunnelName sameAsName1 = TunnelName.tunnelName("name1"); - final TunnelName name2 = TunnelName.tunnelName("name2"); - - /** - * Checks that the TunnelName class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelName.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(name1, sameAsName1) - .addEqualityGroup(name2).testEquals(); - } - - /** - * Checks the construction of a OpenFlowGroupId object. - */ - @Test - public void testConstruction() { - final String nameValue = "name3"; - final TunnelName name = TunnelName.tunnelName(nameValue); - assertThat(name, is(notNullValue())); - assertThat(name.value(), is(nameValue)); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java deleted file mode 100644 index 46634c7c..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.tunnel; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.DefaultApplicationId; - -import com.google.common.testing.EqualsTester; - -/** - * Test of order model entity. - */ -public class TunnelSubscriptionTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelSubscription.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquality() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421)); - ApplicationId appId = new DefaultApplicationId(243, "test"); - ApplicationId appId2 = new DefaultApplicationId(2431, "test1"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} |