X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcompatibility%2Finventory-topology-compatibility%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fcompatibility%2Ftopologymanager%2FCompatibleTopologyManager.java;h=11320a12cd3b0708561e5bb107a5519024a08d55;hb=eff56082a308f3be21cd4eefd03e0799a6b04714;hp=184c06eb70f37613a67a0b96953aed81e8c096f4;hpb=06716ed7b28c246a8acd99397993025976053b1d;p=controller.git diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java index 184c06eb70..11320a12cd 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topologymanager/CompatibleTopologyManager.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.Set; import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader; +import org.opendaylight.controller.sal.core.ConstructionException; import org.opendaylight.controller.sal.core.Edge; import org.opendaylight.controller.sal.core.Host; import org.opendaylight.controller.sal.core.NodeConnector; @@ -63,22 +64,25 @@ public class CompatibleTopologyManager extends ConfigurableLinkManager implement final Topology topology = getDataReader().readOperationalData(topologyMapping.getTopologyPath()); final HashMap> ret = new HashMap<>(); for (final Node node : topology.getNode()) { - final org.opendaylight.controller.sal.core.Node adNode = topologyMapping.toAdNode(node); - ret.put(adNode, topologyMapping.toEdges( - FluentIterable.from(topology.getLink()).filter(new Predicate() { - @Override - public boolean apply(final Link input) { - final NodeId nodeId = node.getNodeId(); - if (nodeId.equals(input.getSource().getSourceNode())) { - return true; + try { + ret.put(topologyMapping.toAdNode(node), topologyMapping.toEdges( + FluentIterable.from(topology.getLink()).filter(new Predicate() { + @Override + public boolean apply(final Link input) { + final NodeId nodeId = node.getNodeId(); + if (nodeId.equals(input.getSource().getSourceNode())) { + return true; + } + if (nodeId.equals(input.getDestination().getDestNode())) { + return true; + } + + return false; } - if (nodeId.equals(input.getDestination().getDestNode())) { - return true; - } - - return false; - } - }))); + }))); + } catch (ConstructionException e) { + throw new IllegalStateException(String.format("Failed to construct node for {}", node), e); + } } return ret; } @@ -86,7 +90,7 @@ public class CompatibleTopologyManager extends ConfigurableLinkManager implement /** * Returns true if point is connected to link */ - public boolean isInternal(final TerminationPoint point) { + private boolean isInternal(final TerminationPoint point) { final Topology topology = getDataReader().readConfigurationData(topologyMapping.getTopologyPath()); final TpId tpId = point.getKey().getTpId(); return FluentIterable.from(topology.getLink()).anyMatch(new Predicate() {