import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.unimgr.mef.nrp.api.ActivationDriver;
import org.opendaylight.unimgr.mef.nrp.api.EndPoint;
import org.opendaylight.unimgr.mef.nrp.api.FailureResult;
}
- endpoints = input.getEndPoint().stream().map(ep -> {
- EndPoint2 nrpAttributes = ep.augmentation(EndPoint2.class);
- EndPoint endPoint = new EndPoint(ep, nrpAttributes);
- endPoint.setLocalId(ep.getLocalId());
- return endPoint;
- }).collect(Collectors.toList());
+ endpoints = input.getEndPoint() == null ? Collections.emptyList() :
+ input.getEndPoint().stream().map(ep -> {
+ EndPoint2 nrpAttributes = ep.augmentation(EndPoint2.class);
+ EndPoint endPoint = new EndPoint(ep, nrpAttributes);
+ endPoint.setLocalId(ep.getLocalId());
+ return endPoint;
+ }).collect(Collectors.toList());
String uniqueStamp = service.getServiceIdPool().getServiceId();
LOG.debug("connectivity service passed validation, request = {}", input);
if (decomposedRequest == null || decomposedRequest.isEmpty()) {
throw new FailureResult("Cannot define activation scheme for "
- + endpoints.stream().map(e -> e.getEndpoint().getServiceInterfacePoint()
- .getServiceInterfacePointId().getValue())
- .collect(Collectors.joining(",", "[", "]")));
+ + endpoints.stream().map(e -> e.getEndpoint()
+ .getServiceInterfacePoint().getServiceInterfacePointId().getValue()
+ )
+ .collect(Collectors.joining(",", "[", "]")));
}
ActivationTransaction tx = new ActivationTransaction();
}
private ConnectivityService createConnectivityModel(String uniqueStamp)
- throws TransactionCommitFailedException, TimeoutException {
+ throws TimeoutException, InterruptedException, ExecutionException {
assert decomposedRequest != null : "this method can be only run after request was successfuly decomposed";
//sort of unique ;)
try {
- tx.submit().checkedGet(500, TimeUnit.MILLISECONDS);
+ tx.commit().get(500, TimeUnit.MILLISECONDS);
LOG.info("Success with serializing Connections and Connectivity Service for {}", uniqueStamp);
- } catch (TimeoutException e) {
+ } catch (TimeoutException | InterruptedException | ExecutionException e) {
LOG.error("Error with committing Connections and Connectivity Service for {} within {} ms",
uniqueStamp, 500);
throw e;
- } catch (TransactionCommitFailedException e) {
- LOG.error("Error with committing Connections and Connectivity Service for " + uniqueStamp, e);
- throw e;
}
return new ConnectivityServiceBuilder(cs).build();
Objects.requireNonNull(csep);
builder
+ .setParentNodeEdgePoint(Collections.emptyList())
+ .setClientNodeEdgePoint(Collections.emptyList())
.setOperationalState(csep.getOperationalState())
.setLayerProtocolName(csep.getLayerProtocolName())
.setLifecycleState(csep.getLifecycleState())