*/
package org.opendaylight.netvirt.elan.l2gw.ha.handlers;
-import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
-import com.google.common.base.Optional;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
+import java.util.Optional;
import java.util.concurrent.ExecutionException;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.infra.Datastore;
import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.Datastore.Operational;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
import org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAJobScheduler;
import org.opendaylight.netvirt.elan.l2gw.ha.merge.GlobalAugmentationMerger;
//Also update the manager section in config which helps in cluster reboot scenarios
LoggingFutures.addErrorLogging(
txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
- confTx -> haBuilder.getManagers().forEach(manager -> {
+ confTx -> haBuilder.getManagers().values().forEach(manager -> {
InstanceIdentifier<Managers> managerIid =
dstPath.augmentation(HwvtepGlobalAugmentation.class).child(Managers.class, manager.key());
- confTx.put(managerIid, manager, CREATE_MISSING_PARENTS);
+ confTx.mergeParentStructurePut(managerIid, manager);
})), LOG, "Error updating the manager section in config");
} else {
haNodeBuilder.addAugmentation(HwvtepGlobalAugmentation.class, haBuilder.build());
Node haNode = haNodeBuilder.build();
if (Operational.class.equals(datastoreType)) {
- tx.merge(dstPath, haNode, CREATE_MISSING_PARENTS);
+ tx.mergeParentStructureMerge(dstPath, haNode);
} else {
- tx.put(dstPath, haNode, CREATE_MISSING_PARENTS);
+ tx.mergeParentStructurePut(dstPath, haNode);
}
}
PhysicalSwitchAugmentation srcPsAugmenatation =
srcPsNodeOptional.get().augmentation(PhysicalSwitchAugmentation.class);
- Node existingDstPsNode = tx.read(dstPsPath).get().orNull();
+ Node existingDstPsNode = tx.read(dstPsPath).get().orElse(null);
PhysicalSwitchAugmentation existingDstPsAugmentation =
HwvtepHAUtil.getPhysicalSwitchAugmentationOfNode(existingDstPsNode);
if (Operational.class.equals(datastoreType)) {
dstPsNodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, dstPsAugmentationBuilder.build());
Node dstPsNode = dstPsNodeBuilder.build();
- tx.merge(dstPsPath, dstPsNode, CREATE_MISSING_PARENTS);
+ tx.mergeParentStructureMerge(dstPsPath, dstPsNode);
LOG.debug("Copied {} physical switch node from {} to {}", datastoreType, srcPsPath, dstPsPath);
}