public static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node toTopologyNode( final NodeId nodeId, final NodeRef invNodeRef) { return new NodeBuilder() .setNodeId(nodeId) .addAugmentation(InventoryNode.class, new InventoryNodeBuilder() .setInventoryNodeRef(invNodeRef) .build()) .build(); }
public static Node createBasicNode(String nodeIdStr) { NodeId nodeId = new NodeId(nodeIdStr); NodeKey nodeKey = new NodeKey(nodeId); NodeBuilder nodeBuilder = new NodeBuilder(); nodeBuilder.setKey(nodeKey); nodeBuilder.setNodeId(nodeId); List<SupportingNode> childNodeList = new ArrayList<>(); nodeBuilder.setSupportingNode(childNodeList); List<TerminationPoint> ports = new ArrayList<>(); TerminationPoint tpWest = createTp(VC_NODE_TP_WEST); ports.add(tpWest); TerminationPoint tpEast = createTp(VC_NODE_TP_EAST); ports.add(tpEast); nodeBuilder.setTerminationPoint(ports); return nodeBuilder.build(); }
NodeImpl(NodeBuilder base) { if (base.key() != null) { this.key = base.key(); } else { this.key = new NodeKey(base.getNodeId()); } this._nodeId = key.getNodeId(); this._supportingNode = base.getSupportingNode(); this._terminationPoint = base.getTerminationPoint(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }
private NodeHolder(final NodeId id) { this.inab = new IgpNodeAttributesBuilder(); this.nb = new NodeBuilder().setKey(new NodeKey(id)).setNodeId(id); }
@Nonnull @Override public ListenableFuture<Node> onNodeUpdated(@Nonnull final NodeId nodeId, @Nonnull final Node configNode) { // update magic return Futures.immediateFuture(new NodeBuilder().addAugmentation(NetconfNode.class, new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.Connected).build()).build()); }
public synchronized Node getNode() { List<AttachmentPoints> attachmentPoints = new ArrayList<>(); for (AttachmentPointsBuilder apb : apbs) { attachmentPoints.add(apb.build()); } hostNodeBuilder.setAttachmentPoints(attachmentPoints); return nodeBuilder.addAugmentation(HostNode.class, hostNodeBuilder.build()).build(); }
/** * Synchronized in-core state of a node into the backing store using the transaction * * @param trans data modification transaction which to use * @return True if the node has been purged, false otherwise. */ private boolean syncState(final WriteTransaction trans) { final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.getKey()); /* * Transaction's putOperationalData() does a merge. Force it onto a replace * by removing the data. If we decide to remove the node -- we just skip the put. */ trans.delete(LogicalDatastoreType.OPERATIONAL, nid); if (!this.advertized) { if (this.tps.isEmpty() && this.prefixes.isEmpty()) { LOG.debug("Removing unadvertized unused node {}", this.nb.getNodeId()); return true; } LOG.debug("Node {} is still implied by {} TPs and {} prefixes", this.nb.getNodeId(), this.tps.size(), this.prefixes.size()); } // Re-generate termination points this.nb.setTerminationPoint(Lists.newArrayList(Collections2.transform(this.tps.values(), input -> input.getTp()))); // Re-generate prefixes this.inab.setPrefix(Lists.newArrayList(this.prefixes.values())); // Write the node out final Node n = this.nb.addAugmentation(Node1.class, new Node1Builder().setIgpNodeAttributes(this.inab.build()).build()).build(); trans.put(LogicalDatastoreType.OPERATIONAL, nid, n); LOG.debug("Created node {} at {}", n, nid); return false; }
/** * @param nodeName NodeId used for initialization * @param logicalDatastoreType Logical datastore type where topology will be initialized * @param datastoreAccess Datastore access used for initialization * @return If Topology was successfully initialized */ public static boolean initTopologyNode(final String nodeName, final LogicalDatastoreType logicalDatastoreType, final DatastoreAccess datastoreAccess) { InstanceIdentifier<Node> nodeIdentifier = NodeIdentityListener.SUBSCRIBED_PATH.child(Node.class, new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeName))); return datastoreAccess.checkAndPut(nodeIdentifier, new NodeBuilder().setKey(new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeName))).build(), logicalDatastoreType, false); }
private static NodeBuilder createBasicVppNodeBuilder(NodeId nodeId) { return new NodeBuilder().setNodeId(nodeId).setSupportingNode(Arrays.asList( new SupportingNodeBuilder().setTopologyRef(SUPPORTING_TOPOLOGY_NETCONF).setNodeRef(nodeId).build())); }
private static NodeBuilder getNodeIdBuilder(final RemoteDeviceId id) { final NodeBuilder nodeBuilder = new NodeBuilder(); nodeBuilder.setKey(new NodeKey(new NodeId(id.getName()))); return nodeBuilder; }
private static Node getNodeWithId(final RemoteDeviceId id) { final NodeBuilder builder = getNodeIdBuilder(id); return builder.build(); }
private NodeImpl(NodeBuilder 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(); 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.network.topology.topology.Node>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>> 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.network.topology.topology.Node>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
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); } }
private Object getNodeId() { return this.nb.getNodeId(); } }
private boolean checkForRemoval(final WriteTransaction trans) { final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.getKey()); if (!this.advertized) { if (this.tps.isEmpty() && this.prefixes.isEmpty()) { trans.delete(LogicalDatastoreType.OPERATIONAL, nid); LOG.debug("Removing unadvertized unused node {}", this.nb.getNodeId()); return true; } LOG.debug("Node {} is still implied by {} TPs and {} prefixes", this.nb.getNodeId(), this.tps.size(), this.prefixes.size()); } return false; }
@Nonnull @Override public Node getFailedState(@Nonnull final NodeId nodeId, @Nonnull final Node configNode) { return new NodeBuilder().addAugmentation(NetconfNode.class, new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.UnableToConnect).build()).build(); }
public synchronized Node getHostNode() { List<AttachmentPoints> attachmentPoints = new ArrayList<>(); for (AttachmentPointsBuilder apb : apbs) { attachmentPoints.add(apb.build()); } hostNodeBuilder.setAttachmentPoints(attachmentPoints); return nodeBuilder.addAugmentation(HostNode.class, hostNodeBuilder.build()).build(); }
@Override public ListenableFuture<Void> createVxlanBridgeDomainOnVppNode(@Nonnull String bridgeDomainName, @Nonnull VxlanVni vni, @Nonnull NodeId vppNodeId) { TopologyVbridgeAugment topoAug = new TopologyVbridgeAugmentBuilder().setTunnelType(TunnelTypeVxlan.class) .setArpTermination(false) .setFlood(true) .setForward(true) .setLearn(true) .setUnknownUnicastFlood(true) .setTunnelParameters(new VxlanTunnelParametersBuilder().setVni(vni).build()) .build(); return createBridgeDomainOnVppNode(bridgeDomainName, topoAug, createBasicVppNodeBuilder(vppNodeId).build()); }
private void putNode(final WriteTransaction trans, final NodeHolder holder) { if (holder.syncState(trans)) { this.nodes.remove(holder.getNodeId()); } }