@Override public SupportingNode build() { return new SupportingNodeImpl(this); }
SupportingNodeImpl(SupportingNodeBuilder base) { if (base.key() != null) { this.key = base.key(); } else { this.key = new SupportingNodeKey(base.getNodeRef(), base.getTopologyRef()); } this._nodeRef = key.getNodeRef(); this._topologyRef = key.getTopologyRef(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }
private List<SupportingNode> createDefaultSuplNode(FabricId fabricid) { SupportingNodeBuilder builder = new SupportingNodeBuilder(); builder.setNodeRef(fabricid); builder.setKey(new SupportingNodeKey(fabricid, new TopologyId(Constants.FABRICS_TOPOLOGY_ID))); return Lists.newArrayList(builder.build()); }
public SupportingNodeBuilder(SupportingNode base) { if (base.getKey() == null) { this._key = new SupportingNodeKey( base.getNodeRef(), base.getTopologyRef() ); this._nodeRef = base.getNodeRef(); this._topologyRef = base.getTopologyRef(); } else { this._key = base.getKey(); this._nodeRef = _key.getNodeRef(); this._topologyRef = _key.getTopologyRef(); } if (base instanceof SupportingNodeImpl) { SupportingNodeImpl impl = (SupportingNodeImpl) 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.node.attributes.SupportingNode> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private SupportingNodeImpl(SupportingNodeBuilder base) { if (base.getKey() == null) { this._key = new SupportingNodeKey( base.getNodeRef(), base.getTopologyRef() ); this._nodeRef = base.getNodeRef(); this._topologyRef = base.getTopologyRef(); } else { this._key = base.getKey(); this._nodeRef = _key.getNodeRef(); this._topologyRef = _key.getTopologyRef(); } switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
private static NodeBuilder createBasicVppNodeBuilder(NodeId nodeId) { return new NodeBuilder().setNodeId(nodeId).setSupportingNode(Arrays.asList( new SupportingNodeBuilder().setTopologyRef(SUPPORTING_TOPOLOGY_NETCONF).setNodeRef(nodeId).build())); }
if (other.getKey() != null) { return false; } else if(!_key.equals(other.getKey())) { return false; if (other.getNodeRef() != null) { return false; } else if(!_nodeRef.equals(other.getNodeRef())) { return false; if (other.getTopologyRef() != null) { return false; } else if(!_topologyRef.equals(other.getTopologyRef())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { 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; }
public SupportingNodeBuilder(SupportingNode base) { this.key = base.key(); this._nodeRef = base.getNodeRef(); this._topologyRef = base.getTopologyRef(); if (base instanceof SupportingNodeImpl) { SupportingNodeImpl impl = (SupportingNodeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<SupportingNode>>, Augmentation<SupportingNode>> aug =((AugmentationHolder<SupportingNode>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
if (!Objects.equals(_nodeRef, other.getNodeRef())) { return false; if (!Objects.equals(_topologyRef, other.getTopologyRef())) { return false; if (!e.getValue().equals(other.augmentation(e.getKey()))) { return false;
@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); } } }
private InstanceIdentifier<SupportingNode> createSuplNodeIId(DeviceKey key) { return InstanceIdentifier.create(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(this.fabricid.getValue()))) .child(Node.class, new NodeKey(this.nodeid)) .child(SupportingNode.class, new SupportingNodeKey(key.getNodeId(), key.getTopoId())); } }
public SupportingNodeBuilder addAugmentation(Class<? extends Augmentation<SupportingNode>> augmentationType, Augmentation<SupportingNode> augmentationValue) { if (augmentationValue == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentationValue); return this; }
@Override public int hashCode() { if (hashValid) { return hash; } final int prime = 31; int result = 1; result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_nodeRef == null) ? 0 : _nodeRef.hashCode()); result = prime * result + ((_topologyRef == null) ? 0 : _topologyRef.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); hash = result; hashValid = true; return result; }
private SupportingNode createSupportingNode(final NodeId sni, final Boolean inControl) { final SupportingNodeKey sk = new SupportingNodeKey(sni, this.source); final SupportingNodeBuilder snb = new SupportingNodeBuilder(); snb.setNodeRef(sni); snb.setKey(sk); snb.addAugmentation(SupportingNode1.class, new SupportingNode1Builder().setPathComputationClient( new PathComputationClientBuilder().setControlling(inControl).build()).build()); return snb.build(); }
public SupportingNode build() { return new SupportingNodeImpl(this); }
public SupportingNodeBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
private void buildNodeAttribute(NodeBuilder builder, ComposeFabricInput input, FabricId fabricId) { builder.setKey(new NodeKey(fabricId)); List<DeviceNodes> devices = input.getDeviceNodes(); if (devices != null) { List<SupportingNode> snodes = Lists.newArrayList(); for (DeviceNodes device : devices) { InstanceIdentifier<?> nodeRef = device.getDeviceRef().getValue(); NodeId nodeid = nodeRef.firstKeyOf(Node.class).getNodeId(); TopologyId topoId = nodeRef.firstKeyOf(Topology.class).getTopologyId(); SupportingNodeBuilder snodeBuilder = new SupportingNodeBuilder(); snodeBuilder.setNodeRef(nodeid); snodeBuilder.setTopologyRef(topoId); snodeBuilder.setKey(new SupportingNodeKey(nodeid, topoId)); snodes.add(snodeBuilder.build()); } builder.setSupportingNode(snodes); } }
TopologyId topoid = noderef.firstKeyOf(Topology.class).getTopologyId(); final InstanceIdentifier<SupportingNode> suplNodeIid = MdSalUtils.createFNodeIId(input.getFabricId()) .child(SupportingNode.class, new SupportingNodeKey(deviceid, topoid)); SupportingNodeBuilder suplNodeBuilder = new SupportingNodeBuilder(); suplNodeBuilder.setNodeRef(deviceid); suplNodeBuilder.setTopologyRef(topoid); suplNodeBuilder.setKey(new SupportingNodeKey(deviceid, topoid)); trans.put(LogicalDatastoreType.OPERATIONAL, suplNodeIid, suplNodeBuilder.build(), true);