public NodeBuilder(Node base) { this.key = base.key(); this._nodeId = base.getNodeId(); this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<Node>>, Augmentation<Node>> aug =((AugmentationHolder<Node>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
return false; if (!Objects.equals(_supportingNode, other.getSupportingNode())) { return false;
public NodeBuilder(Node base) { if (base.getKey() == null) { this._key = new NodeKey( base.getNodeId() ); this._nodeId = base.getNodeId(); } else { this._key = base.getKey(); this._nodeId = _key.getNodeId(); } this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); if (base instanceof NodeImpl) { NodeImpl impl = (NodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
if (other.getSupportingNode() != null) { return false; } else if(!_supportingNode.equals(other.getSupportingNode())) { return false;
public static NodeId supportingNode(final Node node) { for (final SupportingNode n : node.getSupportingNode()) { final SupportingNode1 n1 = n.getAugmentation(SupportingNode1.class); if (n1 != null && n1.getPathComputationClient().isControlling()) { return n.getKey().getNodeRef(); } } return null; }
@Override protected ListenableFuture<OperationResult> invokeOperation() { final InstanceIdentifier<Topology> tii = TopologyProgrammingUtil.topologyForInput(this.pcepDestroyTunnelInput); final InstanceIdentifier<Link> lii = TunnelProgrammingUtil.linkIdentifier(tii, this.pcepDestroyTunnelInput); try (final ReadOnlyTransaction t = this.dataProvider.newReadOnlyTransaction()) { final Node node; final Link link; try { // The link has to exist link = t.read(LogicalDatastoreType.OPERATIONAL, lii).checkedGet().get(); // The source node has to exist node = TunelProgrammingUtil.sourceNode(t, tii, link).get(); } catch (IllegalStateException | ReadFailedException e) { LOG.debug("Link or node does not exist.", e); return TunelProgrammingUtil.RESULT; } final RemoveLspInputBuilder ab = new RemoveLspInputBuilder(); ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName()); ab.setNode(node.getSupportingNode().get(0).getKey().getNodeRef()); return Futures.transform( (ListenableFuture<RpcResult<RemoveLspOutput>>) this.topologyService.removeLsp(ab.build()), new Function<RpcResult<RemoveLspOutput>, OperationResult>() { @Override public OperationResult apply(final RpcResult<RemoveLspOutput> input) { return input.getResult(); } }); } } }
private void handleSni(final InstanceIdentifier<Node> sni, final Node n, final Boolean inControl, final ReadWriteTransaction trans) { if (sni != null) { final NodeKey k = InstanceIdentifier.keyOf(sni); boolean have = false; /* * We may have found a termination point which has been created as a destination, * so it does not have a supporting node pointer. Since we now know what it is, * fill it in. */ if (n.getSupportingNode() != null) { for (final SupportingNode sn : n.getSupportingNode()) { if (sn.getNodeRef().equals(k.getNodeId())) { have = true; break; } } } if (!have) { final SupportingNode sn = createSupportingNode(k.getNodeId(), inControl); trans.put(LogicalDatastoreType.OPERATIONAL, this.target.child(Node.class, n.getKey()).child( SupportingNode.class, sn.getKey()), sn); } } }