use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project netvirt by opendaylight.
the class NodeConnectedHandler method copyChildPSOpToHAPS.
/**
* Copy child physical switch node data to HA physical switch data of Operational data tree.
*
* @param childPsNode HA child PS node
* @param haPath HA node path
* @param haPspath Ha Physical Switch Node path
* @param tx Transaction
* @throws ReadFailedException Exception thrown if read fails
*/
public void copyChildPSOpToHAPS(Node childPsNode, InstanceIdentifier<Node> haPath, InstanceIdentifier<Node> haPspath, ReadWriteTransaction tx) throws ReadFailedException {
NodeBuilder haPSNodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(haPspath);
PhysicalSwitchAugmentationBuilder dstBuilder = new PhysicalSwitchAugmentationBuilder();
PhysicalSwitchAugmentation src = childPsNode.getAugmentation(PhysicalSwitchAugmentation.class);
Node existingHAPSNode = HwvtepHAUtil.readNode(tx, OPERATIONAL, haPspath);
PhysicalSwitchAugmentation existingHAPSAugumentation = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(existingHAPSNode);
psAugmentationMerger.mergeOperationalData(dstBuilder, existingHAPSAugumentation, src, haPath);
psNodeMerger.mergeOperationalData(haPSNodeBuilder, existingHAPSNode, childPsNode, haPath);
mergeOpManagedByAttributes(src, dstBuilder, haPath);
haPSNodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, dstBuilder.build());
Node haPsNode = haPSNodeBuilder.build();
tx.merge(OPERATIONAL, haPspath, haPsNode, true);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project netvirt by opendaylight.
the class InterVpnLinkLocatorTest method stubNwUtilsGetOperativeDpns.
private void stubNwUtilsGetOperativeDpns(int maxNbrOfOperativeDpns) throws Exception {
WriteTransaction writeTx1 = dataBroker.newWriteOnlyTransaction();
for (int i = 1; i <= maxNbrOfOperativeDpns; i++) {
NodeId nodeId = new NodeId("openflow:" + i);
Node node = new NodeBuilder().setId(nodeId).build();
writeTx1.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(nodeId)).build(), node);
}
writeTx1.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project netvirt by opendaylight.
the class ElanBridgeManager method copyBridgeToConfig.
private void copyBridgeToConfig(Node brIntNode) {
NodeBuilder bridgeNodeBuilder = new NodeBuilder(brIntNode);
// termination points need to be masssaged to remove the ifindex field
// which are not allowed in the config data store
List<TerminationPoint> terminationPoints = brIntNode.getTerminationPoint();
if (terminationPoints != null) {
List<TerminationPoint> newTerminationPoints = new ArrayList<>();
for (TerminationPoint tp : terminationPoints) {
OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
TerminationPointBuilder tpBuilder = new TerminationPointBuilder(tp);
if (ovsdbTerminationPointAugmentation != null) {
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(ovsdbTerminationPointAugmentation);
tpAugmentationBuilder.setIfindex(null);
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
}
newTerminationPoints.add(tpBuilder.build());
}
bridgeNodeBuilder.setTerminationPoint(newTerminationPoints);
}
InstanceIdentifier<Node> brNodeIid = SouthboundUtils.createInstanceIdentifier(brIntNode.getNodeId());
this.mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, brNodeIid, bridgeNodeBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project netvirt by opendaylight.
the class NaptEventHandler method buildInventoryDpnNode.
private static Node buildInventoryDpnNode(BigInteger dpnId) {
NodeId nodeId = new NodeId("openflow:" + dpnId);
Node nodeDpn = new NodeBuilder().setId(nodeId).setKey(new NodeKey(nodeId)).build();
return nodeDpn;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method writeFlow.
private void writeFlow(final CommandInterpreter ci, final FlowBuilder flow, final NodeBuilder nodeBuilder) {
final ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
final InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.getKey());
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(), true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, flow.build(), true);
final CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(final Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(final Throwable throwable) {
LOG.error(throwable.getMessage(), throwable);
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
Aggregations