package org.opendaylight.transportpce.common.mapping;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.transportpce.common.StringConstants;
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
.child(Nodes.class, new NodesKey(nodeId))
.child(Mapping.class, new MappingKey(oldMapping.getLogicalConnectionPoint()));
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, mapIID, newMapping);
- CheckedFuture<Void, TransactionCommitFailedException> submit = writeTransaction.submit();
- submit.checkedGet();
+ ListenableFuture<Void> submit = writeTransaction.submit();
+ submit.get();
return true;
}
return false;
- } catch (TransactionCommitFailedException e) {
- LOG.error("Transaction Commit Error updating Mapping {} for node {}",
- oldMapping.getLogicalConnectionPoint(), nodeId, e);
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Error updating Mapping {} for node {}", oldMapping.getLogicalConnectionPoint(), nodeId, e);
return false;
}
} else {
int client = 1;
if (!deviceObject.isPresent() || deviceObject.get().getCircuitPacks() == null) {
LOG.warn("Circuit Packs are not present for {}", nodeId);
- return false; // TODO return false or continue?
+ return false;
+ // TODO return false or continue?
}
Map<String, String> lcpMap = new HashMap<>();
Map<String, Mapping> mappingMap = new HashMap<>();
return cpPerSrg;
}
- @SuppressWarnings("checkstyle:linelength") //last LOG info message in this method is too long
+ //last LOG info message in this method is too long
+ @SuppressWarnings("checkstyle:linelength")
private boolean createPpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
// Creating mapping data for SRG's PP
HashMap<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.srg.CircuitPacks>> srgCps
InstanceIdentifier<Network> nodesIID = InstanceIdentifier.builder(Network.class).build();
Network network = nwBldr.build();
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, nodesIID, network);
- CheckedFuture<Void, TransactionCommitFailedException> submit = writeTransaction.submit();
+ ListenableFuture<Void> submit = writeTransaction.submit();
try {
- submit.checkedGet();
+ submit.get();
return true;
- } catch (TransactionCommitFailedException e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.warn("Failed to post {}", network, e);
return false;
}
return mpBldr.build();
}
- @SuppressWarnings("checkstyle:linelength") // some LOG messages are too long
+ // some LOG messages are too long
+ @SuppressWarnings("checkstyle:linelength")
private boolean createTtpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
// Creating mapping data for degree TTP's
List<Degree> degrees = getDegrees(nodeId, deviceInfo);