use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project netvirt by opendaylight.
the class TunnelCmd method transform.
@Override
public Tunnels transform(InstanceIdentifier<Node> nodePath, Tunnels src) {
TunnelsBuilder tunnelsBuilder = new TunnelsBuilder(src);
tunnelsBuilder.setLocalLocatorRef(HwvtepHAUtil.convertLocatorRef(src.getLocalLocatorRef(), nodePath));
tunnelsBuilder.setRemoteLocatorRef(HwvtepHAUtil.convertLocatorRef(src.getRemoteLocatorRef(), nodePath));
tunnelsBuilder.setTunnelUuid(HwvtepHAUtil.getUUid(HwvtepHAUtil.getTepIpVal(src.getRemoteLocatorRef())));
HwvtepPhysicalLocatorRef hwvtepPhysicalLocatorRef = HwvtepHAUtil.convertLocatorRef(src.getLocalLocatorRef(), nodePath);
HwvtepPhysicalLocatorRef hwvtepPhysicalLocatorRef1 = HwvtepHAUtil.convertLocatorRef(src.getRemoteLocatorRef(), nodePath);
tunnelsBuilder.setKey(new TunnelsKey(hwvtepPhysicalLocatorRef, hwvtepPhysicalLocatorRef1));
return tunnelsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project netvirt by opendaylight.
the class TunnelCmd method generateId.
@Override
public InstanceIdentifier<Tunnels> generateId(InstanceIdentifier<Node> id, Tunnels src) {
HwvtepPhysicalLocatorRef hwvtepPhysicalLocatorRef = HwvtepHAUtil.convertLocatorRef(src.getLocalLocatorRef(), id);
HwvtepPhysicalLocatorRef hwvtepPhysicalLocatorRef1 = HwvtepHAUtil.convertLocatorRef(src.getRemoteLocatorRef(), id);
TunnelsKey key = new TunnelsKey(hwvtepPhysicalLocatorRef, hwvtepPhysicalLocatorRef1);
return id.augmentation(PhysicalSwitchAugmentation.class).child(Tunnels.class, key);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project netvirt by opendaylight.
the class NodeConnectedHandler method copyHANodeConfigToChild.
/**
* Copy HA global node data to Child HA node of config data tree .
*
* @param srcNode Node which to be transformed
* @param childPath Path to which source node will be transformed
* @param tx Transaction
*/
private void copyHANodeConfigToChild(Node srcNode, InstanceIdentifier<Node> childPath, ReadWriteTransaction tx) {
if (srcNode == null) {
return;
}
HwvtepGlobalAugmentation src = srcNode.getAugmentation(HwvtepGlobalAugmentation.class);
if (src == null) {
return;
}
NodeBuilder nodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(childPath);
HwvtepGlobalAugmentationBuilder dstBuilder = new HwvtepGlobalAugmentationBuilder();
globalAugmentationMerger.mergeConfigData(dstBuilder, src, childPath);
globalNodeMerger.mergeConfigData(nodeBuilder, srcNode, childPath);
nodeBuilder.addAugmentation(HwvtepGlobalAugmentation.class, dstBuilder.build());
Node dstNode = nodeBuilder.build();
tx.put(CONFIGURATION, childPath, dstNode, WriteTransaction.CREATE_MISSING_PARENTS);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project netvirt by opendaylight.
the class NodeConnectedHandler method copyHAPSConfigToChildPS.
/**
* Copy HA physical switch data to Child Physical switch node of config data tree.
*
* @param haPsNode HA physical Switch Node
* @param childPath HA Child Node path
* @param tx Transaction
*/
public void copyHAPSConfigToChildPS(Node haPsNode, InstanceIdentifier<Node> childPath, ReadWriteTransaction tx) {
InstanceIdentifier<Node> childPsPath = HwvtepHAUtil.convertPsPath(haPsNode, childPath);
NodeBuilder childPsBuilder = HwvtepHAUtil.getNodeBuilderForPath(childPsPath);
PhysicalSwitchAugmentationBuilder dstBuilder = new PhysicalSwitchAugmentationBuilder();
PhysicalSwitchAugmentation src = haPsNode.getAugmentation(PhysicalSwitchAugmentation.class);
psAugmentationMerger.mergeConfigData(dstBuilder, src, childPath);
psNodeMerger.mergeConfigData(childPsBuilder, haPsNode, childPath);
childPsBuilder.addAugmentation(PhysicalSwitchAugmentation.class, dstBuilder.build());
Node childPSNode = childPsBuilder.build();
tx.put(CONFIGURATION, childPsPath, childPSNode, WriteTransaction.CREATE_MISSING_PARENTS);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src in project netvirt by opendaylight.
the class NodeCopier method copyPSNode.
@Override
public void copyPSNode(Optional<Node> srcPsNodeOptional, InstanceIdentifier<Node> srcPsPath, InstanceIdentifier<Node> dstPsPath, InstanceIdentifier<Node> dstGlobalPath, LogicalDatastoreType logicalDatastoreType, ReadWriteTransaction tx) throws ReadFailedException {
if (!srcPsNodeOptional.isPresent() && logicalDatastoreType == CONFIGURATION) {
Futures.addCallback(tx.read(logicalDatastoreType, srcPsPath), new FutureCallback<Optional<Node>>() {
@Override
public void onSuccess(Optional<Node> nodeOptional) {
HAJobScheduler.getInstance().submitJob(() -> {
try {
ReadWriteTransaction tx1 = new BatchedTransaction();
if (nodeOptional.isPresent()) {
copyPSNode(nodeOptional, srcPsPath, dstPsPath, dstGlobalPath, logicalDatastoreType, tx1);
} else {
/**
* Deleting node please refer @see #copyGlobalNode for explanation
*/
HwvtepHAUtil.deleteNodeIfPresent(tx1, logicalDatastoreType, dstPsPath);
}
} catch (ReadFailedException e) {
LOG.error("Failed to read src node {}", srcPsNodeOptional.get());
}
});
}
@Override
public void onFailure(Throwable throwable) {
}
});
return;
}
NodeBuilder dstPsNodeBuilder = HwvtepHAUtil.getNodeBuilderForPath(dstPsPath);
PhysicalSwitchAugmentationBuilder dstPsAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
PhysicalSwitchAugmentation srcPsAugmenatation = srcPsNodeOptional.get().getAugmentation(PhysicalSwitchAugmentation.class);
Node existingDstPsNode = HwvtepHAUtil.readNode(tx, logicalDatastoreType, dstPsPath);
PhysicalSwitchAugmentation existingDstPsAugmentation = HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(existingDstPsNode);
if (OPERATIONAL == logicalDatastoreType) {
psAugmentationMerger.mergeOperationalData(dstPsAugmentationBuilder, existingDstPsAugmentation, srcPsAugmenatation, dstPsPath);
psNodeMerger.mergeOperationalData(dstPsNodeBuilder, existingDstPsNode, srcPsNodeOptional.get(), dstPsPath);
} else {
psAugmentationMerger.mergeConfigData(dstPsAugmentationBuilder, srcPsAugmenatation, dstPsPath);
psNodeMerger.mergeConfigData(dstPsNodeBuilder, srcPsNodeOptional.get(), dstPsPath);
}
mergeOpManagedByAttributes(srcPsAugmenatation, dstPsAugmentationBuilder, dstGlobalPath);
dstPsNodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, dstPsAugmentationBuilder.build());
Node dstPsNode = dstPsNodeBuilder.build();
tx.merge(logicalDatastoreType, dstPsPath, dstPsNode, true);
LOG.debug("Copied {} physical switch node from {} to {}", logicalDatastoreType, srcPsPath, dstPsPath);
}
Aggregations