+ /**
+ * Call the PCE RPC path-computation-reroute-request to check if any other path exists.
+ *
+ * @param input Service to be rerouted
+ */
+ protected boolean serviceRerouteCheck(Services input) {
+ Optional<ServicePaths> servicePaths = serviceDataStoreOperations.getServicePath(input.getServiceName());
+ if (servicePaths.isEmpty()) {
+ LOG.warn("Service path of '{}' does not exist in datastore", input.getServiceName());
+ return false;
+ }
+ // Get the network xpdr termination points
+ Map<AToZKey, AToZ> mapaToz = servicePaths.get().getPathDescription().getAToZDirection().getAToZ();
+ String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
+ .getResource().getResource()).getTpId();
+ String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2")).getResource()
+ .getResource()).getTpId();
+ PathComputationRerouteRequestInput inputPC = new PathComputationRerouteRequestInputBuilder()
+ .setHardConstraints(input.getHardConstraints())
+ .setSoftConstraints(input.getSoftConstraints())
+ .setServiceAEnd(createServiceAEndReroute(input.getServiceAEnd()))
+ .setServiceZEnd(createServiceZEndReroute(input.getServiceZEnd()))
+ .setPceRoutingMetric(PceMetric.TEMetric)
+ .setEndpoints(new EndpointsBuilder()
+ .setAEndTp(aendtp)
+ .setZEndTp(zendtp)
+ .build())
+ .build();
+ ListenableFuture<PathComputationRerouteRequestOutput> res =
+ pathComputationService.pathComputationRerouteRequest(inputPC);
+ try {
+ return res.get().getConfigurationResponseCommon().getResponseCode().equals(ResponseCodes.RESPONSE_OK);
+ } catch (ExecutionException | InterruptedException e) {
+ LOG.warn("ServiceRerouteCheck FAILED ! ", e);
+ return false;
+ }
+ }
+