*/
package org.opendaylight.netvirt.elan.l2gw.utils;
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
import java.util.ArrayList;
import java.util.Collections;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
import org.opendaylight.netvirt.elan.utils.Scheduler;
import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayCache;
(validNetworks, logicalSwitch) -> !validNetworks.contains(logicalSwitch);
private static Predicate<TerminationPoint> CONTAINS_VLANBINDINGS = (port) ->
- port.getAugmentation(HwvtepPhysicalPortAugmentation.class) != null
- && port.getAugmentation(HwvtepPhysicalPortAugmentation.class).getVlanBindings() != null;
+ port.augmentation(HwvtepPhysicalPortAugmentation.class) != null
+ && port.augmentation(HwvtepPhysicalPortAugmentation.class).getVlanBindings() != null;
private final DataBroker broker;
() -> {
L2GatewayDevice l2GwDevice = l2GatewayCache.get(deviceName);
NodeId globalNodeId = globalNodeIid.firstKeyOf(Node.class).getNodeId();
- Node configNode = MDSALUtil.read(broker, CONFIGURATION, globalNodeIid)
+ Node configNode = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, globalNodeIid)
.or(defaultNode(globalNodeId));
- Node configPsNode = MDSALUtil.read(broker, CONFIGURATION, psNodeIid).or(defaultNode(psNodeId));
+ Node configPsNode =
+ MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, psNodeIid).or(defaultNode(psNodeId));
cleanupStaleLogicalSwitches(l2GwDevice, configNode, configPsNode);
cleanupTasks.remove(psNodeIid.firstKeyOf(Node.class).getNodeId());
}, getCleanupDelay(), TimeUnit.SECONDS);
Map<String, List<InstanceIdentifier<VlanBindings>>> vlans = new HashMap<>();
ports.stream()
.filter(CONTAINS_VLANBINDINGS)
- .forEach((port) -> {
- port.getAugmentation(HwvtepPhysicalPortAugmentation.class)
- .getVlanBindings()
- .forEach((binding) -> putVlanBindingVsLogicalSwitch(configPsNode, vlans, port, binding));
- });
+ .forEach((port) -> port.augmentation(HwvtepPhysicalPortAugmentation.class)
+ .getVlanBindings()
+ .forEach((binding) -> putVlanBindingVsLogicalSwitch(configPsNode, vlans, port, binding)));
return vlans;
}
final TerminationPoint tp,
final VlanBindings vlanBinding) {
return HwvtepSouthboundUtils.createInstanceIdentifier(nodeId)
- .child(TerminationPoint.class, tp.getKey())
+ .child(TerminationPoint.class, tp.key())
.augmentation(HwvtepPhysicalPortAugmentation.class)
- .child(VlanBindings.class, vlanBinding.getKey());
+ .child(VlanBindings.class, vlanBinding.key());
}
private void cleanupStaleBindings(final String globalNodeId,
final String staleLogicalSwitch) {
LOG.trace("CleanupStaleBindings for logical switch {}", staleLogicalSwitch);
- ListenableFutures.addErrorLogging(
- txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ LoggingFutures.addErrorLogging(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
if (vlans.containsKey(staleLogicalSwitch)) {
- vlans.get(staleLogicalSwitch)
- .forEach((vlanIid) -> tx.delete(LogicalDatastoreType.CONFIGURATION, vlanIid));
+ vlans.get(staleLogicalSwitch).forEach((vlanIid) -> tx.delete(vlanIid));
}
}),
LOG, "Failed to delete stale vlan bindings from node {}", globalNodeId);
}
private List<String> getLogicalSwitchesOnDevice(final Node globalConfigNode) {
- HwvtepGlobalAugmentation augmentation = globalConfigNode.getAugmentation(HwvtepGlobalAugmentation.class);
+ HwvtepGlobalAugmentation augmentation = globalConfigNode.augmentation(HwvtepGlobalAugmentation.class);
if (augmentation == null || augmentation.getLogicalSwitches() == null) {
return Collections.emptyList();
}