}
//Check presence of service to be deleted
Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
- Services service;
if (serviceOpt.isEmpty()) {
LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
return ModelMappingUtils.createDeleteServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
}
- service = serviceOpt.orElseThrow();
LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
this.pceListener.setInput(new ServiceInput(input));
this.pceListener.setServiceReconfigure(false);
this.networkListener.setserviceDataStoreOperations(serviceDataStoreOperations);
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
+ Services service = serviceOpt.orElseThrow();
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
this.rendererServiceWrapper.performRenderer(
serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
LogMessages.serviceNotInDS(serviceName),
ResponseCodes.RESPONSE_FAILED);
}
- Services service = servicesObject.orElseThrow();
Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
if (servicePathsObject.isEmpty()) {
LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
LogMessages.servicePathNotInDS(serviceName),
ResponseCodes.RESPONSE_FAILED);
}
- ServicePaths servicePaths = servicePathsObject.orElseThrow();
// serviceInput for later use maybe...
+ Services service = servicesObject.orElseThrow();
ServiceInput serviceInput = new ServiceInput(input);
serviceInput.setServiceAEnd(service.getServiceAEnd());
serviceInput.setServiceZEnd(service.getServiceZEnd());
serviceInput.setSoftConstraints(service.getSoftConstraints());
serviceInput.setCustomer(service.getCustomer());
serviceInput.setCustomerContact(service.getCustomerContact());
-
// Get the network xpdr termination points
+ ServicePaths servicePaths = servicePathsObject.orElseThrow();
Map<AToZKey, AToZ> mapaToz = servicePaths.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();
-
PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
service.getServiceAEnd(), service.getServiceZEnd(),
- new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
-
+ new EndpointsBuilder()
+ .setAEndTp(
+ ((TerminationPoint) mapaToz
+ .get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
+ .getResource()
+ .getResource())
+ .getTpId())
+ .setZEndTp(
+ ((TerminationPoint) mapaToz
+ .get(new AToZKey("2"))
+ .getResource()
+ .getResource())
+ .getTpId())
+ .build());
if (output == null) {
LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
return ModelMappingUtils.createRerouteServiceReply(
LOG.info("RPC serviceRestoration received for {}", serviceName);
Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
- if (!servicesObject.isPresent()) {
+ if (servicesObject.isEmpty()) {
LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
return ModelMappingUtils.createRestoreServiceReply(
LogMessages.serviceNotInDS(serviceName));
// Validation
OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
new ServiceInput(input), RpcActions.TempServiceCreate);
- if (! validationResult.isSuccess()) {
+ if (!validationResult.isSuccess()) {
LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
return ModelMappingUtils.createCreateServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
verify(rpcProviderService, times(1)).registerRpcImplementations(any(ClassToInstanceMap.class));
}
-// @Test
-// void testNotImplementedRpc() throws InterruptedException, ExecutionException {
-// ListenableFuture<RpcResult<ServiceSrlgGetOutput>> result = new ServicehandlerImpl(rpcProviderService,
-// serviceDataStoreOperations, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-// catalogDataStoreOperations, pathComputationService, rendererServiceOperations,
-// notificationPublishService)
-// .serviceSrlgGet(new ServiceSrlgGetInputBuilder().build());
-//
-// result.addListener(() -> endSignal.countDown(), executorService);
-// endSignal.await();
-// assertNotNull(result.get());
-// assertFalse(result.get().isSuccessful());
-// assertNull(result.get().getResult());
-// assertEquals(ErrorType.RPC, result.get().getErrors().get(0).getErrorType());
-// assertEquals(ErrorSeverity.ERROR, result.get().getErrors().get(0).getSeverity());
-// assertEquals(ErrorTag.OPERATION_NOT_SUPPORTED, result.get().getErrors().get(0).getTag());
-// assertEquals("RPC not implemented yet", result.get().getErrors().get(0).getMessage());
-// }
-
@Test
void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ListenableFuture<RpcResult<ServiceCreateOutput>> result =