X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcompatibility%2Fsal-compatibility%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcompatibility%2Ftopology%2FTopologyMapping.xtend;h=9a19e104173d11a41d449e450e5d7bb3f43e092f;hp=62983ccce477abec0a6c9a3a069b763c0911fdc9;hb=8ccb61090ae30c7ea750b606034016c248d90f80;hpb=b42589d43a0d8767585f44f67229ddfd3a829ede diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend index 62983ccce4..9a19e10417 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/topology/TopologyMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.compatibility.topology import com.google.common.collect.FluentIterable @@ -10,19 +17,20 @@ import org.opendaylight.controller.sal.core.Node import org.opendaylight.controller.sal.core.NodeConnector import org.opendaylight.controller.sal.core.UpdateType import org.opendaylight.controller.sal.topology.TopoEdgeUpdate -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NodeId -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TpId -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.Topology -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Link +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link import static com.google.common.base.Preconditions.* import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.* import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader import org.opendaylight.yangtools.yang.binding.InstanceIdentifier import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector +import org.slf4j.LoggerFactory class TopologyMapping { - + private static val LOG = LoggerFactory.getLogger(TopologyMapping); private new() { throw new UnsupportedOperationException("Utility class. Instantiation is not allowed."); } @@ -47,7 +55,20 @@ class TopologyMapping { } public static def toAdEdgeProperties(Edge e,TypeSafeDataReader reader) { - val nc = reader.readOperationalData(e.tailNodeConnector.toNodeConnectorRef.value as InstanceIdentifier) + val ncref = e.tailNodeConnector.toNodeConnectorRef + if(ncref == null) { + LOG.debug("Edge {} ncref {}",e,ncref) + return null; + } + val ncInstanceId = (ncref.value as InstanceIdentifier) + if(ncInstanceId == null) { + LOG.debug("Edge {} ncref {}",e,ncref) + return null; + } + val nc = reader.readOperationalData(ncInstanceId) + if(nc == null) { + return null; + } return nc.toADNodeConnectorProperties } @@ -68,4 +89,4 @@ class TopologyMapping { checkNotNull(nodeId); return new Node(MD_SAL_TYPE,nodeId.toADNodeId); } -} \ No newline at end of file +}