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/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