TE Topoplogy subsystem I2RS API changes
This submission contains the following:
1. Major changes in apps/tetopology. The changes are mainly introduced
to support new searching keys in TE Topology.
2. Add RESTCONF notification support in the TE Provider. i.e., for
south-bound RESTCONF communication with the domain controller.
Change-Id: I6786959deb66c98626edc65ff52694dcf08981a3
diff --git a/apps/tetopology/BUCK b/apps/tetopology/BUCK
index 4fdc805..9ccc662 100644
--- a/apps/tetopology/BUCK
+++ b/apps/tetopology/BUCK
@@ -1,16 +1,11 @@
-COMPILE_DEPS = [
- '//lib:CORE_DEPS',
- '//incubator/api:onos-incubator-api',
- '//core/store/serializers:onos-core-serializers',
+BUNDLES = [
+ '//apps/tetopology/api:onos-apps-tetopology-api',
]
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
-)
-
onos_app (
title = 'TE Topology Core App',
- category = 'Traffic Steering',
+ category = 'ACTN',
url = 'http://onosproject.org',
description = 'Application to create and manage hierarchical TE topologies.',
+ included_bundles = BUNDLES,
)
diff --git a/apps/tetopology/api/BUCK b/apps/tetopology/api/BUCK
new file mode 100644
index 0000000..2b27800
--- /dev/null
+++ b/apps/tetopology/api/BUCK
@@ -0,0 +1,7 @@
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+]
+
+osgi_jar_with_tests (
+ deps = COMPILE_DEPS,
+)
diff --git a/apps/tetopology/api/pom.xml b/apps/tetopology/api/pom.xml
new file mode 100644
index 0000000..a72261e
--- /dev/null
+++ b/apps/tetopology/api/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016-present 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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>onos-tetopology</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.8.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>onos-app-tetopology-api</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <description>IETF TE topology management API</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/CommonTopologyData.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/CommonTopologyData.java
new file mode 100644
index 0000000..e8b901f
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/CommonTopologyData.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.net.DeviceId;
+
+import java.util.BitSet;
+
+/**
+ * Representation of topology common attributes.
+ */
+public class CommonTopologyData {
+ private final OptimizationType optimization;
+ private final BitSet flags;
+ private final KeyId networkId;
+ private final DeviceId ownerId;
+
+ /**
+ * Create an instance of CommonTopologyData.
+ *
+ * @param networkId the network identifier
+ * @param optimization the TE topology optimization criteria
+ * @param flags the topology characteristics flags
+ * @param ownerId the controller identifier owning this topology
+ */
+ public CommonTopologyData(KeyId networkId, OptimizationType optimization,
+ BitSet flags, DeviceId ownerId) {
+ this.optimization = optimization;
+ this.flags = flags;
+ this.networkId = networkId;
+ this.ownerId = ownerId;
+ }
+
+ /**
+ * Creates an instance of CommonTopologyData from a given TE topology.
+ *
+ * @param teTopology the given TE Topology
+ */
+ public CommonTopologyData(TeTopology teTopology) {
+ optimization = teTopology.optimization();
+ flags = teTopology.flags();
+ networkId = teTopology.networkId();
+ ownerId = teTopology.ownerId();
+ }
+
+
+ /**
+ * Returns the topology optimization type.
+ *
+ * @return the optimization type
+ */
+ public OptimizationType optimization() {
+ return optimization;
+ }
+
+ /**
+ * Returns the network identifier.
+ *
+ * @return the network id
+ */
+ public KeyId networkId() {
+ return networkId;
+ }
+
+ /**
+ * Returns the topology characteristics flags.
+ *
+ * @return the flags
+ */
+ public BitSet flags() {
+ return flags;
+ }
+
+ /**
+ * Returns the SDN controller identifier owning this topology.
+ *
+ * @return the SDN controller id
+ */
+ public DeviceId ownerId() {
+ return ownerId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(optimization, flags, ownerId, networkId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof CommonTopologyData) {
+ CommonTopologyData that = (CommonTopologyData) object;
+ return Objects.equal(optimization, that.optimization) &&
+ Objects.equal(flags, that.flags) &&
+ Objects.equal(networkId, that.networkId) &&
+ Objects.equal(ownerId, that.ownerId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("optimization", optimization)
+ .add("flags", flags)
+ .add("ownerId", ownerId)
+ .add("networkId", networkId)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java
new file mode 100644
index 0000000..faa35e1
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.onosproject.net.DeviceId;
+import org.onosproject.tetopology.management.api.link.NetworkLink;
+import org.onosproject.tetopology.management.api.node.NetworkNode;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Default Network implementation.
+ */
+public class DefaultNetwork implements Network {
+ private final KeyId networkId;
+ private final List<KeyId> supportingNetworkIds;
+ private final Map<KeyId, NetworkNode> nodes;
+ private final Map<KeyId, NetworkLink> links;
+ private final TeTopologyId teTopologyId;
+ private final boolean serverProvided;
+ private final DeviceId ownerId;
+
+ /**
+ * Creates an instance of DefaultNetwork.
+ *
+ * @param networkId network identifier
+ * @param supportingNetworkIds supporting network identifier
+ * @param nodes list of nodes within the network
+ * @param links list of links within the network
+ * @param teTopologyId TE topology identifier
+ * @param serverProvided whether the network is received from server
+ * @param ownerId the the controller identifier owning this topology
+ */
+ public DefaultNetwork(KeyId networkId, List<KeyId> supportingNetworkIds,
+ Map<KeyId, NetworkNode> nodes, Map<KeyId, NetworkLink> links,
+ TeTopologyId teTopologyId, boolean serverProvided,
+ DeviceId ownerId) {
+ this.networkId = networkId;
+ this.supportingNetworkIds = supportingNetworkIds != null ?
+ Lists.newArrayList(supportingNetworkIds) : null;
+ this.nodes = nodes != null ? Maps.newHashMap(nodes) : null;
+ this.links = links != null ? Maps.newHashMap(links) : null;
+ this.teTopologyId = teTopologyId;
+ this.serverProvided = serverProvided;
+ this.ownerId = ownerId;
+ }
+
+
+ @Override
+ public KeyId networkId() {
+ return networkId;
+ }
+
+ @Override
+ public List<KeyId> supportingNetworkIds() {
+ if (supportingNetworkIds == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(supportingNetworkIds);
+ }
+
+ @Override
+ public Map<KeyId, NetworkNode> nodes() {
+ if (nodes == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(nodes);
+ }
+
+ @Override
+ public NetworkNode node(KeyId nodeId) {
+ return nodes.get(nodeId);
+ }
+
+ @Override
+ public Map<KeyId, NetworkLink> links() {
+ if (links == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(links);
+ }
+
+ @Override
+ public NetworkLink link(KeyId linkId) {
+ return links.get(linkId);
+ }
+
+ @Override
+ public boolean isServerProvided() {
+ return serverProvided;
+ }
+
+ @Override
+ public TeTopologyId teTopologyId() {
+ return teTopologyId;
+ }
+
+ @Override
+ public DeviceId ownerId() {
+ return ownerId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkId, supportingNetworkIds,
+ nodes, links, serverProvided, teTopologyId, ownerId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultNetwork) {
+ DefaultNetwork that = (DefaultNetwork) object;
+ return Objects.equal(networkId, that.networkId) &&
+ Objects.equal(supportingNetworkIds, that.supportingNetworkIds) &&
+ Objects.equal(nodes, that.nodes) &&
+ Objects.equal(links, that.links) &&
+ Objects.equal(serverProvided, that.serverProvided) &&
+ Objects.equal(teTopologyId, that.teTopologyId) &&
+ Objects.equal(ownerId, that.ownerId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("networkId", networkId)
+ .add("supportingNetworkIds", supportingNetworkIds)
+ .add("nodes", nodes)
+ .add("links", links)
+ .add("serverProvided", serverProvided)
+ .add("teTopologyId", teTopologyId)
+ .add("ownerId", ownerId)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java
new file mode 100644
index 0000000..5e8c7f4
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+/**
+ * Default Networks implementation.
+ */
+public class DefaultNetworks implements Networks {
+ private final List<Network> networks;
+
+ /**
+ * Creates an instance of DefaultNetworks.
+ *
+ * @param networks list of networks
+ */
+ public DefaultNetworks(List<Network> networks) {
+ this.networks = networks != null ?
+ Lists.newArrayList(networks) : null;
+ }
+
+ @Override
+ public List<Network> networks() {
+ if (networks == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(networks);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networks);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultNetworks) {
+ DefaultNetworks that = (DefaultNetworks) object;
+ return Objects.equal(networks, that.networks);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("networks", networks)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultTeTopologies.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultTeTopologies.java
new file mode 100644
index 0000000..e96060d
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultTeTopologies.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableMap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Default TeTopologies implementation.
+ */
+public class DefaultTeTopologies implements TeTopologies {
+ private final String name;
+ private final Map<TeTopologyKey, TeTopology> teTopologies;
+
+ /**
+ * Creates an instance of DefaultTeTopologies.
+ *
+ * @param name the name of a TeTopology set
+ * @param teTopologies the list of TeTopology
+ */
+ public DefaultTeTopologies(String name, Map<TeTopologyKey, TeTopology> teTopologies) {
+ this.name = name;
+ this.teTopologies = teTopologies != null ?
+ new HashMap<>(teTopologies) : null;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public Map<TeTopologyKey, TeTopology> teTopologies() {
+ if (teTopologies == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(teTopologies);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, teTopologies);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultTeTopologies) {
+ DefaultTeTopologies that = (DefaultTeTopologies) object;
+ return Objects.equal(name, that.name) &&
+ Objects.equal(teTopologies, that.teTopologies);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("name", name)
+ .add("teTopologies", teTopologies)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultTeTopology.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultTeTopology.java
new file mode 100644
index 0000000..7099c6e
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/DefaultTeTopology.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import org.onosproject.net.DeviceId;
+import org.onosproject.tetopology.management.api.link.TeLink;
+import org.onosproject.tetopology.management.api.link.TeLinkTpKey;
+import org.onosproject.tetopology.management.api.node.TeNode;
+
+import java.util.BitSet;
+import java.util.Map;
+
+/**
+ * Default implementation of TeTopology.
+ */
+public class DefaultTeTopology implements TeTopology {
+ private final TeTopologyKey teKey;
+ private final Map<Long, TeNode> teNodes;
+ private final Map<TeLinkTpKey, TeLink> teLinks;
+ private final String idString;
+ private final CommonTopologyData common;
+
+ /**
+ * Creates an instance of DefaultTeTopology.
+ *
+ * @param teKey the TE topology key used for searching
+ * @param teNodes the list of TE nodes in the topology
+ * @param teLinks the list of TE links in the topology
+ * @param idString the TE Topology id string value
+ * @param common the common topology attributes
+ */
+ public DefaultTeTopology(TeTopologyKey teKey, Map<Long, TeNode> teNodes,
+ Map<TeLinkTpKey, TeLink> teLinks, String idString,
+ CommonTopologyData common) {
+ this.teKey = teKey;
+ this.teNodes = teNodes != null ? Maps.newHashMap(teNodes) : null;
+ this.teLinks = teLinks != null ? Maps.newHashMap(teLinks) : null;
+ this.idString = idString;
+ this.common = common;
+ }
+
+ @Override
+ public TeTopologyKey teTopologyId() {
+ return teKey;
+ }
+
+ @Override
+ public BitSet flags() {
+ if (common == null) {
+ return null;
+ }
+ return common.flags();
+ }
+
+ @Override
+ public OptimizationType optimization() {
+ if (common == null) {
+ return null;
+ }
+ return common.optimization();
+ }
+
+ @Override
+ public Map<Long, TeNode> teNodes() {
+ if (teNodes == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(teNodes);
+ }
+
+ @Override
+ public TeNode teNode(long teNodeId) {
+ return teNodes.get(teNodeId);
+ }
+
+ @Override
+ public Map<TeLinkTpKey, TeLink> teLinks() {
+ if (teLinks == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(teLinks);
+ }
+
+ @Override
+ public TeLink teLink(TeLinkTpKey teLinkId) {
+ return teLinks.get(teLinkId);
+ }
+
+ @Override
+ public String teTopologyIdStringValue() {
+ return idString;
+ }
+
+ @Override
+ public KeyId networkId() {
+ if (common == null) {
+ return null;
+ }
+ return common.networkId();
+ }
+
+ @Override
+ public DeviceId ownerId() {
+ if (common == null) {
+ return null;
+ }
+ return common.ownerId();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(teKey, teNodes,
+ teLinks, common, idString);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultTeTopology) {
+ DefaultTeTopology that = (DefaultTeTopology) object;
+ return Objects.equal(teKey, that.teKey) &&
+ Objects.equal(teNodes, that.teNodes) &&
+ Objects.equal(teLinks, that.teLinks) &&
+ Objects.equal(common, that.common) &&
+ Objects.equal(idString, that.idString);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("teKey", teKey)
+ .add("teNodes", teNodes)
+ .add("teLinks", teLinks)
+ .add("common", common)
+ .add("idString", idString)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/EncodingType.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/EncodingType.java
new file mode 100644
index 0000000..fc7ea5e
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/EncodingType.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+/**
+ * LSP encoding type.
+ * See RFC 3471 for details.
+ */
+public enum EncodingType {
+
+ /**
+ * Designates Packet LSP encoding.
+ */
+ LSP_ENCODING_PACKET(1),
+
+ /**
+ * Designates Ethernet LSP encoding.
+ */
+ LSP_ENCODING_ETHERNET(2),
+
+ /**
+ * Designates ANSI/ETSI PDH encoding.
+ */
+ LSP_ENCODING_PDH(3),
+
+ /**
+ * Designates SDH ITU-T G.707 / SONET ANSI T1.105 LSP encoding.
+ */
+ LSP_ENCODING_SDH(5),
+
+ /**
+ * Designates Digital Wrapper LSP encoding.
+ */
+ LSP_ENCODING_DIGITAL_WRAPPER(7),
+
+ /**
+ * Designates Lambda (photonic) LSP encoding.
+ */
+ LSP_ENCODING_LAMBDA(8),
+
+ /**
+ * Designates Fiber LSP encoding.
+ */
+ LSP_ENCODING_FIBER(9),
+
+ /**
+ * Designates Fiber Channel LSP encoding.
+ */
+ LSP_ENCODING_FIBER_CHANNEL(11),
+
+ /**
+ * Designates G.709 ODUk (Digital Path)LSP encoding.
+ */
+ LSP_ENCODING_ODUK(12);
+
+ private int value;
+
+ /**
+ * Creates an instance of EncodingType.
+ *
+ * @param value value of encoding type
+ */
+ EncodingType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the corresponding integer value of the encoding type.
+ *
+ * @return corresponding integer value
+ */
+ public int value() {
+ return value;
+ }
+
+ /**
+ * Returns the encoding type constant corresponding to the given integer
+ * value. If the given value cannot be mapped to any valid encoding type,
+ * a null is returned.
+ *
+ * @param value integer value
+ * @return corresponding encoding type constant
+ */
+ public static EncodingType of(int value) {
+ switch (value) {
+ case 1:
+ return LSP_ENCODING_PACKET;
+ case 2:
+ return LSP_ENCODING_ETHERNET;
+ case 3:
+ return LSP_ENCODING_PDH;
+ case 5:
+ return LSP_ENCODING_SDH;
+ case 7:
+ return LSP_ENCODING_DIGITAL_WRAPPER;
+ case 8:
+ return LSP_ENCODING_LAMBDA;
+ case 9:
+ return LSP_ENCODING_FIBER;
+ case 11:
+ return LSP_ENCODING_FIBER_CHANNEL;
+ case 12:
+ return LSP_ENCODING_ODUK;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/KeyId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/KeyId.java
similarity index 99%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/KeyId.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/KeyId.java
index 6e73a5b..1c7ff01 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/KeyId.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/KeyId.java
@@ -21,7 +21,6 @@
/**
* Representation of an key identifier in URI.
- *
*/
public class KeyId {
/**
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/Label.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/LongValue.java
similarity index 64%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/LongValue.java
index 558fc5a..66af170 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/LongValue.java
@@ -13,33 +13,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.tetopology.management.api.link;
-
-import java.util.Objects;
+package org.onosproject.tetopology.management.api;
import com.google.common.base.MoreObjects;
+import java.util.Objects;
+
/**
- * Implementation of Label as an ElementType.
+ * Implementation of using a long integer to represent
+ * an ElementType.
*/
-public class Label implements ElementType {
+public class LongValue {
private final long value;
/**
- * Creates an instance of Label.
+ * Creates an instance of LongValue.
*
- * @param label label value
+ * @param value long value
*/
- public Label(long label) {
- this.value = label;
+ public LongValue(long value) {
+ this.value = value;
}
/**
- * Returns the label.
+ * Returns the long integer representing the ElementType.
*
- * @return value of the label
+ * @return long integer
*/
- public long label() {
+ public long value() {
return value;
}
@@ -53,10 +54,9 @@
if (this == obj) {
return true;
}
- if (obj instanceof Label) {
- Label other = (Label) obj;
- return
- Objects.equals(value, other.value);
+ if (obj instanceof LongValue) {
+ LongValue other = (LongValue) obj;
+ return Objects.equals(value, other.value);
}
return false;
}
@@ -64,7 +64,7 @@
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
- .add("value", value)
- .toString();
+ .add("value", value)
+ .toString();
}
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Network.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Network.java
new file mode 100644
index 0000000..389ff46
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Network.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016-present 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.tetopology.management.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.tetopology.management.api.link.NetworkLink;
+import org.onosproject.tetopology.management.api.node.NetworkNode;
+
+/**
+ * Abstraction of a network element.
+ */
+public interface Network extends TeTopologyEventSubject {
+
+ /**
+ * Returns the network identifier / key.
+ *
+ * @return network identifier
+ */
+ KeyId networkId();
+
+ /**
+ * Returns the network keys (or identifiers) of the supporting
+ * networks which serve as the underlay networks of the current
+ * network which is mapped by the specified network identifier.
+ *
+ * @return list of network keys
+ */
+ List<KeyId> supportingNetworkIds();
+
+ /**
+ * Returns a collection of the network nodes of the network mapped
+ * by the specified network identifier.
+ *
+ * @return a collection of network nodes
+ */
+ Map<KeyId, NetworkNode> nodes();
+
+ /**
+ * Returns the network node corresponding to the given identifier
+ * which is encoded as a URI. If no node is found, a null
+ * is returned.
+ *
+ * @param nodeId node id
+ * @return value of node or null
+ */
+ NetworkNode node(KeyId nodeId);
+
+ /**
+ * Returns a collection of links in the network mapped by the specified
+ * network identifier.
+ *
+ * @return a collection of currently known links
+ */
+ Map<KeyId, NetworkLink> links();
+
+ /**
+ * Returns the link corresponding to the given identifier which is
+ * encoded as a URI. If no such a link is found, a null is returned.
+ *
+ * @param linkId link id
+ * @return value of the link
+ */
+ NetworkLink link(KeyId linkId);
+
+ /**
+ * Returns true if the network is provided by a server, or false if
+ * configured by a client.
+ *
+ * @return true if the network is provided by a server; false otherwise
+ */
+ boolean isServerProvided();
+
+ /**
+ * Returns the TE topology identifier for this network.
+ *
+ * @return TE topology id
+ */
+ TeTopologyId teTopologyId();
+
+ /**
+ * Returns the controller identifier owning this abstracted topology.
+ *
+ * @return the controller id
+ */
+ DeviceId ownerId();
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/Networks.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Networks.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/Networks.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Networks.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/OptimizationType.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/OptimizationType.java
new file mode 100644
index 0000000..b5af761
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/OptimizationType.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+/**
+ * TE optimization type.
+ */
+public enum OptimizationType {
+
+ /**
+ * Designates optimization is not applied.
+ */
+ NOT_OPTIMIZED(0),
+
+ /**
+ * Designates optimization criteria least cost.
+ */
+ LEAST_COST(1),
+
+ /**
+ * Designates optimization criteria shortest delay.
+ */
+ SHORTEST_DELAY(2),
+
+ /**
+ * Designates optimization criteria best link utilization.
+ */
+ BEST_LINK_UTILIZATION(3),
+
+ /**
+ * Designates optimization criteria best link protection.
+ */
+ BEST_LINK_PROTECTION(4);
+
+ private int value;
+
+ /**
+ * Creates an instance of OptimizationType.
+ *
+ * @param value value of optimization type
+ */
+ OptimizationType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the optimization type value.
+ *
+ * @return the value of optimization type
+ */
+ public int value() {
+ return value;
+ }
+
+ /**
+ * Returns the optimization constant corresponding to the given value.
+ * If the given value cannot be mapped to any optimization type, a null
+ * is returned.
+ *
+ * @param value the value of the optimization type
+ * @return corresponding optimization type constant
+ */
+ public static OptimizationType of(int value) {
+ switch (value) {
+ case 0:
+ return OptimizationType.NOT_OPTIMIZED;
+ case 1:
+ return OptimizationType.LEAST_COST;
+ case 2:
+ return OptimizationType.SHORTEST_DELAY;
+ case 3:
+ return OptimizationType.BEST_LINK_UTILIZATION;
+ case 4:
+ return OptimizationType.BEST_LINK_PROTECTION;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/ProviderClientId.java
similarity index 60%
copy from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
copy to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/ProviderClientId.java
index d96ed74..04edd14 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/ProviderClientId.java
@@ -16,27 +16,25 @@
package org.onosproject.tetopology.management.api;
import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Objects;
/**
- * TE Topology identifiers.
+ * TE topology provider and client identifiers.
*/
-public class TeTopologyId {
+public abstract class ProviderClientId {
private final long providerId;
private final long clientId;
- private final String topologyId;
/**
- * Creates an instance of TE topology identifier.
+ * Creates an instance of TE topology provider client identifier.
*
- * @param providerId value of provider identifier
- * @param clientId value of client identifier
- * @param topologyId value of topology identifier
+ * @param providerId provider identifier
+ * @param clientId client identifier
*/
- public TeTopologyId(long providerId, long clientId, String topologyId) {
+ public ProviderClientId(long providerId, long clientId) {
this.providerId = providerId;
this.clientId = clientId;
- this.topologyId = topologyId;
}
/**
@@ -57,18 +55,9 @@
return clientId;
}
- /**
- * Returns the topology identifier.
- *
- * @return topology identifier
- */
- public String topologyId() {
- return topologyId;
- }
-
@Override
public int hashCode() {
- return Objects.hashCode(providerId, clientId, topologyId);
+ return Objects.hashCode(providerId, clientId);
}
@Override
@@ -76,21 +65,27 @@
if (this == object) {
return true;
}
- if (object instanceof TeTopologyId) {
- TeTopologyId that = (TeTopologyId) object;
- return Objects.equal(this.providerId, that.providerId) &&
- Objects.equal(this.clientId, that.clientId) &&
- Objects.equal(this.topologyId, that.topologyId);
+ if (object instanceof ProviderClientId) {
+ ProviderClientId that = (ProviderClientId) object;
+ return Objects.equal(providerId, that.providerId) &&
+ Objects.equal(clientId, that.clientId);
}
return false;
}
- @Override
- public String toString() {
+ /**
+ * Returns ToStringHelper with providerId and clientId.
+ *
+ * @return toStringHelper
+ */
+ protected ToStringHelper toStringHelper() {
return MoreObjects.toStringHelper(this)
.add("providerId", providerId)
- .add("clientId", clientId)
- .add("topologyId", topologyId)
- .toString();
+ .add("clientId", clientId);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper().toString();
}
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/SwitchingType.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/SwitchingType.java
new file mode 100644
index 0000000..a6c1dba
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/SwitchingType.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+/**
+ * Type of switching on a link.
+ * See RFC 3471 for details.
+ */
+public enum SwitchingType {
+
+ /**
+ * Designates packet-switch capable-1 (PSC-1).
+ */
+ PACKET_SWITCH_CAPABLE1(1),
+
+ /**
+ * Designates packet-switch capable-2 (PSC-2).
+ */
+ PACKET_SWITCH_CAPABLE2(2),
+
+ /**
+ * Designates packet-switch capable-3 (PSC-3).
+ */
+ PACKET_SWITCH_CAPABLE3(3),
+
+ /**
+ * Designates packet-switch capable-4 (PSC-4).
+ */
+ PACKET_SWITCH_CAPABLE4(4),
+
+ /**
+ * Designates ethernet virtual private line (EVPL).
+ */
+ ETHERNET_VIRTUAL_PRIVATE_LINE(5),
+
+ /**
+ * Designates layer-2 switch capable (L2SC).
+ */
+ LAYER2_SWITCH_CAPABLE(51),
+
+ /**
+ * Designates time-division-multiplex capable (TDM).
+ */
+ TIME_DIVISION_MULTIPLEX_CAPABLE(100),
+
+ /**
+ * Designates OTN-TDM capable.
+ */
+ OTN_TDM_CAPABLE(101),
+
+ /**
+ * Designates lambda-switch capable (LSC).
+ */
+ LAMBDA_SWITCH_CAPABLE(150),
+
+ /**
+ * Designates fiber-switch capable (FSC).
+ */
+ FIBER_SWITCH_CAPABLE(200);
+
+ private int value;
+
+ /**
+ * Creates an instance of a switching type constant corresponding
+ * to the given integer value.
+ *
+ * @param value integer value
+ */
+ SwitchingType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the integer value of the switching type.
+ *
+ * @return integer value
+ */
+ public int value() {
+ return value;
+ }
+
+ /**
+ * Returns the switching type corresponding to a given integer
+ * value. If the given value is not valid, a null is returned.
+ *
+ * @param value integer value
+ * @return corresponding switching type; or null if value is invalid
+ */
+ public static SwitchingType of(int value) {
+ switch (value) {
+ case 1:
+ return PACKET_SWITCH_CAPABLE1;
+ case 2:
+ return PACKET_SWITCH_CAPABLE2;
+ case 3:
+ return PACKET_SWITCH_CAPABLE3;
+ case 4:
+ return PACKET_SWITCH_CAPABLE4;
+ case 5:
+ return ETHERNET_VIRTUAL_PRIVATE_LINE;
+ case 51:
+ return LAYER2_SWITCH_CAPABLE;
+ case 100:
+ return TIME_DIVISION_MULTIPLEX_CAPABLE;
+ case 101:
+ return OTN_TDM_CAPABLE;
+ case 150:
+ return LAMBDA_SWITCH_CAPABLE;
+ case 200:
+ return FIBER_SWITCH_CAPABLE;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeConstants.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeConstants.java
new file mode 100644
index 0000000..180602b
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeConstants.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+/**
+ * The common TE constants.
+ */
+public final class TeConstants {
+ /**
+ * Lowest priority of a GMPLS traffic link.
+ */
+ public static final short MIN_PRIORITY = 0;
+
+ /**
+ * Highest priority of a GMPLS traffic link.
+ */
+ public static final short MAX_PRIORITY = 7;
+
+ /**
+ * Size of the BitSet flags used in TE Topology data structures, such as
+ * TE links, TE nodes, and TE topologies.
+ */
+ public static final short FLAG_MAX_BITS = 16;
+
+ /**
+ * Indication of a Nil flag or a uninitialized long integer.
+ */
+ public static final long NIL_LONG_VALUE = 0;
+
+ // no instantiation
+ private TeConstants() {
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeStatus.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeStatus.java
similarity index 81%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeStatus.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeStatus.java
index 59296bc..356a853 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeStatus.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeStatus.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.tetopology.management.api.node;
+package org.onosproject.tetopology.management.api;
/**
* Represents ENUM data of teStatus.
@@ -72,22 +72,6 @@
}
/**
- * Returns the object of teStatus fromString input String. Returns null
- * when the integer value is not recognized.
- *
- * @param valInString input String
- * @return Object of teStatus
- */
- public static TeStatus of(String valInString) {
- try {
- int tmpVal = Integer.parseInt(valInString);
- return of(tmpVal);
- } catch (NumberFormatException e) {
- }
- return null;
- }
-
- /**
* Returns the object of teAdminStatusEnumForTypeInt.Returns null
* when string conversion fails or converted integer value is not
* recognized.
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologies.java
similarity index 61%
copy from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
copy to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologies.java
index 84fc030..1a58fae 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologies.java
@@ -15,12 +15,25 @@
*/
package org.onosproject.tetopology.management.api;
-import org.onosproject.net.provider.ProviderRegistry;
+import java.util.Map;
/**
- * Abstraction of IETF networks topology provider registry.
+ * Abstraction of an entity which represents a set of TE topologies.
*/
-public interface TeTopologyProviderRegistry
- extends ProviderRegistry<TeTopologyProvider, TeTopologyProviderService> {
+public interface TeTopologies {
+
+ /**
+ * Returns the name of the TE topology set.
+ *
+ * @return name
+ */
+ String name();
+
+ /**
+ * Returns a collection of currently known TE topologies.
+ *
+ * @return list of TE topologies
+ */
+ Map<TeTopologyKey, TeTopology> teTopologies();
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopology.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopology.java
new file mode 100644
index 0000000..4976aec
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopology.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2016-present 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.tetopology.management.api;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.tetopology.management.api.link.TeLink;
+import org.onosproject.tetopology.management.api.link.TeLinkTpKey;
+import org.onosproject.tetopology.management.api.node.TeNode;
+
+import java.util.BitSet;
+import java.util.Map;
+
+/**
+ * Abstraction of a TE topology.
+ */
+public interface TeTopology extends TeTopologyEventSubject {
+ /**
+ * Indicates that the specified topology is not usable for
+ * any ACTN operations.
+ */
+ public static final int BIT_DISABLED = 0;
+
+ /**
+ * Indicates that the topology is auto-constructed by
+ * the controller by an auto-discovery mechanism.
+ */
+ public static final int BIT_LEARNT = 1;
+
+ /**
+ * Indicates that the topology is merged from other
+ * supporting topologies.
+ */
+ public static final int BIT_MERGED = 2;
+
+ /**
+ * Indicates that the topology is customized based on
+ * another topology.
+ */
+ public static final int BIT_CUSTOMIZED = 3;
+
+ /**
+ * Returns the TE topology identifier.
+ *
+ * @return the topology id
+ */
+ TeTopologyKey teTopologyId();
+
+ /**
+ * Returns the topology characteristics flags.
+ *
+ * @return the flags
+ */
+ public BitSet flags();
+
+ /**
+ * Returns the topology optimization criteria.
+ *
+ * @return the optimization
+ */
+ public OptimizationType optimization();
+
+ /**
+ * Returns a collection of TE nodes in the topology.
+ *
+ * @return a collection of currently known TE nodes
+ */
+ Map<Long, TeNode> teNodes();
+
+ /**
+ * Returns a TE node in the topology that matches the given node
+ * identifier. A null will be returned if no such node exists.
+ *
+ * @param teNodeId the TE node id
+ * @return the corresponding node; or null if not found
+ */
+ TeNode teNode(long teNodeId);
+
+ /**
+ * Returns a collection of links in the topology.
+ *
+ * @return a collection of currently known te links
+ */
+ Map<TeLinkTpKey, TeLink> teLinks();
+
+ /**
+ * Returns a TE link in the topology that matches the given
+ * link identifier. If no such a link is found, a null is returned.
+ *
+ * @param teLinkId the TE link id
+ * @return the corresponding link; or null if not found
+ */
+ TeLink teLink(TeLinkTpKey teLinkId);
+
+ /**
+ * Returns the TE topology identifier string value.
+ *
+ * @return the topology id in String format
+ */
+ String teTopologyIdStringValue();
+
+ /**
+ * Returns the network identifier.
+ *
+ * @return network identifier
+ */
+ KeyId networkId();
+
+ /**
+ * Returns the identity of the controller owning this abstracted topology.
+ *
+ * @return the controller id
+ */
+ DeviceId ownerId();
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java
new file mode 100644
index 0000000..25bca39
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import org.onosproject.event.AbstractEvent;
+
+/**
+ * TE topology event.
+ */
+public class TeTopologyEvent
+ extends AbstractEvent<TeTopologyEvent.Type, TeTopologyEventSubject> {
+
+ /**
+ * Type of TE topology events.
+ */
+ public enum Type {
+ /**
+ * Designates addition of a network.
+ */
+ NETWORK_ADDED,
+
+ /**
+ * Designates update of a network.
+ */
+ NETWORK_UPDATED,
+
+ /**
+ * Designates removal of a network.
+ */
+ NETWORK_REMOVED,
+
+ /**
+ * Designates addition of a network node.
+ */
+ NODE_ADDED,
+
+ /**
+ * Designates update of a network node.
+ */
+ NODE_UPDATED,
+
+ /**
+ * Designates removal of a network node.
+ */
+ NODE_REMOVED,
+
+ /**
+ * Designates addition of a termination point.
+ */
+ TP_ADDED,
+
+ /**
+ * Designates update of a termination point.
+ */
+ TP_UPDATED,
+
+ /**
+ * Designates removal of a termination point.
+ */
+ TP_REMOVED,
+
+ /**
+ * Designates addition of a network link.
+ */
+ LINK_ADDED,
+
+ /**
+ * Designates update of a network link.
+ */
+ LINK_UPDATED,
+
+ /**
+ * Designates removal of a network link.
+ */
+ LINK_REMOVED,
+
+ /**
+ * Designates addition of a TE topology.
+ */
+ TE_TOPOLOGY_ADDED,
+
+ /**
+ * Designates update of a TE topology.
+ */
+ TE_TOPOLOGY_UPDATED,
+
+ /**
+ * Designates removal of a TE topology.
+ */
+ TE_TOPOLOGY_REMOVED,
+
+ /**
+ * Designates addition of a TE node.
+ */
+ TE_NODE_ADDED,
+
+ /**
+ * Designates update of a TE node.
+ */
+ TE_NODE_UPDATED,
+
+ /**
+ * Designates removal of a TE node.
+ */
+ TE_NODE_REMOVED,
+
+ /**
+ * Designates addition of a TE link.
+ */
+ TE_LINK_ADDED,
+
+ /**
+ * Designates update of a TE link.
+ */
+ TE_LINK_UPDATED,
+
+ /**
+ * Designates removal of a TE link.
+ */
+ TE_LINK_REMOVED;
+ }
+
+ /**
+ * Constructor for TeTopologyEvent.
+ *
+ * @param type type of topology event
+ * @param subject event subject interface
+ */
+ public TeTopologyEvent(Type type, TeTopologyEventSubject subject) {
+ super(type, subject);
+ }
+
+ /**
+ * Constructor for TeTopologyEvent.
+ *
+ * @param type type of topology event
+ * @param subject event subject interface
+ * @param time event time
+ */
+ public TeTopologyEvent(Type type, TeTopologyEventSubject subject, long time) {
+ super(type, subject, time);
+ }
+
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
similarity index 63%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
index d96ed74..d79246d 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
@@ -15,15 +15,12 @@
*/
package org.onosproject.tetopology.management.api;
-import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
- * TE Topology identifiers.
+ * TE Topology identifier in String format.
*/
-public class TeTopologyId {
- private final long providerId;
- private final long clientId;
+public class TeTopologyId extends ProviderClientId {
private final String topologyId;
/**
@@ -34,30 +31,11 @@
* @param topologyId value of topology identifier
*/
public TeTopologyId(long providerId, long clientId, String topologyId) {
- this.providerId = providerId;
- this.clientId = clientId;
+ super(providerId, clientId);
this.topologyId = topologyId;
}
/**
- * Returns the provider identifier.
- *
- * @return provider identifier
- */
- public long providerId() {
- return providerId;
- }
-
- /**
- * Returns the client identifier.
- *
- * @return client identifier
- */
- public long clientId() {
- return clientId;
- }
-
- /**
* Returns the topology identifier.
*
* @return topology identifier
@@ -68,7 +46,7 @@
@Override
public int hashCode() {
- return Objects.hashCode(providerId, clientId, topologyId);
+ return Objects.hashCode(super.hashCode(), topologyId);
}
@Override
@@ -77,19 +55,18 @@
return true;
}
if (object instanceof TeTopologyId) {
+ if (!super.equals(object)) {
+ return false;
+ }
TeTopologyId that = (TeTopologyId) object;
- return Objects.equal(this.providerId, that.providerId) &&
- Objects.equal(this.clientId, that.clientId) &&
- Objects.equal(this.topologyId, that.topologyId);
+ return Objects.equal(this.topologyId, that.topologyId);
}
return false;
}
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("providerId", providerId)
- .add("clientId", clientId)
+ return toStringHelper()
.add("topologyId", topologyId)
.toString();
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyKey.java
new file mode 100644
index 0000000..9cd1724
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyKey.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
+
+/**
+ * TE topology key in long integer format.
+ */
+public class TeTopologyKey extends ProviderClientId {
+ private final long topologyId;
+
+ /**
+ * Creates an instance of TE topology identifier.
+ *
+ * @param providerId provider identifier
+ * @param clientId client identifier
+ * @param topologyId topology identifier
+ */
+ public TeTopologyKey(long providerId, long clientId, long topologyId) {
+ super(providerId, clientId);
+ this.topologyId = topologyId;
+ }
+
+ /**
+ * Returns the topology identifier.
+ *
+ * @return topology identifier
+ */
+ public long topologyId() {
+ return topologyId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), topologyId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeTopologyKey) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ TeTopologyKey that = (TeTopologyKey) object;
+ return Objects.equal(topologyId, that.topologyId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns ToStringHelper with additional topologyId.
+ *
+ * @return toStringHelper
+ */
+ protected ToStringHelper toTopologyKeyStringHelper() {
+ return toStringHelper().add("topologyId", topologyId);
+ }
+
+ @Override
+ public String toString() {
+ return toTopologyKeyStringHelper().toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
similarity index 93%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
index 84fc030..b44adaf 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
@@ -18,7 +18,7 @@
import org.onosproject.net.provider.ProviderRegistry;
/**
- * Abstraction of IETF networks topology provider registry.
+ * Abstraction of TE topology provider registry.
*/
public interface TeTopologyProviderRegistry
extends ProviderRegistry<TeTopologyProvider, TeTopologyProviderService> {
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java
new file mode 100644
index 0000000..40c8025
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import org.onosproject.event.ListenerService;
+import org.onosproject.tetopology.management.api.link.NetworkLinkKey;
+import org.onosproject.tetopology.management.api.link.TeLink;
+import org.onosproject.tetopology.management.api.link.TeLinkTpGlobalKey;
+import org.onosproject.tetopology.management.api.node.NetworkNodeKey;
+import org.onosproject.tetopology.management.api.node.TeNode;
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TerminationPointKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+import org.onosproject.tetopology.management.api.node.TunnelTerminationPoint;
+
+/**
+ * TE Topology Service API.
+ */
+public interface TeTopologyService
+ extends ListenerService<TeTopologyEvent, TeTopologyListener> {
+
+ /**
+ * Returns a collection of currently known networks.
+ *
+ * @return a collection of networks
+ */
+ Networks networks();
+
+ /**
+ * Returns the network identified by its network identifier. if no
+ * network can be found, a null is returned.
+ *
+ * @param networkId network id in URI format
+ * @return the corresponding network; or null if not found
+ */
+ Network network(KeyId networkId);
+
+ /**
+ * Updates the network.
+ *
+ * @param network network to be updated
+ */
+ void updateNetwork(Network network);
+
+ /**
+ * Removes the network corresponding to the given network identifier.
+ *
+ * @param networkId network id in URI format
+ */
+ void removeNetwork(KeyId networkId);
+
+ /**
+ * Returns a collection of currently known TE topologies.
+ *
+ * @return a collection of topologies
+ */
+ TeTopologies teTopologies();
+
+ /**
+ * Returns the TE Topology identified by the given key.
+ *
+ * @param topologyKey the given TE topology Key
+ * @return the corresponding TE topology
+ */
+ TeTopology teTopology(TeTopologyKey topologyKey);
+
+ /**
+ * Returns the merged topology in MDSC.
+ *
+ * @return the merged topology
+ */
+ TeTopology mergedTopology();
+
+ /**
+ * Creates or Updates a TE topology based on the given topology.
+ *
+ * @param teTopology the given TE topology
+ */
+ void updateTeTopology(TeTopology teTopology);
+
+ /**
+ * Removes the TE Topology identified by its key. Does nothing if
+ * no topology is found which matches the key.
+ *
+ * @param topologyKey the TE topology key
+ */
+ void removeTeTopology(TeTopologyKey topologyKey);
+
+ /**
+ * Returns the TE node identified by the given node key. If no TE
+ * node is found, a null is returned.
+ *
+ * @param nodeKey the TE node key
+ * @return the corresponding TE node,or null
+ */
+ TeNode teNode(TeNodeKey nodeKey);
+
+ /**
+ * Returns the TE link identified by the given TE link key. If no
+ * TE link is found, a null is returned.
+ *
+ * @param linkKey the TE link key
+ * @return the corresponding TE link or null
+ */
+ TeLink teLink(TeLinkTpGlobalKey linkKey);
+
+ /**
+ * Returns a tunnel termination point identified by the given tunnel
+ * termination point key. If no tunnel termination point is found,
+ * a null is returned.
+ *
+ * @param ttpKey the tunnel termination point key
+ * @return the corresponding tunnel termination point
+ */
+ TunnelTerminationPoint tunnelTerminationPoint(TtpKey ttpKey);
+
+ /**
+ * Returns the network Id for a TE Topology key.
+ *
+ * @param teTopologyKey the TE topology key
+ * @return value of network Id
+ */
+ KeyId networkId(TeTopologyKey teTopologyKey);
+
+ /**
+ * Returns the network node key for a TE node key.
+ *
+ * @param teNodeKey a TE node key
+ * @return value of network node key
+ */
+ NetworkNodeKey nodeKey(TeNodeKey teNodeKey);
+
+ /**
+ * Returns the network link key for a TE link key.
+ *
+ * @param teLinkKey a TE node key
+ * @return value of network link key
+ */
+ NetworkLinkKey linkKey(TeLinkTpGlobalKey teLinkKey);
+
+ /**
+ * Returns the termination point key for a TE termination point key.
+ *
+ * @param teTpKey a TE termination point key
+ * @return value of termination point key
+ */
+ TerminationPointKey terminationPointKey(TeLinkTpGlobalKey teTpKey);
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeUtils.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeUtils.java
new file mode 100644
index 0000000..4b6bf52
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeUtils.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016 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.tetopology.management.api;
+
+import com.google.common.collect.Lists;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * TE utility functions.
+ */
+public final class TeUtils {
+
+ // no instantiation
+ private TeUtils() {
+ }
+
+ /**
+ * Returns true if the given collection is empty; false otherwise.
+ *
+ * @param c the given collection
+ * @return true or false
+ */
+ public static boolean nonEmpty(Collection<?> c) {
+ return c != null && !c.isEmpty();
+ }
+
+ /**
+ * Adds a given element to a given list. If element is null, the
+ * given list is returned without modification. If the list is null,
+ * the function will instantiate and return a new list.
+ *
+ * @param list the given list
+ * @param element the given list element
+ * @param <T> the element type
+ * @return the resulting list
+ */
+ public static <T> List<T> addListElement(List<T> list, T element) {
+ if (element == null) {
+ return list;
+ }
+
+ List<T> result = (list == null) ? Lists.newArrayList() : list;
+
+ result.add(element);
+
+ return result;
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
similarity index 86%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
index 8e46d22..fbe6955 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
@@ -20,7 +20,7 @@
import com.google.common.base.MoreObjects;
/**
- * Implementation of Automous System (AS) number as an ElementType.
+ * Implementation of Autonomous System (AS) number as an ElementType.
*/
public class AsNumber implements ElementType {
private final int asNumber;
@@ -28,18 +28,18 @@
/**
* Creates an instance of AsNumber.
*
- * @param asNumber value of autonomous system number
+ * @param asNumber autonomous system number
*/
public AsNumber(int asNumber) {
this.asNumber = asNumber;
}
/**
- * Returns the asNumber.
+ * Returns the autonomous system number.
*
- * @return value of the autonomous system number
+ * @return the AS number
*/
- public int getAsNumber() {
+ public int asNumber() {
return asNumber;
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/CommonLinkData.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/CommonLinkData.java
new file mode 100644
index 0000000..61dbe31
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/CommonLinkData.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.EncodingType;
+import org.onosproject.tetopology.management.api.SwitchingType;
+import org.onosproject.tetopology.management.api.TeStatus;
+
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * Representation of link common attributes.
+ */
+public class CommonLinkData {
+ private final TeStatus adminStatus;
+ private final TeStatus opStatus;
+ private final BitSet flags;
+
+ private final SwitchingType switchingLayer;
+ private final EncodingType encodingLayer;
+
+ private final ExternalLink externalLink;
+ private final UnderlayPath underlayPath;
+ private final TePathAttributes teAttributes;
+ private final List<Long> interLayerLocks;
+ private final LinkBandwidth bandwidth;
+ private final Long adminGroup;
+
+ /**
+ * Creates an instance of CommonLinkData.
+ *
+ * @param adminStatus the admin status
+ * @param opStatus the operational Status
+ * @param flags the flags
+ * @param switchingLayer the network layer switching type
+ * @param encodingLayer the network layer encoding type
+ * @param externalLink the external link specific attributes
+ * @param underlayPath the link underlay path and supporting tunnel
+ * @param teAttributes the link path TE attributes
+ * @param adminGroup the administrative group
+ * @param interLayerLocks the supported inter-layer locks
+ * @param bandwidth the link maximum and available bandwidth at
+ * each priority level
+ */
+ public CommonLinkData(TeStatus adminStatus,
+ TeStatus opStatus, BitSet flags, SwitchingType switchingLayer,
+ EncodingType encodingLayer, ExternalLink externalLink,
+ UnderlayPath underlayPath, TePathAttributes teAttributes,
+ Long adminGroup, List<Long> interLayerLocks,
+ LinkBandwidth bandwidth) {
+ this.adminStatus = adminStatus;
+ this.opStatus = opStatus;
+ this.flags = flags;
+ this.switchingLayer = switchingLayer;
+ this.encodingLayer = encodingLayer;
+ this.externalLink = externalLink;
+ this.underlayPath = underlayPath;
+ this.teAttributes = teAttributes;
+ this.adminGroup = adminGroup;
+ this.interLayerLocks = interLayerLocks != null ?
+ Lists.newArrayList(interLayerLocks) : null;
+ this.bandwidth = bandwidth;
+ }
+
+ /**
+ * Creates an instance of CommonLinkData with a TeLink.
+ *
+ * @param link the TE link
+ */
+ public CommonLinkData(TeLink link) {
+ this.adminStatus = link.adminStatus();
+ this.opStatus = link.opStatus();
+ this.flags = link.flags();
+ this.switchingLayer = link.switchingLayer();
+ this.encodingLayer = link.encodingLayer();
+ this.externalLink = link.externalLink();
+ this.underlayPath = new UnderlayPath(link);
+ this.teAttributes = new TePathAttributes(link);
+ this.adminGroup = link.administrativeGroup();
+ this.interLayerLocks = link.interLayerLocks() != null ?
+ Lists.newArrayList(link.interLayerLocks()) : null;
+ this.bandwidth = new LinkBandwidth(link);
+ }
+
+
+ /**
+ * Returns the admin status.
+ *
+ * @return the admin status
+ */
+ public TeStatus adminStatus() {
+ return adminStatus;
+ }
+
+ /**
+ * Returns the operational status.
+ *
+ * @return the optional status
+ */
+ public TeStatus opStatus() {
+ return opStatus;
+ }
+
+ /**
+ * Returns the flags.
+ *
+ * @return the flags
+ */
+ public BitSet flags() {
+ return flags;
+ }
+
+ /**
+ * Returns the network layer switching type for this link.
+ *
+ * @return the switching layer type
+ */
+ public SwitchingType switchingLayer() {
+ return switchingLayer;
+ }
+
+ /**
+ * Returns the network layer encoding type for this link.
+ *
+ * @return the encoding type
+ */
+ public EncodingType encodingLayer() {
+ return encodingLayer;
+ }
+
+ /**
+ * Returns the external link.
+ *
+ * @return the external link
+ */
+ public ExternalLink externalLink() {
+ return externalLink;
+ }
+
+ /**
+ * Returns the link underlay path and tunnel.
+ *
+ * @return the underlay path
+ */
+ public UnderlayPath underlayPath() {
+ return underlayPath;
+ }
+
+ /**
+ * Returns the path TE attributes.
+ *
+ * @return the path TE Attributes
+ */
+ public TePathAttributes teAttributes() {
+ return teAttributes;
+ }
+
+ /**
+ * Returns the link administrative group.
+ *
+ * @return the admin group
+ */
+ public Long adminGroup() {
+ return adminGroup;
+ }
+
+ /**
+ * Returns the supported inter-layer locks.
+ *
+ * @return the inter-layer locks
+ */
+ public List<Long> interLayerLocks() {
+ if (interLayerLocks == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(interLayerLocks);
+ }
+
+ /**
+ * Returns the link maximum and available bandwidth at each priority level.
+ *
+ * @return the bandwidth
+ */
+ public LinkBandwidth bandwidth() {
+ return bandwidth;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(adminStatus, opStatus, flags, switchingLayer,
+ encodingLayer, externalLink, underlayPath,
+ teAttributes, interLayerLocks, bandwidth);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof CommonLinkData) {
+ CommonLinkData that = (CommonLinkData) object;
+ return Objects.equal(adminStatus, that.adminStatus) &&
+ Objects.equal(opStatus, that.opStatus) &&
+ Objects.equal(flags, that.flags) &&
+ Objects.equal(switchingLayer, that.switchingLayer) &&
+ Objects.equal(encodingLayer, that.encodingLayer) &&
+ Objects.equal(externalLink, that.externalLink) &&
+ Objects.equal(underlayPath, that.underlayPath) &&
+ Objects.equal(teAttributes, that.teAttributes) &&
+ Objects.equal(interLayerLocks, that.interLayerLocks) &&
+ Objects.equal(bandwidth, that.bandwidth);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("adminStatus", adminStatus)
+ .add("opStatus", opStatus)
+ .add("flags", flags)
+ .add("switchingLayer", switchingLayer)
+ .add("encodingLayer", encodingLayer)
+ .add("externalLink", externalLink)
+ .add("underlayPath", underlayPath)
+ .add("teAttributes", teAttributes)
+ .add("interLayerLocks", interLayerLocks)
+ .add("bandwidth", bandwidth)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ConnectivityMatrixId.java
similarity index 62%
copy from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
copy to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ConnectivityMatrixId.java
index 004b3ed..e275b9c 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ConnectivityMatrixId.java
@@ -15,12 +15,19 @@
*/
package org.onosproject.tetopology.management.api.link;
+import org.onosproject.tetopology.management.api.LongValue;
+
/**
- * Represents the underlay primary path that supports a TE link.
+ * Implementation of Connectivity matrix entry id as an element type.
*/
-public class UnderlayPrimaryPath extends UnderlayAbstractPath {
-/*
- * Underlay primary path currently has the same data structure defined in
- * the underlay abstract path. It may be extended per standard definitions.
- */
+public class ConnectivityMatrixId extends LongValue implements ElementType {
+
+ /**
+ * Creates a connectivity matrix identifier.
+ *
+ * @param entryId the entry identifier
+ */
+ public ConnectivityMatrixId(long entryId) {
+ super(entryId);
+ }
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java
new file mode 100644
index 0000000..6f47d60
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.KeyId;
+import org.onosproject.tetopology.management.api.node.NodeTpKey;
+
+import java.util.List;
+
+/**
+ * Default implementation of a network link.
+ */
+public class DefaultNetworkLink implements NetworkLink {
+ private final KeyId linkId;
+ private final NodeTpKey source;
+ private final NodeTpKey destination;
+ private final List<NetworkLinkKey> supportingLinkIds;
+ private final TeLink teLink;
+
+ /**
+ * Creates an instance of a network link.
+ *
+ * @param linkId link identifier
+ * @param source source of termination point
+ * @param destination destination termination point
+ * @param supportingLinkIds supporting links
+ * @param teLink TE link which this network link maps to
+ */
+ public DefaultNetworkLink(KeyId linkId,
+ NodeTpKey source,
+ NodeTpKey destination,
+ List<NetworkLinkKey> supportingLinkIds,
+ TeLink teLink) {
+ this.linkId = linkId;
+ this.source = source;
+ this.destination = destination;
+ this.supportingLinkIds = supportingLinkIds != null ?
+ Lists.newArrayList(supportingLinkIds) : null;
+ this.teLink = teLink;
+ }
+
+ @Override
+ public KeyId linkId() {
+ return linkId;
+ }
+
+ @Override
+ public NodeTpKey source() {
+ return source;
+ }
+
+ @Override
+ public NodeTpKey destination() {
+ return destination;
+ }
+
+ @Override
+ public List<NetworkLinkKey> supportingLinkIds() {
+ if (supportingLinkIds == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(supportingLinkIds);
+ }
+
+ @Override
+ public TeLink teLink() {
+ return teLink;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(linkId, source, destination,
+ supportingLinkIds, teLink);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultNetworkLink) {
+ DefaultNetworkLink that = (DefaultNetworkLink) object;
+ return Objects.equal(linkId, that.linkId) &&
+ Objects.equal(source, that.source) &&
+ Objects.equal(destination, that.destination) &&
+ Objects.equal(supportingLinkIds, that.supportingLinkIds) &&
+ Objects.equal(teLink, that.teLink);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("linkId", linkId)
+ .add("source", source)
+ .add("destination", destination)
+ .add("supportingLinkIds", supportingLinkIds)
+ .add("teLink", teLink)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/DefaultTeLink.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/DefaultTeLink.java
new file mode 100644
index 0000000..72e713f
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/DefaultTeLink.java
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.EncodingType;
+import org.onosproject.tetopology.management.api.SwitchingType;
+import org.onosproject.tetopology.management.api.TeConstants;
+import org.onosproject.tetopology.management.api.TeStatus;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * The default implementation of TE link.
+ */
+public class DefaultTeLink implements TeLink {
+ private final TeLinkTpKey teLinkKey;
+ private final TeLinkTpKey peerTeLinkKey;
+ private final TeTopologyKey underlayTopologyId;
+ private final TeLinkTpGlobalKey supportTeLinkId;
+ private final TeLinkTpGlobalKey sourceTeLinkId;
+ private final CommonLinkData teData;
+
+ /**
+ * Creates an instance of a TE link.
+ *
+ * @param teLinkKey the TE link key
+ * @param peerTeLinkKey the bi-directional peer link key
+ * @param underlayTopologyId the link underlay TE topology id
+ * @param supportTeLinkId the supporting TE link id
+ * @param sourceTeLinkId the source TE link id
+ * @param teData the link common te data
+ */
+ public DefaultTeLink(TeLinkTpKey teLinkKey,
+ TeLinkTpKey peerTeLinkKey,
+ TeTopologyKey underlayTopologyId,
+ TeLinkTpGlobalKey supportTeLinkId,
+ TeLinkTpGlobalKey sourceTeLinkId,
+ CommonLinkData teData) {
+ this.teLinkKey = teLinkKey;
+ this.peerTeLinkKey = peerTeLinkKey;
+ this.underlayTopologyId = underlayTopologyId;
+ this.supportTeLinkId = supportTeLinkId;
+ this.sourceTeLinkId = sourceTeLinkId;
+ this.teData = teData;
+ }
+
+ @Override
+ public TeLinkTpKey teLinkKey() {
+ return teLinkKey;
+ }
+
+ @Override
+ public TeLinkTpKey peerTeLinkKey() {
+ return peerTeLinkKey;
+ }
+
+ @Override
+ public BitSet flags() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.flags();
+ }
+
+ @Override
+ public SwitchingType switchingLayer() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.switchingLayer();
+ }
+
+ @Override
+ public EncodingType encodingLayer() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.encodingLayer();
+ }
+
+ @Override
+ public ExternalLink externalLink() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.externalLink();
+ }
+
+ @Override
+ public TeTopologyKey underlayTeTopologyId() {
+ return underlayTopologyId;
+ }
+
+ @Override
+ public UnderlayPrimaryPath primaryPath() {
+ if (teData == null || teData.underlayPath() == null) {
+ return null;
+ }
+ return teData.underlayPath().primaryPath();
+ }
+
+ @Override
+ public List<UnderlayBackupPath> backupPaths() {
+ if (teData == null || teData.underlayPath() == null) {
+ return null;
+ }
+ return teData.underlayPath().backupPaths();
+ }
+
+ @Override
+ public TunnelProtectionType tunnelProtectionType() {
+ if (teData == null || teData.underlayPath() == null) {
+ return null;
+ }
+ return teData.underlayPath().tunnelProtectionType();
+ }
+
+ @Override
+ public long sourceTtpId() {
+ if (teData == null || teData.underlayPath() == null) {
+ return TeConstants.NIL_LONG_VALUE;
+ }
+ return teData.underlayPath().srcTtpId();
+ }
+
+ @Override
+ public long destinationTtpId() {
+ if (teData == null || teData.underlayPath() == null) {
+ return TeConstants.NIL_LONG_VALUE;
+ }
+ return teData.underlayPath().dstTtpId();
+ }
+
+ @Override
+ public TeTunnelId teTunnelId() {
+ if (teData == null || teData.underlayPath() == null) {
+ return null;
+ }
+ return teData.underlayPath().teTunnelId();
+ }
+
+ @Override
+ public TeLinkTpGlobalKey supportingTeLinkId() {
+ return supportTeLinkId;
+ }
+
+ @Override
+ public TeLinkTpGlobalKey sourceTeLinkId() {
+ return sourceTeLinkId;
+ }
+
+ @Override
+ public long cost() {
+ if (teData == null || teData.teAttributes() == null) {
+ return TeConstants.NIL_LONG_VALUE;
+ }
+ return teData.teAttributes().cost();
+ }
+
+ @Override
+ public long delay() {
+ if (teData == null || teData.teAttributes() == null) {
+ return TeConstants.NIL_LONG_VALUE;
+ }
+ return teData.teAttributes().delay();
+ }
+
+ @Override
+ public List<Long> srlgs() {
+ if (teData == null || teData.teAttributes() == null) {
+ return null;
+ }
+ return teData.teAttributes().srlgs();
+ }
+
+ @Override
+ public Long administrativeGroup() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.adminGroup();
+ }
+
+ @Override
+ public List<Long> interLayerLocks() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.interLayerLocks();
+ }
+
+ @Override
+ public float[] maxBandwidth() {
+ if (teData == null || teData.bandwidth() == null) {
+ return null;
+ }
+ return teData.bandwidth().maxBandwidth();
+ }
+
+ @Override
+ public float[] availBandwidth() {
+ if (teData == null || teData.bandwidth() == null) {
+ return null;
+ }
+ return teData.bandwidth().availBandwidth();
+ }
+
+ @Override
+ public float[] maxAvailLspBandwidth() {
+ if (teData == null || teData.bandwidth() == null) {
+ return null;
+ }
+ return teData.bandwidth().maxAvailLspBandwidth();
+ }
+
+ @Override
+ public float[] minAvailLspBandwidth() {
+ if (teData == null || teData.bandwidth() == null) {
+ return null;
+ }
+ return teData.bandwidth().minAvailLspBandwidth();
+ }
+
+ @Override
+ public OduResource oduResource() {
+ if (teData == null || teData.bandwidth() == null) {
+ return null;
+ }
+ return teData.bandwidth().oduResource();
+ }
+
+ @Override
+ public TeStatus adminStatus() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.adminStatus();
+ }
+
+ @Override
+ public TeStatus opStatus() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.opStatus();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(teLinkKey, peerTeLinkKey, underlayTopologyId,
+ supportTeLinkId, sourceTeLinkId, teData);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultTeLink) {
+ DefaultTeLink that = (DefaultTeLink) object;
+ return Objects.equal(teLinkKey, that.teLinkKey) &&
+ Objects.equal(peerTeLinkKey, that.peerTeLinkKey) &&
+ Objects.equal(underlayTopologyId, that.underlayTopologyId) &&
+ Objects.equal(supportTeLinkId, that.supportTeLinkId) &&
+ Objects.equal(sourceTeLinkId, that.sourceTeLinkId) &&
+ Objects.equal(teData, that.teData);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("teLinkKey", teLinkKey)
+ .add("peerTeLinkKey", peerTeLinkKey)
+ .add("underlayTopologyId", underlayTopologyId)
+ .add("supportTeLinkId", supportTeLinkId)
+ .add("sourceTeLinkId", sourceTeLinkId)
+ .add("teData", teData)
+ .toString();
+ }
+
+
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ElementType.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ElementType.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ElementType.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ElementType.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ExternalLink.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ExternalLink.java
new file mode 100644
index 0000000..9e11152
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ExternalLink.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of an external domain link.
+ */
+public class ExternalLink {
+ private final TeLinkTpGlobalKey externalLinkKey;
+ private final Long plugId;
+
+ /**
+ * Creates an instance of an external domain link.
+ *
+ * @param externalLinkKey external TE link key
+ * @param plugId global plug identifier
+ */
+ public ExternalLink(TeLinkTpGlobalKey externalLinkKey, long plugId) {
+ this.externalLinkKey = externalLinkKey;
+ this.plugId = plugId;
+ }
+
+ /**
+ * Returns the external TE link key.
+ *
+ * @return the externalLinkKey
+ */
+ public TeLinkTpGlobalKey externalLinkKey() {
+ return externalLinkKey;
+ }
+
+ /**
+ * Returns the global plug identifier.
+ *
+ * @return value of the global plug id
+ */
+ public Long plugId() {
+ return plugId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalLinkKey, plugId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof ExternalLink) {
+ ExternalLink that = (ExternalLink) object;
+ return Objects.equal(externalLinkKey, that.externalLinkKey) &&
+ Objects.equal(plugId, that.plugId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("externalLinkKey", externalLinkKey)
+ .add("plugId", plugId)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
similarity index 67%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
index 004b3ed..1411f0a 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
@@ -15,12 +15,19 @@
*/
package org.onosproject.tetopology.management.api.link;
+import org.onosproject.tetopology.management.api.LongValue;
+
/**
- * Represents the underlay primary path that supports a TE link.
+ * Implementation of a label as an element type.
*/
-public class UnderlayPrimaryPath extends UnderlayAbstractPath {
-/*
- * Underlay primary path currently has the same data structure defined in
- * the underlay abstract path. It may be extended per standard definitions.
- */
+public class Label extends LongValue implements ElementType {
+ /**
+ * Creates a label instance.
+ *
+ * @param label label value
+ */
+ public Label(long label) {
+ super(label);
+ }
+
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/LinkBandwidth.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/LinkBandwidth.java
new file mode 100644
index 0000000..0aff5ab
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/LinkBandwidth.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+import java.util.Arrays;
+
+/**
+ * Representation the TE link bandwidths.
+ */
+public class LinkBandwidth {
+ /**
+ * Maximum bandwidth, Size is MAX_PRIORITY + 1.
+ */
+ private final float[] maxBandwidth;
+
+ /**
+ * Unreserved bandwidth, Size is MAX_PRIORITY + 1.
+ */
+ private final float[] availBandwidth;
+
+ /**
+ * Maximum available bandwidth for a LSP.
+ */
+ private final float[] maxAvailLspBandwidth;
+
+ /**
+ * Minimum available bandwidth for a LSP.
+ */
+ private final float[] minAvailLspBandwidth;
+
+ /**
+ * ODU resources.
+ */
+ private final OduResource odu;
+
+ /**
+ * Creates an instance of link bandwidth.
+ *
+ * @param maxBandwidth the maximum bandwidth at each priority level
+ * @param availBandwidth the available bandwidth at each priority level
+ * @param maxAvailLspBandwidth the maximum available bandwidth for a LSP at
+ * each priority level
+ * @param minAvailLspBandwidth the minimum available bandwidth for a LSP at
+ * each priority level
+ * @param odu ODU resources
+ */
+ public LinkBandwidth(float[] maxBandwidth,
+ float[] availBandwidth,
+ float[] maxAvailLspBandwidth,
+ float[] minAvailLspBandwidth,
+ OduResource odu) {
+ this.maxBandwidth = maxBandwidth != null ?
+ Arrays.copyOf(maxBandwidth, maxBandwidth.length) : null;
+ this.availBandwidth = availBandwidth != null ?
+ Arrays.copyOf(availBandwidth, availBandwidth.length) : null;
+ this.maxAvailLspBandwidth = maxAvailLspBandwidth != null ?
+ Arrays.copyOf(maxAvailLspBandwidth,
+ maxAvailLspBandwidth.length) : null;
+ this.minAvailLspBandwidth = minAvailLspBandwidth != null ?
+ Arrays.copyOf(minAvailLspBandwidth,
+ minAvailLspBandwidth.length) : null;
+ this.odu = odu;
+ }
+
+ /**
+ * Creates an instance of link bandwidth with a TE link.
+ *
+ * @param link the TE link
+ */
+ public LinkBandwidth(TeLink link) {
+ this.maxBandwidth = link.maxBandwidth();
+ this.availBandwidth = link.maxAvailLspBandwidth();
+ this.maxAvailLspBandwidth = link.maxAvailLspBandwidth();
+ this.minAvailLspBandwidth = link.minAvailLspBandwidth();
+ this.odu = link.oduResource();
+ }
+
+ /**
+ * Returns the maximum bandwidth at each priority level.
+ *
+ * @return the maxBandwidth
+ */
+ public float[] maxBandwidth() {
+ if (maxBandwidth == null) {
+ return null;
+ }
+ return Arrays.copyOf(maxBandwidth, maxBandwidth.length);
+ }
+
+ /**
+ * Returns the available bandwidth at each priority level.
+ *
+ * @return the available bandwidth
+ */
+ public float[] availBandwidth() {
+ if (availBandwidth == null) {
+ return null;
+ }
+ return Arrays.copyOf(availBandwidth, availBandwidth.length);
+ }
+
+ /**
+ * Returns the maximum available bandwidth for a LSP at each priority
+ * level.
+ *
+ * @return the maximum available bandwidth
+ */
+ public float[] maxAvailLspBandwidth() {
+ if (maxAvailLspBandwidth == null) {
+ return null;
+ }
+ return Arrays.copyOf(maxAvailLspBandwidth, maxAvailLspBandwidth.length);
+ }
+
+ /**
+ * Returns the minimum available bandwidth for a LSP at each priority level.
+ *
+ * @return the minimum available bandwidth
+ */
+ public float[] minAvailLspBandwidth() {
+ if (minAvailLspBandwidth == null) {
+ return null;
+ }
+ return Arrays.copyOf(minAvailLspBandwidth, minAvailLspBandwidth.length);
+ }
+
+ /**
+ * Returns the link ODUk resources.
+ *
+ * @return the ODUk resources
+ */
+ public OduResource oduResource() {
+ return odu;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(maxBandwidth, availBandwidth, maxAvailLspBandwidth,
+ minAvailLspBandwidth, odu);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof LinkBandwidth) {
+ LinkBandwidth that = (LinkBandwidth) object;
+ return Objects.equal(maxBandwidth, that.maxBandwidth) &&
+ Objects.equal(availBandwidth, that.availBandwidth) &&
+ Objects.equal(maxAvailLspBandwidth, that.maxAvailLspBandwidth) &&
+ Objects.equal(minAvailLspBandwidth, that.minAvailLspBandwidth) &&
+ Objects.equal(odu, that.odu);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("maxBandwidth", maxBandwidth)
+ .add("availBandwidth", availBandwidth)
+ .add("maxAvailLspBandwidth", maxAvailLspBandwidth)
+ .add("minAvailLspBandwidth", minAvailLspBandwidth)
+ .add("odu", odu)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
similarity index 70%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
index 09cb010..37a5e5a 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
@@ -15,19 +15,18 @@
*/
package org.onosproject.tetopology.management.api.link;
-import java.util.List;
-
import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
-import org.onosproject.tetopology.management.api.node.TerminationPointKey;
+import org.onosproject.tetopology.management.api.node.NodeTpKey;
+
+import java.util.List;
/**
* Abstraction of a base network link.
*/
-public interface NetworkLink extends TeTopologyEventSubject {
+public interface NetworkLink {
/**
- * Returns the link id.
+ * Returns the link identifier.
*
* @return link identifier
*/
@@ -36,29 +35,28 @@
/**
* Returns the link source termination point.
*
- * @return source link termination point id
+ * @return source link termination point identifier
*/
- TerminationPointKey getSource();
+ NodeTpKey source();
/**
* Returns the link destination termination point.
*
* @return destination link termination point id
*/
- TerminationPointKey getDestination();
+ NodeTpKey destination();
/**
- * Returns the supporting link ids.
+ * Returns the supporting link identifiers.
*
* @return list of the ids of the supporting links
*/
- List<NetworkLinkKey> getSupportingLinkIds();
+ List<NetworkLinkKey> supportingLinkIds();
/**
- * Returns the link te extension.
+ * Returns the link TE extension.
*
* @return TE link attributes
*/
- TeLink getTe();
-
+ TeLink teLink();
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkEventSubject.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkEventSubject.java
new file mode 100644
index 0000000..ead8c8d
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkEventSubject.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
+
+/**
+ * Representation of a network link event.
+ */
+public class NetworkLinkEventSubject implements TeTopologyEventSubject {
+ private final NetworkLinkKey key;
+ private final NetworkLink networkLink;
+
+ /**
+ * Creates a network link event instance.
+ *
+ * @param key the network link global key
+ * @param networkLink the network link object
+ */
+ public NetworkLinkEventSubject(NetworkLinkKey key, NetworkLink networkLink) {
+ this.key = key;
+ this.networkLink = networkLink;
+ }
+
+ /**
+ * Returns the network link global key.
+ *
+ * @return the key
+ */
+ public NetworkLinkKey key() {
+ return key;
+ }
+
+ /**
+ * Returns the network link.
+ *
+ * @return the network link
+ */
+ public NetworkLink networkLink() {
+ return networkLink;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(key, networkLink);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof NetworkLinkEventSubject) {
+ NetworkLinkEventSubject that = (NetworkLinkEventSubject) object;
+ return Objects.equal(key, that.key) &&
+ Objects.equal(networkLink, that.networkLink);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("key", key)
+ .add("networkLink", networkLink)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkKey.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkKey.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkKey.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/OduResource.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/OduResource.java
new file mode 100644
index 0000000..3834d9c
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/OduResource.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of an ODU link resource.
+ */
+public class OduResource {
+ private final short odu0s;
+ private final short odu1s;
+ private final short odu2s;
+ private final short odu2es;
+ private final short odu3s;
+ private final short odu4s;
+ private final short oduFlexes;
+
+ /**
+ * Creates an instance of an ODU link resource.
+ *
+ * @param odu0s number of available ODU0 containers
+ * @param odu1s number of available ODU1 containers
+ * @param odu2s number of available ODU2 containers
+ * @param odu2es number of available ODU2e containers
+ * @param odu3s number of available ODU3 containers
+ * @param odu4s number of available ODU4 containers
+ * @param oduFlexes available ODUflex bandwidth in terms of ODU0 containers
+ */
+ public OduResource(short odu0s, short odu1s, short odu2s,
+ short odu2es, short odu3s, short odu4s,
+ short oduFlexes) {
+ this.odu0s = odu0s;
+ this.odu1s = odu1s;
+ this.odu2s = odu2s;
+ this.odu2es = odu2es;
+ this.odu3s = odu3s;
+ this.odu4s = odu4s;
+ this.oduFlexes = oduFlexes;
+ }
+
+ /**
+ * Returns the number of available ODU0s.
+ *
+ * @return the odu0s
+ */
+ public short odu0s() {
+ return odu0s;
+ }
+
+ /**
+ * Returns the number of available ODU1s.
+ *
+ * @return the odu1s
+ */
+ public short odu1s() {
+ return odu1s;
+ }
+
+ /**
+ * Returns the number of available ODU2s.
+ *
+ * @return the odu2s
+ */
+ public short odu2s() {
+ return odu2s;
+ }
+
+ /**
+ * Returns the number of available ODU2es.
+ *
+ * @return the odu2es
+ */
+ public short odu2es() {
+ return odu2es;
+ }
+
+ /**
+ * Returns the number of available ODU3s.
+ *
+ * @return the odu3s
+ */
+ public short odu3s() {
+ return odu3s;
+ }
+
+ /**
+ * Returns the number of available ODU4s.
+ *
+ * @return the odu4s
+ */
+ public short odu4s() {
+ return odu4s;
+ }
+
+ /**
+ * Returns available ODUflex bandwidth in terms of ODU0 containers.
+ *
+ * @return the oduFlexes
+ */
+ public short oduFlexes() {
+ return oduFlexes;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(odu0s, odu1s, odu2s, odu2es, odu3s,
+ odu4s, oduFlexes);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof OduResource) {
+ OduResource that = (OduResource) object;
+ return (this.odu0s == that.odu0s) &&
+ (this.odu1s == that.odu1s) &&
+ (this.odu2s == that.odu2s) &&
+ (this.odu2es == that.odu2es) &&
+ (this.odu3s == that.odu3s) &&
+ (this.odu4s == that.odu4s) &&
+ (this.oduFlexes == that.oduFlexes);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("odu0s", odu0s)
+ .add("odu1s", odu1s)
+ .add("odu2s", odu2s)
+ .add("odu2es", odu2es)
+ .add("odu3s", odu3s)
+ .add("odu4s", odu4s)
+ .add("oduFlexes", oduFlexes)
+ .toString();
+ }
+
+
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
similarity index 60%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
index 646c772..e5158f7 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
@@ -19,21 +19,29 @@
import com.google.common.base.Objects;
/**
- * Represent a path element.
+ * Representation of a path element.
*/
public class PathElement {
private final long pathElementId;
+ private final long teNodeId;
private final ElementType type;
+ private final boolean loose;
/**
- * Creates an instance of PathElement.
+ * Creates a path element.
*
* @param pathElementId path element identifier
- * @param type path element type
+ * @param teNodeId identifier of the TE node to which this
+ * path element belongs
+ * @param type path element type
+ * @param loose loose if true; strict if false
*/
- public PathElement(long pathElementId, ElementType type) {
+ public PathElement(long pathElementId, long teNodeId,
+ ElementType type, boolean loose) {
this.pathElementId = pathElementId;
+ this.teNodeId = teNodeId;
this.type = type;
+ this.loose = loose;
}
/**
@@ -46,6 +54,15 @@
}
/**
+ * Returns the TE node identifier.
+ *
+ * @return te node id
+ */
+ public long teNodeId() {
+ return teNodeId;
+ }
+
+ /**
* Returns the path element type.
*
* @return path element type
@@ -54,9 +71,18 @@
return type;
}
+ /**
+ * Returns the loose flag. true = loose; false = strict.
+ *
+ * @return loose value
+ */
+ public boolean loose() {
+ return loose;
+ }
+
@Override
public int hashCode() {
- return Objects.hashCode(pathElementId, type);
+ return Objects.hashCode(pathElementId, teNodeId, type, loose);
}
@Override
@@ -66,8 +92,10 @@
}
if (object instanceof PathElement) {
PathElement that = (PathElement) object;
- return Objects.equal(this.pathElementId, that.pathElementId) &&
- Objects.equal(this.type, that.type);
+ return Objects.equal(pathElementId, that.pathElementId) &&
+ Objects.equal(teNodeId, that.teNodeId) &&
+ Objects.equal(type, that.type) &&
+ Objects.equal(loose, that.loose);
}
return false;
}
@@ -76,7 +104,9 @@
public String toString() {
return MoreObjects.toStringHelper(this)
.add("pathElementId", pathElementId)
+ .add("teNodeId", teNodeId)
.add("type", type)
+ .add("loose", loose)
.toString();
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv4.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv4.java
new file mode 100644
index 0000000..f7510cd
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv4.java
@@ -0,0 +1,85 @@
+/**
+ * Copyright 2016 Open Networking Laboratory
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.packet.Ip4Address;
+
+import java.util.Objects;
+
+/**
+ * Implementation of IPv4 address as an element type.
+ */
+public class TeIpv4 implements ElementType {
+ private final Ip4Address v4Address;
+ private final short v4PrefixLength;
+
+ /**
+ * Creates an IPv4 address.
+ *
+ * @param v4Address the IPv4 address
+ * @param v4PrefixLength the length of IPv4 prefix
+ */
+ public TeIpv4(Ip4Address v4Address, short v4PrefixLength) {
+ this.v4Address = v4Address;
+ this.v4PrefixLength = v4PrefixLength;
+ }
+
+ /**
+ * Returns the IPv4 address.
+ *
+ * @return IPv4 address
+ */
+ public Ip4Address v4Address() {
+ return v4Address;
+ }
+
+ /**
+ * Returns the length of the IPv4 address prefix.
+ *
+ * @return IPv4 address prefix length
+ */
+ public short v4PrefixLength() {
+ return v4PrefixLength;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(v4Address, v4PrefixLength);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof TeIpv4) {
+ TeIpv4 other = (TeIpv4) obj;
+ return Objects.equals(v4Address, other.v4Address) &&
+ Objects.equals(v4PrefixLength, other.v4PrefixLength);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("v4Address", v4Address)
+ .add("v4PrefixLength", v4PrefixLength)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv6.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv6.java
new file mode 100644
index 0000000..c1a1f22
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv6.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.packet.Ip6Address;
+
+import java.util.Objects;
+
+/**
+ * Implementation of an IPv6 address as an element type.
+ */
+public class TeIpv6 implements ElementType {
+ private final Ip6Address v6Address;
+ private final short v6PrefixLength;
+
+ /**
+ * Creates an IPv6 address.
+ *
+ * @param v6Address the IP v6 address to set
+ * @param v6PrefixLength the length of the IPv6 address prefix
+ */
+ public TeIpv6(Ip6Address v6Address, short v6PrefixLength) {
+ this.v6Address = v6Address;
+ this.v6PrefixLength = v6PrefixLength;
+ }
+
+ /**
+ * Returns the IPv6 address.
+ *
+ * @return the IPv6 address
+ */
+ public Ip6Address v6Address() {
+ return v6Address;
+ }
+
+ /**
+ * Returns the length of the IPv6 address prefix.
+ *
+ * @return IPv6 address prefix length
+ */
+ public short v6PrefixLength() {
+ return v6PrefixLength;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(v6Address, v6PrefixLength);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof TeIpv6) {
+ TeIpv6 other = (TeIpv6) obj;
+ return Objects.equals(v6Address, other.v6Address) &&
+ Objects.equals(v6PrefixLength, other.v6PrefixLength);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("v6Address", v6Address)
+ .add("v6PrefixLength", v6PrefixLength)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLink.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLink.java
new file mode 100644
index 0000000..81d93c4
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLink.java
@@ -0,0 +1,246 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import org.onosproject.tetopology.management.api.EncodingType;
+import org.onosproject.tetopology.management.api.SwitchingType;
+import org.onosproject.tetopology.management.api.TeStatus;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * Abstraction of a TE link.
+ */
+public interface TeLink {
+ /**
+ * Indicates that the TE link belongs to an abstract topology.
+ */
+ public static final short BIT_ABSTRACT = 0;
+
+ /**
+ * Indicates that the underlay topology that supports this TE link
+ * is dynamically created as opposed to being created by provisioning.
+ */
+ public static final short BIT_DYNAMIC = 1;
+
+ /**
+ * Indicates that the underlay topology is committed to service.
+ */
+ public static final short BIT_COMMITTED = 2;
+
+ /**
+ * Indicates that the TE link connects 2 TE domains.
+ */
+ public static final short BIT_ACCESS_INTERDOMAIN = 3;
+
+ /**
+ * Indicates that the TE link is not numbered.
+ */
+ public static final short BIT_UNNUMBERED = 4;
+
+ /**
+ * Returns the TE link key.
+ *
+ * @return the TE link key
+ */
+ TeLinkTpKey teLinkKey();
+
+ /**
+ * Returns the key of the bi-directional peer TE link.
+ *
+ * @return peer TE link key
+ */
+ TeLinkTpKey peerTeLinkKey();
+
+ /**
+ * Returns the flags of this TE link.
+ *
+ * @return the flags
+ */
+ BitSet flags();
+
+ /**
+ * Returns the network layer switching type for this link.
+ *
+ * @return the network layer switching type
+ */
+ SwitchingType switchingLayer();
+
+ /**
+ * Returns the network layer encoding type for this link.
+ *
+ * @return the encoding type
+ */
+ EncodingType encodingLayer();
+
+ /**
+ * Returns the external link.
+ *
+ * @return the external link
+ */
+ ExternalLink externalLink();
+
+ /**
+ * Returns the underlay TE topology identifier for the link.
+ *
+ * @return the underlay TE topology id
+ */
+ TeTopologyKey underlayTeTopologyId();
+
+ /**
+ * Returns the primary path.
+ *
+ * @return underlay primary path
+ */
+ UnderlayPrimaryPath primaryPath();
+
+ /**
+ * Returns the backup paths.
+ *
+ * @return list of underlay backup paths
+ */
+ List<UnderlayBackupPath> backupPaths();
+
+ /**
+ * Returns the supporting tunnel protection type.
+ *
+ * @return the tunnel protection type
+ */
+ TunnelProtectionType tunnelProtectionType();
+
+ /**
+ * Returns the supporting tunnel's source tunnel termination point
+ * identifier.
+ *
+ * @return the source TTP id
+ */
+ long sourceTtpId();
+
+ /**
+ * Returns the supporting tunnel's destination tunnel termination
+ * point identifier.
+ *
+ * @return the destination TTP id
+ */
+ long destinationTtpId();
+
+ /**
+ * Returns the supporting tunnel identifier.
+ *
+ * @return the supporting tunnel id
+ */
+ TeTunnelId teTunnelId();
+
+ /**
+ * Returns the supporting TE link identifier.
+ *
+ * @return the supporting TE link id
+ */
+ TeLinkTpGlobalKey supportingTeLinkId();
+
+ /**
+ * Returns the source TE link identifier.
+ *
+ * @return the source link id
+ */
+ TeLinkTpGlobalKey sourceTeLinkId();
+
+ /**
+ * Returns the link cost.
+ *
+ * @return the cost
+ */
+ long cost();
+
+ /**
+ * Returns the link delay.
+ *
+ * @return the delay
+ */
+ long delay();
+
+ /**
+ * Returns the link SRLG values.
+ *
+ * @return the srlgs
+ */
+ List<Long> srlgs();
+
+ /**
+ * Returns the link administrative group.
+ *
+ * @return the adminGroup
+ */
+ Long administrativeGroup();
+
+ /**
+ * Returns the supported inter-layer locks.
+ *
+ * @return the inter-layer locks
+ */
+ List<Long> interLayerLocks();
+
+ /**
+ * Returns the maximum bandwidth at each priority level.
+ *
+ * @return a list of maximum bandwidths
+ */
+ float[] maxBandwidth();
+
+ /**
+ * Returns the available bandwidth at each priority level.
+ *
+ * @return a list of available bandwidths
+ */
+ float[] availBandwidth();
+
+ /**
+ * Returns the maximum available bandwidth for a LSP at each priority level.
+ *
+ * @return a list of maximum available bandwidths
+ */
+ float[] maxAvailLspBandwidth();
+
+ /**
+ * Returns the minimum available bandwidth for a LSP at each priority level.
+ *
+ * @return a list of minimum available bandwidths
+ */
+ float[] minAvailLspBandwidth();
+
+ /**
+ * Returns the administrative status of this TE link.
+ *
+ * @return the admin status
+ */
+ TeStatus adminStatus();
+
+ /**
+ * Returns the operational status of this TE link.
+ *
+ * @return the operational status
+ */
+ TeStatus opStatus();
+
+ /**
+ * Returns the link ODUk resources.
+ *
+ * @return the ODUk resources
+ */
+ OduResource oduResource();
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkAccessType.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkAccessType.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkAccessType.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkAccessType.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkEventSubject.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkEventSubject.java
new file mode 100644
index 0000000..8937d92
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkEventSubject.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
+
+/**
+ * Representation of a TE link event.
+ */
+public class TeLinkEventSubject implements TeTopologyEventSubject {
+ private final TeLinkTpGlobalKey key;
+ private final TeLink teLink;
+
+ /**
+ * Creates an instance of TE link event.
+ *
+ * @param key the TE link key
+ * @param teLink the TE link
+ */
+ public TeLinkEventSubject(TeLinkTpGlobalKey key, TeLink teLink) {
+ this.key = key;
+ this.teLink = teLink;
+ }
+
+ /**
+ * Returns the TE link global key.
+ *
+ * @return the key
+ */
+ public TeLinkTpGlobalKey key() {
+ return key;
+ }
+
+ /**
+ * Returns the TE link.
+ *
+ * @return the TE link
+ */
+ public TeLink teLink() {
+ return teLink;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(key, teLink);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeLinkEventSubject) {
+ TeLinkEventSubject that = (TeLinkEventSubject) object;
+ return Objects.equal(key, that.key) &&
+ Objects.equal(teLink, that.teLink);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("key", key)
+ .add("teLink", teLink)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkId.java
similarity index 64%
copy from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
copy to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkId.java
index 004b3ed..3aaab28 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkId.java
@@ -15,12 +15,19 @@
*/
package org.onosproject.tetopology.management.api.link;
+import org.onosproject.tetopology.management.api.LongValue;
+
/**
- * Represents the underlay primary path that supports a TE link.
+ * Implementation of a TE link identifier as an element type.
*/
-public class UnderlayPrimaryPath extends UnderlayAbstractPath {
-/*
- * Underlay primary path currently has the same data structure defined in
- * the underlay abstract path. It may be extended per standard definitions.
- */
+public class TeLinkId extends LongValue implements ElementType {
+
+ /**
+ * Creates a TE link identifier based on a given long integer.
+ *
+ * @param linkId TE link id
+ */
+ public TeLinkId(long linkId) {
+ super(linkId);
+ }
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkTpGlobalKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkTpGlobalKey.java
new file mode 100644
index 0000000..5298553
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkTpGlobalKey.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of a global TE link TP (i.e., TE termination point) key.
+ */
+public class TeLinkTpGlobalKey extends TeNodeKey {
+ private final long teLinkTpId;
+
+ /**
+ * Creates a global TE link TP key.
+ *
+ * @param providerId provider identifier
+ * @param clientId client identifier
+ * @param topologyId topology identifier
+ * @param teNodeId TE node identifier
+ * @param teLinkTpId TE link termination point identifier
+ */
+ public TeLinkTpGlobalKey(long providerId, long clientId,
+ long topologyId, long teNodeId,
+ long teLinkTpId) {
+ super(providerId, clientId, topologyId, teNodeId);
+ this.teLinkTpId = teLinkTpId;
+ }
+
+ /**
+ * Creates a global TE link TP key based on a given local TE node key.
+ *
+ * @param teNodeKey the local TE node key
+ * @param teLinkTpId TE link termination point identifier
+ */
+ public TeLinkTpGlobalKey(TeNodeKey teNodeKey, long teLinkTpId) {
+ super(teNodeKey.providerId(), teNodeKey.clientId(),
+ teNodeKey.topologyId(), teNodeKey.teNodeId());
+ this.teLinkTpId = teLinkTpId;
+ }
+
+ /**
+ * Creates a global TE link TP key based on a given TE topology key
+ * and a local TE link TP key.
+ *
+ * @param teTopologyKey the key of TE Topology to which this link belongs
+ * @param teLinkTpKey the local TE link key
+ */
+ public TeLinkTpGlobalKey(TeTopologyKey teTopologyKey,
+ TeLinkTpKey teLinkTpKey) {
+ super(teTopologyKey.providerId(), teTopologyKey.clientId(),
+ teTopologyKey.topologyId(), teLinkTpKey.teNodeId());
+ this.teLinkTpId = teLinkTpKey.teLinkTpId();
+ }
+
+ /**
+ * Returns the TE link TP identifier.
+ *
+ * @return the TE link id
+ */
+ public long teLinkTpId() {
+ return teLinkTpId;
+ }
+
+ /**
+ * Returns the key of the TE node from which this link TP originates.
+ *
+ * @return the TE node key
+ */
+ public TeNodeKey teNodeKey() {
+ return new TeNodeKey(providerId(), clientId(), topologyId(), teNodeId());
+ }
+
+ /**
+ * Returns the key of the TE Topology to which this link TP belongs.
+ *
+ * @return the TE topology key
+ */
+ @Override
+ public TeTopologyKey teTopologyKey() {
+ return new TeTopologyKey(providerId(), clientId(), topologyId());
+ }
+
+ /**
+ * Returns the local TE link TP key.
+ *
+ * @return the TE link TP key
+ */
+ public TeLinkTpKey teLinkTpKey() {
+ return new TeLinkTpKey(teNodeId(), teLinkTpId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), teLinkTpId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeLinkTpGlobalKey) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ TeLinkTpGlobalKey that = (TeLinkTpGlobalKey) object;
+ return Objects.equal(teLinkTpId, that.teLinkTpId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns a helper for toString() with additional TE link TP identifier.
+ *
+ * @return a toString helper
+ */
+ protected ToStringHelper toTeLinkTpKeyStringHelper() {
+ return toTeNodeKeyStringHelper().add("teLinkTpId", teLinkTpId);
+ }
+
+ @Override
+ public String toString() {
+ return toTeLinkTpKeyStringHelper().toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkTpKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkTpKey.java
new file mode 100644
index 0000000..5616147
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkTpKey.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of the TE link TP (i.e., TE termination point) Key in
+ * the scope of a TE node.
+ */
+public final class TeLinkTpKey {
+ private final long teNodeId;
+ private final long teLinkTpId;
+
+ /**
+ * Creates a TE link TP key.
+ *
+ * @param teNodeId TE Node identifier
+ * @param teLinkTpId TE Link termination point identifier
+ */
+ public TeLinkTpKey(long teNodeId, long teLinkTpId) {
+ this.teNodeId = teNodeId;
+ this.teLinkTpId = teLinkTpId;
+ }
+
+ /**
+ * Returns the TE Node identifier.
+ *
+ * @return the TE node id
+ */
+ public long teNodeId() {
+ return teNodeId;
+ }
+
+ /**
+ * Returns the TE link termination point identifier.
+ *
+ * @return the TE link TP id
+ */
+ public long teLinkTpId() {
+ return teLinkTpId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(teNodeId, teLinkTpId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeLinkTpKey) {
+ TeLinkTpKey that = (TeLinkTpKey) object;
+ return Objects.equal(teNodeId, that.teNodeId) &&
+ Objects.equal(teLinkTpId, that.teLinkTpId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("teNodeId", teNodeId)
+ .add("teLinkTpId", teLinkTpId)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TePathAttributes.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TePathAttributes.java
new file mode 100644
index 0000000..e0760b3
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TePathAttributes.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+/**
+ * Represents the common attributes of a TE path or segment.
+ */
+public class TePathAttributes {
+ private final Long cost;
+ private final Long delay;
+ private final List<Long> srlgs;
+
+ /**
+ * Creates an instance of TE path attributes.
+ *
+ * @param cost the path's cost
+ * @param delay the path's delay
+ * @param srlgs the path's shared risk link groups (SRLGs)
+ */
+ public TePathAttributes(Long cost, Long delay, List<Long> srlgs) {
+ this.cost = cost;
+ this.delay = delay;
+ this.srlgs = srlgs != null ? Lists.newArrayList(srlgs) : null;
+ }
+
+ /**
+ * Creates an instance of TE path attributes based on a given TE link.
+ *
+ * @param link the TE link
+ */
+ public TePathAttributes(TeLink link) {
+ this.cost = link.cost();
+ this.delay = link.delay();
+ this.srlgs = link.srlgs() != null ?
+ Lists.newArrayList(link.srlgs()) : null;
+ }
+
+ /**
+ * Returns the path cost.
+ *
+ * @return the cost
+ */
+ public long cost() {
+ return cost;
+ }
+
+ /**
+ * Returns the path delay.
+ *
+ * @return the delay
+ */
+ public long delay() {
+ return delay;
+ }
+
+ /**
+ * Returns the path SRLG values.
+ *
+ * @return the srlgs
+ */
+ public List<Long> srlgs() {
+ if (srlgs == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(srlgs);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(cost, delay, srlgs);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TePathAttributes) {
+ TePathAttributes that = (TePathAttributes) object;
+ return Objects.equal(cost, that.cost) &&
+ Objects.equal(delay, that.delay) &&
+ Objects.equal(srlgs, that.srlgs);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("cost", cost)
+ .add("delay", delay)
+ .add("srlgs", srlgs)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeTunnelId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeTunnelId.java
new file mode 100644
index 0000000..2cc231c
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeTunnelId.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of a TE tunnel identifier.
+ */
+public class TeTunnelId {
+ private final long srcTeNodeId;
+ private final long dstTeNodeId;
+ private final long tunnelId;
+
+ /**
+ * Create a TE tunnel identifier.
+ *
+ * @param srcTeNodeId source TE node id
+ * @param dstTeNodeId destination TE node id
+ * @param tunnelId tunnel id
+ */
+ public TeTunnelId(long srcTeNodeId, long dstTeNodeId, long tunnelId) {
+ this.srcTeNodeId = srcTeNodeId;
+ this.dstTeNodeId = dstTeNodeId;
+ this.tunnelId = tunnelId;
+ }
+
+ /**
+ * Returns the source TE node identifier of the tunnel.
+ *
+ * @return the source TE node id
+ */
+ public long sourceTeNodeId() {
+ return srcTeNodeId;
+ }
+
+ /**
+ * Returns the destination TE node identifier of the tunnel.
+ *
+ * @return the destination TE node id
+ */
+ public long destinationTeNodeId() {
+ return dstTeNodeId;
+ }
+
+ /**
+ * Returns the tunnel identifier.
+ *
+ * @return the tunnel id
+ */
+ public long tunnelId() {
+ return tunnelId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(srcTeNodeId, dstTeNodeId, tunnelId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeTunnelId) {
+ TeTunnelId that = (TeTunnelId) object;
+ return (srcTeNodeId == that.srcTeNodeId) &&
+ (dstTeNodeId == that.dstTeNodeId) &&
+ (tunnelId == that.tunnelId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("srcTeNodeId", srcTeNodeId)
+ .add("dstTeNodeId", dstTeNodeId)
+ .add("tunnelId", tunnelId)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TunnelProtectionType.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TunnelProtectionType.java
new file mode 100644
index 0000000..59772e6
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TunnelProtectionType.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2016-present 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.tetopology.management.api.link;
+
+/**
+ * Represents the tunnel protection type.
+ */
+public enum TunnelProtectionType {
+
+ /**
+ * Represents unprotected.
+ */
+ UNPROTECTED(0),
+
+ /**
+ * Represents extra traffic.
+ */
+ EXTRA_TRAFFIC(1),
+
+ /**
+ * Represents shared.
+ */
+ SHARED(2),
+
+ /**
+ * Represents one-for-one.
+ */
+ ONE_FOR_ONE(3),
+
+ /**
+ * Represents one-plus-one.
+ */
+ ONE_PLUS_ONE(4),
+
+ /**
+ * Represents enhanced.
+ */
+ ENHANCED(5);
+
+ private int value;
+
+ TunnelProtectionType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the value of the tunnel protection type.
+ *
+ * @return value of tunnel protection type
+ */
+ public int value() {
+ return value;
+ }
+
+ /**
+ * Returns the tunnel protection type constant corresponding to the given
+ * string. Returns null when string conversion fails or converted integer
+ * value is not recognized.
+ *
+ * @param s input string
+ * @return corresponding protection type constant
+ */
+ public static TunnelProtectionType of(String s) {
+ try {
+ int tmpVal = Integer.parseInt(s);
+ return of(tmpVal);
+ } catch (NumberFormatException ignored) {
+ }
+ return null;
+ }
+
+ /**
+ * Returns the tunnel protection type constant corresponding to the
+ * given integer. Returns null when the integer value is not recognized.
+ *
+ * @param value integer value
+ * @return corresponding protection type constant
+ */
+ public static TunnelProtectionType of(int value) {
+ switch (value) {
+ case 0:
+ return UNPROTECTED;
+ case 1:
+ return EXTRA_TRAFFIC;
+ case 2:
+ return SHARED;
+ case 3:
+ return ONE_FOR_ONE;
+ case 4:
+ return ONE_PLUS_ONE;
+ case 5:
+ return ENHANCED;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayAbstractPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayAbstractPath.java
new file mode 100644
index 0000000..6b7a149
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayAbstractPath.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.Lists;
+
+/**
+ * Represents the common definition of an underlay path that supports a TE link.
+ */
+public class UnderlayAbstractPath {
+ private final List<PathElement> pathElements;
+ private final Boolean loose;
+
+ /**
+ * Creates a underlay abstract path.
+ *
+ * @param pathElements the list of elements along the path
+ * @param loose loose if true, or otherwise strict
+ */
+ public UnderlayAbstractPath(List<PathElement> pathElements, Boolean loose) {
+ this.pathElements = Lists.newArrayList(pathElements);
+ this.loose = loose;
+ }
+
+ /**
+ * Returns the loose flag, indicating whether the path is loose or strict.
+ *
+ * @return true if the path is loose, false if it is strict.
+ */
+ public Boolean loose() {
+ return loose;
+ }
+
+ /**
+ * Returns the list of path elements.
+ *
+ * @return list of path elements
+ */
+ public List<PathElement> pathElements() {
+ return Collections.unmodifiableList(pathElements);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(pathElements, loose);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof UnderlayAbstractPath) {
+ UnderlayAbstractPath other = (UnderlayAbstractPath) obj;
+ return Objects.equals(pathElements, other.pathElements) &&
+ Objects.equals(loose, other.loose);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("pathElements", pathElements)
+ .add("loose", loose)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
similarity index 73%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
index 385fed8..676175e 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
@@ -15,7 +15,9 @@
*/
package org.onosproject.tetopology.management.api.link;
+import java.util.List;
import java.util.Objects;
+
import com.google.common.base.MoreObjects;
/**
@@ -23,19 +25,23 @@
* protect the underlay primary path.
*/
public class UnderlayBackupPath extends UnderlayAbstractPath {
- private long index;
+ private final long index;
/**
- * Sets the index.
+ * Creates a underlay backup path.
*
- * @param index the index to set
+ * @param index the path index
+ * @param pathElements list of backup service paths
+ * @param loose loose if true; restrict otherwise
*/
- public void setIndex(long index) {
+ public UnderlayBackupPath(long index, List<PathElement> pathElements,
+ Boolean loose) {
+ super(pathElements, loose);
this.index = index;
}
/**
- * Returns the index.
+ * Returns the path index.
*
* @return path index
*/
@@ -66,9 +72,9 @@
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
- .add("index", index)
- .add("ref", ref())
- .add("pathElements", pathElements())
- .toString();
+ .add("index", index)
+ .add("pathElements", pathElements())
+ .add("loose", loose())
+ .toString();
}
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java
new file mode 100644
index 0000000..92786b1
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+/**
+ * Represents the TE link underlay path and tunnel data.
+ */
+public class UnderlayPath {
+ private final UnderlayPrimaryPath primaryPath;
+ private final List<UnderlayBackupPath> backupPaths;
+ private final TunnelProtectionType tunnelProtectionType;
+ private final long srcTtpId;
+ private final long dstTtpId;
+ private final TeTunnelId teTunnelId;
+
+ /**
+ * Creates a underlay path.
+ *
+ * @param primaryPath the underlay primary path
+ * @param backupPaths the underlay backup paths
+ * @param tunnelProtectionType the supporting tunnel protection type to set
+ * @param srcTtpId the source tunnel termination point id
+ * @param dstTtpId the destination tunnel termination point id
+ * @param teTunnelId the supporting TE tunnel id
+ */
+ public UnderlayPath(UnderlayPrimaryPath primaryPath,
+ List<UnderlayBackupPath> backupPaths,
+ TunnelProtectionType tunnelProtectionType,
+ long srcTtpId,
+ long dstTtpId,
+ TeTunnelId teTunnelId) {
+ this.primaryPath = primaryPath;
+ this.backupPaths = backupPaths != null ?
+ Lists.newArrayList(backupPaths) : null;
+ this.tunnelProtectionType = tunnelProtectionType;
+ this.srcTtpId = srcTtpId;
+ this.dstTtpId = dstTtpId;
+ this.teTunnelId = teTunnelId;
+ }
+
+ /**
+ * Creates a underlay path based on a TE link.
+ *
+ * @param link the TE link
+ */
+ public UnderlayPath(TeLink link) {
+ this.primaryPath = link.primaryPath();
+ this.backupPaths = link.backupPaths() != null ?
+ Lists.newArrayList(link.backupPaths()) : null;
+ this.tunnelProtectionType = link.tunnelProtectionType();
+ this.srcTtpId = link.sourceTtpId();
+ this.dstTtpId = link.destinationTtpId();
+ this.teTunnelId = link.teTunnelId();
+ }
+
+ /**
+ * Returns the primary path.
+ *
+ * @return underlay primary path
+ */
+ public UnderlayPrimaryPath primaryPath() {
+ return primaryPath;
+ }
+
+ /**
+ * Returns the backup paths.
+ *
+ * @return list of underlay backup paths
+ */
+ public List<UnderlayBackupPath> backupPaths() {
+ if (backupPaths == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(backupPaths);
+ }
+
+ /**
+ * Returns the supporting tunnel protection type.
+ *
+ * @return the supporting tunnel protection type
+ */
+ public TunnelProtectionType tunnelProtectionType() {
+ return tunnelProtectionType;
+ }
+
+ /**
+ * Returns the supporting TE tunnel's source tunnel termination point
+ * identifier.
+ *
+ * @return the supporting source TTP id
+ */
+ public long srcTtpId() {
+ return srcTtpId;
+ }
+
+ /**
+ * Returns the supporting TE tunnel's destination tunnel termination
+ * point identifier.
+ *
+ * @return the destination TTP id
+ */
+ public long dstTtpId() {
+ return dstTtpId;
+ }
+
+ /**
+ * Returns the supporting TE tunnel identifier.
+ *
+ * @return the supporting tunnel id
+ */
+ public TeTunnelId teTunnelId() {
+ return teTunnelId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(primaryPath, backupPaths, tunnelProtectionType,
+ srcTtpId, dstTtpId, teTunnelId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof UnderlayPath) {
+ UnderlayPath that = (UnderlayPath) object;
+ return Objects.equal(primaryPath, that.primaryPath) &&
+ Objects.equal(backupPaths, that.backupPaths) &&
+ Objects.equal(tunnelProtectionType, that.tunnelProtectionType) &&
+ Objects.equal(srcTtpId, that.srcTtpId) &&
+ Objects.equal(dstTtpId, that.dstTtpId) &&
+ Objects.equal(teTunnelId, that.teTunnelId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("primaryPath", primaryPath)
+ .add("backupPaths", backupPaths)
+ .add("tunnelProtectionType", tunnelProtectionType)
+ .add("srcTtpId", srcTtpId)
+ .add("dstTtpId", dstTtpId)
+ .add("teTunnelId", teTunnelId)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
new file mode 100644
index 0000000..39ec127
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPrimaryPath.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.link;
+
+import java.util.List;
+
+/**
+ * Represents the underlay primary path that supports a TE link.
+ */
+public class UnderlayPrimaryPath extends UnderlayAbstractPath {
+ // Underlay primary path currently has the same data structure defined in
+ // the underlay abstract path. It may be extended per standard definitions.
+
+ /**
+ * Creates an instance of UnderlayPrimaryPath.
+ *
+ * @param pathElements the list of elements along the path
+ * @param loose loose if true, or otherwise strict
+ */
+ public UnderlayPrimaryPath(List<PathElement> pathElements, Boolean loose) {
+ super(pathElements, loose);
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java
similarity index 65%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java
index 1b47cf9..a8f7ebf 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.java
@@ -15,56 +15,42 @@
*/
package org.onosproject.tetopology.management.api.link;
-import java.util.Objects;
-
+import com.google.common.base.MoreObjects;
import org.onlab.packet.IpAddress;
-import com.google.common.base.MoreObjects;
+import java.util.Objects;
/**
- * Implementation of unnumbered link as an ElementType.
+ * Implementation of unnumbered link as an element type.
*/
public class UnnumberedLink implements ElementType {
- private IpAddress routerId;
- private long interfaceId;
+ private final IpAddress routerId;
+ private final long interfaceId;
/**
- * Creates an instance of UnnumberedLink.
- */
- public UnnumberedLink() {
- }
-
- /**
- * Sets the router Id.
+ * Creates a unnumbered link.
*
- * @param routerId the routerId to set
+ * @param routerId the router id to set
+ * @param interfaceId the interface id to set
*/
- public void setRouterId(IpAddress routerId) {
+ public UnnumberedLink(IpAddress routerId, long interfaceId) {
this.routerId = routerId;
- }
-
- /**
- * Sets the interface Id.
- *
- * @param interfaceId the interfaceId to set
- */
- public void setInterfaceId(long interfaceId) {
this.interfaceId = interfaceId;
}
/**
- * Returns the router Id.
+ * Returns the router identifier.
*
- * @return router identifier
+ * @return router id
*/
public IpAddress routerId() {
return routerId;
}
/**
- * Returns the interface Id.
+ * Returns the interface identifier.
*
- * @return interface identifier
+ * @return interface id
*/
public long interfaceId() {
return interfaceId;
@@ -83,8 +69,8 @@
if (obj instanceof UnnumberedLink) {
UnnumberedLink other = (UnnumberedLink) obj;
return
- Objects.equals(routerId, other.routerId) &&
- Objects.equals(interfaceId, other.interfaceId);
+ Objects.equals(routerId, other.routerId) &&
+ Objects.equals(interfaceId, other.interfaceId);
}
return false;
}
@@ -92,8 +78,8 @@
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
- .add("routerId", routerId)
- .add("interfaceId", interfaceId)
- .toString();
+ .add("routerId", routerId)
+ .add("interfaceId", interfaceId)
+ .toString();
}
}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/package-info.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/package-info.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/package-info.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/package-info.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/AbstractConnectivity.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/AbstractConnectivity.java
new file mode 100644
index 0000000..9632084
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/AbstractConnectivity.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.link.ElementType;
+import org.onosproject.tetopology.management.api.link.TePathAttributes;
+import org.onosproject.tetopology.management.api.link.UnderlayAbstractPath;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * The abstraction of a TE node internal connectivity to link
+ * termination points.
+ */
+public class AbstractConnectivity {
+ // list of elements that can be constrained/connected to
+ private final List<ElementType> constrainingElements;
+ private final BitSet flags;
+ private final TePathAttributes teAttributes;
+ private final UnderlayAbstractPath underlayPath;
+
+ /**
+ * Creates an abstract connectivity instance.
+ *
+ * @param constrainingElements list of elements that can be constrained
+ * or connected to
+ * @param flags indicate whether this connectivity is usable
+ * @param teAttributes the connectivity path TE attributes
+ * @param underlayPath the underlay path
+ */
+ public AbstractConnectivity(List<ElementType> constrainingElements,
+ BitSet flags,
+ TePathAttributes teAttributes,
+ UnderlayAbstractPath underlayPath) {
+ this.constrainingElements = Lists.newArrayList(constrainingElements);
+ this.flags = flags;
+ this.teAttributes = teAttributes;
+ this.underlayPath = underlayPath;
+ }
+
+ /**
+ * Returns the "constraining elements" that can be constrained
+ * or connected to "from" element.
+ *
+ * @return the "constraining elements" of the connectivity
+ */
+ public List<ElementType> constrainingElements() {
+ return Collections.unmodifiableList(constrainingElements);
+ }
+
+ /**
+ * Returns the flags indicating if the connectivity is usable.
+ *
+ * @return flags of the connectivity
+ */
+ public BitSet flags() {
+ return flags;
+ }
+
+ /**
+ * Returns the TE attributes of the connectivity.
+ *
+ * @return the TE attributes
+ */
+ public TePathAttributes teAttributes() {
+ return teAttributes;
+ }
+
+ /**
+ * Returns the underlay path.
+ *
+ * @return the underlay path
+ */
+ public UnderlayAbstractPath underlayPath() {
+ return underlayPath;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(constrainingElements, flags,
+ teAttributes, underlayPath);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof AbstractConnectivity) {
+ AbstractConnectivity that = (AbstractConnectivity) object;
+ return Objects.equal(constrainingElements, that.constrainingElements) &&
+ Objects.equal(flags, that.flags) &&
+ Objects.equal(teAttributes, that.teAttributes) &&
+ Objects.equal(underlayPath, that.underlayPath);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("constrainingElements", constrainingElements)
+ .add("flags", flags)
+ .add("teAttributes", teAttributes)
+ .add("underlayPath", underlayPath)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/CommonNodeData.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/CommonNodeData.java
new file mode 100644
index 0000000..b657e44
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/CommonNodeData.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import java.util.BitSet;
+
+import org.onosproject.tetopology.management.api.TeStatus;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of common node attributes.
+ */
+public class CommonNodeData {
+ private final String name;
+ private final TeStatus adminStatus;
+ private final TeStatus opStatus;
+ private final BitSet flags;
+
+ /**
+ * Creates a common node data instance.
+ *
+ * @param name the TE node name
+ * @param adminStatus the admin status
+ * @param opStatus the operational status
+ * @param flags the node flags
+ */
+ public CommonNodeData(String name, TeStatus adminStatus,
+ TeStatus opStatus, BitSet flags) {
+ this.name = name;
+ this.adminStatus = adminStatus;
+ this.opStatus = opStatus;
+ this.flags = flags;
+ }
+
+ /**
+ * Creates a common node data instance based on a given TE node.
+ *
+ * @param node the given TE node
+ */
+ public CommonNodeData(TeNode node) {
+ this.name = node.name();
+ this.adminStatus = node.adminStatus();
+ this.opStatus = node.opStatus();
+ this.flags = node.flags();
+ }
+
+ /**
+ * Returns the TE node name.
+ *
+ * @return the name
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * Returns the administrative status.
+ *
+ * @return the admin status
+ */
+ public TeStatus adminStatus() {
+ return adminStatus;
+ }
+
+ /**
+ * Returns the operational status.
+ *
+ * @return the operational status
+ */
+ public TeStatus opStatus() {
+ return opStatus;
+ }
+
+ /**
+ * Returns the flags in the common node data.
+ *
+ * @return the flags
+ */
+ public BitSet flags() {
+ return flags;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, adminStatus, opStatus, flags);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof CommonNodeData) {
+ CommonNodeData that = (CommonNodeData) object;
+ return Objects.equal(name, that.name) &&
+ Objects.equal(adminStatus, that.adminStatus) &&
+ Objects.equal(opStatus, that.opStatus) &&
+ Objects.equal(flags, that.flags);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("name", name)
+ .add("adminStatus", adminStatus)
+ .add("opStatus", opStatus)
+ .add("flags", flags)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java
new file mode 100644
index 0000000..3a4313b
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.link.ElementType;
+import org.onosproject.tetopology.management.api.link.TePathAttributes;
+import org.onosproject.tetopology.management.api.link.UnderlayAbstractPath;
+
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * Represents node's switching limitations.
+ */
+public class ConnectivityMatrix extends AbstractConnectivity {
+ /**
+ * Indicates that switching is disallowed.
+ */
+ public static final short BIT_DISALLOWED = 0;
+
+ /**
+ * Indicates that an alternative switching connection path
+ * is available.
+ */
+ public static final short BIT_ALTERNATIVE_PATH_AVAILABLE = 1;
+
+ /**
+ * Indicates that switching in this node is disabled.
+ */
+ public static final short BIT_DISABLED = 2;
+
+ private final long key;
+ private final ElementType from;
+ // list of elements that can be merged with the "from" element
+ private final List<ElementType> mergingList;
+
+ /**
+ * Creates a connectivity matrix instance.
+ *
+ * @param key the connectivity matrix key
+ * @param from the "from" element (e.g. TE link id or
+ * label) in the matrix
+ * @param mergingList the list of elements that can be merged
+ * with the "from" element
+ * @param constrainingElements the list of elements that can be constrained
+ * or connected to the "from" element
+ * @param flags the indicator whether this connectivity
+ * matrix is usable
+ * @param teAttributes the connectivity TE attributes of this matrix
+ * @param underlayPath the underlay path of the matrix
+ */
+ public ConnectivityMatrix(long key,
+ ElementType from,
+ List<ElementType> mergingList,
+ List<ElementType> constrainingElements,
+ BitSet flags,
+ TePathAttributes teAttributes,
+ UnderlayAbstractPath underlayPath) {
+ super(constrainingElements, flags, teAttributes, underlayPath);
+ this.key = key;
+ this.from = from;
+ this.mergingList = mergingList != null ?
+ Lists.newArrayList(mergingList) : null;
+ }
+
+ /**
+ * Returns the key.
+ *
+ * @return connectivity matrix key
+ */
+ public long key() {
+ return key;
+ }
+
+ /**
+ * Returns the "from" element of a connectivity matrix.
+ *
+ * @return the "from" of the connectivity matrix
+ */
+ public ElementType from() {
+ return from;
+ }
+
+ /**
+ * Returns the "merging list" can be merged with the "from" element.
+ *
+ * @return the "merging list" of the connectivity matrix
+ */
+ public List<ElementType> mergingList() {
+ if (mergingList == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(mergingList);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(key, from, mergingList, super.hashCode());
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof ConnectivityMatrix) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ ConnectivityMatrix that = (ConnectivityMatrix) object;
+ return Objects.equal(this.key, that.key) &&
+ Objects.equal(this.from, that.from) &&
+ Objects.equal(this.mergingList, that.mergingList);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("key", key)
+ .add("from", from)
+ .add("mergingList", mergingList)
+ .add("constrainingElements", constrainingElements())
+ .add("flags", flags())
+ .add("teAttributes", teAttributes())
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrixKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrixKey.java
new file mode 100644
index 0000000..addfef1
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrixKey.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of a TE connectivity matrix entry key.
+ */
+public class ConnectivityMatrixKey extends TeNodeKey {
+ private final long entryId;
+
+ /**
+ * Creates a connectivity matrix key.
+ *
+ * @param providerId provider identifier
+ * @param clientId client identifier
+ * @param topologyId topology identifier
+ * @param teNodeId TE node identifier
+ * @param entryId connectivity matrix entry id
+ */
+ public ConnectivityMatrixKey(long providerId, long clientId,
+ long topologyId, long teNodeId,
+ long entryId) {
+ super(providerId, clientId, topologyId, teNodeId);
+ this.entryId = entryId;
+ }
+
+ /**
+ * Creates a connectivity matrix key base on a given TE node key.
+ *
+ * @param teNodeKey TE node key
+ * @param entryId connectivity matrix entry id
+ */
+ public ConnectivityMatrixKey(TeNodeKey teNodeKey, long entryId) {
+ super(teNodeKey.providerId(), teNodeKey.clientId(),
+ teNodeKey.topologyId(), teNodeKey.teNodeId());
+ this.entryId = entryId;
+ }
+
+ /**
+ * Returns the TE node key.
+ *
+ * @return the TE node key
+ */
+ public TeNodeKey teNodekey() {
+ return new TeNodeKey(providerId(), clientId(), topologyId(), teNodeId());
+ }
+
+ /**
+ * Returns the connectivity matrix entry identifier.
+ *
+ * @return the connectivity matrix entry id
+ */
+ public long entryId() {
+ return entryId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), entryId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof ConnectivityMatrixKey) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ ConnectivityMatrixKey that = (ConnectivityMatrixKey) object;
+ return Objects.equal(this.entryId, that.entryId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns ToStringHelper with additional entry identifier.
+ *
+ * @return toStringHelper
+ */
+ protected ToStringHelper toConnMatrixKeyStringHelper() {
+ return toTeNodeKeyStringHelper().add("entryId", entryId);
+ }
+
+ @Override
+ public String toString() {
+ return toConnMatrixKeyStringHelper().toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java
new file mode 100644
index 0000000..1219cf6
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.onosproject.tetopology.management.api.KeyId;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Default network node implementation.
+ */
+public class DefaultNetworkNode implements NetworkNode {
+ private final KeyId id;
+ private final List<NetworkNodeKey> supportingNodeIds;
+ private final TeNode teNode;
+ private final Map<KeyId, TerminationPoint> tps;
+
+
+ /**
+ * Creates a network node instance.
+ *
+ * @param id network node identifier
+ * @param nodeIds support node identifiers
+ * @param teNode te parameter of the node
+ * @param tps the tps to set
+ */
+ public DefaultNetworkNode(KeyId id,
+ List<NetworkNodeKey> nodeIds,
+ TeNode teNode,
+ Map<KeyId, TerminationPoint> tps) {
+ this.id = id;
+ this.supportingNodeIds = nodeIds != null ?
+ Lists.newArrayList(nodeIds) : null;
+ this.teNode = teNode;
+ this.tps = tps != null ? Maps.newHashMap(tps) : null;
+ }
+
+ /**
+ * Returns the node identifier.
+ *
+ * @return node identifier
+ */
+ @Override
+ public KeyId nodeId() {
+ return id;
+ }
+
+ /**
+ * Returns the list of supporting node identifiers for this node.
+ *
+ * @return list of supporting node identifiers
+ */
+ @Override
+ public List<NetworkNodeKey> supportingNodeIds() {
+ if (supportingNodeIds == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(supportingNodeIds);
+ }
+
+ /**
+ * Returns the node TE attributes.
+ *
+ * @return TE attributes of this node
+ */
+ @Override
+ public TeNode teNode() {
+ return teNode;
+ }
+
+ /**
+ * Returns the list of termination points associated with this node.
+ *
+ * @return a list of termination points
+ */
+ @Override
+ public Map<KeyId, TerminationPoint> terminationPoints() {
+ if (tps == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(tps);
+ }
+
+ /**
+ * Returns the termination point.
+ *
+ * @return the termination point
+ */
+ @Override
+ public TerminationPoint terminationPoint(KeyId tpId) {
+ return tps.get(tpId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, supportingNodeIds, teNode, tps);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultNetworkNode) {
+ DefaultNetworkNode that = (DefaultNetworkNode) object;
+ return Objects.equal(id, that.id) &&
+ Objects.equal(supportingNodeIds, that.supportingNodeIds) &&
+ Objects.equal(teNode, that.teNode) &&
+ Objects.equal(tps, that.tps);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("id", id)
+ .add("supportingNodeIds", supportingNodeIds)
+ .add("teNode", teNode)
+ .add("tps", tps)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTeNode.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTeNode.java
new file mode 100644
index 0000000..90333ac
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTeNode.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.onosproject.tetopology.management.api.TeStatus;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+import java.util.BitSet;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The default implementation of TE Node.
+ */
+public class DefaultTeNode implements TeNode {
+ private final long teNodeId;
+ private final TeTopologyKey underlayTopologyId;
+ private final TeNodeKey supportTeNodeId;
+ private final TeNodeKey sourceTeNodeId;
+ private final CommonNodeData teData;
+ private final Map<Long, ConnectivityMatrix> connMatrices;
+ private final List<Long> teLinkIds;
+ private final Map<Long, TunnelTerminationPoint> ttps;
+ private final List<Long> teTpIds;
+
+ /**
+ * Creates a TE node instance.
+ *
+ * @param teNodeId TE node identifier
+ * @param underlayTopologyIdId the node underlay TE topology id
+ * @param supportTeNodeId the supporting TE node id
+ * @param sourceTeNodeId the source TE node id
+ * @param teData the node common te data
+ * @param connMatrices the connectivity matrix table
+ * @param teLinkIds the list of TE link ids originating from the node
+ * @param ttps the list of tunnel termination points
+ * @param teTpIds the currently known termination point ids
+ */
+ public DefaultTeNode(long teNodeId,
+ TeTopologyKey underlayTopologyIdId,
+ TeNodeKey supportTeNodeId,
+ TeNodeKey sourceTeNodeId,
+ CommonNodeData teData,
+ Map<Long, ConnectivityMatrix> connMatrices,
+ List<Long> teLinkIds,
+ Map<Long, TunnelTerminationPoint> ttps,
+ List<Long> teTpIds) {
+ this.teNodeId = teNodeId;
+ this.underlayTopologyId = underlayTopologyIdId;
+ this.supportTeNodeId = supportTeNodeId;
+ this.sourceTeNodeId = sourceTeNodeId;
+ this.teData = teData;
+ this.connMatrices = connMatrices != null ?
+ Maps.newHashMap(connMatrices) : null;
+ this.teLinkIds = teLinkIds != null ?
+ Lists.newArrayList(teLinkIds) : null;
+ this.ttps = ttps != null ? Maps.newHashMap(ttps) : null;
+ this.teTpIds = teTpIds != null ?
+ Lists.newArrayList(teTpIds) : null;
+ }
+
+ @Override
+ public long teNodeId() {
+ return teNodeId;
+ }
+
+ @Override
+ public String name() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.name();
+ }
+
+ @Override
+ public BitSet flags() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.flags();
+ }
+
+ @Override
+ public TeTopologyKey underlayTeTopologyId() {
+ return underlayTopologyId;
+ }
+
+ @Override
+ public TeNodeKey supportingTeNodeId() {
+ return supportTeNodeId;
+ }
+
+ @Override
+ public TeNodeKey sourceTeNodeId() {
+ return sourceTeNodeId;
+ }
+
+ @Override
+ public Map<Long, ConnectivityMatrix> connectivityMatrices() {
+ if (connMatrices == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(connMatrices);
+ }
+
+ @Override
+ public ConnectivityMatrix connectivityMatrix(long entryId) {
+ return connMatrices.get(entryId);
+ }
+
+ @Override
+ public List<Long> teLinkIds() {
+ if (teLinkIds == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(teLinkIds);
+ }
+
+ @Override
+ public Map<Long, TunnelTerminationPoint> tunnelTerminationPoints() {
+ if (ttps == null) {
+ return null;
+ }
+ return ImmutableMap.copyOf(ttps);
+ }
+
+ @Override
+ public TunnelTerminationPoint tunnelTerminationPoint(long ttpId) {
+ return ttps.get(ttpId);
+ }
+
+ @Override
+ public TeStatus adminStatus() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.adminStatus();
+ }
+
+ @Override
+ public TeStatus opStatus() {
+ if (teData == null) {
+ return null;
+ }
+ return teData.opStatus();
+ }
+
+ @Override
+ public List<Long> teTerminationPointIds() {
+ return Collections.unmodifiableList(teTpIds);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(teNodeId, underlayTopologyId,
+ supportTeNodeId, sourceTeNodeId, teData,
+ connMatrices, teLinkIds, ttps, teTpIds);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultTeNode) {
+ DefaultTeNode that = (DefaultTeNode) object;
+ return Objects.equal(teNodeId, that.teNodeId) &&
+ Objects.equal(underlayTopologyId, that.underlayTopologyId) &&
+ Objects.equal(supportTeNodeId, that.supportTeNodeId) &&
+ Objects.equal(sourceTeNodeId, that.sourceTeNodeId) &&
+ Objects.equal(teData, that.teData) &&
+ Objects.equal(connMatrices, that.connMatrices) &&
+ Objects.equal(teLinkIds, that.teLinkIds) &&
+ Objects.equal(ttps, that.ttps) &&
+ Objects.equal(teTpIds, that.teTpIds);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("teNodeId", teNodeId)
+ .add("underlayTopologyId", underlayTopologyId)
+ .add("supportTeNodeId", supportTeNodeId)
+ .add("sourceTeNodeId", sourceTeNodeId)
+ .add("teData", teData)
+ .add("connMatrices", connMatrices)
+ .add("teLinkIds", teLinkIds)
+ .add("ttps", ttps)
+ .add("teTpIds", teTpIds)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTerminationPoint.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTerminationPoint.java
new file mode 100644
index 0000000..13b8e9a
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTerminationPoint.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.KeyId;
+
+import java.util.List;
+
+/**
+ * The default implementation of TE termination point.
+ */
+public class DefaultTerminationPoint implements TerminationPoint {
+ private final KeyId tpId;
+ private final List<TerminationPointKey> supportingTpIds;
+ private final Long teTpId;
+
+ /**
+ * Creates a termination point.
+ *
+ * @param tpId termination point identifier
+ * @param tps support termination point identifier
+ * @param teTpId TE termination point identifier
+ */
+ public DefaultTerminationPoint(KeyId tpId,
+ List<TerminationPointKey> tps,
+ Long teTpId) {
+ this.tpId = tpId;
+ this.supportingTpIds = tps != null ? Lists.newArrayList(tps) : null;
+ this.teTpId = teTpId;
+ }
+
+ @Override
+ public KeyId tpId() {
+ return tpId;
+ }
+
+ @Override
+ public Long teTpId() {
+ return teTpId;
+ }
+
+ @Override
+ public List<TerminationPointKey> supportingTpIds() {
+ if (supportingTpIds == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(supportingTpIds);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tpId, supportingTpIds, teTpId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultTerminationPoint) {
+ DefaultTerminationPoint that = (DefaultTerminationPoint) object;
+ return Objects.equal(tpId, that.tpId) &&
+ Objects.equal(supportingTpIds, that.supportingTpIds) &&
+ Objects.equal(teTpId, that.teTpId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("tpId", tpId)
+ .add("supportingTpIds", supportingTpIds)
+ .add("teTpId", teTpId)
+ .toString();
+ }
+
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTunnelTerminationPoint.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTunnelTerminationPoint.java
new file mode 100644
index 0000000..de366ce
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTunnelTerminationPoint.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.onosproject.tetopology.management.api.EncodingType;
+import org.onosproject.tetopology.management.api.SwitchingType;
+
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * Default implementation of a tunnel termination point.
+ */
+public class DefaultTunnelTerminationPoint implements TunnelTerminationPoint {
+ private final long ttpId;
+ private final SwitchingType switchingLayer;
+ private final EncodingType encodingLayer;
+ private final BitSet flags;
+ private final List<Long> interLayerLockList;
+ private final List<LocalLinkConnectivity> localLinkConnectivityList;
+ private final float[] availAdaptBandwidth;
+
+ /**
+ * Create a tunnel termination point.
+ *
+ * @param ttpId tunnel termination point id
+ * @param switchingLayer switching network layer to which this
+ * TTP belongs
+ * @param encodingLayer encoding layer to which this TTP belongs
+ * @param flags the TTP flags
+ * @param interLayerLockList the supported inter-layer locks
+ * @param localLinkConnectivityList the local link connectivity list
+ * @param availAdaptBandwidth the remaining adaptation bandwidth
+ * at each priority level
+ */
+ public DefaultTunnelTerminationPoint(long ttpId,
+ SwitchingType switchingLayer,
+ EncodingType encodingLayer,
+ BitSet flags,
+ List<Long> interLayerLockList,
+ List<LocalLinkConnectivity> localLinkConnectivityList,
+ float[] availAdaptBandwidth) {
+ this.ttpId = ttpId;
+ this.switchingLayer = switchingLayer;
+ this.encodingLayer = encodingLayer;
+ this.flags = flags;
+ this.interLayerLockList = interLayerLockList != null ?
+ Lists.newArrayList(interLayerLockList) : null;
+ this.localLinkConnectivityList = localLinkConnectivityList != null ?
+ Lists.newArrayList(localLinkConnectivityList) : null;
+ this.availAdaptBandwidth = availAdaptBandwidth != null ?
+ Arrays.copyOf(availAdaptBandwidth,
+ availAdaptBandwidth.length) : null;
+ }
+
+ @Override
+ public long ttpId() {
+ return ttpId;
+ }
+
+ @Override
+ public SwitchingType switchingLayer() {
+ return switchingLayer;
+ }
+
+ @Override
+ public EncodingType encodingLayer() {
+ return encodingLayer;
+ }
+
+ @Override
+ public BitSet flags() {
+ return flags;
+ }
+
+ @Override
+ public List<Long> interLayerLockList() {
+ if (interLayerLockList == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(interLayerLockList);
+ }
+
+ @Override
+ public List<LocalLinkConnectivity> localLinkConnectivityList() {
+ if (localLinkConnectivityList == null) {
+ return null;
+ }
+ return ImmutableList.copyOf(localLinkConnectivityList);
+ }
+
+ @Override
+ public float[] availAdaptBandwidth() {
+ if (availAdaptBandwidth == null) {
+ return null;
+ }
+ return Arrays.copyOf(availAdaptBandwidth, availAdaptBandwidth.length);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ttpId, switchingLayer, encodingLayer, flags,
+ interLayerLockList, localLinkConnectivityList,
+ availAdaptBandwidth);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof DefaultTunnelTerminationPoint) {
+ DefaultTunnelTerminationPoint that = (DefaultTunnelTerminationPoint) object;
+ return Objects.equal(ttpId, that.ttpId) &&
+ Objects.equal(switchingLayer, that.switchingLayer) &&
+ Objects.equal(encodingLayer, that.encodingLayer) &&
+ Objects.equal(flags, that.flags) &&
+ Objects.equal(interLayerLockList, that.interLayerLockList) &&
+ Objects.equal(localLinkConnectivityList, that.localLinkConnectivityList) &&
+ Objects.equal(availAdaptBandwidth, that.availAdaptBandwidth);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("ttpId", ttpId)
+ .add("switchingLayer", switchingLayer)
+ .add("encodingLayer", encodingLayer)
+ .add("flags", flags)
+ .add("interLayerLockList", interLayerLockList)
+ .add("localLinkConnectivityList", localLinkConnectivityList)
+ .add("availAdaptBandwidth", availAdaptBandwidth)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/LocalLinkConnectivity.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/LocalLinkConnectivity.java
new file mode 100644
index 0000000..2520c26
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/LocalLinkConnectivity.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import org.onosproject.tetopology.management.api.link.ElementType;
+import org.onosproject.tetopology.management.api.link.TePathAttributes;
+import org.onosproject.tetopology.management.api.link.UnderlayAbstractPath;
+
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * The connectivity between tunnel termination point and link termination
+ * points.
+ */
+public class LocalLinkConnectivity extends AbstractConnectivity {
+ /**
+ * Indicates that the link connectivity is disabled.
+ */
+ public static final short BIT_DISABLED = 0;
+
+ /**
+ * Indicates that an alternative path of the link connection is
+ * available.
+ */
+ public static final short BIT_ALTERNATIVE_PATH_AVAILABLE = 1;
+
+ /**
+ * Creates a local link connectivity instance.
+ *
+ * @param constrainingElements list of elements that can be constrained
+ * or connected to
+ * @param flags indicate whether this connectivity is usable
+ * @param teAttributes the connectivity path TE attributes
+ * @param underlayPath the underlay path
+ */
+ public LocalLinkConnectivity(List<ElementType> constrainingElements, BitSet flags,
+ TePathAttributes teAttributes,
+ UnderlayAbstractPath underlayPath) {
+ super(constrainingElements, flags, teAttributes, underlayPath);
+ }
+
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
similarity index 76%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
index 23ae28a..1f3c76b 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
@@ -16,49 +16,49 @@
package org.onosproject.tetopology.management.api.node;
import java.util.List;
+import java.util.Map;
import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
/**
* Abstraction of a network node.
*/
-public interface NetworkNode extends TeTopologyEventSubject {
+public interface NetworkNode {
/**
- * Returns the node id.
+ * Returns the node identifier.
*
* @return node identifier
*/
KeyId nodeId();
/**
- * Returns the supporting node ids.
+ * Returns the supporting node identifiers.
*
* @return list of the ids of the supporting nodes
*/
- List<NetworkNodeKey> getSupportingNodeIds();
+ List<NetworkNodeKey> supportingNodeIds();
/**
* Returns the node TE extension attributes.
*
* @return node TE extension attributes
*/
- TeNode getTe();
+ TeNode teNode();
/**
* Returns a collection of currently known termination points.
*
* @return a collection of termination points associated with this node
*/
- List<TerminationPoint> getTerminationPoints();
+ Map<KeyId, TerminationPoint> terminationPoints();
/**
* Returns the termination point.
*
- * @param tpId termination point id
+ * @param tpId termination point id
* @return value of termination point
*/
- TerminationPoint getTerminationPoint(KeyId tpId);
+ TerminationPoint terminationPoint(KeyId tpId);
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeEventSubject.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeEventSubject.java
new file mode 100644
index 0000000..6257466
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeEventSubject.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
+
+/**
+ * Representation of a network node event.
+ */
+public class NetworkNodeEventSubject implements TeTopologyEventSubject {
+ private final NetworkNodeKey key;
+ private final NetworkNode node;
+
+ /**
+ * Creates a network node event.
+ *
+ * @param key the network node global key
+ * @param node the network node
+ */
+ public NetworkNodeEventSubject(NetworkNodeKey key, NetworkNode node) {
+ this.key = key;
+ this.node = node;
+ }
+
+ /**
+ * Returns the network node global key.
+ *
+ * @return the key
+ */
+ public NetworkNodeKey key() {
+ return key;
+ }
+
+ /**
+ * Returns the network node.
+ *
+ * @return the node
+ */
+ public NetworkNode neworkNode() {
+ return node;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(key, node);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof NetworkNodeEventSubject) {
+ NetworkNodeEventSubject that = (NetworkNodeEventSubject) object;
+ return Objects.equal(key, that.key) &&
+ Objects.equal(node, that.node);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("key", key)
+ .add("node", node)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeKey.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeKey.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeKey.java
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NodeTpKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NodeTpKey.java
new file mode 100644
index 0000000..8e9c3f9
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NodeTpKey.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import org.onosproject.tetopology.management.api.KeyId;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of a node's termination point key under a known network.
+ */
+public class NodeTpKey {
+ private final KeyId nodeId;
+ private final KeyId tpId;
+
+ /**
+ * Creates a node's termination point key.
+ *
+ * @param nodeId node identifier
+ * @param tpId termination point identifier
+ */
+ public NodeTpKey(KeyId nodeId, KeyId tpId) {
+ this.nodeId = nodeId;
+ this.tpId = tpId;
+ }
+
+ /**
+ * Returns the node identifier.
+ *
+ * @return node id
+ */
+ public KeyId nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * Returns the termination point identifier.
+ *
+ * @return termination point identifier
+ */
+ public KeyId tpId() {
+ return tpId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(nodeId, tpId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof NodeTpKey) {
+ NodeTpKey that = (NodeTpKey) object;
+ return Objects.equal(nodeId, that.nodeId) &&
+ Objects.equal(tpId, that.tpId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("nodeId", nodeId)
+ .add("tpId", tpId)
+ .toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNode.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNode.java
new file mode 100644
index 0000000..be04626
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNode.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import java.util.BitSet;
+import java.util.List;
+import java.util.Map;
+
+import org.onosproject.tetopology.management.api.TeStatus;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+/**
+ * Abstraction of a TE node.
+ */
+public interface TeNode {
+ /**
+ * Indicates that the TE node belongs to an abstract topology.
+ */
+ public static final short BIT_ABSTRACT = 0;
+
+ /**
+ * Indicates that the TE node is disabled.
+ */
+ public static final short BIT_DISABLED = 1;
+
+ /**
+ * Returns the TE node identifier.
+ *
+ * @return TE node identifier
+ */
+ long teNodeId();
+
+ /**
+ * Returns the TE node name.
+ *
+ * @return the te node name
+ */
+ String name();
+
+ /**
+ * Returns the flags.
+ *
+ * @return the flags
+ */
+ BitSet flags();
+
+ /**
+ * Returns the underlay TE topology identifier for the node.
+ *
+ * @return the underlay TE topology id
+ */
+ TeTopologyKey underlayTeTopologyId();
+
+ /**
+ * Returns the supporting TE node identifier.
+ *
+ * @return the id of the supporting node
+ */
+ TeNodeKey supportingTeNodeId();
+
+ /**
+ * Returns the source TE node identifier.
+ *
+ * @return the id of the source node
+ */
+ TeNodeKey sourceTeNodeId();
+
+ /**
+ * Returns the connectivity matrix table of the node.
+ *
+ * @return the connectivity matrix table
+ */
+ Map<Long, ConnectivityMatrix> connectivityMatrices();
+
+ /**
+ * Returns the connectivity matrix identified by its entry identifier.
+ *
+ * @param entryId connection matrix id
+ * @return the connectivity matrix
+ */
+ ConnectivityMatrix connectivityMatrix(long entryId);
+
+ /**
+ * Returns a list of TE link identifiers originating from the node.
+ *
+ * @return a list of TE link ids
+ */
+ List<Long> teLinkIds();
+
+ /**
+ * Returns a collection of currently known tunnel termination points.
+ *
+ * @return a collection of tunnel termination points associated with this node
+ */
+ Map<Long, TunnelTerminationPoint> tunnelTerminationPoints();
+
+ /**
+ * Returns a tunnel termination point identified by its identifier.
+ *
+ * @param ttpId tunnel termination point identifier
+ * @return the tunnel termination point
+ */
+ TunnelTerminationPoint tunnelTerminationPoint(long ttpId);
+
+ /**
+ * Returns the admin status.
+ *
+ * @return the adminStatus
+ */
+ TeStatus adminStatus();
+
+ /**
+ * Returns the operational status.
+ *
+ * @return the opStatus
+ */
+ TeStatus opStatus();
+
+ /**
+ * Returns a collection of currently known TE termination point identifiers.
+ *
+ * @return a collection of termination point ids associated with this node
+ */
+ List<Long> teTerminationPointIds();
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNodeEventSubject.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNodeEventSubject.java
new file mode 100644
index 0000000..39b81fa
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNodeEventSubject.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of TE node event.
+ */
+public class TeNodeEventSubject implements TeTopologyEventSubject {
+ private final TeNodeKey key;
+ private final TeNode teNode;
+
+ /**
+ * Creates a TE node event.
+ *
+ * @param key the TE node global key
+ * @param teNode the TE node
+ */
+ public TeNodeEventSubject(TeNodeKey key, TeNode teNode) {
+ this.key = key;
+ this.teNode = teNode;
+ }
+
+ /**
+ * Returns the TE node global key.
+ *
+ * @return the key
+ */
+ public TeNodeKey key() {
+ return key;
+ }
+
+ /**
+ * Returns the TE node.
+ *
+ * @return the TE node
+ */
+ public TeNode teNode() {
+ return teNode;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(key, teNode);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeNodeEventSubject) {
+ TeNodeEventSubject that = (TeNodeEventSubject) object;
+ return Objects.equal(key, that.key) &&
+ Objects.equal(teNode, that.teNode);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("key", key)
+ .add("teNode", teNode)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNodeKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNodeKey.java
new file mode 100644
index 0000000..a5ae09f
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TeNodeKey.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
+
+/**
+ * TE node Key.
+ */
+public class TeNodeKey extends TeTopologyKey {
+ private final long teNodeId;
+
+ /**
+ * Creates a TE node key.
+ *
+ * @param providerId provider identifier
+ * @param clientId client identifier
+ * @param topologyId topology identifier
+ * @param teNodeId TE node identifier
+ */
+ public TeNodeKey(long providerId, long clientId,
+ long topologyId, long teNodeId) {
+ super(providerId, clientId, topologyId);
+ this.teNodeId = teNodeId;
+ }
+
+ /**
+ * Creates a TE node key based on a given TE topology key and a
+ * TE node identifier.
+ *
+ * @param teTopologyKey the key of TE Topology to which this node belongs
+ * @param nodeId TE node identifier
+ */
+ public TeNodeKey(TeTopologyKey teTopologyKey, long nodeId) {
+ super(teTopologyKey.providerId(), teTopologyKey.clientId(),
+ teTopologyKey.topologyId());
+ this.teNodeId = nodeId;
+ }
+
+ /**
+ * Returns the TE Node identifier.
+ *
+ * @return the TE node id
+ */
+ public long teNodeId() {
+ return teNodeId;
+ }
+
+ public TeTopologyKey teTopologyKey() {
+ return new TeTopologyKey(providerId(), clientId(), topologyId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), teNodeId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TeNodeKey) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ TeNodeKey that = (TeNodeKey) object;
+ return Objects.equal(this.teNodeId, that.teNodeId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns ToStringHelper with an additional TE node identifier.
+ *
+ * @return toStringHelper
+ */
+ protected ToStringHelper toTeNodeKeyStringHelper() {
+ return toTopologyKeyStringHelper().add("teNodeId", teNodeId);
+ }
+
+ @Override
+ public String toString() {
+ return toTeNodeKeyStringHelper().toString();
+ }
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
similarity index 66%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
index f27cafe..c4e0c8c 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
@@ -18,32 +18,30 @@
import java.util.List;
import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.TeTopologyEventSubject;
/**
* Abstraction of a termination point.
*/
-public interface TerminationPoint extends TeTopologyEventSubject {
+public interface TerminationPoint {
/**
- * Returns the termination point id.
+ * Returns the termination point identifier.
*
* @return termination point id
*/
- KeyId id();
+ KeyId tpId();
/**
- * Returns list of supporting termination point ids.
+ * Returns list of supporting termination point identifiers.
*
- * @return the supportingTpIds
+ * @return the supporting termination point ids
*/
- List<TerminationPointKey> getSupportingTpIds();
+ List<TerminationPointKey> supportingTpIds();
/**
- * Returns TE attributes for this termination point.
+ * Returns TE termination point identifier.
*
- * @return the te attribute
+ * @return the TE TP id
*/
- TeTerminationPoint getTe();
-
+ Long teTpId();
}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.java
similarity index 70%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.java
index f4a57f4..15ee536 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.java
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.java
@@ -15,11 +15,10 @@
*/
package org.onosproject.tetopology.management.api.node;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
+import com.google.common.base.Objects;
import org.onosproject.tetopology.management.api.KeyId;
-import com.google.common.base.Objects;
+import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Representation of a termination point key or reference.
@@ -28,11 +27,11 @@
private final KeyId tpId;
/**
- * Creates an instance of TerminationPointKey.
+ * Creates a termination point key.
*
* @param networkId network identifier
- * @param nodeId node identifier
- * @param tpId termination point identifier
+ * @param nodeId node identifier
+ * @param tpId termination point identifier
*/
public TerminationPointKey(KeyId networkId, KeyId nodeId, KeyId tpId) {
super(networkId, nodeId);
@@ -40,7 +39,28 @@
}
/**
- * Returns the termination point Id.
+ * Creates an instance of termination point key based on a given
+ * network node key.
+ *
+ * @param nodeKey node key
+ * @param tpId termination point identifier
+ */
+ public TerminationPointKey(NetworkNodeKey nodeKey, KeyId tpId) {
+ super(nodeKey.networkId(), nodeKey.nodeId());
+ this.tpId = tpId;
+ }
+
+ /**
+ * Returns the termination point identifier.
+ *
+ * @return termination point identifier
+ */
+ public NetworkNodeKey networkNodeKey() {
+ return new NetworkNodeKey(networkId(), nodeId());
+ }
+
+ /**
+ * Returns the termination point identifier.
*
* @return termination point identifier
*/
@@ -60,7 +80,7 @@
return false;
}
TerminationPointKey that = (TerminationPointKey) object;
- return Objects.equal(this.tpId, that.tpId);
+ return Objects.equal(tpId, that.tpId);
}
return false;
}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TtpKey.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TtpKey.java
new file mode 100644
index 0000000..60dc9f3
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TtpKey.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of a TE tunnel termination point key.
+ */
+public class TtpKey extends TeNodeKey {
+ private final long ttpId;
+
+ /**
+ * Creates a TE tunnel termination point key.
+ *
+ * @param providerId provider identifier
+ * @param clientId client identifier
+ * @param topologyId topology identifier
+ * @param teNodeId TE node identifier
+ * @param ttpId tunnel termination point identifier
+ */
+ public TtpKey(long providerId, long clientId, long topologyId,
+ long teNodeId, long ttpId) {
+ super(providerId, clientId, topologyId, teNodeId);
+ this.ttpId = ttpId;
+ }
+
+ /**
+ * Creates a TE tunnel termination point key based on a given TE node
+ * key and a tunnel termination point identifier.
+ *
+ * @param teNodeKey TE node key
+ * @param ttpId tunnel termination point id
+ */
+ public TtpKey(TeNodeKey teNodeKey, long ttpId) {
+ super(teNodeKey.providerId(), teNodeKey.clientId(),
+ teNodeKey.topologyId(), teNodeKey.teNodeId());
+ this.ttpId = ttpId;
+ }
+
+ /**
+ * Returns the TE node key.
+ *
+ * @return the TE node key
+ */
+ public TeNodeKey teNodekey() {
+ return new TeNodeKey(providerId(), clientId(), topologyId(), teNodeId());
+ }
+
+ /**
+ * Returns the tunnel termination point identifier.
+ *
+ * @return the tunnel termination point id
+ */
+ public long ttpId() {
+ return ttpId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), ttpId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof TtpKey) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ TtpKey that = (TtpKey) object;
+ return Objects.equal(ttpId, that.ttpId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns ToStringHelper with an additional tunnel termination point
+ * identifier.
+ *
+ * @return toStringHelper
+ */
+ protected ToStringHelper toTtpKeyStringHelper() {
+ return toTeNodeKeyStringHelper().add("ttpId", ttpId);
+ }
+
+ @Override
+ public String toString() {
+ return toTtpKeyStringHelper().toString();
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TunnelTerminationPoint.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TunnelTerminationPoint.java
new file mode 100644
index 0000000..8da43d2
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TunnelTerminationPoint.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2016 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.tetopology.management.api.node;
+
+import org.onosproject.tetopology.management.api.EncodingType;
+import org.onosproject.tetopology.management.api.SwitchingType;
+
+import java.util.BitSet;
+import java.util.List;
+
+/**
+ * Representation of a tunnel termination point.
+ */
+public interface TunnelTerminationPoint {
+ /**
+ * Indicates that the TTP supports one-plus-one protection.
+ */
+ public static final short BIT_1PLUS1_PROTECTION_CAPABLE = 0;
+
+ /**
+ * Indicates that the TTP is disabled.
+ */
+ public static final short BIT_DISABLED = 1;
+
+ /**
+ * Indicates that the TTP is operationally down.
+ */
+ public static final short BIT_STATUS_DOWN = 2;
+
+ /**
+ * Returns the tunnel termination point identifier.
+ *
+ * @return tunnel termination point id
+ */
+ long ttpId();
+
+ /**
+ * Returns the network layer switching type to which this TTP belongs.
+ *
+ * @return the switching type
+ */
+ SwitchingType switchingLayer();
+
+ /**
+ * Returns the network layer encoding type to which this TTP belongs.
+ *
+ * @return the encoding type
+ */
+ EncodingType encodingLayer();
+
+ /**
+ * Returns the flags of this TTP.
+ *
+ * @return the flags
+ */
+ BitSet flags();
+
+ /**
+ * Returns the supported inter-layer locks.
+ *
+ * @return list of inter-layer locks
+ */
+ List<Long> interLayerLockList();
+
+ /**
+ * Returns the local link connectivity list.
+ *
+ * @return the local link connectivity list
+ */
+ List<LocalLinkConnectivity> localLinkConnectivityList();
+
+ /**
+ * Returns the remaining adaptation bandwidth at each priority level.
+ *
+ * @return list of available adaptation bandwidth
+ */
+ float[] availAdaptBandwidth();
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/package-info.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/package-info.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/package-info.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/package-info.java
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/package-info.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/package-info.java
similarity index 100%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/package-info.java
rename to apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/package-info.java
diff --git a/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeLinkApiTest.java b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeLinkApiTest.java
new file mode 100644
index 0000000..32788f1
--- /dev/null
+++ b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeLinkApiTest.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2016 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.tetopology.manager.api;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.tetopology.management.api.link.ElementType;
+import org.onosproject.tetopology.management.api.link.Label;
+import org.onosproject.tetopology.management.api.link.PathElement;
+import org.onosproject.tetopology.management.api.link.TeLinkTpGlobalKey;
+import org.onosproject.tetopology.management.api.link.UnderlayBackupPath;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Unit tests for TE link APIs.
+ */
+public class TeLinkApiTest {
+ private static final long DEFAULT_PROVIDER_ID = 123;
+ private static final long DEFAULT_CLIENT_ID = 456;
+ private static final long DEFAULT_TOPOLOGY_ID = 789;
+ private static final long DEFAULT_TE_NODE_ID = 1234;
+ private static final long DEFAULT_TE_LINK_TP_ID = 5678;
+ private static final String DEFAULT_TOPOLOGY_ID_STRING =
+ "default-topology-123";
+ private static final long DEFAULT_PATH_ELEMENT_ID = 234;
+ private static final long DEFAULT_UNDERLAY_BACKUP_PATH_IDX = 10;
+
+ private long providerId;
+ private long clientId;
+ private long topologyId;
+ private long teNodeId;
+ private long teLinkTpId;
+ private long pathElementId;
+ private long underlayBackupPathIndex;
+
+ private String topologyIdString;
+
+ @Before
+ public void setUp() {
+ providerId = DEFAULT_PROVIDER_ID;
+ clientId = DEFAULT_CLIENT_ID;
+ topologyId = DEFAULT_TOPOLOGY_ID;
+ teNodeId = DEFAULT_TE_NODE_ID;
+ teLinkTpId = DEFAULT_TE_LINK_TP_ID;
+ topologyIdString = DEFAULT_TOPOLOGY_ID_STRING;
+ pathElementId = DEFAULT_PATH_ELEMENT_ID;
+ underlayBackupPathIndex = DEFAULT_UNDERLAY_BACKUP_PATH_IDX;
+ }
+
+ @Test
+ public void teLinkTpGlobalKeyEqualOperatorTest() {
+ TeLinkTpGlobalKey key1 = new TeLinkTpGlobalKey(providerId, clientId,
+ topologyId, teNodeId,
+ teLinkTpId);
+ TeLinkTpGlobalKey key2 = new TeLinkTpGlobalKey(providerId, clientId,
+ topologyId, teNodeId,
+ teLinkTpId);
+ TeLinkTpGlobalKey key3 = new TeLinkTpGlobalKey(providerId + 1, clientId,
+ topologyId, teNodeId,
+ teLinkTpId);
+ TeLinkTpGlobalKey key4 = new TeLinkTpGlobalKey(providerId, clientId + 1,
+ topologyId, teNodeId,
+ teLinkTpId);
+ TeLinkTpGlobalKey key5 = new TeLinkTpGlobalKey(providerId, clientId,
+ topologyId + 1,
+ teNodeId, teLinkTpId);
+ TeLinkTpGlobalKey key6 = new TeLinkTpGlobalKey(providerId, clientId,
+ topologyId,
+ teNodeId + 1, teLinkTpId);
+ TeLinkTpGlobalKey key7 = new TeLinkTpGlobalKey(providerId, clientId,
+ topologyId,
+ teNodeId, teLinkTpId + 1);
+
+ assertTrue("Two topology Ids must be equal", key1.equals(key2));
+
+ assertFalse("Two topology Ids must be unequal", key1.equals(key3));
+ assertFalse("Two topology Ids must be unequal", key3.equals(key1));
+
+ assertFalse("Two topology Ids must be unequal", key1.equals(key4));
+ assertFalse("Two topology Ids must be unequal", key4.equals(key1));
+
+ assertFalse("Two topology Ids must be unequal", key1.equals(key5));
+ assertFalse("Two topology Ids must be unequal", key5.equals(key1));
+
+ assertFalse("Two topology Ids must be unequal", key1.equals(key6));
+ assertFalse("Two topology Ids must be unequal", key6.equals(key1));
+
+ assertFalse("Two topology Ids must be unequal", key1.equals(key7));
+ assertFalse("Two topology Ids must be unequal", key7.equals(key1));
+ }
+
+ @Test
+ public void underLayBackupPathEqualOperatorTest() {
+ ElementType pathElementType1 = new Label(pathElementId + 1);
+ ElementType pathElementType2 = new Label(pathElementId + 2);
+ ElementType pathElementType3 = new Label(pathElementId + 3);
+ ElementType pathElementType4 = new Label(pathElementId + 4);
+
+ PathElement pathElement1 = new PathElement(pathElementId, teNodeId,
+ pathElementType1, true);
+ PathElement pathElement2 = new PathElement(pathElementId + 1,
+ teNodeId + 1,
+ pathElementType2, true);
+ PathElement pathElement3 = new PathElement(pathElementId + 2,
+ teNodeId + 2,
+ pathElementType3, true);
+ PathElement pathElement4 = new PathElement(pathElementId + 3,
+ teNodeId + 3,
+ pathElementType4, true);
+
+ List<PathElement> pathElementList1 = new ArrayList<>();
+ pathElementList1.add(pathElement1);
+ pathElementList1.add(pathElement2);
+ pathElementList1.add(pathElement3);
+
+ List<PathElement> pathElementList2 = new ArrayList<>();
+ pathElementList1.add(pathElement1);
+ pathElementList1.add(pathElement2);
+ pathElementList1.add(pathElement4);
+
+ // bp1 and bp2 are the same. bp3, bp4, and bp5 differ by one
+ // attribute comparing to bp1.
+ UnderlayBackupPath bp1 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList1, true);
+ UnderlayBackupPath bp2 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList1, true);
+
+ UnderlayBackupPath bp3 = new UnderlayBackupPath(
+ underlayBackupPathIndex + 1, pathElementList1, true);
+ UnderlayBackupPath bp4 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList2, true);
+ UnderlayBackupPath bp5 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList1, false);
+
+
+ assertTrue("Two backup paths must be equal", bp1.equals(bp2));
+
+ assertFalse("Two backup paths must be unequal", bp1.equals(bp3));
+ assertFalse("Two backup paths must be unequal", bp3.equals(bp1));
+
+ assertFalse("Two backup paths must be unequal", bp1.equals(bp4));
+ assertFalse("Two backup paths must be unequal", bp4.equals(bp1));
+
+ assertFalse("Two backup paths must be unequal", bp1.equals(bp5));
+ assertFalse("Two backup paths must be unequal", bp5.equals(bp1));
+ }
+}
diff --git a/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeNetworkApiTest.java b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeNetworkApiTest.java
new file mode 100644
index 0000000..3cce230
--- /dev/null
+++ b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeNetworkApiTest.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2016 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.tetopology.manager.api;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.tetopology.management.api.TeTopologyId;
+import org.onosproject.tetopology.management.api.TeTopologyKey;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Unit tests for TE topology APIs.
+ */
+public class TeNetworkApiTest {
+ private static final long DEFAULT_PROVIDER_ID = 1234;
+ private static final long DEFAULT_CLIENT_ID = 5678;
+ private static final long DEFAULT_TOPOLOGY_ID = 9876;
+ private static final String DEFAULT_TOPOLOGY_ID_STRING =
+ "default-topology-123";
+
+ private long providerId;
+ private long clientId;
+ private long topologyId;
+ private String topologyIdString;
+
+ @Before
+ public void setUp() {
+ providerId = DEFAULT_PROVIDER_ID;
+ clientId = DEFAULT_CLIENT_ID;
+ topologyId = DEFAULT_TOPOLOGY_ID;
+ topologyIdString = DEFAULT_TOPOLOGY_ID_STRING;
+ }
+
+ @Test
+ public void topologyIdEqualOperatorTest() {
+ TeTopologyId id1 = new TeTopologyId(providerId, clientId,
+ topologyIdString);
+ TeTopologyId id2 = new TeTopologyId(providerId, clientId,
+ topologyIdString);
+ TeTopologyId id3 = new TeTopologyId(providerId + 1, clientId,
+ topologyIdString);
+ TeTopologyId id4 = new TeTopologyId(providerId, clientId + 1,
+ topologyIdString);
+ TeTopologyId id5 = new TeTopologyId(providerId, clientId,
+ topologyIdString + "abc");
+
+ assertTrue("Two topology ids must be equal", id1.equals(id2));
+
+ assertFalse("Two topology ids must be unequal", id1.equals(id3));
+ assertFalse("Two topology ids must be unequal", id3.equals(id1));
+
+ assertFalse("Two topology ids must be unequal", id1.equals(id4));
+ assertFalse("Two topology ids must be unequal", id4.equals(id1));
+
+ assertFalse("Two topology ids must be unequal", id1.equals(id5));
+ assertFalse("Two topology ids must be unequal", id5.equals(id1));
+ }
+
+ @Test
+ public void topologyKeyEqualOperatorTest() {
+ TeTopologyKey key1 = new TeTopologyKey(providerId, clientId,
+ topologyId);
+ TeTopologyKey key2 = new TeTopologyKey(providerId, clientId,
+ topologyId);
+ TeTopologyKey key3 = new TeTopologyKey(providerId + 1, clientId,
+ topologyId);
+ TeTopologyKey key4 = new TeTopologyKey(providerId, clientId + 1,
+ topologyId);
+ TeTopologyKey key5 = new TeTopologyKey(providerId, clientId,
+ topologyId + 1);
+
+ assertTrue("Two topology keys must be equal", key1.equals(key2));
+
+ assertFalse("Two topology keys must be unequal", key1.equals(key3));
+ assertFalse("Two topology keys must be unequal", key3.equals(key1));
+
+ assertFalse("Two topology keys must be unequal", key1.equals(key4));
+ assertFalse("Two topology keys must be unequal", key4.equals(key1));
+
+ assertFalse("Two topology keys must be unequal", key1.equals(key5));
+ assertFalse("Two topology keys must be unequal", key5.equals(key1));
+ }
+}
diff --git a/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeNodeApiTest.java b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeNodeApiTest.java
new file mode 100644
index 0000000..e2a4b3f
--- /dev/null
+++ b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/TeNodeApiTest.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright 2016 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.tetopology.manager.api;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.tetopology.management.api.link.ConnectivityMatrixId;
+import org.onosproject.tetopology.management.api.link.ElementType;
+import org.onosproject.tetopology.management.api.link.Label;
+import org.onosproject.tetopology.management.api.link.PathElement;
+import org.onosproject.tetopology.management.api.link.TePathAttributes;
+import org.onosproject.tetopology.management.api.link.UnderlayAbstractPath;
+import org.onosproject.tetopology.management.api.link.UnderlayBackupPath;
+import org.onosproject.tetopology.management.api.node.ConnectivityMatrix;
+import org.onosproject.tetopology.management.api.node.ConnectivityMatrixKey;
+import org.onosproject.tetopology.management.api.node.TeNodeKey;
+import org.onosproject.tetopology.management.api.node.TtpKey;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.List;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Unit tests for TE node APIs.
+ */
+public class TeNodeApiTest {
+ private static final long DEFAULT_PROVIDER_ID = 123;
+ private static final long DEFAULT_CLIENT_ID = 456;
+ private static final long DEFAULT_TOPOLOGY_ID = 789;
+ private static final long DEFAULT_TE_NODE_ID = 1234;
+ private static final long DEFAULT_CONNECTIVITY_ENTRY_ID = 5678;
+ private static final long DEFAULT_TTP_ID = 897;
+ private static final String DEFAULT_TOPOLOGY_ID_STRING =
+ "default-topology-123";
+ private static final long DEFAULT_PATH_ELEMENT_ID = 234;
+ private static final long DEFAULT_UNDERLAY_BACKUP_PATH_IDX = 10;
+
+ private long providerId;
+ private long clientId;
+ private long topologyId;
+ private long teNodeId;
+ private long connectivityMatrixEntryId;
+ private long pathElementId;
+ private long underlayBackupPathIndex;
+ private long ttpId;
+
+ private String topologyIdString;
+
+ @Before
+ public void setUp() {
+ providerId = DEFAULT_PROVIDER_ID;
+ clientId = DEFAULT_CLIENT_ID;
+ topologyId = DEFAULT_TOPOLOGY_ID;
+ teNodeId = DEFAULT_TE_NODE_ID;
+ connectivityMatrixEntryId = DEFAULT_CONNECTIVITY_ENTRY_ID;
+ topologyIdString = DEFAULT_TOPOLOGY_ID_STRING;
+ pathElementId = DEFAULT_PATH_ELEMENT_ID;
+ underlayBackupPathIndex = DEFAULT_UNDERLAY_BACKUP_PATH_IDX;
+ ttpId = DEFAULT_TTP_ID;
+ }
+
+ @Test
+ public void connectivityMatrixKeyEqualOperatorTest() {
+ ConnectivityMatrixKey key1 = new ConnectivityMatrixKey(providerId,
+ clientId,
+ topologyId,
+ teNodeId,
+ connectivityMatrixEntryId);
+ ConnectivityMatrixKey key2 = new ConnectivityMatrixKey(providerId,
+ clientId,
+ topologyId,
+ teNodeId,
+ connectivityMatrixEntryId);
+ ConnectivityMatrixKey key3 = new ConnectivityMatrixKey(providerId + 1,
+ clientId,
+ topologyId,
+ teNodeId,
+ connectivityMatrixEntryId);
+ ConnectivityMatrixKey key4 = new ConnectivityMatrixKey(providerId,
+ clientId + 1,
+ topologyId,
+ teNodeId,
+ connectivityMatrixEntryId);
+ ConnectivityMatrixKey key5 = new ConnectivityMatrixKey(providerId,
+ clientId,
+ topologyId + 1,
+ teNodeId,
+ connectivityMatrixEntryId);
+ ConnectivityMatrixKey key6 = new ConnectivityMatrixKey(providerId,
+ clientId,
+ topologyId,
+ teNodeId + 1,
+ connectivityMatrixEntryId);
+ ConnectivityMatrixKey key7 = new ConnectivityMatrixKey(providerId,
+ clientId,
+ topologyId,
+ teNodeId,
+ connectivityMatrixEntryId + 1);
+
+ assertTrue("Two matrix keys must be equal", key1.equals(key2));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key3));
+ assertFalse("Two matrix keys must be unequal", key3.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key4));
+ assertFalse("Two matrix keys must be unequal", key4.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key5));
+ assertFalse("Two matrix keys must be unequal", key5.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key6));
+ assertFalse("Two matrix keys must be unequal", key6.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key7));
+ assertFalse("Two matrix keys must be unequal", key7.equals(key1));
+ }
+
+ @Test
+ public void underlayBackupPathEqualOperatorTest() {
+ ElementType pathElementType1 = new Label(pathElementId + 1);
+ ElementType pathElementType2 = new Label(pathElementId + 2);
+ ElementType pathElementType3 = new Label(pathElementId + 3);
+ ElementType pathElementType4 = new Label(pathElementId + 4);
+
+ PathElement pathElement1 = new PathElement(pathElementId, teNodeId,
+ pathElementType1, true);
+ PathElement pathElement2 = new PathElement(pathElementId + 1,
+ teNodeId + 1,
+ pathElementType2, true);
+ PathElement pathElement3 = new PathElement(pathElementId + 2,
+ teNodeId + 2,
+ pathElementType3, true);
+ PathElement pathElement4 = new PathElement(pathElementId + 3,
+ teNodeId + 3,
+ pathElementType4, true);
+
+ List<PathElement> pathElementList1 = new ArrayList<>();
+ pathElementList1.add(pathElement1);
+ pathElementList1.add(pathElement2);
+ pathElementList1.add(pathElement3);
+
+ List<PathElement> pathElementList2 = new ArrayList<>();
+ pathElementList2.add(pathElement1);
+ pathElementList2.add(pathElement2);
+ pathElementList2.add(pathElement4);
+
+ // bp1 and bp2 are the same. bp3, bp4, and bp5 differ by one
+ // attribute comparing to bp1.
+ UnderlayBackupPath bp1 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList1, true);
+ UnderlayBackupPath bp2 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList1, true);
+
+ UnderlayBackupPath bp3 = new UnderlayBackupPath(
+ underlayBackupPathIndex + 1, pathElementList1, true);
+ UnderlayBackupPath bp4 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList2, true);
+ UnderlayBackupPath bp5 = new UnderlayBackupPath(
+ underlayBackupPathIndex, pathElementList1, false);
+
+
+ assertTrue("Two backup paths must be equal", bp1.equals(bp2));
+
+ assertFalse("Two backup paths must be unequal", bp1.equals(bp3));
+ assertFalse("Two backup paths must be unequal", bp3.equals(bp1));
+
+ assertFalse("Two backup paths must be unequal", bp1.equals(bp4));
+ assertFalse("Two backup paths must be unequal", bp4.equals(bp1));
+
+ assertFalse("Two backup paths must be unequal", bp1.equals(bp5));
+ assertFalse("Two backup paths must be unequal", bp5.equals(bp1));
+ }
+
+
+ @Test
+ public void connectivityMatrixEqualOperatorTest() {
+ long key1 = connectivityMatrixEntryId;
+ long key2 = connectivityMatrixEntryId + 1;
+
+ ElementType pathElementType1 = new Label(pathElementId + 1);
+ ElementType pathElementType2 = new Label(pathElementId + 2);
+ ElementType pathElementType3 = new Label(pathElementId + 3);
+ ElementType pathElementType4 = new Label(pathElementId + 4);
+
+ PathElement pathElement1 = new PathElement(pathElementId, teNodeId,
+ pathElementType1, true);
+ PathElement pathElement2 = new PathElement(pathElementId + 1,
+ teNodeId + 1,
+ pathElementType2, true);
+ PathElement pathElement3 = new PathElement(pathElementId + 2,
+ teNodeId + 2,
+ pathElementType3, true);
+ PathElement pathElement4 = new PathElement(pathElementId + 3,
+ teNodeId + 3,
+ pathElementType4, true);
+
+ List<PathElement> pathElementList1 = new ArrayList<>();
+ pathElementList1.add(pathElement1);
+ pathElementList1.add(pathElement2);
+ pathElementList1.add(pathElement3);
+
+ List<PathElement> pathElementList2 = new ArrayList<>();
+ pathElementList2.add(pathElement1);
+ pathElementList2.add(pathElement2);
+ pathElementList2.add(pathElement4);
+
+ UnderlayAbstractPath abstractPath1 = new UnderlayAbstractPath(
+ pathElementList1, true);
+ UnderlayAbstractPath abstractPath2 = new UnderlayAbstractPath(
+ pathElementList2, true);
+
+ ElementType from = new ConnectivityMatrixId(connectivityMatrixEntryId);
+ List<ElementType> mergingList = new ArrayList<>();
+ mergingList.add(new ConnectivityMatrixId(connectivityMatrixEntryId + 1));
+ mergingList.add(new ConnectivityMatrixId(connectivityMatrixEntryId + 2));
+
+ List<ElementType> constrainList = new ArrayList<>();
+ constrainList.add(new ConnectivityMatrixId(connectivityMatrixEntryId + 3));
+ constrainList.add(new ConnectivityMatrixId(connectivityMatrixEntryId + 4));
+
+ BitSet flags = new BitSet(1);
+
+ List<Long> srlgs = new ArrayList<>();
+ srlgs.add(new Long(10));
+ TePathAttributes tePathAttributes = new TePathAttributes(new Long(10),
+ new Long(10),
+ srlgs);
+
+ ConnectivityMatrix matrix1 = new ConnectivityMatrix(key1,
+ from,
+ mergingList,
+ constrainList,
+ flags,
+ tePathAttributes,
+ abstractPath1);
+ ConnectivityMatrix matrix2 = new ConnectivityMatrix(key1,
+ from,
+ mergingList,
+ constrainList,
+ flags,
+ tePathAttributes,
+ abstractPath1);
+ ConnectivityMatrix matrix3 = new ConnectivityMatrix(key1,
+ from,
+ mergingList,
+ constrainList,
+ flags,
+ tePathAttributes,
+ abstractPath2);
+ ConnectivityMatrix matrix4 = new ConnectivityMatrix(key2,
+ from,
+ mergingList,
+ constrainList,
+ flags,
+ tePathAttributes,
+ abstractPath1);
+
+ assertTrue("Two conn matrices must be equal", matrix1.equals(matrix2));
+
+ assertFalse("Two conn matrices must be unequal", matrix1.equals(matrix3));
+ assertFalse("Two conn matrices must be unequal", matrix3.equals(matrix1));
+
+ assertFalse("Two conn matrices must be unequal", matrix1.equals(matrix4));
+ assertFalse("Two conn matrices must be unequal", matrix4.equals(matrix1));
+ }
+
+ @Test
+ public void teNodeKeyEqualOperatorTest() {
+ TeNodeKey key1 = new TeNodeKey(providerId, clientId,
+ topologyId, teNodeId);
+ TeNodeKey key2 = new TeNodeKey(providerId, clientId,
+ topologyId, teNodeId);
+ TeNodeKey key3 = new TeNodeKey(providerId + 1, clientId,
+ topologyId, teNodeId);
+ TeNodeKey key4 = new TeNodeKey(providerId, clientId + 1,
+ topologyId, teNodeId);
+ TeNodeKey key5 = new TeNodeKey(providerId, clientId,
+ topologyId + 1, teNodeId);
+ TeNodeKey key6 = new TeNodeKey(providerId, clientId,
+ topologyId, teNodeId + 1);
+
+ assertTrue("Two matrix keys must be equal", key1.equals(key2));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key3));
+ assertFalse("Two matrix keys must be unequal", key3.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key4));
+ assertFalse("Two matrix keys must be unequal", key4.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key5));
+ assertFalse("Two matrix keys must be unequal", key5.equals(key1));
+
+ assertFalse("Two matrix keys must be unequal", key1.equals(key6));
+ assertFalse("Two matrix keys must be unequal", key6.equals(key1));
+ }
+
+ @Test
+ public void ttpMatrixKeyEqualOperatorTest() {
+ TtpKey key1 = new TtpKey(providerId, clientId, topologyId,
+ teNodeId, ttpId);
+ TtpKey key2 = new TtpKey(providerId, clientId, topologyId,
+ teNodeId, ttpId);
+ TtpKey key3 = new TtpKey(providerId + 1, clientId, topologyId,
+ teNodeId, ttpId);
+ TtpKey key4 = new TtpKey(providerId, clientId + 1, topologyId,
+ teNodeId, ttpId);
+ TtpKey key5 = new TtpKey(providerId, clientId, topologyId + 1,
+ teNodeId, ttpId);
+ TtpKey key6 = new TtpKey(providerId, clientId, topologyId,
+ teNodeId + 1, ttpId);
+ TtpKey key7 = new TtpKey(providerId, clientId, topologyId,
+ teNodeId, ttpId + 1);
+
+ assertTrue("Two TTP keys must be equal", key1.equals(key2));
+
+ assertFalse("Two TTP keys must be unequal", key1.equals(key3));
+ assertFalse("Two TTP keys must be unequal", key3.equals(key1));
+
+ assertFalse("Two TTP keys must be unequal", key1.equals(key4));
+ assertFalse("Two TTP keys must be unequal", key4.equals(key1));
+
+ assertFalse("Two TTP keys must be unequal", key1.equals(key5));
+ assertFalse("Two TTP keys must be unequal", key5.equals(key1));
+
+ assertFalse("Two TTP keys must be unequal", key1.equals(key6));
+ assertFalse("Two TTP keys must be unequal", key6.equals(key1));
+
+ assertFalse("Two TTP keys must be unequal", key1.equals(key7));
+ assertFalse("Two TTP keys must be unequal", key7.equals(key1));
+ }
+
+}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/package-info.java b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/package-info.java
similarity index 85%
rename from apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/package-info.java
rename to apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/package-info.java
index b2c69be..0a3c586 100644
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/package-info.java
+++ b/apps/tetopology/api/src/test/java/org/onosproject/tetopology/manager/api/package-info.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
- * TE Topology Management implementation.
+ * The TE topology APis test functions.
+ *
*/
-package org.onosproject.tetopology.management.impl;
+package org.onosproject.tetopology.manager.api;
diff --git a/apps/tetopology/app.xml b/apps/tetopology/app.xml
deleted file mode 100644
index e675d4c..0000000
--- a/apps/tetopology/app.xml
+++ /dev/null
@@ -1,23 +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.
- -->
-<app name="org.onosproject.tetopology" origin="HUAWEI" version="${project.version}"
- featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
- features="${project.artifactId}">
- <description>${project.description}</description>
- <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
-</app>
-
diff --git a/apps/tetopology/features.xml b/apps/tetopology/features.xml
deleted file mode 100644
index 5b08d80..0000000
--- a/apps/tetopology/features.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- ~ 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.
- -->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
- <feature name="${project.artifactId}" version="${project.version}"
- description="${project.description}">
- <feature>onos-api</feature>
- <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
- </feature>
-</features>
diff --git a/apps/tetopology/pom.xml b/apps/tetopology/pom.xml
index 75ae24d..fcf01a7 100644
--- a/apps/tetopology/pom.xml
+++ b/apps/tetopology/pom.xml
@@ -19,82 +19,30 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onosproject</groupId>
<artifactId>onos-apps</artifactId>
+ <groupId>org.onosproject</groupId>
<version>1.8.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>onos-app-tetopology</artifactId>
- <version>1.8.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
+ <artifactId>onos-tetopology</artifactId>
+ <packaging>pom</packaging>
- <description>IETF TE Management</description>
+ <description>IETF TE Topology management</description>
- <properties>
- <onos.app.name>org.onosproject.tetopology</onos.app.name>
- <onos.app.category>Application</onos.app.category>
- <onos.app.url>http://onosproject.org</onos.app.url>
- <onos.app.readme>IETF TE Management.</onos.app.readme>
- <!-- onos.app.requires>com.huawei.tsdn.yang</onos.app.requires -->
- </properties>
+ <modules>
+ <module>api</module>
+ <!--
+ <module>app</module>
+ -->
+ </modules>
+
+<!--
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
- <version>${project.version}</version>
- </dependency>
- <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>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
<artifactId>onos-incubator-api</artifactId>
- <version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-misc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-common</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-common</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
-
</dependencies>
+-->
</project>
+
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java
deleted file mode 100644
index e2d600f..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetwork.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.link.NetworkLink;
-import org.onosproject.tetopology.management.api.node.NetworkNode;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Default Network implementation.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- * <pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- * </pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class DefaultNetwork implements Network {
- private KeyId networkId;
- private List<KeyId> supportingNetworkIds;
- private List<NetworkNode> nodes;
- private List<NetworkLink> links;
- private TeTopologyId teTopologyId;
- private boolean serverProvided;
-
- /**
- * Constructor with all fields.
- *
- * @param networkId network identifier
- * @param supportingNetworkIds supporting network identifier
- * @param nodes list of nodes within the network
- * @param links list of links within the network
- * @param teTopologyId TE topology identifier
- * @param serverProvided whether the network is received from server
- */
- public DefaultNetwork(KeyId networkId, List<KeyId> supportingNetworkIds,
- List<NetworkNode> nodes, List<NetworkLink> links, TeTopologyId teTopologyId,
- boolean serverProvided) {
- this.networkId = networkId;
- this.supportingNetworkIds = supportingNetworkIds;
- this.nodes = nodes;
- this.links = links;
- this.teTopologyId = teTopologyId;
- this.serverProvided = serverProvided;
- }
-
- /**
- * Constructor with key only.
- *
- * @param networkId network identifier
- */
- public DefaultNetwork(KeyId networkId) {
- this.networkId = networkId;
- }
-
- /**
- * Creates an instance of DefaultNetwork from an existing Network object.
- *
- * @param network network identifier
- */
- public DefaultNetwork(Network network) {
- this.networkId = network.networkId();
- this.supportingNetworkIds = network.getSupportingNetworkIds();
- this.nodes = network.getNodes();
- this.links = network.getLinks();
- this.teTopologyId = network.getTeTopologyId();
- this.serverProvided = network.isServerProvided();
- }
-
- @Override
- public KeyId networkId() {
- return networkId;
- }
-
- @Override
- public List<KeyId> getSupportingNetworkIds() {
- return supportingNetworkIds;
- }
-
- @Override
- public List<NetworkNode> getNodes() {
- return nodes;
- }
-
- @Override
- public NetworkNode getNode(KeyId nodeId) {
-
- for (NetworkNode node : nodes) {
- if (node.nodeId().equals(nodeId)) {
- return node;
- }
- }
- return null;
- }
-
- @Override
- public List<NetworkLink> getLinks() {
- return links;
- }
-
- @Override
- public NetworkLink getLink(KeyId linkId) {
-
- for (NetworkLink link : links) {
- if (link.linkId().equals(linkId)) {
- return link;
- }
- }
- return null;
- }
-
- @Override
- public boolean isServerProvided() {
- return serverProvided;
- }
-
- @Override
- public TeTopologyId getTeTopologyId() {
- return teTopologyId;
- }
-
-
- /**
- * Sets the supporting network keys.
- *
- * @param supportingNetworkIds the supportingNetworkIds to set
- */
- public void setSupportingNetworkIds(List<KeyId> supportingNetworkIds) {
- this.supportingNetworkIds = supportingNetworkIds;
- }
-
- /**
- * Sets the list of nodes .
- *
- * @param nodes the nodes to set
- */
- public void setNodes(List<NetworkNode> nodes) {
- this.nodes = nodes;
- }
-
- /**
- * Sets the links.
- *
- * @param links the links to set
- */
- public void setLinks(List<NetworkLink> links) {
- this.links = links;
- }
-
- /**
- * Sets the attribute serverProvided.
- *
- * @param serverProvided the attribute to set
- */
- public void setServerProvided(boolean serverProvided) {
- this.serverProvided = serverProvided;
- }
-
- /**
- * Sets the TE Topology Id.
- *
- * @param teTopologyId the teTopologyId to set
- */
- public void setTeTopologyId(TeTopologyId teTopologyId) {
- this.teTopologyId = teTopologyId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(networkId, supportingNetworkIds,
- nodes, links, serverProvided, teTopologyId);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof DefaultNetwork) {
- DefaultNetwork that = (DefaultNetwork) object;
- return Objects.equal(this.networkId, that.networkId) &&
- Objects.equal(this.supportingNetworkIds, that.supportingNetworkIds) &&
- Objects.equal(this.nodes, that.nodes) &&
- Objects.equal(this.links, that.links) &&
- Objects.equal(this.serverProvided, that.serverProvided) &&
- Objects.equal(this.teTopologyId, that.teTopologyId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("networkId", networkId)
- .add("supportingNetworkIds", supportingNetworkIds)
- .add("nodes", nodes)
- .add("links", links)
- .add("serverProvided", serverProvided)
- .add("teTopologyId", teTopologyId)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java
deleted file mode 100644
index 51515e0..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/DefaultNetworks.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-import java.util.List;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Default Networks implementation.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- * <pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- * </pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class DefaultNetworks implements Networks, TeTopologyEventSubject {
- private List<Network> networks;
-
- /**
- * Creates an instance of DefaultNetworks.
- */
- public DefaultNetworks() {
- }
-
- /**
- * Constructor with all fields.
- *
- * @param networks list of networks
- */
- public DefaultNetworks(List<Network> networks) {
- this.networks = networks;
- }
-
- @Override
- public List<Network> networks() {
- return networks;
- }
-
- /**
- * Sets the networks.
- *
- * @param networks the networks to set
- */
- public void setNetworks(List<Network> networks) {
- this.networks = networks;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(networks);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof DefaultNetworks) {
- DefaultNetworks that = (DefaultNetworks) object;
- return Objects.equal(this.networks, that.networks);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("networks", networks)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/InternalTeNetwork.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/InternalTeNetwork.java
deleted file mode 100644
index 294d7d7..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/InternalTeNetwork.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Internal TE Network implementation.
- */
-public class InternalTeNetwork extends DefaultNetwork {
- private TeTopologyType teTopologyType;
-
- /**
- * Constructor with all fields.
- *
- * @param teTopologyType TE topology type
- * @param network network object
- */
- public InternalTeNetwork(TeTopologyType teTopologyType, Network network) {
- super(network);
- this.teTopologyType = teTopologyType;
- }
-
- /**
- * Returns the TE topoology type.
- *
- * @return TE topology type
- */
- public TeTopologyType getTeTopologyType() {
- return this.teTopologyType;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), teTopologyType);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof InternalTeNetwork) {
-
- if (!super.equals(object)) {
- return false;
- }
-
- InternalTeNetwork that = (InternalTeNetwork) object;
- return Objects.equal(this.teTopologyType, that.teTopologyType);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("teTopologyType", teTopologyType)
- .add("DefaultNetwork", super.toString())
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/Network.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/Network.java
deleted file mode 100644
index 2f2014a..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/Network.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2016-present 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.tetopology.management.api;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.link.NetworkLink;
-import org.onosproject.tetopology.management.api.node.NetworkNode;
-
-/**
- * Abstraction of a network element.
- */
-public interface Network extends TeTopologyEventSubject {
-
- /**
- * Returns the network identifier / key of this element.
- *
- * @return network identifier
- */
- KeyId networkId();
-
- /**
- * Returns the attribute of supporting Network.
- *
- * @return list of the ids of the supporting networks
- */
- List<KeyId> getSupportingNetworkIds();
-
- /**
- * Returns a collection of nodes in the network identified by the specified
- * network id.
- *
- * @return a collection of currently known nodes
- */
- List<NetworkNode> getNodes();
-
- /**
- * Returns the node.
- *
- * @param nodeId node id URI format
- * @return value of node
- */
- NetworkNode getNode(KeyId nodeId);
-
- /**
- * Returns a collection of links in the network identified by the specified
- * network id.
- *
- * @return a collection of currently known links
- */
- List<NetworkLink> getLinks();
-
- /**
- * Returns the link.
- *
- * @param linkId link id in URI format
- * @return value of link
- */
- NetworkLink getLink(KeyId linkId);
-
- /**
- * Returns if the network is provided by a server or is configured by a
- * client.
- *
- * @return true if the network is provided by a server; false otherwise
- */
- boolean isServerProvided();
-
- /**
- * Returns the TE topology Id.
- *
- * @return TE topology id for this network
- */
- TeTopologyId getTeTopologyId();
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java
deleted file mode 100644
index 556294f..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEvent.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-import org.onosproject.event.AbstractEvent;
-
-/**
- * TE network topology event.
- */
-public class TeTopologyEvent
- extends AbstractEvent<TeTopologyEvent.Type, TeTopologyEventSubject> {
-
- /**
- * Type of TE topology events.
- */
- public enum Type {
-
- /** Designates addition of a network. */
- NETWORK_ADDED,
-
- /** Designates update of a network. */
- NETWORK_UPDATED,
-
- /** Designates removal of a network. */
- NETWORK_REMOVED,
-
- /** Designates addition of a node. */
- NODE_ADDED,
-
- /** Designates update of a node. */
- NODE_UPDATED,
-
- /** Designates removal of a node. */
- NODE_REMOVED,
-
- /** Designates addition of a termination point. */
- TP_ADDED,
-
- /** Designates update of a termination point. */
- TP_UPDATED,
-
- /** Designates removal of a termination point. */
- TP_REMOVED,
-
- /** Designates addition of a link. */
- LINK_ADDED,
-
- /** Designates update of a link. */
- LINK_UPDATED,
-
- /** Designates removal of a link. */
- LINK_REMOVED;
- }
-
- /**
- * Constructor for TeTopologyEvent.
- *
- * @param type type of topology event
- * @param subject event subject interface
- */
- public TeTopologyEvent(Type type, TeTopologyEventSubject subject) {
- super(type, subject);
- }
-
- /**
- * Constructor for TeTopologyEvent.
- *
- * @param type type of topology event
- * @param subject event subject interface
- * @param time event time
- */
- public TeTopologyEvent(Type type, TeTopologyEventSubject subject, long time) {
- super(type, subject, time);
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java
deleted file mode 100644
index fc4981f..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-import org.onosproject.event.ListenerService;
-
-/**
- * TE Topology Service API.
- */
-public interface TeTopologyService
- extends ListenerService<TeTopologyEvent, TeTopologyListener> {
-
- /**
- * Returns a collection of currently known networks.
- *
- * @return a collection of networks
- */
- Networks getNetworks();
-
- /**
- * Returns the network identified by its network id.
- *
- * @param networkId network id in URI format
- * @return value of network
- */
- Network getNetwork(KeyId networkId);
-
- /**
- * Updates the network.
- *
- * @param network network to be updated
- */
- void updateNetwork(Network network);
-
- /**
- * Removes the network.
- *
- * @param networkId network id in URI format
- */
- void removeNetwork(KeyId networkId);
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStore.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStore.java
deleted file mode 100644
index 0433496..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStore.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-import java.util.List;
-
-import org.onosproject.store.Store;
-
-/**
- * Inventory of TE network topology.
- */
-public interface TeTopologyStore
- extends Store<TeTopologyEvent, TeTopologyStoreDelegate> {
-
- /**
- * Returns a collection of currently known networks.
- *
- * @param type TE topology type
- * @return a collection of stored internal TE networks
- */
- List<InternalTeNetwork> getNetworks(TeTopologyType type);
-
- /**
- * Returns the network.
- *
- * @param networkId network id in URI format
- * @return value of internal TE network
- */
- InternalTeNetwork getNetwork(KeyId networkId);
-
- /**
- * Updates the network.
- *
- * @param network value of the network to be updated
- */
- void updateNetwork(InternalTeNetwork network);
-
- /**
- * Removes the network.
- *
- * @param networkId network id in URI format
- */
- void removeNetwork(KeyId networkId);
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStoreDelegate.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStoreDelegate.java
deleted file mode 100644
index 7f6c929..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyStoreDelegate.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api;
-
-import org.onosproject.store.StoreDelegate;
-
-/**
- * Abstraction of TE networks store delegate.
- */
-public interface TeTopologyStoreDelegate extends StoreDelegate<TeTopologyEvent> {
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyType.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyType.java
deleted file mode 100644
index e9cfb43..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/TeTopologyType.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2016-present 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.tetopology.management.api;
-
-/**
- * TE Topology type enumeration.
- */
-public enum TeTopologyType {
-
- /**
- * Native topology.
- */
- NATIVE(0),
-
- /**
- * Customized topology.
- */
- CUSTOMIZED(1),
-
- /**
- * Subordinate TE topology received from SB.
- */
- SUBORDINATE(2),
-
- /**
- * Configured TE topology received from NB.
- */
- CONFIGURED(3),
-
- /**
- * ANY - default value, used for topology filtering based on topology type.
- */
- ANY(4);
-
- private int teTopologyType;
-
- /**
- * Creates an instance of teTopologyType.
- *
- * @param value value of teTopologyType
- */
- TeTopologyType(int value) {
- teTopologyType = value;
- }
-
- /**
- * Returns the attribute teTopologyType.
- *
- * @return value of teTopologyType
- */
- public int teTopologyType() {
- return teTopologyType;
- }
-
- /**
- * Returns the object of teTopologyType from input String. Returns null
- * when string conversion fails or value is not recognized.
- *
- * @param valInString input String
- * @return Object of teTopologyType
- */
- public static TeTopologyType of(String valInString) {
- try {
- int tmpVal = Integer.parseInt(valInString);
- return of(tmpVal);
- } catch (Exception e) {
- }
- return null;
- }
-
- /**
- * Returns the object of teTopologyType from input integer. Returns null
- * when the integer value is not recognized.
- *
- * @param value value of teTopologyType
- * @return Object of corresponding TE topology type
- */
- public static TeTopologyType of(int value) {
- switch (value) {
- case 0:
- return TeTopologyType.NATIVE;
- case 1:
- return TeTopologyType.CUSTOMIZED;
- case 2:
- return TeTopologyType.SUBORDINATE;
- case 3:
- return TeTopologyType.CONFIGURED;
- case 4:
- return TeTopologyType.ANY;
- default :
- return null;
- }
- }
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java
deleted file mode 100644
index 9aa4cd2..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/DefaultNetworkLink.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.node.TerminationPointKey;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * NetworkLink implementation.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- *<pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- *</pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class DefaultNetworkLink implements NetworkLink {
- private final KeyId linkId;
- private TerminationPointKey source;
- private TerminationPointKey destination;
- private List<NetworkLinkKey> supportingLinkIds;
- private TeLink te;
-
- /**
- * Creates an instance of DefaultNetworkLink.
- *
- * @param linkId link identifier
- */
- public DefaultNetworkLink(KeyId linkId) {
- this.linkId = linkId;
- }
-
- /**
- * Sets the link source point.
- *
- * @param source the source to set
- */
- public void setSource(TerminationPointKey source) {
- this.source = source;
- }
-
- /**
- * Sets the link destination point.
- *
- * @param destination the destination to set
- */
- public void setDestination(TerminationPointKey destination) {
- this.destination = destination;
- }
-
- /**
- * Sets the supporting link Ids.
- *
- * @param supportingLinkIds the supportingLinkIds to set
- */
- public void setSupportingLinkIds(List<NetworkLinkKey> supportingLinkIds) {
- this.supportingLinkIds = supportingLinkIds;
- }
-
- /**
- * Sets the te extension.
- *
- * @param te the te to set
- */
- public void setTe(TeLink te) {
- this.te = te;
- }
-
- @Override
- public KeyId linkId() {
- return linkId;
- }
-
- @Override
- public TerminationPointKey getSource() {
- return source;
- }
-
- @Override
- public TerminationPointKey getDestination() {
- return destination;
- }
- @Override
- public List<NetworkLinkKey> getSupportingLinkIds() {
- return supportingLinkIds;
- }
-
- @Override
- public TeLink getTe() {
- return te;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(linkId, source, destination, supportingLinkIds, te);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof DefaultNetworkLink) {
- DefaultNetworkLink that = (DefaultNetworkLink) object;
- return Objects.equal(this.linkId, that.linkId) &&
- Objects.equal(this.source, that.source) &&
- Objects.equal(this.destination, that.destination) &&
- Objects.equal(this.supportingLinkIds, that.supportingLinkIds) &&
- Objects.equal(this.te, that.te);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("linkId", linkId)
- .add("source", source)
- .add("destination", destination)
- .add("supportingLinkIds", supportingLinkIds)
- .add("te", te)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ExternalDomain.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ExternalDomain.java
deleted file mode 100644
index e847da4..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/ExternalDomain.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import org.onosproject.tetopology.management.api.KeyId;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Representation of an external domain link.
- */
-public class ExternalDomain {
- private final KeyId remoteTeNodeId;
- private final KeyId remoteTeLinkTpId;
- private final long plugId;
-
- /**
- * Creates an instance of ExternalDomain.
- *
- * @param remoteTeNodeId remote TE node identifier
- * @param remoteTeLinkTpId remote TE link termination point identifier
- * @param plugId global plug id
- */
- public ExternalDomain(KeyId remoteTeNodeId, KeyId remoteTeLinkTpId, long plugId) {
- this.remoteTeNodeId = remoteTeNodeId;
- this.remoteTeLinkTpId = remoteTeLinkTpId;
- this.plugId = plugId;
- }
-
- /**
- * Creates an instance of ExternalDomain with remote TE node and tp.
- *
- * @param remoteTeNodeId remote TE node identifier
- * @param remoteTeLinkTpId remote TE link termination point identifier
- */
- public ExternalDomain(KeyId remoteTeNodeId, KeyId remoteTeLinkTpId) {
- this.remoteTeNodeId = remoteTeNodeId;
- this.remoteTeLinkTpId = remoteTeLinkTpId;
- this.plugId = 0L;
- }
-
- /**
- * Creates an instance of ExternalDomain with plugId.
- *
- * @param plugId global plug id
- */
- public ExternalDomain(long plugId) {
- this.remoteTeNodeId = null;
- this.remoteTeLinkTpId = null;
- this.plugId = plugId;
- }
-
- /**
- * Returns the remote TeNode Id.
- *
- * @return value of the remote TE node identifier
- */
- public KeyId remoteTeNodeId() {
- return remoteTeNodeId;
- }
-
- /**
- * Returns the remote TeLink TpId.
- *
- * @return value of the remote TE link identifier
- */
- public KeyId remoteTeLinkTpId() {
- return remoteTeLinkTpId;
- }
-
- /**
- * Returns the plugId.
- *
- * @return value of the global plug id
- */
- public long plugId() {
- return plugId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(remoteTeNodeId, remoteTeLinkTpId, remoteTeLinkTpId);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof ExternalDomain) {
- ExternalDomain that = (ExternalDomain) object;
- return Objects.equal(this.remoteTeNodeId, that.remoteTeNodeId) &&
- Objects.equal(this.remoteTeLinkTpId, that.remoteTeLinkTpId) &&
- Objects.equal(this.remoteTeLinkTpId, that.remoteTeLinkTpId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("remoteTeNodeId", remoteTeNodeId)
- .add("remoteTeLinkTpId", remoteTeLinkTpId)
- .add("remoteTeLinkTpId", remoteTeLinkTpId)
- .toString();
- }
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/LinkProtectionType.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/LinkProtectionType.java
deleted file mode 100644
index bcbdf0c..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/LinkProtectionType.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2016-present 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.tetopology.management.api.link;
-
-/**
- * Represents ENUM data of linkProtectionType.
- */
-public enum LinkProtectionType {
-
- /**
- * Represents unprotected.
- */
- UNPROTECTED(0),
-
- /**
- * Represents extraTraffic.
- */
- EXTRA_TRAFFIC(1),
-
- /**
- * Represents shared.
- */
- SHARED(2),
-
- /**
- * Represents yangAutoPrefix1For1.
- */
- YANGAUTOPREFIX1_FOR_1(3),
-
- /**
- * Represents yangAutoPrefix1Plus1.
- */
- YANGAUTOPREFIX1_PLUS_1(4),
-
- /**
- * Represents enhanced.
- */
- ENHANCED(5);
-
- private int linkProtectionType;
-
- LinkProtectionType(int value) {
- linkProtectionType = value;
- }
-
- /**
- * Returns the attribute linkProtectionType.
- *
- * @return value of linkProtectionType
- */
- public int linkProtectionType() {
- return linkProtectionType;
- }
-
- /**
- * Returns the object of linkProtectionType from input String. Returns null
- * when string conversion fails or converted integer value is not recognized.
- *
- * @param valInString input String
- * @return Object of linkProtectionType
- */
- public static LinkProtectionType of(String valInString) {
- try {
- int tmpVal = Integer.parseInt(valInString);
- return of(tmpVal);
- } catch (NumberFormatException e) {
- }
- return null;
- }
-
- /**
- * Returns the object of linkProtectionType from input integer. Returns null
- * when the integer value is not recognized.
- *
- * @param value value of linkProtectionTypeForTypeInt
- * @return Object of linkProtectionTypeForTypeInt
- */
- public static LinkProtectionType of(int value) {
- switch (value) {
- case 0:
- return LinkProtectionType.UNPROTECTED;
- case 1:
- return LinkProtectionType.EXTRA_TRAFFIC;
- case 2:
- return LinkProtectionType.SHARED;
- case 3:
- return LinkProtectionType.YANGAUTOPREFIX1_FOR_1;
- case 4:
- return LinkProtectionType.YANGAUTOPREFIX1_PLUS_1;
- case 5:
- return LinkProtectionType.ENHANCED;
- default :
- return null;
- }
- }
-
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv4.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv4.java
deleted file mode 100644
index fdef295..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv4.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.util.Objects;
-
-import org.onlab.packet.Ip4Address;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Implementation of IPv4 address as an ElementType.
- */
-public class TeIpv4 implements ElementType {
- private Ip4Address v4Address;
- private short v4PrefixLength;
- private boolean v4Loose;
-
- /**
- * Creates an instance of TeIpv4.
- */
- public TeIpv4() {
- }
-
- /**
- * Sets the v4 address.
- *
- * @param v4Address the v4Address to set
- */
- public void setV4Address(Ip4Address v4Address) {
- this.v4Address = v4Address;
- }
-
- /**
- * Sets the prefix length.
- *
- * @param v4PrefixLength the v4PrefixLength to set
- */
- public void setV4PrefixLength(short v4PrefixLength) {
- this.v4PrefixLength = v4PrefixLength;
- }
-
- /**
- * Sets the loose flag.
- *
- * @param v4Loose the v4Loose to set
- */
- public void setV4Loose(boolean v4Loose) {
- this.v4Loose = v4Loose;
- }
-
- /**
- * Returns the v4Address.
- *
- * @return IPv4 address
- */
- public Ip4Address v4Address() {
- return v4Address;
- }
-
- /**
- * Returns the v4PrefixLength.
- *
- * @return IPv4 address prefix length
- */
- public short v4PrefixLength() {
- return v4PrefixLength;
- }
-
- /**
- * Returns the v4Loose.
- *
- * @return true if the address specifies a loose hop; false otherwise
- */
- public boolean v4Loose() {
- return v4Loose;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(v4Address, v4PrefixLength, v4Loose);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof TeIpv4) {
- TeIpv4 other = (TeIpv4) obj;
- return Objects.equals(v4Address, other.v4Address) &&
- Objects.equals(v4PrefixLength, other.v4PrefixLength) &&
- Objects.equals(v4Loose, other.v4Loose);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("v4Address", v4Address)
- .add("v4PrefixLength", v4PrefixLength)
- .add("v4Loose", v4Loose)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv6.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv6.java
deleted file mode 100644
index 074a866..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeIpv6.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.util.Objects;
-
-import org.onlab.packet.Ip6Address;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Implementation of IPv6 address as an ElementType.
- */
-public class TeIpv6 implements ElementType {
- private Ip6Address v6Address;
- private short v6PrefixLength;
- private boolean v6Loose;
-
- /**
- * Creates an instance of TeIpv6.
- */
- public TeIpv6() {
- }
-
- /**
- * Sets the v6 address.
- *
- * @param v6Address the v6Address to set
- */
- public void setV6Address(Ip6Address v6Address) {
- this.v6Address = v6Address;
- }
-
- /**
- * Sets the prefix length.
- *
- * @param v6PrefixLength the v6PrefixLength to set
- */
- public void setV6PrefixLength(short v6PrefixLength) {
- this.v6PrefixLength = v6PrefixLength;
- }
-
- /**
- * Sets the loose flag.
- *
- * @param v6Loose the v6Loose to set
- */
- public void setv6Loose(boolean v6Loose) {
- this.v6Loose = v6Loose;
- }
-
- /**
- * Returns the v6Address.
- *
- * @return IPv6 address
- */
- public Ip6Address v6Address() {
- return v6Address;
- }
-
- /**
- * Returns the v6PrefixLength.
- *
- * @return IPv6 address prefix length
- */
- public short v6PrefixLength() {
- return v6PrefixLength;
- }
-
- /**
- * Returns the v6Loose.
- *
- * @return true if the address specifies a loose hop; false otherwise
- */
- public boolean v6Loose() {
- return v6Loose;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(v6Address, v6PrefixLength, v6Loose);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof TeIpv6) {
- TeIpv6 other = (TeIpv6) obj;
- return Objects.equals(v6Address, other.v6Address) &&
- Objects.equals(v6PrefixLength, other.v6PrefixLength) &&
- Objects.equals(v6Loose, other.v6Loose);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("v6Address", v6Address)
- .add("v6PrefixLength", v6PrefixLength)
- .add("v6Loose", v6Loose)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeLink.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeLink.java
deleted file mode 100644
index 181f710..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/TeLink.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.node.TeStatus;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Link TE extension.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- *<pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- *</pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class TeLink {
- // See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.
- // topology.rev20160708.ietftetopology
- // .augmentedntlink.te.config.DefaultTeLinkAttributes for reference
- private BigInteger linkIndex;
- private String name;
- private TeStatus adminStatus;
- private TeStatus opStatus;
- private TeLinkAccessType accessType;
- //private administrativeGroup
- private LinkProtectionType linkProtectionType;
- private BigDecimal maxLinkBandwidth;
- private BigDecimal maxResvLinkBandwidth;
- private List<UnreservedBandwidth> unreservedBandwidths;
- private long teDefaultMetric;
- private ExternalDomain externalDomain;
- private List<Long> teSrlgs;
- private boolean isAbstract;
- private UnderlayPath underlayPath;
-
- /**
- * Creates an instance of TeLink.
- *
- * @param linkIndex TE link index
- */
- public TeLink(BigInteger linkIndex) {
- this.linkIndex = linkIndex;
- }
-
- /**
- * Sets the name.
- *
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the administrative status.
- *
- * @param adminStatus the adminStatus to set
- */
- public void setAdminStatus(TeStatus adminStatus) {
- this.adminStatus = adminStatus;
- }
-
- /**
- * Sets the operational status.
- *
- * @param opStatus the opStatus to set
- */
- public void setOpStatus(TeStatus opStatus) {
- this.opStatus = opStatus;
- }
-
- /**
- * Sets the access type.
- *
- * @param accessType the accessType to set
- */
- public void setAccessType(TeLinkAccessType accessType) {
- this.accessType = accessType;
- }
-
- /**
- * Sets the protection type.
- *
- * @param type the linkProtectionType to set
- */
- public void setLinkProtectionType(LinkProtectionType type) {
- this.linkProtectionType = type;
- }
-
- /**
- * Sets the link maximum bandwidth.
- *
- * @param bw the maxLinkBandwidth to set
- */
- public void setMaxLinkBandwidth(BigDecimal bw) {
- this.maxLinkBandwidth = bw;
- }
-
- /**
- * Sets the link maximum reservable bandwidth.
- *
- * @param bw the maxResvLinkBandwidth to set
- */
- public void setMaxResvLinkBandwidth(BigDecimal bw) {
- this.maxResvLinkBandwidth = bw;
- }
-
- /**
- * Sets the list of link unreserved bandwidths.
- *
- * @param bwList the unreservedBandwidths to set
- */
- public void setUnreservedBandwidths(List<UnreservedBandwidth> bwList) {
- this.unreservedBandwidths = bwList;
- }
-
- /**
- * Sets the default metric.
- *
- * @param metric the teDefaultMetric to set
- */
- public void setTeDefaultMetric(long metric) {
- this.teDefaultMetric = metric;
- }
-
- /**
- * Sets the external domain link.
- *
- * @param extDomain the externalDomain to set
- */
- public void setExternalDomain(ExternalDomain extDomain) {
- this.externalDomain = extDomain;
- }
-
- /**
- * Sets the list of SRLGs.
- *
- * @param teSrlgs the teSrlgs to set
- */
- public void setTeSrlgs(List<Long> teSrlgs) {
- this.teSrlgs = teSrlgs;
- }
-
- /**
- * Sets the isAbstract flag.
- *
- * @param isAbstract the isAbstract to set
- */
- public void setIsAbstract(boolean isAbstract) {
- this.isAbstract = isAbstract;
- }
-
- /**
- * Sets the link underlay path.
- *
- * @param underlayPath the underlay path to set
- */
- public void setUnderlayPath(UnderlayPath underlayPath) {
- this.underlayPath = underlayPath;
- }
-
- /**
- * Returns the link index.
- *
- * @return link index
- */
- public BigInteger linkIndex() {
- return linkIndex;
- }
-
- /**
- * Returns the name.
- *
- * @return name of the TE link
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns the administrative status.
- *
- * @return link admin status
- */
- public TeStatus adminStatus() {
- return adminStatus;
- }
-
- /**
- * Returns the operational status.
- *
- * @return link operational status
- */
- public TeStatus opStatus() {
- return opStatus;
- }
-
- /**
- * Returns the access type.
- *
- * @return link access type
- */
- public TeLinkAccessType accessType() {
- return accessType;
- }
-
- /**
- * Returns the link protection type.
- *
- * @return link protection type
- */
- public LinkProtectionType linkProtectionType() {
- return linkProtectionType;
- }
-
- /**
- * Returns the link maximum bandwidth.
- *
- * @return link maximum bandwidth
- */
- public BigDecimal maxLinkBandwidth() {
- return maxLinkBandwidth;
- }
-
- /**
- * Returns the maximum reservable bandwidth.
- *
- * @return link maximum reservable bandwidth
- */
- public BigDecimal maxResvLinkBandwidth() {
- return maxResvLinkBandwidth;
- }
-
- /**
- * Returns the list of link unreserved bandwidths.
- *
- * @return link unreserved bandwidth
- */
- public List<UnreservedBandwidth> unreservedBandwidths() {
- return unreservedBandwidths;
- }
-
- /**
- * Returns the te default metric.
- *
- * @return link TE metric
- */
- public long teDefaultMetric() {
- return teDefaultMetric;
- }
-
- /**
- * Returns the external domain link.
- *
- * @return external domain
- */
- public ExternalDomain externalDomain() {
- return externalDomain;
- }
-
- /**
- * Returns the list of SRLGs.
- *
- * @return link SRLG
- */
- public List<Long> teSrlgs() {
- return teSrlgs;
- }
-
- /**
- * Returns the flag isAbstract.
- *
- * @return true or false if link is abstract
- */
- public boolean isAbstract() {
- return isAbstract;
- }
-
- /**
- * Returns the underlay path data.
- *
- * @return link underlay TE path
- */
- public UnderlayPath underlayPath() {
- return underlayPath;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(linkIndex, name, adminStatus, opStatus, accessType,
- linkProtectionType, maxLinkBandwidth, maxResvLinkBandwidth, unreservedBandwidths,
- teDefaultMetric, externalDomain, teSrlgs, isAbstract, underlayPath);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof TeLink) {
- TeLink that = (TeLink) object;
- return Objects.equal(this.linkIndex, that.linkIndex) &&
- Objects.equal(this.name, that.name) &&
- Objects.equal(this.adminStatus, that.adminStatus) &&
- Objects.equal(this.opStatus, that.opStatus) &&
- Objects.equal(this.accessType, that.accessType) &&
- Objects.equal(this.linkProtectionType, that.linkProtectionType) &&
- Objects.equal(this.maxLinkBandwidth, that.maxLinkBandwidth) &&
- Objects.equal(this.maxResvLinkBandwidth, that.maxResvLinkBandwidth) &&
- Objects.equal(this.unreservedBandwidths, that.unreservedBandwidths) &&
- Objects.equal(this.teDefaultMetric, that.teDefaultMetric) &&
- Objects.equal(this.externalDomain, that.externalDomain) &&
- Objects.equal(this.teSrlgs, that.teSrlgs) &&
- Objects.equal(this.isAbstract, that.isAbstract) &&
- Objects.equal(this.underlayPath, that.underlayPath);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("linkIndex", linkIndex)
- .add("name", name)
- .add("adminStatus", adminStatus)
- .add("opStatus", opStatus)
- .add("accessType", accessType)
- .add("linkProtectionType", linkProtectionType)
- .add("maxLinkBandwidth", maxLinkBandwidth)
- .add("maxResvLinkBandwidth", maxResvLinkBandwidth)
- .add("unreservedBandwidths", unreservedBandwidths)
- .add("teDefaultMetric", teDefaultMetric)
- .add("externalDomain", externalDomain)
- .add("teSrlgs", teSrlgs)
- .add("isAbstract", isAbstract)
- .add("underlayPath", underlayPath)
- .toString();
- }
-
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayAbstractPath.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayAbstractPath.java
deleted file mode 100644
index f57a75f..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayAbstractPath.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.util.List;
-import java.util.Objects;
-
-import org.onosproject.tetopology.management.api.node.TeNetworkTopologyId;
-
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents the common defintion of an underlay path that supports a TE link.
- */
-public class UnderlayAbstractPath {
- private TeNetworkTopologyId ref;
- private List<PathElement> pathElements;
-
- /**
- * Creates an instance of UnderlayAbstractPath.
- */
- public UnderlayAbstractPath() {
- }
-
- /**
- * Sets the TE Topology reference.
- *
- * @param ref the ref to set
- */
- public void setRef(TeNetworkTopologyId ref) {
- this.ref = ref;
- }
-
- /**
- * Sets the list of path elements.
- *
- * @param pathElements the pathElement to set
- */
- public void setPathElement(List<PathElement> pathElements) {
- this.pathElements = pathElements;
- }
-
- /**
- * Returns the TE Topology reference.
- *
- * @return value of TE network topology identifier
- */
- public TeNetworkTopologyId ref() {
- return ref;
- }
-
- /**
- * Returns the list of path elements.
- *
- * @return list of path elements
- */
- public List<PathElement> pathElements() {
- return pathElements;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(ref, pathElements);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof UnderlayAbstractPath) {
- UnderlayAbstractPath other = (UnderlayAbstractPath) obj;
- return Objects.equals(ref, other.ref) &&
- Objects.equals(pathElements, other.pathElements);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("ref", ref)
- .add("pathElements", pathElements)
- .toString();
- }
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java
deleted file mode 100644
index 9d0886b..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayPath.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.node.TerminationPointKey;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Represents the TE link underlay path data.
- */
-public class UnderlayPath {
- private int protectionType;
- private UnderlayPrimaryPath primaryPath;
- private List<UnderlayBackupPath> backupPaths;
- private TerminationPointKey trailSrc;
- private TerminationPointKey trailDes;
-
- /**
- * Creates an instance of Underlay.
- */
- public UnderlayPath() {
- }
-
- /**
- * Sets the protection type.
- *
- * @param protectionType the protectionType to set
- */
- public void setProtectionType(int protectionType) {
- this.protectionType = protectionType;
- }
-
- /**
- * Sets the primary path.
- *
- * @param primaryPath the primaryPath to set
- */
- public void setPrimaryPath(UnderlayPrimaryPath primaryPath) {
- this.primaryPath = primaryPath;
- }
-
- /**
- * Sets the link of backup paths.
- *
- * @param backupPaths the backupPath to set
- */
- public void setBackupPath(List<UnderlayBackupPath> backupPaths) {
- this.backupPaths = backupPaths;
- }
-
- /**
- * Sets the trail source.
- *
- * @param trailSrc the trailSrc to set
- */
- public void setTrailSrc(TerminationPointKey trailSrc) {
- this.trailSrc = trailSrc;
- }
-
- /**
- * Sets the trail destination.
- *
- * @param trailDes the trailDes to set
- */
- public void setTrailDes(TerminationPointKey trailDes) {
- this.trailDes = trailDes;
- }
-
- /**
- * Returns the protection type.
- *
- * @return path protection type
- */
- public int protectionType() {
- return protectionType;
- }
-
- /**
- * Returns the primary path.
- *
- * @return underlay primary path
- */
- public UnderlayPrimaryPath primaryPath() {
- return primaryPath;
- }
-
- /**
- * Returns the backup paths.
- *
- * @return list of underlay backup paths
- */
- public List<UnderlayBackupPath> backupPaths() {
- return backupPaths;
- }
-
- /**
- * Returns the trail source.
- *
- * @return trail source
- */
- public TerminationPointKey trailSrc() {
- return trailSrc;
- }
-
- /**
- * Returns the trail destination.
- *
- * @return trail destination
- */
- public TerminationPointKey trailDes() {
- return trailDes;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(protectionType, primaryPath,
- backupPaths, trailSrc, trailDes);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof UnderlayPath) {
- UnderlayPath that = (UnderlayPath) object;
- return Objects.equal(this.protectionType, that.protectionType) &&
- Objects.equal(this.primaryPath, that.primaryPath) &&
- Objects.equal(this.backupPaths, that.backupPaths) &&
- Objects.equal(this.trailSrc, that.trailSrc) &&
- Objects.equal(this.trailDes, that.trailDes);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("protectionType", protectionType)
- .add("primaryPath", primaryPath)
- .add("backupPaths", backupPaths)
- .add("trailSrc", trailSrc)
- .add("trailDes", trailDes)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnreservedBandwidth.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnreservedBandwidth.java
deleted file mode 100644
index 4225345..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/link/UnreservedBandwidth.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.link;
-
-import java.math.BigDecimal;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Representation of a link's unreserved bandwidth.
- */
-public class UnreservedBandwidth {
- private final short priority;
- private final BigDecimal bandwidth;
-
- /**
- * Create an instance of UnreservedBandwidth.
- *
- * @param priority allocatable priority of unreserved bandwidth
- * @param bandwidth bandwidth
- */
- public UnreservedBandwidth(short priority, BigDecimal bandwidth) {
- this.priority = priority;
- this.bandwidth = bandwidth;
- }
-
- /**
- * Returns the priority.
- *
- * @return the priority
- */
- public short priority() {
- return priority;
- }
-
- /**
- * Returns the bandwidth.
- *
- * @return the bandwidth
- */
- public BigDecimal bandwidth() {
- return bandwidth;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(priority, bandwidth);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof UnreservedBandwidth) {
- UnreservedBandwidth that = (UnreservedBandwidth) object;
- return Objects.equal(this.priority, that.priority) &&
- Objects.equal(this.bandwidth, that.bandwidth);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("priority", priority)
- .add("bandwidth", bandwidth)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java
deleted file mode 100644
index ba298a8..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/ConnectivityMatrix.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Represents node's switching limitations.
- */
-public class ConnectivityMatrix {
- private final long id;
- private TerminationPointKey from;
- private TerminationPointKey to;
- private boolean isAllowed;
-
- /**
- * Creates an instance of ConnectivityMatrix.
- *
- * @param id connectivity matrix identifier
- * @param from from termination point key
- * @param to to termination point key
- * @param isAllowed indicate whether this connectivity matrix is useable
- */
- public ConnectivityMatrix(long id, TerminationPointKey from,
- TerminationPointKey to, boolean isAllowed) {
- this.id = id;
- this.from = from;
- this.to = to;
- this.isAllowed = isAllowed;
- }
-
- /**
- * Constructor with id only.
- *
- * @param id connectivity matrix id
- */
- public ConnectivityMatrix(long id) {
- this.id = id;
- }
-
- /**
- * Returns the id.
- *
- * @return connectivity matrix id
- */
- public long id() {
- return id;
- }
-
- /**
- * Returns the "from" of a connectivity matrix.
- *
- * @return the "from" of a connectivity matrix
- */
- public TerminationPointKey from() {
- return from;
- }
-
- /**
- * Returns the "to" of a connectivity matrix.
- *
- * @return the "to" of a connectivity matrix
- */
- public TerminationPointKey to() {
- return to;
- }
-
- /**
- * Returns true if the connectivity matrix is allowed; false otherwise.
- *
- * @return true if the connectivity matrix is allowed; false otherwise
- */
- public boolean isAllowed() {
- return isAllowed;
- }
-
- /**
- * Sets the from termination point.
- *
- * @param from the from to set
- */
- public void setFrom(TerminationPointKey from) {
- this.from = from;
- }
-
- /**
- * Sets the to termination point.
- *
- * @param to the to to set
- */
- public void setTo(TerminationPointKey to) {
- this.to = to;
- }
-
- /**
- * Sets isAllowed.
- *
- * @param isAllowed the isAllowed to set
- */
- public void setIsAllowed(boolean isAllowed) {
- this.isAllowed = isAllowed;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, from, to, isAllowed);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof ConnectivityMatrix) {
- ConnectivityMatrix that = (ConnectivityMatrix) object;
- return Objects.equal(this.id, that.id) &&
- Objects.equal(this.from, that.from) &&
- Objects.equal(this.to, that.to) &&
- Objects.equal(this.isAllowed, that.isAllowed);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id)
- .add("from", from)
- .add("to", to)
- .add("isAllowed", isAllowed)
- .toString();
- }
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java
deleted file mode 100644
index 62c65b5..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultNetworkNode.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.KeyId;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * NetworkNode implementation.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- *<pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- *</pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class DefaultNetworkNode implements NetworkNode {
- private final KeyId id;
- private List<NetworkNodeKey> supportingNodeIds;
- private TeNode te;
- private List<TerminationPoint> tps;
-
- /**
- * Creates an instance of DefaultNetworkNode using Id.
- *
- * @param id network node identifier
- */
- public DefaultNetworkNode(KeyId id) {
- this.id = id;
- }
-
- /**
- * Creates an instance of DefaultNetworkNode.
- *
- * @param id network node identifier
- * @param nodeIds support node identifiers
- * @param te te parameter of the node
- */
- public DefaultNetworkNode(KeyId id, List<NetworkNodeKey> nodeIds, TeNode te) {
- this.id = id;
- this.supportingNodeIds = nodeIds;
- this.te = te;
- }
-
- /**
- * Sets the list of supporting node ids.
- *
- * @param ids the supporting node ids to set
- */
- public void setSupportingNodeIds(List<NetworkNodeKey> ids) {
- this.supportingNodeIds = ids;
- }
-
- /**
- * Sets the te attribute.
- *
- * @param te the te to set
- */
- public void setTe(TeNode te) {
- this.te = te;
- }
-
- /**
- * Sets the TerminationPoints.
- *
- * @param tps the tps to set
- */
- public void setTerminationPoints(List<TerminationPoint> tps) {
- this.tps = tps;
- }
-
- /**
- * Returns the node identifier.
- *
- * @return node identifier
- */
- @Override
- public KeyId nodeId() {
- return id;
- }
-
- /**
- * Returns the supportingNodeIds.
- *
- * @return list of supporting node identifiers for this node
- */
- @Override
- public List<NetworkNodeKey> getSupportingNodeIds() {
- return supportingNodeIds;
- }
-
- /**
- * Returns the te attribute value.
- *
- * @return TE attributes of this node
- */
- @Override
- public TeNode getTe() {
- return te;
- }
-
- /**
- * Returns the list of termination points.
- *
- * @return a list of termination points associated with this node
- */
- @Override
- public List<TerminationPoint> getTerminationPoints() {
- return tps;
- }
-
- /**
- * Returns the termination point.
- *
- * @return the termination point
- */
- @Override
- public TerminationPoint getTerminationPoint(KeyId tpId) {
-
- for (TerminationPoint tp : tps) {
- if (tp.id().equals(tpId)) {
- return tp;
- }
- }
-
- return null;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, supportingNodeIds, te, tps);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof DefaultNetworkNode) {
- DefaultNetworkNode that = (DefaultNetworkNode) object;
- return Objects.equal(this.id, that.id) &&
- Objects.equal(this.supportingNodeIds, that.supportingNodeIds) &&
- Objects.equal(this.te, that.te) &&
- Objects.equal(this.tps, that.tps);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id)
- .add("supportingNodeIds", supportingNodeIds)
- .add("te", te)
- .add("tps", tps)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTerminationPoint.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTerminationPoint.java
deleted file mode 100644
index 057cd4c..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/DefaultTerminationPoint.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.KeyId;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Represent a termination point.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- *<pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- *</pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class DefaultTerminationPoint implements TerminationPoint {
- private KeyId id;
- private List<TerminationPointKey> supportingTpIds;
- private TeTerminationPoint te;
-
- /**
- * Creates an instance of DefaultTerminationPoint.
- *
- * @param id termination point identifier
- * @param tps support termination point identifier
- * @param te te parameters of the terminiation point
- */
- public DefaultTerminationPoint(KeyId id, List<TerminationPointKey> tps,
- TeTerminationPoint te) {
- this.id = id;
- this.supportingTpIds = tps;
- this.te = te;
- }
-
- /**
- * Creates an instance of DefaultTerminationPoint with teTpId only.
- *
- * @param id termination point identifier
- */
- public DefaultTerminationPoint(KeyId id) {
- this.id = id;
- }
-
- @Override
- public KeyId id() {
- return id;
- }
-
- @Override
- public List<TerminationPointKey> getSupportingTpIds() {
- return supportingTpIds;
- }
-
- @Override
- public TeTerminationPoint getTe() {
- return te;
- }
-
- /**
- * Sets the Id.
- *
- * @param id the id to set
- */
- public void setId(KeyId id) {
- this.id = id;
- }
-
- /**
- * Sets the supportingTpIds.
- *
- * @param tps the supportingTpIds to set
- */
- public void setSupportingTpIds(List<TerminationPointKey> tps) {
- this.supportingTpIds = tps;
- }
-
- /**
- * Sets the te extension.
- *
- * @param te the te to set
- */
- public void setTe(TeTerminationPoint te) {
- this.te = te;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(id, supportingTpIds, te);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof DefaultTerminationPoint) {
- DefaultTerminationPoint that = (DefaultTerminationPoint) object;
- return Objects.equal(this.id, that.id) &&
- Objects.equal(this.supportingTpIds, that.supportingTpIds) &&
- Objects.equal(this.te, that.te);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id)
- .add("supportingTpIds", supportingTpIds)
- .add("te", te)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/InterfaceSwitchingCapability.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/InterfaceSwitchingCapability.java
deleted file mode 100644
index 99e06de..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/InterfaceSwitchingCapability.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-/**
- * Interface switching capability representation.
- */
-public class InterfaceSwitchingCapability {
- // Should include switching capability, lsp encoding, max_lsp-bandwidth
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeNetworkTopologyId.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeNetworkTopologyId.java
deleted file mode 100644
index 4c3bbe9..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeNetworkTopologyId.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.TeTopologyId;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * TE Network Topology identifiers.
- */
-public class TeNetworkTopologyId {
- private final KeyId networkId;
- private final TeTopologyId topologyId;
-
- /**
- * Creates an instance of TeNetworkTopologyId.
- *
- * @param networkId network identifier
- * @param topologyId topology identifier
- */
- public TeNetworkTopologyId(KeyId networkId, TeTopologyId topologyId) {
- this.networkId = networkId;
- this.topologyId = topologyId;
- }
-
- /**
- * Creates TeNetworkTopologyId with networkId.
- *
- * @param networkId network identifier
- */
- public TeNetworkTopologyId(KeyId networkId) {
- this.networkId = networkId;
- this.topologyId = null;
- }
-
- /**
- * Creates TeNetworkTopologyId with topologyId.
- *
- * @param topologyId topology identifier
- */
- public TeNetworkTopologyId(TeTopologyId topologyId) {
- this.networkId = null;
- this.topologyId = topologyId;
- }
-
- /**
- * Returns the network identifier.
- *
- * @return network id
- */
- public KeyId getNetworkId() {
- return networkId;
- }
-
- /**
- * Returns the topology identifier.
- *
- * @return TE topology id
- */
- public TeTopologyId getTopologyId() {
- return topologyId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(networkId, topologyId);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof TeNetworkTopologyId) {
- TeNetworkTopologyId that = (TeNetworkTopologyId) object;
- return Objects.equal(this.networkId, that.networkId) &&
- Objects.equal(this.topologyId, that.topologyId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("networkId", networkId)
- .add("topologyId", topologyId)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeNode.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeNode.java
deleted file mode 100644
index 0eef01c..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeNode.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import java.util.List;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * TE Node representation.
- * <p>
- * The Set/Get methods below are defined to accept and pass references because
- * the object class is treated as a "composite" object class that holds
- * references to various member objects and their relationships, forming a
- * data tree. Internal routines of the TE topology manager may use the
- * following example methods to construct and manipulate any piece of data in
- * the data tree:
- * <pre>
- * newNode.getTe().setAdminStatus(), or
- * newNode.getSupportingNodeIds().add(nodeId), etc.
- * </pre>
- * Same for constructors where, for example, a child list may be constructed
- * first and passed in by reference to its parent object constructor.
- */
-public class TeNode {
- // See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.
- // topology.rev20160708.ietftetopology
- // .augmentednwnode.te.config.DefaultTeNodeAttributes for reference
- private String teNodeId;
- private String name;
- private TeStatus adminStatus;
- private TeStatus opStatus;
- private boolean isAbstract;
- private List<ConnectivityMatrix> connMatrices;
- private TeNetworkTopologyId underlayTopology;
- private List<TunnelTerminationPoint> tunnelTerminationPoints;
-
- /**
- * Creates an instance of TeNode.
- *
- * @param teNodeId TE node identifier
- */
- public TeNode(String teNodeId) {
- this.teNodeId = teNodeId;
- }
-
- /**
- * Sets the node name.
- *
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the node administrative status.
- *
- * @param adminStatus the adminStatus to set
- */
- public void setAdminStatus(TeStatus adminStatus) {
- this.adminStatus = adminStatus;
- }
-
- /**
- * Sets the node operational status.
- *
- * @param opStatus the opStatus to set
- */
- public void setOpStatus(TeStatus opStatus) {
- this.opStatus = opStatus;
- }
-
- /**
- * Sets the node is an abstract node or not.
- *
- * @param isAbstract the isAbstract to set
- */
- public void setAbstract(boolean isAbstract) {
- this.isAbstract = isAbstract;
- }
-
- /**
- * Set connectivity matrix table.
- *
- * @param connMatrices connectivity matrix table
- */
- public void setConnectivityMatrices(List<ConnectivityMatrix> connMatrices) {
- this.connMatrices = connMatrices;
- }
-
- /**
- * Sets the node underlay TE topology.
- *
- * @param topo the underlayTopology to set
- */
- public void setUnderlayTopology(TeNetworkTopologyId topo) {
- this.underlayTopology = topo;
- }
-
- /**
- * Sets the list of tunnel termination points.
- *
- * @param ttps the tunnelTerminationPoints to set
- */
- public void setTunnelTerminationPoints(List<TunnelTerminationPoint> ttps) {
- this.tunnelTerminationPoints = ttps;
- }
-
- /**
- * Returns the teNodeId.
- *
- * @return TE node id
- */
- public String teNodeId() {
- return teNodeId;
- }
-
- /**
- * Returns the name.
- *
- * @return TE node name
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns the adminStatus.
- *
- * @return TE node admin status
- */
- public TeStatus adminStatus() {
- return adminStatus;
- }
-
- /**
- * Returns the opStatus.
- *
- * @return TE node operational status
- */
- public TeStatus opStatus() {
- return opStatus;
- }
-
- /**
- * Returns the isAbstract.
- *
- * @return true or false if the TE node is abstract
- */
- public boolean isAbstract() {
- return isAbstract;
- }
-
- /**
- * Returns the connectivity matrix table.
- *
- * @return node connectivity matrix table
- */
- public List<ConnectivityMatrix> connectivityMatrices() {
- return connMatrices;
- }
-
- /**
- * Returns the underlay topology.
- *
- * @return node underlay topology
- */
- public TeNetworkTopologyId underlayTopology() {
- return underlayTopology;
- }
-
- /**
- * Returns the tunnelTerminationPoints.
- *
- * @return list of tunnel terminational points
- */
- public List<TunnelTerminationPoint> tunnelTerminationPoints() {
- return tunnelTerminationPoints;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(teNodeId, name, adminStatus, opStatus, isAbstract,
- connMatrices, underlayTopology, tunnelTerminationPoints);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof TeNode) {
- TeNode that = (TeNode) object;
- return Objects.equal(this.teNodeId, that.teNodeId) &&
- Objects.equal(this.name, that.name) &&
- Objects.equal(this.adminStatus, that.adminStatus) &&
- Objects.equal(this.opStatus, that.opStatus) &&
- Objects.equal(this.isAbstract, that.isAbstract) &&
- Objects.equal(this.connMatrices, that.connMatrices) &&
- Objects.equal(this.underlayTopology, that.underlayTopology) &&
- Objects.equal(this.tunnelTerminationPoints, that.tunnelTerminationPoints);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("teNodeId", teNodeId)
- .add("name", name)
- .add("adminStatus", adminStatus)
- .add("opStatus", opStatus)
- .add("isAbstract", isAbstract)
- .add("connMatrices", connMatrices)
- .add("underlayTopology", underlayTopology)
- .add("tunnelTerminationPoints", tunnelTerminationPoints)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeTerminationPoint.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeTerminationPoint.java
deleted file mode 100644
index bc18a8c..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TeTerminationPoint.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import java.util.List;
-
-import org.onosproject.tetopology.management.api.KeyId;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * TE termination point representation.
- */
-public class TeTerminationPoint {
- private KeyId teTpId;
- private List<InterfaceSwitchingCapability> capabilities;
- private long interLayerLockId;
-
- /**
- * Creates an instance of TeTerminationPoint.
- *
- * @param teTpId TE termination point identifier
- * @param capabilities capability descriptor for termination point
- * @param interLayerLockId inter-layer lock identifier
- */
- public TeTerminationPoint(KeyId teTpId,
- List<InterfaceSwitchingCapability> capabilities, long interLayerLockId) {
- this.teTpId = teTpId;
- this.capabilities = capabilities;
- this.interLayerLockId = interLayerLockId;
- }
-
- /**
- * Creates an instance of TeTerminationPoint with teTpId only.
- *
- * @param teTpId TE termination point id
- */
- public TeTerminationPoint(KeyId teTpId) {
- this.teTpId = teTpId;
- }
-
- /**
- * Returns the TE termination point id.
- *
- * @return value of teTpId
- */
- public KeyId teTpId() {
- return teTpId;
- }
-
- /**
- * Returns the interface switching capabilities.
- *
- * @return interface switching capabilities
- */
- public List<InterfaceSwitchingCapability> interfaceSwitchingCapabilities() {
- return capabilities;
- }
-
- /**
- * Returns the interLayerLockId.
- *
- * @return interlayer lock id
- */
- public long getInterLayerLockId() {
- return interLayerLockId;
- }
-
- /**
- * Sets the te tp Id.
- *
- * @param teTpId the teTpId to set
- */
- public void setTeTpId(KeyId teTpId) {
- this.teTpId = teTpId;
- }
-
- /**
- * Sets the interface switching capabilities.
- *
- * @param capabilities the capabilities to set
- */
- public void setInterfaceSwitchingCapabilities(List<InterfaceSwitchingCapability> capabilities) {
- this.capabilities = capabilities;
- }
-
- /**
- * Sets the inter layer lockId.
- *
- * @param interLayerLockId the interLayerLockId to set
- */
- public void setInterLayerLockId(long interLayerLockId) {
- this.interLayerLockId = interLayerLockId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(teTpId, capabilities, interLayerLockId);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof TeTerminationPoint) {
- TeTerminationPoint that = (TeTerminationPoint) object;
- return Objects.equal(this.teTpId, that.teTpId) &&
- Objects.equal(this.capabilities, that.capabilities) &&
- Objects.equal(this.interLayerLockId, that.interLayerLockId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("teTpId", teTpId)
- .add("capabilities", capabilities)
- .add("interLayerLockId", interLayerLockId)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationCapability.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationCapability.java
deleted file mode 100644
index dedb53a..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TerminationCapability.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-/**
- * The termination capabilities between tunnel-termination-point
- * and link termination-point.
- */
-public class TerminationCapability {
- // See reference - org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang
- // .ietf.te.topology.rev20160708.ietftetopology.augmentednwnode.te
- //.tunnelterminationpoint.config.DefaultTerminationCapability
- private TerminationPointKey linkTpId;
- //List<MaxLspBandwidth> maxLspBandwidth
- // TODO - to be extended per future standard definitions
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TunnelTerminationPoint.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TunnelTerminationPoint.java
deleted file mode 100644
index df81a09..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/api/node/TunnelTerminationPoint.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.api.node;
-
-import java.util.List;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-/**
- * Representation of a tunnel termination point.
- */
-public class TunnelTerminationPoint {
- //See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te
- //.topology.rev20160708.ietftetopology
- //.augmentednwnode.te.DefaultTunnelTerminationPoint
- //org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology
- //.rev20160708.ietftetopology
- //.augmentednwnode.te.tunnelterminationpoint.DefaultConfig
- private byte[] tunnelTpId;
- private List<InterfaceSwitchingCapability> switchingCapabilities;
- private long interLayerLockId;
- private List<TerminationCapability> terminationCapability;
-
- /**
- * Create an instance of TunnelTerminationPoint.
- *
- * @param tunnelTpId tunnel termination point id
- */
- public TunnelTerminationPoint(byte[] tunnelTpId) {
- this.tunnelTpId = tunnelTpId;
- }
-
- /**
- * Sets the switching capabilities.
- *
- * @param swcaps the switching capabilities to set
- */
- public void setSwitchingCapabilities(List<InterfaceSwitchingCapability> swcaps) {
- this.switchingCapabilities = swcaps;
- }
-
- /**
- * Sets the interLayerLockId.
- *
- * @param id the interLayerLockId to set
- */
- public void setInterLayerLockId(long id) {
- this.interLayerLockId = id;
- }
-
- /**
- * Sets the termination capability.
- *
- * @param terminationCapability the terminationCapability to set
- */
- public void setTerminationCapabilities(List<TerminationCapability> terminationCapability) {
- this.terminationCapability = terminationCapability;
- }
-
- /**
- * Returns the tunnelTpId.
- *
- * @return tunnel termination point id
- */
- public byte[] getTunnelTpId() {
- return tunnelTpId;
- }
-
- /**
- * Returns the switching capabilities.
- *
- * @return switching capabilities
- */
- public List<InterfaceSwitchingCapability> getSwitchingCapabilities() {
- return switchingCapabilities;
- }
-
- /**
- * Returns the interLayerLockId.
- *
- * @return inter layer lock identifier
- */
- public long getInterLayerLockId() {
- return interLayerLockId;
- }
-
- /**
- * Returns the termination capability list.
- *
- * @return termination capabilities
- */
- public List<TerminationCapability> getTerminationCapabilities() {
- return terminationCapability;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(tunnelTpId, switchingCapabilities, interLayerLockId, terminationCapability);
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof TunnelTerminationPoint) {
- TunnelTerminationPoint that = (TunnelTerminationPoint) object;
- return Objects.equal(this.tunnelTpId, that.tunnelTpId) &&
- Objects.equal(this.switchingCapabilities, that.switchingCapabilities) &&
- Objects.equal(this.terminationCapability, that.terminationCapability) &&
- Objects.equal(this.interLayerLockId, that.interLayerLockId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("tunnelTpId", tunnelTpId)
- .add("switchingCapabilities", switchingCapabilities)
- .add("interLayerLockId", interLayerLockId)
- .add("terminationCapability", terminationCapability)
- .toString();
- }
-
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/DistributedTeTopologyStore.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/DistributedTeTopologyStore.java
deleted file mode 100644
index f177709..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/DistributedTeTopologyStore.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.List;
-import java.lang.annotation.ElementType;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
-import org.onlab.packet.IpAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.store.AbstractStore;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.ConsistentMap;
-import org.onosproject.store.service.MapEvent;
-import org.onosproject.store.service.MapEventListener;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.Network;
-import org.onosproject.tetopology.management.api.Networks;
-import org.onosproject.tetopology.management.api.TeTopologyEvent;
-import org.onosproject.tetopology.management.api.TeTopologyId;
-import org.onosproject.tetopology.management.api.TeTopologyType;
-import org.onosproject.tetopology.management.api.link.AsNumber;
-import org.onosproject.tetopology.management.api.link.DefaultNetworkLink;
-import org.onosproject.tetopology.management.api.link.ExternalDomain;
-import org.onosproject.tetopology.management.api.link.TeIpv4;
-import org.onosproject.tetopology.management.api.link.TeIpv6;
-import org.onosproject.tetopology.management.api.link.Label;
-import org.onosproject.tetopology.management.api.link.LinkProtectionType;
-import org.onosproject.tetopology.management.api.link.NetworkLink;
-import org.onosproject.tetopology.management.api.link.NetworkLinkKey;
-import org.onosproject.tetopology.management.api.link.PathElement;
-import org.onosproject.tetopology.management.api.link.TeLink;
-import org.onosproject.tetopology.management.api.link.TeLinkAccessType;
-import org.onosproject.tetopology.management.api.link.UnderlayBackupPath;
-import org.onosproject.tetopology.management.api.link.UnderlayPrimaryPath;
-import org.onosproject.tetopology.management.api.link.UnnumberedLink;
-import org.onosproject.tetopology.management.api.link.UnreservedBandwidth;
-import org.onosproject.tetopology.management.api.node.ConnectivityMatrix;
-import org.onosproject.tetopology.management.api.node.DefaultNetworkNode;
-import org.onosproject.tetopology.management.api.node.DefaultTerminationPoint;
-import org.onosproject.tetopology.management.api.node.InterfaceSwitchingCapability;
-import org.onosproject.tetopology.management.api.node.NetworkNode;
-import org.onosproject.tetopology.management.api.node.NetworkNodeKey;
-import org.onosproject.tetopology.management.api.node.TeNetworkTopologyId;
-import org.onosproject.tetopology.management.api.node.TeNode;
-import org.onosproject.tetopology.management.api.node.TeStatus;
-import org.onosproject.tetopology.management.api.node.TeTerminationPoint;
-import org.onosproject.tetopology.management.api.node.TerminationCapability;
-import org.onosproject.tetopology.management.api.node.TerminationPoint;
-import org.onosproject.tetopology.management.api.node.TerminationPointKey;
-import org.onosproject.tetopology.management.api.node.TunnelTerminationPoint;
-import org.onosproject.tetopology.management.api.TeTopologyStore;
-import org.onosproject.tetopology.management.api.TeTopologyStoreDelegate;
-import org.onosproject.tetopology.management.api.DefaultNetwork;
-import org.onosproject.tetopology.management.api.DefaultNetworks;
-import org.onosproject.tetopology.management.api.InternalTeNetwork;
-import org.slf4j.Logger;
-
-/**
- * Implementation of the IETF network store.
- */
-@Component(immediate = true)
-@Service
-public class DistributedTeTopologyStore
- extends AbstractStore<TeTopologyEvent, TeTopologyStoreDelegate>
- implements TeTopologyStore {
-
- private final Logger log = getLogger(getClass());
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- // Track networks by network key
- private ConsistentMap<KeyId, InternalTeNetwork> networkIdNetworkConsistentMap;
- private Map<KeyId, InternalTeNetwork> networkIdNetworkMap;
-
- // Listener for network events
- private final MapEventListener<KeyId, InternalTeNetwork> networkMapListener = new InternalNetworkMapListener();
-
- private static final Serializer NETWORK_SERIALIZER = Serializer
- .using(new KryoNamespace.Builder().register(KryoNamespaces.API)
- .register(KeyId.class)
- .register(InternalTeNetwork.class)
- .register(TeTopologyId.class)
- .register(DefaultNetwork.class)
- .register(DefaultNetworks.class)
- .register(InternalTeNetwork.class)
- .register(Network.class)
- .register(Networks.class)
- .register(TeTopologyType.class)
- .register(TeIpv4.class)
- .register(NetworkLinkKey.class)
- .register(NetworkLink.class)
- .register(PathElement.class)
- .register(TeLink.class)
- .register(UnderlayBackupPath.class)
- .register(UnderlayPrimaryPath.class)
- .register(UnnumberedLink.class)
- .register(UnreservedBandwidth.class)
- .register(InterfaceSwitchingCapability.class)
- .register(NetworkNode.class)
- .register(TeNode.class)
- .register(TerminationPoint.class)
- .register(TeTerminationPoint.class)
- .register(TerminationCapability.class)
- .register(TeStatus.class)
- .register(TunnelTerminationPoint.class)
- .register(DefaultNetworkLink.class)
- .register(DefaultNetworkNode.class)
- .register(DefaultTerminationPoint.class)
- .register(TerminationPointKey.class)
- .register(TeNetworkTopologyId.class)
- .register(NetworkNodeKey.class)
- .register(ConnectivityMatrix.class)
- .register(TeTopologyId.class)
- .register(TeLinkAccessType.class)
- .register(BigInteger.class)
- .register(String.class)
- .register(Long.class)
- .register(Boolean.class)
- .register(BigDecimal.class)
- .register(Short.class)
- .register(IpAddress.class)
- .register(Integer.class)
- .register(ExternalDomain.class)
- .register(ElementType.class)
- .register(LinkProtectionType.class)
- .register(Label.class)
- .register(TeIpv6.class)
- .register(AsNumber.class)
- .build());
-
- /**
- * Distributed network store service activate method.
- */
- @Activate
- public void activate() {
- log.info("TE topology store is activated");
- networkIdNetworkConsistentMap = storageService.<KeyId, InternalTeNetwork>consistentMapBuilder()
- .withSerializer(NETWORK_SERIALIZER)
- .withName("networkId-network")
- .withRelaxedReadConsistency()
- .build();
- networkIdNetworkConsistentMap.addListener(networkMapListener);
- networkIdNetworkMap = networkIdNetworkConsistentMap.asJavaMap();
-
- log.info("Started");
- }
-
- /**
- * Distributed network store service deactivate method.
- */
- @Deactivate
- public void deactivate() {
- networkIdNetworkConsistentMap.removeListener(networkMapListener);
- log.info("Stopped");
- }
-
- @Override
- public List<InternalTeNetwork> getNetworks(TeTopologyType type) {
- List<InternalTeNetwork> networks = new ArrayList<>();
-
- for (Map.Entry<KeyId, InternalTeNetwork> entry:networkIdNetworkMap.entrySet()) {
- KeyId networkId = entry.getKey();
- InternalTeNetwork network = entry.getValue();
-
- if (network.getTeTopologyType() == type ||
- type == TeTopologyType.ANY) {
- networks.add(network);
- }
- }
-
- return networks;
- }
-
- @Override
- public InternalTeNetwork getNetwork(KeyId networkId) {
- return networkIdNetworkMap.get(networkId);
- }
-
- @Override
- public void updateNetwork(InternalTeNetwork network) {
- //TODO - check the validity of the network before updating
- log.info("network = {}", network);
- networkIdNetworkMap.put(network.networkId(), network);
- }
-
- @Override
- public void removeNetwork(KeyId networkId) {
- networkIdNetworkMap.remove(networkId);
- }
-
- /**
- * Listener class to map listener map events to the network events.
- */
- private class InternalNetworkMapListener implements MapEventListener<KeyId, InternalTeNetwork> {
- @Override
- public void event(MapEvent<KeyId, InternalTeNetwork> event) {
- TeTopologyEvent.Type type = null;
- TeTopologyEvent topologyEvent = null;
- switch (event.type()) {
- case INSERT:
- type = TeTopologyEvent.Type.NETWORK_ADDED;
- // Need to check if nodes/links are already in, otherwise errors
- topologyEvent = new TeTopologyEvent(type, event.newValue().value());
- break;
- case UPDATE:
- // Need to check what attributes change, and coordinate with other Node/Link events.
- if ((event.oldValue().value() != null) && (event.newValue().value() == null)) {
- type = TeTopologyEvent.Type.NETWORK_REMOVED;
- topologyEvent = new TeTopologyEvent(type, event.oldValue().value());
- } else {
- type = TeTopologyEvent.Type.NETWORK_UPDATED;
- topologyEvent = new TeTopologyEvent(type, event.newValue().value());
- }
- break;
- case REMOVE:
- type = TeTopologyEvent.Type.NETWORK_REMOVED;
- topologyEvent = new TeTopologyEvent(type, event.oldValue().value());
- break;
- default:
- log.error("Unsupported event type: {}", event.type());
- }
- log.info("Event type {}, Event {}", type, topologyEvent);
- if (topologyEvent != null) {
- notifyDelegate(topologyEvent);
- }
- }
- }
-
-}
-
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyIdConfig.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyIdConfig.java
deleted file mode 100644
index 4cfe0d8..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyIdConfig.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.impl;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.incubator.net.config.basics.ConfigException;
-import org.onosproject.net.config.Config;
-import org.onosproject.tetopology.management.api.TeTopologyId;
-
-/**
- * Configuration for TE Topology Identifiers.
- */
-public class TeTopologyIdConfig extends Config<ApplicationId> {
- public static final String CONFIG_VALUE_ERROR = "Error parsing config value";
- private static final String PROVIDER_ID = "provider-id";
- private static final String CLIENT_ID = "client-id";
- private static final String TOPOLOGY_ID = "topology-id";
-
- /**
- * Generates TE topology identifier.
- *
- * @return encoded TE topology identifier
- * @throws ConfigException if the parameters are not correctly configured
- * or conversion of the parameters fails
- */
- public TeTopologyId getTeTopologyId() throws ConfigException {
- try {
- long providerId = object.path(PROVIDER_ID).asLong();
- long clientId = object.path(CLIENT_ID).asLong();
- String topologyId = object.path(TOPOLOGY_ID).asText();
-
- return new TeTopologyId(providerId, clientId, topologyId);
-
- } catch (IllegalArgumentException e) {
- throw new ConfigException(CONFIG_VALUE_ERROR, e);
- }
- }
-}
diff --git a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyManager.java b/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyManager.java
deleted file mode 100644
index 358237a..0000000
--- a/apps/tetopology/src/main/java/org/onosproject/tetopology/management/impl/TeTopologyManager.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright 2016 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.tetopology.management.impl;
-
-import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_ADDED;
-import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UPDATED;
-import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Collection;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
-import org.onlab.packet.Ip4Address;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.incubator.net.config.basics.ConfigException;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.MastershipRole;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.config.ConfigFactory;
-import org.onosproject.net.config.NetworkConfigEvent;
-import org.onosproject.net.config.NetworkConfigListener;
-import org.onosproject.net.config.NetworkConfigRegistry;
-import org.onosproject.net.device.DeviceProvider;
-import org.onosproject.net.device.DeviceProviderRegistry;
-import org.onosproject.net.device.DeviceProviderService;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.link.LinkProvider;
-import org.onosproject.net.link.LinkProviderRegistry;
-import org.onosproject.net.link.LinkProviderService;
-import org.onosproject.net.link.LinkService;
-import org.onosproject.net.provider.AbstractListenerProviderRegistry;
-import org.onosproject.net.provider.AbstractProviderService;
-import org.onosproject.net.provider.ProviderId;
-import org.onosproject.tetopology.management.api.DefaultNetwork;
-import org.onosproject.tetopology.management.api.DefaultNetworks;
-import org.onosproject.tetopology.management.api.InternalTeNetwork;
-import org.onosproject.tetopology.management.api.KeyId;
-import org.onosproject.tetopology.management.api.Network;
-import org.onosproject.tetopology.management.api.Networks;
-import org.onosproject.tetopology.management.api.TeTopologyEvent;
-import org.onosproject.tetopology.management.api.TeTopologyId;
-import org.onosproject.tetopology.management.api.TeTopologyListener;
-import org.onosproject.tetopology.management.api.TeTopologyProvider;
-import org.onosproject.tetopology.management.api.TeTopologyProviderRegistry;
-import org.onosproject.tetopology.management.api.TeTopologyProviderService;
-import org.onosproject.tetopology.management.api.TeTopologyService;
-import org.onosproject.tetopology.management.api.TeTopologyStore;
-import org.onosproject.tetopology.management.api.TeTopologyStoreDelegate;
-import org.onosproject.tetopology.management.api.TeTopologyType;
-import org.onosproject.tetopology.management.api.link.DefaultNetworkLink;
-import org.onosproject.tetopology.management.api.link.NetworkLink;
-import org.onosproject.tetopology.management.api.link.NetworkLinkKey;
-import org.onosproject.tetopology.management.api.node.ConnectivityMatrix;
-import org.onosproject.tetopology.management.api.node.DefaultNetworkNode;
-import org.onosproject.tetopology.management.api.node.DefaultTerminationPoint;
-import org.onosproject.tetopology.management.api.node.NetworkNode;
-import org.onosproject.tetopology.management.api.node.NetworkNodeKey;
-import org.onosproject.tetopology.management.api.node.TeNode;
-import org.onosproject.tetopology.management.api.node.TerminationPoint;
-import org.onosproject.tetopology.management.api.node.TerminationPointKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-
-/**
- * Implementation of the topology management service.
- */
-@Component(immediate = true)
-@Service
-public class TeTopologyManager
- extends AbstractListenerProviderRegistry<TeTopologyEvent, TeTopologyListener,
- TeTopologyProvider, TeTopologyProviderService>
- implements TeTopologyService, TeTopologyProviderRegistry, DeviceProvider, LinkProvider {
- private static final String APP_NAME = "org.onosproject.tetopology";
- private static final String IETF_TE_TOPOLOGY_MANAGER = "ietf-te-topology-manager";
- private static final String PROVIDER = "org.onosproject.provider.ietfte.objects";
- private static final long MY_PROVIDER_ID = 0x0a0a0a0aL;
- private static final long DEFAUL_CLIENT_ID = 0x00L;
- private static final String MY_NATIVE_TOPOLOGY_ID = "onos-sc-topo-1";
- private static final TeTopologyId DEFAULT_TOPOLOGY_ID = new TeTopologyId(MY_PROVIDER_ID,
- DEFAUL_CLIENT_ID,
- MY_NATIVE_TOPOLOGY_ID);
- //teTopologyId is configurable from Network Config
- private TeTopologyId teTopologyId = DEFAULT_TOPOLOGY_ID;
-
- private static final Ip4Address NEW_TE_NODE_ID_START = Ip4Address.valueOf("1.1.1.1");
- private static final Ip4Address NEW_TE_NODE_ID_END = Ip4Address.valueOf("1.1.250.250");
- private static final String MDSC_URI_PREFIX = "MDSC";
- private static Ip4Address newTeNodeId = NEW_TE_NODE_ID_START;
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected NetworkConfigRegistry cfgService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceService deviceService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected LinkService linkService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceProviderRegistry deviceProviderRegistry;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected LinkProviderRegistry linkProviderRegistry;
-
- //Only network level data is stored in this subsystem.
- //Link and Device details is stored in Link and Device subsystems.
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- public TeTopologyStore store;
-
- //private TeTopologyStoreDelegate delegate = this::post;
- private final TeTopologyStoreDelegate delegate = new InternalStoreDelegate();
-
- private final ConfigFactory<ApplicationId, TeTopologyIdConfig> factory =
- new ConfigFactory<ApplicationId, TeTopologyIdConfig>(APP_SUBJECT_FACTORY,
- TeTopologyIdConfig.class,
- "teTopologyId",
- true) {
- @Override
- public TeTopologyIdConfig createConfig() {
- return new TeTopologyIdConfig();
- }
- };
- private final NetworkConfigListener cfgLister = new InternalConfigListener();
- private ApplicationId appId;
-
- private DeviceProviderService deviceProviderService;
- private LinkProviderService linkProviderService;
-
- /**
- * Activation helper function.
- */
- public void activateBasics() {
- store.setDelegate(delegate);
- eventDispatcher.addSink(TeTopologyEvent.class, listenerRegistry);
- }
-
- /**
- * Deactivation helper function.
- */
- public void deactivateBasics() {
- store.unsetDelegate(delegate);
- eventDispatcher.removeSink(TeTopologyEvent.class);
- }
-
- @Activate
- public void activate() {
- activateBasics();
- appId = coreService.registerApplication(APP_NAME);
- cfgService.registerConfigFactory(factory);
- cfgService.addListener(cfgLister);
-
- deviceProviderService = deviceProviderRegistry.register(this);
- linkProviderService = linkProviderRegistry.register(this);
-
- //TODO: Needs to add the event listener into LINK and Device subsystem
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- deactivateBasics();
-
- cfgService.removeListener(cfgLister);
- cfgService.unregisterConfigFactory(factory);
-
- deviceProviderRegistry.unregister(this);
- linkProviderRegistry.unregister(this);
-
- //TODO: Needs to remove the event listener from LINK and Device subsystem
-
- log.info("Stopped");
- }
-
- @Override
- public Networks getNetworks() {
- // return a list of the native networks
- List<InternalTeNetwork> teNetworks = store.getNetworks(TeTopologyType.NATIVE);
-
- List<Network> defaultNetworks = new ArrayList<>();
- for (InternalTeNetwork teNetwork : teNetworks) {
- defaultNetworks.add(teNetwork);
- }
-
- return (new DefaultNetworks(defaultNetworks));
- }
-
- @Override
- public Network getNetwork(KeyId networkId) {
- return new DefaultNetwork(store.getNetwork(networkId));
- }
-
- @Override
- public void updateNetwork(Network network) {
- store.updateNetwork(new InternalTeNetwork(TeTopologyType.CONFIGURED, new DefaultNetwork(network)));
- //TODO: Need to update nodes and links to Device/Link subsystems.
- }
-
- @Override
- public void removeNetwork(KeyId networkId) {
- store.removeNetwork(networkId);
- }
-
- @Override
- protected TeTopologyProviderService createProviderService(TeTopologyProvider provider) {
- return new InternalTopologyProviderService(provider);
- }
-
- private class InternalTopologyProviderService
- extends AbstractProviderService<TeTopologyProvider>
- implements TeTopologyProviderService {
-
- protected InternalTopologyProviderService(TeTopologyProvider provider) {
- super(provider);
- }
-
- @Override
- public void networkUpdated(Network network) {
- // Store received network data into the local TE topology data store
- InternalTeNetwork teNetwork = new InternalTeNetwork(TeTopologyType.SUBORDINATE, network);
- store.updateNetwork(teNetwork);
-
- // let's do it here for now
- mergeNetworks();
-
- //TODO: Store node and link in Device/Link subsystem
- //deviceProviderService.deviceConnected(arg0, arg1);
- //linkProviderService.linkDetected(arg0);
- }
-
- @Override
- public void networkRemoved(KeyId networkId) {
- store.removeNetwork(networkId);
- }
-
- @Override
- public void linkUpdated(NetworkLinkKey linkKey, NetworkLink link) {
- // Need to check if this is a new link
-
- //deviceProviderService.deviceConnected(arg0, arg1);
- }
-
- @Override
- public void linkRemoved(NetworkLinkKey linkKey) {
- // No action is required (TODO: Auto-generated method stub)
- }
-
- @Override
- public void nodeUpdated(NetworkNodeKey nodeKey, NetworkNode node) {
- // Need to check if this is a new node
-
- // No action is required (TODO: Auto-generated method stub)
- }
-
- @Override
- public void nodeRemoved(NetworkNodeKey nodeKey) {
- // No action is required (TODO: Auto-generated method stub)
- }
-
- @Override
- public void terminationPointUpdated(TerminationPointKey terminationPointKey,
- TerminationPoint terminationPoint) {
- // No action is required (TODO: Auto-generated method stub)
- }
-
- @Override
- public void terminationPointRemoved(TerminationPointKey terminationPointKey) {
- // No action is required (TODO: Auto-generated method stub)
- }
-
- }
-
- private class InternalStoreDelegate implements TeTopologyStoreDelegate {
- @Override
- public void notify(TeTopologyEvent event) {
- if (event != null) {
- //post(event);
- processEvent(event);
- }
- }
- }
-
- private void processEvent(TeTopologyEvent event) {
- log.info("ProcessEvent {}", event.type().toString());
-
- //TODO - partial merge when network is updated
- if (event.type() == TeTopologyEvent.Type.NETWORK_ADDED) {
- // move network merging to networkUpdated()
- //mergeNetworks();
- }
-
- //TODO: Merge node and links from Device/Links subsytems if required.
-
- post(event);
- }
-
- private void mergeNetworks() {
- /*
- * Merge all subordinate TE topologies, create a simple merged native topology
- * and store it in the topology store.
- */
- /* TODO - generate new id based on its provider id + network id */
- KeyId newNetworkId = KeyId.keyId(Long.toString(teTopologyId.providerId()) + "-" + teTopologyId.topologyId());
- store.removeNetwork(newNetworkId);
- /* create list of links, nodes and termination points */
- List<NetworkLink> allLinks = new ArrayList<>();
- List<NetworkNode> allNodes = new ArrayList<>();
- List<KeyId> allSupportingNetworkIds = new ArrayList<>();
-
- /* translate keys for links/nodes/tps */
- List<InternalTeNetwork> subordNetworks = store.getNetworks(TeTopologyType.SUBORDINATE);
- for (InternalTeNetwork network : subordNetworks) {
- allSupportingNetworkIds.add(network.networkId());
-
- /* create and add new nodes */
- List<NetworkNode> nodes = network.getNodes();
- for (NetworkNode node : nodes) {
-
- KeyId newNodeId = KeyId.keyId(MDSC_URI_PREFIX + node.nodeId());
- TeNode newTeNode = null;
- TeNode origTeNode = node.getTe();
- if (origTeNode != null) {
- newTeNode = new TeNode(origTeNode.teNodeId());
- newTeNode.setName(origTeNode.name());
- newTeNode.setAdminStatus(origTeNode.adminStatus());
- newTeNode.setOpStatus(origTeNode.opStatus());
- newTeNode.setAbstract(origTeNode.isAbstract());
- List<ConnectivityMatrix> newConnMatrices = new ArrayList<>();
-
- for (ConnectivityMatrix conn : origTeNode.connectivityMatrices()) {
- KeyId tpId = conn.from().tpId();
- KeyId newFromTpId = KeyId.keyId(MDSC_URI_PREFIX + tpId);
- TerminationPointKey newFrom = new TerminationPointKey(newNetworkId, newNodeId, newFromTpId);
-
- tpId = conn.to().tpId();
- KeyId newToTpId = KeyId.keyId(MDSC_URI_PREFIX + tpId);
- TerminationPointKey newTo = new TerminationPointKey(newNetworkId, newNodeId, newToTpId);
- ConnectivityMatrix newConnMatrix =
- new ConnectivityMatrix(conn.id(), newFrom, newTo, conn.isAllowed());
- newConnMatrices.add(newConnMatrix);
- }
- newTeNode.setConnectivityMatrices(newConnMatrices);
- newTeNode.setUnderlayTopology(origTeNode.underlayTopology());
- newTeNode.setTunnelTerminationPoints(origTeNode.tunnelTerminationPoints());
- }
- List<NetworkNodeKey> supportingNodes = Lists.newArrayList();
- supportingNodes.add(new NetworkNodeKey(network.networkId(), node.nodeId()));
- DefaultNetworkNode newNode =
- new DefaultNetworkNode(newNodeId, supportingNodes, newTeNode);
- List<TerminationPoint> newTps = Lists.newArrayList();
-
- List<TerminationPoint> origTps = node.getTerminationPoints();
- if (nonEmpty(origTps)) {
- for (TerminationPoint tp : origTps) {
- DefaultTerminationPoint newTp =
- new DefaultTerminationPoint(KeyId.keyId(MDSC_URI_PREFIX + tp.id()));
- List<TerminationPointKey> supportTps = Lists.newArrayList();
- supportTps.add(new TerminationPointKey(network.networkId(), node.nodeId(), tp.id()));
- newTp.setSupportingTpIds(supportTps);
- newTps.add(newTp);
- }
- }
- newNode.setTerminationPoints(newTps);
- allNodes.add(newNode);
- }
-
- /* create and add new links */
- List<NetworkLink> links = network.getLinks();
- if (nonEmpty(links)) {
- for (NetworkLink link : links) {
- KeyId newLinkId = KeyId.keyId(MDSC_URI_PREFIX + link.linkId());
- KeyId k = link.getSource().nodeId();
- KeyId newSourceNodeId =
- KeyId.keyId(MDSC_URI_PREFIX + k);
- k = link.getSource().tpId();
- KeyId newSourceNodeTpId =
- KeyId.keyId(MDSC_URI_PREFIX + k);
- k = link.getDestination().nodeId();
- KeyId newDestNodeId =
- KeyId.keyId(MDSC_URI_PREFIX + k);
- k = link.getDestination().tpId();
- KeyId newDestNodeTpId =
- KeyId.keyId(MDSC_URI_PREFIX + k);
- TerminationPointKey newSourceNodeTp =
- new TerminationPointKey(newNetworkId, newSourceNodeId, newSourceNodeTpId);
- TerminationPointKey newDestNodeTp =
- new TerminationPointKey(newNetworkId, newDestNodeId, newDestNodeTpId);
-
- DefaultNetworkLink newLink = new DefaultNetworkLink(newLinkId);
- newLink.setSource(newSourceNodeTp);
- newLink.setDestination(newDestNodeTp);
- List<NetworkLinkKey> supportLinks = Lists.newArrayList();
- supportLinks.add(new NetworkLinkKey(network.networkId(), link.linkId()));
- newLink.setSupportingLinkIds(supportLinks);
- newLink.setTe(link.getTe());
-
- allLinks.add(newLink);
- }
- }
- }
-
- /* save generated native TE network into the store */
- if (allNodes.size() > 0) {
- //TeTopologyId newTopoId = new TeTopologyId(MY_PROVIDER_ID, 0L, NATIVE_TOPOLOGY_ID);
- DefaultNetwork nativeDefaultNetwork =
- new DefaultNetwork(newNetworkId, allSupportingNetworkIds, allNodes, allLinks, teTopologyId, true);
- InternalTeNetwork newTeNetwork = new InternalTeNetwork(TeTopologyType.NATIVE, nativeDefaultNetwork);
- store.updateNetwork(newTeNetwork);
- }
- }
-
- @Override
- public ProviderId id() {
- return new ProviderId(IETF_TE_TOPOLOGY_MANAGER, PROVIDER);
- }
-
- private class InternalConfigListener implements NetworkConfigListener {
-
- @Override
- public void event(NetworkConfigEvent event) {
- try {
- teTopologyId = cfgService.getConfig(appId, TeTopologyIdConfig.class).getTeTopologyId();
- } catch (ConfigException e) {
- log.error("Configuration error {}", e);
- }
- log.info("new teTopologyId is {}", teTopologyId);
- }
-
- @Override
- public boolean isRelevant(NetworkConfigEvent event) {
- return event.configClass().equals(TeTopologyIdConfig.class) &&
- (event.type() == CONFIG_ADDED ||
- event.type() == CONFIG_UPDATED);
- }
- }
-
- @Override
- public void changePortState(DeviceId arg0, PortNumber arg1, boolean arg2) {
- // TODO: This will be implemented if required.
- }
-
- @Override
- public boolean isReachable(DeviceId arg0) {
- // TODO: This will be implemented if required.
- return false;
- }
-
- @Override
- public void roleChanged(DeviceId arg0, MastershipRole arg1) {
- // TODO: This will be implemented if required.
- }
-
- @Override
- public void triggerProbe(DeviceId arg0) {
- // TODO: This will be implemented if required.
- }
-
- private Ip4Address assignTeNodeId() {
- int value = newTeNodeId.toInt();
-
- if (value >= NEW_TE_NODE_ID_END.toInt()) {
- value = NEW_TE_NODE_ID_START.toInt();
- }
- return Ip4Address.valueOf(value);
- }
-
- private static boolean nonEmpty(Collection<?> c) {
- return c != null && !c.isEmpty();
- }
-}