@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()); }
@Nonnull @Override public ListenableFuture<Node> onNodeCreated(@Nonnull final NodeId nodeId, @Nonnull final Node configNode) { return Futures.immediateFuture(new NodeBuilder().addAugmentation(NetconfNode.class, new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.Connected).build()).build()); }
@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(); }
@Nonnull @Override public Node getInitialState(@Nonnull final NodeId nodeId, @Nonnull final Node configNode) { return new NodeBuilder().addAugmentation(NetconfNode.class, new NetconfNodeBuilder().setConnectionStatus(NetconfNodeFields.ConnectionStatus.Connecting).build()).build(); }
private NodeHolder(final NodeId id) { this.inab = new IgpNodeAttributesBuilder(); this.nb = new NodeBuilder().setKey(new NodeKey(id)).setNodeId(id); }
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(); }
private void unadvertized() { this.inab = new IgpNodeAttributesBuilder(); this.nb = new NodeBuilder().setKey(this.nb.getKey()).setNodeId(this.nb.getNodeId()); this.advertized = false; LOG.debug("Node {} is unadvertized", this.nb.getNodeId()); }
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; }
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(); }
private Node buildConnectionNode( Bridge bridge) { //Update node with managed node reference NodeBuilder connectionNode = new NodeBuilder(); connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId()); OvsdbNodeAugmentationBuilder ovsdbConnectionAugmentationBuilder = new OvsdbNodeAugmentationBuilder(); List<ManagedNodeEntry> managedBridges = new ArrayList<>(); InstanceIdentifier<Node> bridgeIid = SouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), bridge); ManagedNodeEntry managedBridge = new ManagedNodeEntryBuilder().setBridgeRef( new OvsdbBridgeRef(bridgeIid)).build(); managedBridges.add(managedBridge); ovsdbConnectionAugmentationBuilder.setManagedNodeEntry(managedBridges); connectionNode.addAugmentation(OvsdbNodeAugmentation.class, ovsdbConnectionAugmentationBuilder.build()); LOG.debug("Update node with bridge node ref {}", ovsdbConnectionAugmentationBuilder.getManagedNodeEntry().iterator().next()); return connectionNode.build(); }
/** * Creates a NodeBuilder based on the given HostNodeBuilder. * * @param hostNode The HostNodeBuilder where the AttachmentPoints and Id * are. * @return A NodeBuilder with the same Id of HostNodeBuilder and a list of * TerminationPoint corresponding to each HostNodeBuilder's * AttachmentPoints. */ private NodeBuilder createNodeBuilder(HostNodeBuilder hostNode, List<AttachmentPointsBuilder> apbs) { List<TerminationPoint> tps = new ArrayList<>(); for (AttachmentPointsBuilder atb : apbs) { TerminationPoint tp = createTerminationPoint(hostNode); tps.add(tp); atb.setCorrespondingTp(tp.getTpId()); } NodeBuilder node = new NodeBuilder().setNodeId(createNodeId(hostNode)) .setTerminationPoint(tps); node.setKey(new NodeKey(node.getNodeId())); return node; }
public static Node createNode(ConnectionInfo key) { NodeBuilder nodeBuilder = new NodeBuilder(); nodeBuilder.setNodeId(createNodeId(key.getRemoteIp(), key.getRemotePort())); nodeBuilder.addAugmentation(OvsdbNodeAugmentation.class, createOvsdbAugmentation(key)); return nodeBuilder.build(); }
private InstanceIdentifier<IgpNodeAttributes> ensureNodePresent(final ReadWriteTransaction trans, final NodeId ni) { final NodeUsage present = this.nodes.get(ni); if (present != null) { return present.attrId; } final KeyedInstanceIdentifier<Node, NodeKey> nii = nodeInstanceId(ni); final InstanceIdentifier<IgpNodeAttributes> ret = nii.builder().augmentation(Node1.class).child(IgpNodeAttributes.class).build(); trans.merge(LogicalDatastoreType.OPERATIONAL, nii, new NodeBuilder().setKey(nii.getKey()).setNodeId(ni) .addAugmentation(Node1.class, new Node1Builder().setIgpNodeAttributes( new IgpNodeAttributesBuilder().setPrefix(Collections.<Prefix>emptyList()).build()).build()).build()); this.nodes.put(ni, new NodeUsage(ret)); return ret; }
private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node prepareTopologyNode(final NodeId nodeIdInTopology, final InstanceIdentifier<FlowCapableNode> iiToNodeInInventory) { final InventoryNode inventoryNode = new InventoryNodeBuilder() .setInventoryNodeRef(new NodeRef(iiToNodeInInventory.firstIdentifierOf(Node.class))) .build(); final NodeBuilder topologyNodeBuilder = new NodeBuilder(); topologyNodeBuilder.setNodeId(nodeIdInTopology); topologyNodeBuilder.addAugmentation(InventoryNode.class, inventoryNode); return topologyNodeBuilder.build(); }
private void putTopologyNode() { final Node node = new NodeBuilder().setKey(nodeId.getKey()).setNodeId(nodeId.getKey().getNodeId()).build(); final WriteTransaction t = beginTransaction(); t.put(LogicalDatastoreType.OPERATIONAL, nodeId, node); t.submit(); }
/** * Create a new node in the network topology. * * @param node An {@link OfNode} instance. * @return A node in the network topology. */ public static Node newTopologyNode(OfNode node) { InventoryNode invNode = new InventoryNodeBuilder(). setInventoryNodeRef(node.getNodeRef()). build(); return new NodeBuilder(). setNodeId(new NodeId(node.getNodeIdentifier())). addAugmentation(InventoryNode.class, invNode). build(); }
/** * @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); }
public static Node createBasicVcNetNode() { /* * Node <-- VcNode <>-- VcNodeAttributes <-- VcNetNode <>-- NetNodeAttributes */ NetNodeAttributesBuilder netNodeAttrBuilder = new NetNodeAttributesBuilder(); netNodeAttrBuilder.setIsNetNodeEmpty(true); VcNetNodeBuilder vcNetNodeBuilder = new VcNetNodeBuilder(); vcNetNodeBuilder.setNetNodeAttributes(netNodeAttrBuilder.build()); VcNode baseVcNode = createBasicVcNode(VC_NET_NODE_NAME); VcNodeAttributesBuilder vcNodeAttrBuilder = new VcNodeAttributesBuilder(baseVcNode.getVcNodeAttributes()); vcNodeAttrBuilder.addAugmentation(VcNetNode.class, vcNetNodeBuilder.build()); VcNodeBuilder vcNodeBuilder = new VcNodeBuilder(); vcNodeBuilder.setVcNodeAttributes(vcNodeAttrBuilder.build()); Node baseNode = createBasicNode(VC_NET_NODE_NAME); NodeBuilder nodeBuilder = new NodeBuilder(baseNode); nodeBuilder.addAugmentation(VcNode.class, vcNodeBuilder.build()); return nodeBuilder.build(); }
public static Node createBasicVcLdNode() { /* * Node <-- VcNode <>-- VcNodeAttributes <-- VcLdNode <>-- LdNodeAttributes */ LdNodeAttributesBuilder ldNodeAttrBuilder = new LdNodeAttributesBuilder(); ldNodeAttrBuilder.setIsLdNodeEmpty(true); VcLdNodeBuilder vcLdNodeBuilder = new VcLdNodeBuilder(); vcLdNodeBuilder.setLdNodeAttributes(ldNodeAttrBuilder.build()); VcNode baseVcNode = createBasicVcNode(VC_LD_NODE_NAME); VcNodeAttributesBuilder vcNodeAttrBuilder = new VcNodeAttributesBuilder(baseVcNode.getVcNodeAttributes()); vcNodeAttrBuilder.addAugmentation(VcLdNode.class, vcLdNodeBuilder.build()); VcNodeBuilder vcNodeBuilder = new VcNodeBuilder(); vcNodeBuilder.setVcNodeAttributes(vcNodeAttrBuilder.build()); Node baseNode = createBasicNode(VC_LD_NODE_NAME); NodeBuilder nodeBuilder = new NodeBuilder(baseNode); nodeBuilder.addAugmentation(VcNode.class, vcNodeBuilder.build()); return nodeBuilder.build(); }