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/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/api/src/main/java/org/onosproject/tetopology/management/api/KeyId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/KeyId.java
new file mode 100644
index 0000000..1c7ff01
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/KeyId.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.net.URI;
+import java.util.Objects;
+
+/**
+ * Representation of an key identifier in URI.
+ */
+public class KeyId {
+ /**
+ * Represents either no uri, or an unspecified uri.
+ */
+ public static final KeyId NONE = keyId("none:none");
+
+ private final URI uri;
+ private final String str;
+
+ // Public construction is prohibited
+ private KeyId(URI uri) {
+ this.uri = uri;
+ //this.str = uri.toString().toLowerCase();
+ this.str = uri.toString();
+ }
+
+
+ /**
+ * Default constructor for serialization of KeyId.
+ */
+ protected KeyId() {
+ this.uri = null;
+ this.str = null;
+ }
+
+ /**
+ * Returns the backing URI.
+ *
+ * @return backing URI
+ */
+ public URI uri() {
+ return uri;
+ }
+
+ @Override
+ public int hashCode() {
+ return str.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof KeyId) {
+ KeyId that = (KeyId) obj;
+ return this.getClass() == that.getClass() &&
+ Objects.equals(this.str, that.str);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return str;
+ }
+
+ /**
+ * Creates a uri id using the supplied URI.
+ *
+ * @param uri URI
+ * @return UriId
+ */
+ public static KeyId keyId(URI uri) {
+ return new KeyId(uri);
+ }
+
+ /**
+ * Creates a uri id using the supplied URI string.
+ *
+ * @param string URI string
+ * @return UriId
+ */
+ public static KeyId keyId(String string) {
+ return keyId(URI.create(string));
+ }
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/LongValue.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/LongValue.java
new file mode 100644
index 0000000..66af170
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/LongValue.java
@@ -0,0 +1,70 @@
+/*
+ * 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 java.util.Objects;
+
+/**
+ * Implementation of using a long integer to represent
+ * an ElementType.
+ */
+public class LongValue {
+ private final long value;
+
+ /**
+ * Creates an instance of LongValue.
+ *
+ * @param value long value
+ */
+ public LongValue(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the long integer representing the ElementType.
+ *
+ * @return long integer
+ */
+ public long value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof LongValue) {
+ LongValue other = (LongValue) obj;
+ return Objects.equals(value, other.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .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/api/src/main/java/org/onosproject/tetopology/management/api/Networks.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Networks.java
new file mode 100644
index 0000000..b8696a9
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/Networks.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+/**
+ * Abstraction of an entity which represents the functionality of networks.
+ */
+public interface Networks {
+
+ /**
+ * Returns the list of networks.
+ *
+ * @return list of networks
+ */
+ List<Network> networks();
+
+}
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/api/src/main/java/org/onosproject/tetopology/management/api/ProviderClientId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/ProviderClientId.java
new file mode 100644
index 0000000..04edd14
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/ProviderClientId.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;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
+
+/**
+ * TE topology provider and client identifiers.
+ */
+public abstract class ProviderClientId {
+ private final long providerId;
+ private final long clientId;
+
+ /**
+ * Creates an instance of TE topology provider client identifier.
+ *
+ * @param providerId provider identifier
+ * @param clientId client identifier
+ */
+ public ProviderClientId(long providerId, long clientId) {
+ this.providerId = providerId;
+ this.clientId = clientId;
+ }
+
+ /**
+ * Returns the provider identifier.
+ *
+ * @return provider identifier
+ */
+ public long providerId() {
+ return providerId;
+ }
+
+ /**
+ * Returns the client identifier.
+ *
+ * @return client identifier
+ */
+ public long clientId() {
+ return clientId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(providerId, clientId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof ProviderClientId) {
+ ProviderClientId that = (ProviderClientId) object;
+ return Objects.equal(providerId, that.providerId) &&
+ Objects.equal(clientId, that.clientId);
+ }
+ return false;
+ }
+
+ /**
+ * Returns ToStringHelper with providerId and clientId.
+ *
+ * @return toStringHelper
+ */
+ protected ToStringHelper toStringHelper() {
+ return MoreObjects.toStringHelper(this)
+ .add("providerId", providerId)
+ .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/api/src/main/java/org/onosproject/tetopology/management/api/TeStatus.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeStatus.java
new file mode 100644
index 0000000..356a853
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeStatus.java
@@ -0,0 +1,100 @@
+/*
+ * 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;
+
+/**
+ * Represents ENUM data of teStatus.
+ */
+public enum TeStatus {
+
+ /**
+ * Represents up.
+ */
+ UP(0),
+
+ /**
+ * Represents down.
+ */
+ DOWN(1),
+
+ /**
+ * Represents testing.
+ */
+ TESTING(2),
+
+ /**
+ * Represents preparingMaintenance.
+ */
+ PREPARING_MAINTENANCE(3),
+
+ /**
+ * Represents maintenance.
+ */
+ MAINTENANCE(4),
+
+ /**
+ * Status cannot be determined for some reason.
+ */
+ UNKNOWN(5);
+
+ private int teStatus;
+
+ /**
+ * Creates an instance of teStatus.
+ *
+ * @param value value of teStatus
+ */
+ TeStatus(int value) {
+ teStatus = value;
+ }
+
+ /**
+ * Returns the attribute teStatus.
+ *
+ * @return value of teStatus
+ */
+ public int teStatus() {
+ return teStatus;
+ }
+
+ /**
+ * Returns the object of teAdminStatusEnumForTypeInt.Returns null
+ * when string conversion fails or converted integer value is not
+ * recognized.
+ *
+ * @param value value of teAdminStatusEnumForTypeInt
+ * @return Object of teAdminStatusEnumForTypeInt
+ */
+ public static TeStatus of(int value) {
+ switch (value) {
+ case 0:
+ return TeStatus.UP;
+ case 1:
+ return TeStatus.DOWN;
+ case 2:
+ return TeStatus.TESTING;
+ case 3:
+ return TeStatus.PREPARING_MAINTENANCE;
+ case 4:
+ return TeStatus.MAINTENANCE;
+ case 5:
+ return TeStatus.UNKNOWN;
+ default :
+ return null;
+ }
+ }
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologies.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologies.java
new file mode 100644
index 0000000..1a58fae
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologies.java
@@ -0,0 +1,39 @@
+/*
+ * 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.Map;
+
+/**
+ * Abstraction of an entity which represents a set of TE topologies.
+ */
+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/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java
new file mode 100644
index 0000000..4241af4
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyEventSubject.java
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+/**
+ * Abstraction of TE network topology event subject.
+ */
+public interface TeTopologyEventSubject {
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.java
new file mode 100644
index 0000000..d79246d
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyId.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.Objects;
+
+/**
+ * TE Topology identifier in String format.
+ */
+public class TeTopologyId extends ProviderClientId {
+ private final String topologyId;
+
+ /**
+ * Creates an instance of TE topology identifier.
+ *
+ * @param providerId value of provider identifier
+ * @param clientId value of client identifier
+ * @param topologyId value of topology identifier
+ */
+ public TeTopologyId(long providerId, long clientId, String topologyId) {
+ super(providerId, clientId);
+ this.topologyId = topologyId;
+ }
+
+ /**
+ * Returns the topology identifier.
+ *
+ * @return topology identifier
+ */
+ public String 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 TeTopologyId) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ TeTopologyId that = (TeTopologyId) object;
+ return Objects.equal(this.topologyId, that.topologyId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ 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/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java
new file mode 100644
index 0000000..001c79f
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyListener.java
@@ -0,0 +1,25 @@
+/*
+ * 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.EventListener;
+
+/**
+ * Entity capable of receiving TE network Topology related events.
+ */
+public interface TeTopologyListener extends EventListener<TeTopologyEvent> {
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java
new file mode 100644
index 0000000..f52c4a3
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProvider.java
@@ -0,0 +1,67 @@
+/*
+ * 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.net.provider.Provider;
+
+/**
+ * Abstraction of an IETF network provider.
+ * APIs for Manager to signal Provider.
+ */
+public interface TeTopologyProvider extends Provider {
+
+ /**
+ * TODO:
+ *
+ * Signals provider that abstract networks/network/link/node has been created/updated/deleted.
+ * It's used by producers.
+ *
+ */
+
+ // TODO: Need to look at the following functions are required for TE Nodes
+
+ // TODO: consider how dirty the triggerProbe gets; if it costs too much, let's drop it
+
+ /**
+ * Triggers an asynchronous probe of the specified device, intended to
+ * determine whether the device is present or not. An indirect result of this
+ * should be invocation of
+ * {@link org.onosproject.net.device.DeviceProviderService#deviceConnected} )} or
+ * {@link org.onosproject.net.device.DeviceProviderService#deviceDisconnected}
+ * at some later point in time.
+ *
+ * @param deviceId ID of device to be probed
+ */
+ //void triggerProbe(DeviceId deviceId);
+
+ /**
+ * Notifies the provider of a mastership role change for the specified
+ * device as decided by the core.
+ *
+ * @param deviceId device identifier
+ * @param newRole newly determined mastership role
+ */
+ //void roleChanged(DeviceId deviceId, MastershipRole newRole);
+
+ /**
+ * Checks the reachability (connectivity) of a device from this provider.
+ *
+ * @param deviceId device identifier
+ * @return true if reachable, false otherwise
+ */
+ //boolean isReachable(DeviceId deviceId);
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
new file mode 100644
index 0000000..b44adaf
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderRegistry.java
@@ -0,0 +1,26 @@
+/*
+ * 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.net.provider.ProviderRegistry;
+
+/**
+ * Abstraction of TE topology provider registry.
+ */
+public interface TeTopologyProviderRegistry
+ extends ProviderRegistry<TeTopologyProvider, TeTopologyProviderService> {
+
+}
diff --git a/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.java
new file mode 100644
index 0000000..1374999
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/TeTopologyProviderService.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;
+
+import org.onosproject.net.provider.ProviderService;
+import org.onosproject.tetopology.management.api.link.NetworkLink;
+import org.onosproject.tetopology.management.api.link.NetworkLinkKey;
+import org.onosproject.tetopology.management.api.node.NetworkNode;
+import org.onosproject.tetopology.management.api.node.NetworkNodeKey;
+import org.onosproject.tetopology.management.api.node.TerminationPoint;
+import org.onosproject.tetopology.management.api.node.TerminationPointKey;
+
+/**
+ * APIs for Provider to notify Manager about the network topology updates.
+ */
+public interface TeTopologyProviderService
+ extends ProviderService<TeTopologyProvider> {
+
+ /**
+ * Signals that a Network has been created/updated.
+ *
+ * @param network value of the network to be updated
+ */
+ void networkUpdated(Network network);
+
+ /**
+ * Signals that a Network has been removed.
+ *
+ * @param networkId network id in URI format
+ */
+ void networkRemoved(KeyId networkId);
+
+ /**
+ * Signals that a Link has been created/updated.
+ *
+ * @param linkKey link id
+ * @param link link object to be updated
+ */
+ void linkUpdated(NetworkLinkKey linkKey, NetworkLink link);
+
+ /**
+ * Signals that a Network has been removed.
+ *
+ * @param linkKey link id
+ */
+ void linkRemoved(NetworkLinkKey linkKey);
+
+ /**
+ * Signals that a Node has been created/updated.
+ *
+ * @param nodeKey node id
+ * @param node node object to be updated
+ */
+ void nodeUpdated(NetworkNodeKey nodeKey, NetworkNode node);
+
+ /**
+ * Signals that a Node has been removed.
+ *
+ * @param nodeKey node id
+ */
+ void nodeRemoved(NetworkNodeKey nodeKey);
+
+ /**
+ * Signals that a TerminationPoint has been created/updated.
+ *
+ * @param terminationPointKey termination point id
+ * @param terminationPoint termination point object to be updated
+ */
+ void terminationPointUpdated(TerminationPointKey terminationPointKey,
+ TerminationPoint terminationPoint);
+
+ /**
+ * Signals that a TerminationPoint has been removed.
+ *
+ * @param terminationPointKey termination point id
+ */
+ void terminationPointRemoved(TerminationPointKey terminationPointKey);
+
+}
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/api/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
new file mode 100644
index 0000000..fbe6955
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/AsNumber.java
@@ -0,0 +1,70 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+
+/**
+ * Implementation of Autonomous System (AS) number as an ElementType.
+ */
+public class AsNumber implements ElementType {
+ private final int asNumber;
+
+ /**
+ * Creates an instance of AsNumber.
+ *
+ * @param asNumber autonomous system number
+ */
+ public AsNumber(int asNumber) {
+ this.asNumber = asNumber;
+ }
+
+ /**
+ * Returns the autonomous system number.
+ *
+ * @return the AS number
+ */
+ public int asNumber() {
+ return asNumber;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(asNumber);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof AsNumber) {
+ AsNumber other = (AsNumber) obj;
+ return Objects.equals(asNumber, other.asNumber);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("asNumber", asNumber)
+ .toString();
+ }
+
+}
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/api/src/main/java/org/onosproject/tetopology/management/api/link/ConnectivityMatrixId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ConnectivityMatrixId.java
new file mode 100644
index 0000000..e275b9c
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ConnectivityMatrixId.java
@@ -0,0 +1,33 @@
+/*
+ * 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.LongValue;
+
+/**
+ * Implementation of Connectivity matrix entry id as an element type.
+ */
+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/api/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
new file mode 100644
index 0000000..dfe6110
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/ElementType.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+/**
+ * Abstraction of a path element type.
+ */
+public interface ElementType {
+}
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/api/src/main/java/org/onosproject/tetopology/management/api/link/Label.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
new file mode 100644
index 0000000..1411f0a
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/Label.java
@@ -0,0 +1,33 @@
+/*
+ * 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.LongValue;
+
+/**
+ * Implementation of a label as an element type.
+ */
+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/api/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
new file mode 100644
index 0000000..37a5e5a
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLink.java
@@ -0,0 +1,62 @@
+/*
+ * 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 org.onosproject.tetopology.management.api.node.NodeTpKey;
+
+import java.util.List;
+
+/**
+ * Abstraction of a base network link.
+ */
+public interface NetworkLink {
+
+ /**
+ * Returns the link identifier.
+ *
+ * @return link identifier
+ */
+ KeyId linkId();
+
+ /**
+ * Returns the link source termination point.
+ *
+ * @return source link termination point identifier
+ */
+ NodeTpKey source();
+
+ /**
+ * Returns the link destination termination point.
+ *
+ * @return destination link termination point id
+ */
+ NodeTpKey destination();
+
+ /**
+ * Returns the supporting link identifiers.
+ *
+ * @return list of the ids of the supporting links
+ */
+ List<NetworkLinkKey> supportingLinkIds();
+
+ /**
+ * Returns the link TE extension.
+ *
+ * @return TE link attributes
+ */
+ 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/api/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
new file mode 100644
index 0000000..aa5d5e1
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/NetworkLinkKey.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.link;
+
+import org.onosproject.tetopology.management.api.KeyId;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+
+/**
+ * Representation of a link key or link reference.
+ */
+public class NetworkLinkKey {
+ private final KeyId networkId;
+ private final KeyId linkId;
+
+ /**
+ * Creates an instance of NetworkLinkKey.
+ *
+ * @param networkId network identifier
+ * @param linkId link identifier
+ */
+ public NetworkLinkKey(KeyId networkId, KeyId linkId) {
+ this.networkId = networkId;
+ this.linkId = linkId;
+ }
+
+ /**
+ * Returns the network identifier.
+ *
+ * @return network identifier
+ */
+ public KeyId networkId() {
+ return networkId;
+ }
+
+ /**
+ * Returns the link identifier.
+ *
+ * @return link identifier
+ */
+ public KeyId linkId() {
+ return linkId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkId, linkId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof NetworkLinkKey) {
+ NetworkLinkKey that = (NetworkLinkKey) object;
+ return Objects.equal(this.networkId, that.networkId) &&
+ Objects.equal(this.linkId, that.linkId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("networkId", networkId)
+ .add("linkId", linkId)
+ .toString();
+ }
+
+}
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/api/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
new file mode 100644
index 0000000..e5158f7
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/PathElement.java
@@ -0,0 +1,113 @@
+/*
+ * 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 path element.
+ */
+public class PathElement {
+ private final long pathElementId;
+ private final long teNodeId;
+ private final ElementType type;
+ private final boolean loose;
+
+ /**
+ * Creates a path element.
+ *
+ * @param pathElementId path element identifier
+ * @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, long teNodeId,
+ ElementType type, boolean loose) {
+ this.pathElementId = pathElementId;
+ this.teNodeId = teNodeId;
+ this.type = type;
+ this.loose = loose;
+ }
+
+ /**
+ * Returns the path element identifier.
+ *
+ * @return path element id
+ */
+ public long pathElementId() {
+ return pathElementId;
+ }
+
+ /**
+ * Returns the TE node identifier.
+ *
+ * @return te node id
+ */
+ public long teNodeId() {
+ return teNodeId;
+ }
+
+ /**
+ * Returns the path element type.
+ *
+ * @return path element type
+ */
+ public ElementType type() {
+ 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, teNodeId, type, loose);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof PathElement) {
+ PathElement that = (PathElement) object;
+ return Objects.equal(pathElementId, that.pathElementId) &&
+ Objects.equal(teNodeId, that.teNodeId) &&
+ Objects.equal(type, that.type) &&
+ Objects.equal(loose, that.loose);
+ }
+ return false;
+ }
+
+ @Override
+ 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/api/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
new file mode 100644
index 0000000..6fd34f5
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkAccessType.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.link;
+
+/**
+ * Represents ENUM data of teLinkAccessType.
+ */
+public enum TeLinkAccessType {
+ /**
+ * Represents pointToPoint.
+ */
+ POINT_TO_POINT(0),
+
+ /**
+ * Represents multiAccess.
+ */
+ MULTI_ACCESS(1);
+
+ private int teLinkAccessType;
+
+ TeLinkAccessType(int value) {
+ teLinkAccessType = value;
+ }
+
+ /**
+ * Returns the attribute teLinkAccessType.
+ *
+ * @return value of teLinkAccessType
+ */
+ public int teLinkAccessType() {
+ return teLinkAccessType;
+ }
+
+ /**
+ * Returns the object of teLinkAccessType from input String. Returns null
+ * when string conversion fails or converted integer value is not recognized.
+ *
+ * @param valInString input String
+ * @return Object of teLinkAccessType
+ */
+ public static TeLinkAccessType of(String valInString) {
+ try {
+ int tmpVal = Integer.parseInt(valInString);
+ return of(tmpVal);
+ } catch (NumberFormatException e) {
+ }
+ return null;
+ }
+
+ /**
+ * Returns the object of teLinkAccessTypeForTypeInt. Returns null
+ * when the integer value is not recognized.
+ *
+ * @param value value of teLinkAccessTypeForTypeInt
+ * @return Object of teLinkAccessTypeForTypeInt
+ */
+ public static TeLinkAccessType of(int value) {
+ switch (value) {
+ case 0:
+ return TeLinkAccessType.POINT_TO_POINT;
+ case 1:
+ return TeLinkAccessType.MULTI_ACCESS;
+ default :
+ return null;
+ }
+ }
+
+}
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/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkId.java b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkId.java
new file mode 100644
index 0000000..3aaab28
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/TeLinkId.java
@@ -0,0 +1,33 @@
+/*
+ * 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.LongValue;
+
+/**
+ * Implementation of a TE link identifier as an element type.
+ */
+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/api/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
new file mode 100644
index 0000000..676175e
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnderlayBackupPath.java
@@ -0,0 +1,80 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+
+/**
+ * Represents a list of backup service paths on the underlay topology that
+ * protect the underlay primary path.
+ */
+public class UnderlayBackupPath extends UnderlayAbstractPath {
+ private final long index;
+
+ /**
+ * Creates a underlay backup path.
+ *
+ * @param index the path index
+ * @param pathElements list of backup service paths
+ * @param loose loose if true; restrict otherwise
+ */
+ public UnderlayBackupPath(long index, List<PathElement> pathElements,
+ Boolean loose) {
+ super(pathElements, loose);
+ this.index = index;
+ }
+
+ /**
+ * Returns the path index.
+ *
+ * @return path index
+ */
+ public long index() {
+ return index;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), index);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof UnderlayBackupPath) {
+ if (!super.equals(obj)) {
+ return false;
+ }
+ UnderlayBackupPath that = (UnderlayBackupPath) obj;
+ return this.index == that.index;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .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/api/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
new file mode 100644
index 0000000..a8f7ebf
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/UnnumberedLink.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.link;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.packet.IpAddress;
+
+import java.util.Objects;
+
+/**
+ * Implementation of unnumbered link as an element type.
+ */
+public class UnnumberedLink implements ElementType {
+ private final IpAddress routerId;
+ private final long interfaceId;
+
+ /**
+ * Creates a unnumbered link.
+ *
+ * @param routerId the router id to set
+ * @param interfaceId the interface id to set
+ */
+ public UnnumberedLink(IpAddress routerId, long interfaceId) {
+ this.routerId = routerId;
+ this.interfaceId = interfaceId;
+ }
+
+ /**
+ * Returns the router identifier.
+ *
+ * @return router id
+ */
+ public IpAddress routerId() {
+ return routerId;
+ }
+
+ /**
+ * Returns the interface identifier.
+ *
+ * @return interface id
+ */
+ public long interfaceId() {
+ return interfaceId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(routerId, interfaceId);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof UnnumberedLink) {
+ UnnumberedLink other = (UnnumberedLink) obj;
+ return
+ Objects.equals(routerId, other.routerId) &&
+ Objects.equals(interfaceId, other.interfaceId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("routerId", routerId)
+ .add("interfaceId", interfaceId)
+ .toString();
+ }
+}
diff --git a/apps/tetopology/api/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
new file mode 100644
index 0000000..3b4c1cb
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/link/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/**
+ * TE link API.
+ */
+package org.onosproject.tetopology.management.api.link;
\ No newline at end of file
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/api/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
new file mode 100644
index 0000000..1f3c76b
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNode.java
@@ -0,0 +1,64 @@
+/*
+ * 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 java.util.Map;
+
+import org.onosproject.tetopology.management.api.KeyId;
+
+/**
+ * Abstraction of a network node.
+ */
+public interface NetworkNode {
+
+ /**
+ * Returns the node identifier.
+ *
+ * @return node identifier
+ */
+ KeyId nodeId();
+
+ /**
+ * Returns the supporting node identifiers.
+ *
+ * @return list of the ids of the supporting nodes
+ */
+ List<NetworkNodeKey> supportingNodeIds();
+
+ /**
+ * Returns the node TE extension attributes.
+ *
+ * @return node TE extension attributes
+ */
+ TeNode teNode();
+
+ /**
+ * Returns a collection of currently known termination points.
+ *
+ * @return a collection of termination points associated with this node
+ */
+ Map<KeyId, TerminationPoint> terminationPoints();
+
+ /**
+ * Returns the termination point.
+ *
+ * @param tpId termination point id
+ * @return value of termination point
+ */
+ 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/api/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
new file mode 100644
index 0000000..cdb6913
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/NetworkNodeKey.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 key or node reference.
+ */
+public class NetworkNodeKey {
+ private final KeyId networkId;
+ private final KeyId nodeId;
+
+ /**
+ * Creates an instance of NetworkNodeKey.
+ *
+ * @param networkId network identifier
+ * @param nodeId node identifier
+ */
+ public NetworkNodeKey(KeyId networkId, KeyId nodeId) {
+ this.networkId = networkId;
+ this.nodeId = nodeId;
+ }
+
+ /**
+ * Returns the network identifier.
+ *
+ * @return network identifier
+ */
+ public KeyId networkId() {
+ return networkId;
+ }
+
+ /**
+ * Returns the node identifier.
+ *
+ * @return node identifier
+ */
+ public KeyId nodeId() {
+ return nodeId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkId, nodeId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof NetworkNodeKey) {
+ NetworkNodeKey that = (NetworkNodeKey) object;
+ return Objects.equal(this.networkId, that.networkId) &&
+ Objects.equal(this.nodeId, that.nodeId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("networkId", networkId)
+ .add("nodeId", nodeId)
+ .toString();
+ }
+
+}
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/api/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
new file mode 100644
index 0000000..c4e0c8c
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPoint.java
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+/**
+ * Abstraction of a termination point.
+ */
+public interface TerminationPoint {
+
+ /**
+ * Returns the termination point identifier.
+ *
+ * @return termination point id
+ */
+ KeyId tpId();
+
+ /**
+ * Returns list of supporting termination point identifiers.
+ *
+ * @return the supporting termination point ids
+ */
+ List<TerminationPointKey> supportingTpIds();
+
+ /**
+ * Returns TE termination point identifier.
+ *
+ * @return the TE TP id
+ */
+ Long teTpId();
+}
diff --git a/apps/tetopology/api/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
new file mode 100644
index 0000000..15ee536
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/TerminationPointKey.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.node;
+
+import com.google.common.base.Objects;
+import org.onosproject.tetopology.management.api.KeyId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Representation of a termination point key or reference.
+ */
+public class TerminationPointKey extends NetworkNodeKey {
+ private final KeyId tpId;
+
+ /**
+ * Creates a termination point key.
+ *
+ * @param networkId network identifier
+ * @param nodeId node identifier
+ * @param tpId termination point identifier
+ */
+ public TerminationPointKey(KeyId networkId, KeyId nodeId, KeyId tpId) {
+ super(networkId, nodeId);
+ this.tpId = tpId;
+ }
+
+ /**
+ * 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
+ */
+ public KeyId tpId() {
+ return tpId;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), tpId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (object instanceof TerminationPointKey) {
+ if (!super.equals(object)) {
+ return false;
+ }
+ TerminationPointKey that = (TerminationPointKey) object;
+ return Objects.equal(tpId, that.tpId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("networkId", networkId())
+ .add("nodeId", nodeId())
+ .add("tpId", tpId)
+ .toString();
+ }
+
+}
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/api/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
new file mode 100644
index 0000000..ec1a8de
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/node/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/**
+ * TE node API.
+ */
+package org.onosproject.tetopology.management.api.node;
\ No newline at end of file
diff --git a/apps/tetopology/api/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
new file mode 100644
index 0000000..39a178d
--- /dev/null
+++ b/apps/tetopology/api/src/main/java/org/onosproject/tetopology/management/api/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * TE topology management API.
+ */
+package org.onosproject.tetopology.management.api;
\ No newline at end of file