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.");
}
}
public static def toAdEdgeProperties(Edge e,TypeSafeDataReader reader) {
- val nc = reader.readOperationalData(e.tailNodeConnector.toNodeConnectorRef.value as InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector>)
+ val ncref = e.tailNodeConnector.toNodeConnectorRef
+ if(ncref == null) {
+ LOG.debug("Edge {} ncref {}",e,ncref)
+ return null;
+ }
+ val ncInstanceId = (ncref.value as InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector>)
+ if(ncInstanceId == null) {
+ LOG.debug("Edge {} ncref {}",e,ncref)
+ return null;
+ }
+ val nc = reader.readOperationalData(ncInstanceId)
+ if(nc == null) {
+ return null;
+ }
return nc.toADNodeConnectorProperties
}