Search in sources :

Example 1 with NodesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder in project openflowplugin by opendaylight.

the class DeviceInitializationUtil method makeEmptyNodes.

/**
 * Merge empty nodes to operational DS to predict any problems with missing parent for node.
 *
 * @param dataBroker the data broker
 */
public static void makeEmptyNodes(final DataBroker dataBroker) {
    final WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    try {
        tx.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), new NodesBuilder().setNode(Collections.emptyList()).build());
        tx.submit().get();
    } catch (ExecutionException | InterruptedException e) {
        LOG.error("Creation of node failed.", e);
        throw new IllegalStateException(e);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) NodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder) ExecutionException(java.util.concurrent.ExecutionException) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Example 2 with NodesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder in project openflowplugin by opendaylight.

the class DeviceInitializationUtilTest method makeEmptyNodes.

@Test
public void makeEmptyNodes() throws Exception {
    DeviceInitializationUtil.makeEmptyNodes(dataBroker);
    verify(dataBroker).newWriteOnlyTransaction();
    verify(writeTransaction).merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), new NodesBuilder().setNode(Collections.emptyList()).build());
    verify(writeTransaction).submit();
}
Also used : NodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Test(org.junit.Test)

Example 3 with NodesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder in project openflowplugin by opendaylight.

the class FRMTest method addFlowCapableNode.

public void addFlowCapableNode(NodeKey nodeKey) {
    Nodes nodes = new NodesBuilder().setNode(Collections.<Node>emptyList()).build();
    FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
    NodeBuilder nodeBuilder = new NodeBuilder();
    nodeBuilder.setKey(nodeKey);
    nodeBuilder.addAugmentation(FlowCapableNode.class, fcnBuilder.build());
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
    InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
    writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
    writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
    assertCommit(writeTx.submit());
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) NodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder) FlowCapableNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Example 4 with NodesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder in project genius by opendaylight.

the class MdSalUtilTest method addFlowCapableNode.

public void addFlowCapableNode(NodeKey nodeKey) throws ExecutionException, InterruptedException {
    Nodes nodes = new NodesBuilder().setNode(Collections.emptyList()).build();
    final InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
    FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
    NodeBuilder nodeBuilder = new NodeBuilder();
    nodeBuilder.setKey(nodeKey);
    nodeBuilder.addAugmentation(FlowCapableNode.class, fcnBuilder.build());
    WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
    writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
    writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
    writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
    writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
    assertCommit(writeTx.submit());
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) NodesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder) NodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder) FlowCapableNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)

Aggregations

Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)4 NodesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder)4 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)2 FlowCapableNodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder)2 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)2 NodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder)2 ExecutionException (java.util.concurrent.ExecutionException)1 Test (org.junit.Test)1