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);
}
}
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();
}
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());
}
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());
}
Aggregations