import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteOutputBuilder;
PathDescription pathDescription) {
ServiceImplementationRequestInputBuilder serviceImplementationRequestInputBuilder =
new ServiceImplementationRequestInputBuilder();
- serviceImplementationRequestInputBuilder.setServiceName(input.getServiceName());
+ if (input.isServiceReconfigure()) {
+ serviceImplementationRequestInputBuilder.setServiceName(input.getNewServiceName());
+ } else {
+ serviceImplementationRequestInputBuilder.setServiceName(input.getServiceName());
+ }
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.service.implementation
.request.input.ServiceAEndBuilder serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.opendaylight
.transportpce.renderer.rev171017.service.implementation.request.input.ServiceAEndBuilder();
return builder.build();
}
+ public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput
+ createServiceDeleteInput(ServiceReconfigureInput serviceReconfigureInput) {
+ ServiceDeleteInputBuilder builder = new ServiceDeleteInputBuilder();
+ String serviceName = serviceReconfigureInput.getServiceName();
+ builder.setServiceName(serviceReconfigureInput.getServiceName());
+ builder.setServiceHandlerHeader(
+ new ServiceHandlerHeaderBuilder().setRequestId(serviceName + "-reconfigure").build());
+ return builder.build();
+ }
+
public static ServiceAEnd createServiceAEnd(org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types
.rev161014.ServiceEndpoint serviceAEnd) {
ServiceAEndBuilder serviceAEndBuilder = new ServiceAEndBuilder();
return RpcResultBuilder.success(output.build()).buildFuture();
}
+ public static ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> createCreateServiceReply(
+ ServiceFeasibilityCheckInput input, String finalAck, String message, String responseCode) {
+ ResponseParametersBuilder responseParameters = new ResponseParametersBuilder();
+ ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator(finalAck).setResponseMessage(message).setResponseCode(responseCode);
+ if (input.getSdncRequestHeader() != null) {
+ configurationResponseCommon.setRequestId(input.getSdncRequestHeader().getRequestId());
+ } else {
+ configurationResponseCommon.setRequestId(null);
+ }
+ ServiceFeasibilityCheckOutputBuilder output = new ServiceFeasibilityCheckOutputBuilder()
+ .setConfigurationResponseCommon(configurationResponseCommon.build())
+ .setResponseParameters(responseParameters.build());
+ return RpcResultBuilder.success(output.build()).buildFuture();
+ }
+
+ public static ListenableFuture<RpcResult<ServiceReconfigureOutput>> createCreateServiceReply(
+ ServiceReconfigureInput input, String message, RpcStatus rpcStatus) {
+ ServiceReconfigureOutputBuilder output = new ServiceReconfigureOutputBuilder()
+ .setStatus(rpcStatus)
+ .setStatusMessage(message);
+ return RpcResultBuilder.success(output.build()).buildFuture();
+ }
+
public static ListenableFuture<RpcResult<ServiceRerouteOutput>> createRerouteServiceReply(ServiceRerouteInput input,
String finalAckYes, String message, RpcStatus status) {
ServiceRerouteOutputBuilder output = new ServiceRerouteOutputBuilder()
package org.opendaylight.transportpce.servicehandler;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ConnectionType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.RpcActions;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceEndpoint;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInput;
*/
public class ServiceInput {
private String serviceName;
+ private String newServiceName;
private String commonId;
private ConnectionType connectionType;
private SdncRequestHeader sdncRequestHeader;
private ServiceEndpoint serviceZEnd;
private String customer;
private String customerContact;
+ private boolean serviceReconfigure;
public ServiceInput(ServiceCreateInput serviceCreateInput) {
setServiceName(serviceCreateInput.getServiceName());
setServiceZEnd(serviceCreateInput.getServiceZEnd());
setCustomer(serviceCreateInput.getCustomer());
setCustomerContact(serviceCreateInput.getCustomerContact());
+ setServiceReconfigure(false);
+ }
+
+ public ServiceInput(ServiceReconfigureInput serviceReconfigureInput) {
+ setServiceName(serviceReconfigureInput.getServiceName());
+ setNewServiceName(serviceReconfigureInput.getNewServiceName());
+ setSdncRequestHeader(new SdncRequestHeaderBuilder()
+ .setRequestId(serviceReconfigureInput.getServiceName() + "-reconfigure")
+ .setRpcAction(RpcActions.ServiceReconfigure).build());
+ setCommonId(serviceReconfigureInput.getCommonId());
+ setConnectionType(serviceReconfigureInput.getConnectionType());
+ setHardConstraints(serviceReconfigureInput.getHardConstraints());
+ setSoftConstraints(serviceReconfigureInput.getSoftConstraints());
+ setServiceAEnd(serviceReconfigureInput.getServiceAEnd());
+ setServiceZEnd(serviceReconfigureInput.getServiceZEnd());
+ setCustomer(serviceReconfigureInput.getCustomer());
+ setCustomerContact(serviceReconfigureInput.getCustomerContact());
+ setServiceReconfigure(true);
}
public ServiceInput(ServiceDeleteInput serviceDeleteInput) {
setServiceName(serviceDeleteInput.getServiceDeleteReqInfo().getServiceName());
setSdncRequestHeader(serviceDeleteInput.getSdncRequestHeader());
+ setServiceReconfigure(false);
}
public ServiceInput(TempServiceCreateInput tempServiceCreateInput) {
setServiceZEnd(tempServiceCreateInput.getServiceZEnd());
setCustomer(tempServiceCreateInput.getCustomer());
setCustomerContact(tempServiceCreateInput.getCustomerContact());
+ setServiceReconfigure(false);
+ }
+
+ public ServiceInput(ServiceFeasibilityCheckInput serviceFeasibilityCheckInput) {
+ setServiceName(serviceFeasibilityCheckInput.getCommonId());
+ setCommonId(serviceFeasibilityCheckInput.getCommonId());
+ setConnectionType(serviceFeasibilityCheckInput.getConnectionType());
+ setSdncRequestHeader(serviceFeasibilityCheckInput.getSdncRequestHeader());
+ setHardConstraints(serviceFeasibilityCheckInput.getHardConstraints());
+ setSoftConstraints(serviceFeasibilityCheckInput.getSoftConstraints());
+ setServiceAEnd(serviceFeasibilityCheckInput.getServiceAEnd());
+ setServiceZEnd(serviceFeasibilityCheckInput.getServiceZEnd());
+ setCustomer(serviceFeasibilityCheckInput.getCustomer());
+ setCustomerContact(serviceFeasibilityCheckInput.getCustomerContact());
+ setServiceReconfigure(false);
}
public ServiceInput(TempServiceDeleteInput tempServiceDeleteInput) {
setServiceName(comId);
setCommonId(comId);
setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId(comId).build());
+ setServiceReconfigure(false);
}
public ServiceCreateInput getServiceCreateInput() {
- return new ServiceCreateInputBuilder().setServiceName(serviceName)
+ ServiceCreateInputBuilder serviceCreateInputBuilder = new ServiceCreateInputBuilder()
.setCommonId(commonId)
.setConnectionType(connectionType)
.setSdncRequestHeader(sdncRequestHeader)
.setServiceAEnd(new ServiceAEndBuilder(serviceAEnd).build())
.setServiceZEnd(new ServiceZEndBuilder(serviceZEnd).build())
.setCustomer(customer)
- .setCustomerContact(customerContact).build();
+ .setCustomerContact(customerContact);
+ if (isServiceReconfigure()) {
+ serviceCreateInputBuilder.setServiceName(newServiceName);
+ } else {
+ serviceCreateInputBuilder.setServiceName(serviceName);
+ }
+ return serviceCreateInputBuilder.build();
}
public TempServiceCreateInput getTempServiceCreateInput() {
public void setCustomerContact(String customerContact) {
this.customerContact = customerContact;
}
+
+ public String getNewServiceName() {
+ return newServiceName;
+ }
+
+ public void setNewServiceName(String newServiceName) {
+ this.newServiceName = newServiceName;
+ }
+
+ public boolean isServiceReconfigure() {
+ return serviceReconfigure;
+ }
+
+ public void setServiceReconfigure(boolean serviceReconfigure) {
+ this.serviceReconfigure = serviceReconfigure;
+ }
}
@Override
public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
ServiceFeasibilityCheckInput input) {
- throw new UnsupportedOperationException("Not implemented yet");
+ LOG.info("RPC service feasibility check received");
+ // Validation
+ ServiceInput serviceInput = new ServiceInput(input);
+ OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
+ RpcActions.ServiceFeasibilityCheck);
+ if (! validationResult.isSuccess()) {
+ LOG.warn("Aborting service feasibility check because validation of service create request failed: {}",
+ validationResult.getResultMessage());
+ return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
+ validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
+ }
+ this.pceListenerImpl.setInput(new ServiceInput(input));
+ this.pceListenerImpl.setServiceReconfigure(false);
+ this.pceListenerImpl.setServiceFeasiblity(true);
+ this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
+ this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
+ this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
+ LOG.info("Commencing PCE");
+ PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
+ if (output != null) {
+ LOG.info("Service compliant, serviceFeasibilityCheck in progress...");
+ ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
+ return ModelMappingUtils.createCreateServiceReply(input, common.getAckFinalIndicator(),
+ common.getResponseMessage(), common.getResponseCode());
+ } else {
+ return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
+ "PCE calculation failed", ResponseCodes.RESPONSE_FAILED);
+ }
}
@Override
public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
- throw new UnsupportedOperationException("Not implemented yet");
+ LOG.info("RPC service reconfigure received");
+ String message = "";
+ Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(input.getServiceName());
+ if (servicesObject.isPresent()) {
+ LOG.info("Service '{}' is present", input.getServiceName());
+ OperationResult validationResult = ServiceCreateValidation
+ .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
+ if (!validationResult.isSuccess()) {
+ LOG.warn("Aborting service reconfigure because validation of service create request failed: {}",
+ validationResult.getResultMessage());
+ return ModelMappingUtils.createCreateServiceReply(input, validationResult.getResultMessage(),
+ RpcStatus.Failed);
+ }
+ this.pceListenerImpl.setInput(new ServiceInput(input));
+ this.pceListenerImpl.setServiceReconfigure(true);
+ this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
+ this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
+ this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
+ .ServiceDeleteInput serviceDeleteInput =
+ ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
+ .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
+ ServiceNotificationTypes.ServiceDeleteResult);
+ if (output != null) {
+ LOG.info("Service compliant, service reconfigure in progress...");
+ ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
+ return ModelMappingUtils.createCreateServiceReply(input, common.getResponseMessage(),
+ RpcStatus.Successful);
+ } else {
+ return ModelMappingUtils.createCreateServiceReply(input, "Renderer service delete failed !",
+ RpcStatus.Successful);
+ }
+ } else {
+ LOG.error("Service '{}' is not present", input.getServiceName());
+ message = "Service '" + input.getServiceName() + "' is not present";
+ return ModelMappingUtils.createCreateServiceReply(input, message, RpcStatus.Failed);
+ }
}
@Override
private ServiceInput input;
private Boolean serviceReconfigure;
private Boolean tempService;
+ private Boolean serviceFeasiblity;
public PceListenerImpl(RendererServiceOperations rendererServiceOperations,
PathComputationService pathComputationService, NotificationPublishService notificationPublishService,
setServiceReconfigure(false);
setInput(null);
setTempService(false);
+ setServiceFeasiblity(false);
}
@Override
.setAToZDirection(servicePathRpcResult.getPathDescription().getAToZDirection())
.setZToADirection(servicePathRpcResult.getPathDescription().getZToADirection()).build();
LOG.info("PathDescription gets : {}", pathDescription);
- if (input == null) {
- LOG.error("Input is null !");
- return;
- }
- OperationResult operationResult = null;
- if (tempService) {
- operationResult = this.serviceDataStoreOperations
- .createTempService(input.getTempServiceCreateInput());
- if (!operationResult.isSuccess()) {
- LOG.error("Temp Service not created in datastore !");
+ if (!serviceFeasiblity) {
+ if (input == null) {
+ LOG.error("Input is null !");
+ return;
}
- } else {
- operationResult = this.serviceDataStoreOperations
- .createService(input.getServiceCreateInput());
- if (!operationResult.isSuccess()) {
- LOG.error("Service not created in datastore !");
+ OperationResult operationResult = null;
+ if (tempService) {
+ operationResult = this.serviceDataStoreOperations
+ .createTempService(input.getTempServiceCreateInput());
+ if (!operationResult.isSuccess()) {
+ LOG.error("Temp Service not created in datastore !");
+ }
+ } else {
+ operationResult = this.serviceDataStoreOperations
+ .createService(input.getServiceCreateInput());
+ if (!operationResult.isSuccess()) {
+ LOG.error("Service not created in datastore !");
+ }
}
+ ResponseParameters responseParameters = new ResponseParametersBuilder()
+ .setPathDescription(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c
+ ._interface.service.types.rev171016.response.parameters.sp.response
+ .parameters.PathDescriptionBuilder(pathDescription).build())
+ .build();
+ PathComputationRequestOutput pceResponse = new PathComputationRequestOutputBuilder()
+ .setResponseParameters(responseParameters).build();
+ OperationResult operationServicePathSaveResult =
+ this.serviceDataStoreOperations.createServicePath(input, pceResponse);
+ if (!operationServicePathSaveResult.isSuccess()) {
+ LOG.error("Service Path not created in datastore !");
+ }
+ ServiceImplementationRequestInput serviceImplementationRequest =
+ ModelMappingUtils.createServiceImplementationRequest(input, pathDescription);
+ LOG.info("Sending serviceImplementation request : {}", serviceImplementationRequest);
+ this.rendererServiceOperations.serviceImplementation(serviceImplementationRequest);
+ } else {
+ LOG.warn("service-feasibility-check RPC ");
}
- ResponseParameters responseParameters = new ResponseParametersBuilder()
- .setPathDescription(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c
- ._interface.service.types.rev171016.response.parameters.sp.response
- .parameters.PathDescriptionBuilder(pathDescription).build())
- .build();
- PathComputationRequestOutput pceResponse = new PathComputationRequestOutputBuilder()
- .setResponseParameters(responseParameters).build();
- OperationResult operationServicePathSaveResult =
- this.serviceDataStoreOperations.createServicePath(input, pceResponse);
- if (!operationServicePathSaveResult.isSuccess()) {
- LOG.error("Service Path not created in datastore !");
- }
- ServiceImplementationRequestInput serviceImplementationRequest =
- ModelMappingUtils.createServiceImplementationRequest(input, pathDescription);
- LOG.info("Sending serviceImplementation request : {}", serviceImplementationRequest);
- this.rendererServiceOperations.serviceImplementation(serviceImplementationRequest);
} else {
LOG.error("'PathDescription' parameter is null ");
return;
this.tempService = tempService;
}
+ public void setServiceFeasiblity(Boolean serviceFeasiblity) {
+ this.serviceFeasiblity = serviceFeasiblity;
+ }
+
}
return;
}
break;
-
default:
break;
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp.PceMetric;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.routing.constraints.sp.HardConstraints;
}
}
+ public PathComputationRequestOutput performPCE(ServiceFeasibilityCheckInput serviceFeasibilityCheckInput,
+ boolean reserveResource) {
+ LOG.info("performing PCE ...");
+ if (validateParams(serviceFeasibilityCheckInput.getCommonId(),
+ serviceFeasibilityCheckInput.getSdncRequestHeader())) {
+ return performPCE(serviceFeasibilityCheckInput.getHardConstraints(),
+ serviceFeasibilityCheckInput.getSoftConstraints(), serviceFeasibilityCheckInput.getCommonId(),
+ serviceFeasibilityCheckInput.getSdncRequestHeader(), serviceFeasibilityCheckInput.getServiceAEnd(),
+ serviceFeasibilityCheckInput.getServiceZEnd(),
+ ServiceNotificationTypes.ServiceFeasibilityCheckResult, reserveResource);
+ } else {
+ return returnPCEFailed();
+ }
+ }
+
private PathComputationRequestOutput performPCE(org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains
.rev161014.routing.constraints.HardConstraints hardConstraints, org.opendaylight.yang.gen.v1.http.org
.openroadm.routing.constrains.rev161014.routing.constraints.SoftConstraints softConstraints,
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
.ServiceDeleteInput input = ModelMappingUtils.createServiceDeleteInput(serviceRerouteinput, service.get());
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES).setRequestId("1")
- .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("Service reroute successfully !")
+ .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("Renderer service delete in progress")
.build();
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
.ServiceDeleteOutput output = new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer
ServiceRerouteOutput result = this.serviceHandlerImplMock.serviceReroute(serviceRerouteinput).get().getResult();
Assert.assertEquals(org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus.Successful,
result.getStatus());
- Assert.assertEquals("Service reroute successfully !", result.getStatusMessage());
+ Assert.assertEquals("Renderer service delete in progress", result.getStatusMessage());
+ }
+
+ @Test
+ public void reConfigureServiceIfserviceNotPresent() throws ExecutionException, InterruptedException {
+ ServiceReconfigureInput input = ServiceDataUtils.buildServiceReconfigureInput();
+ ServiceReconfigureOutput result = this.serviceHandler.serviceReconfigure(input).get().getResult();
+ Assert.assertEquals(result.getStatus(), RpcStatus.Failed);
+ Assert.assertEquals(result.getStatusMessage(), "Service 'service 1' is not present");
+ }
+
+ @Test
+ public void reConfigureServiceIfserviceIsPresent() throws ExecutionException, InterruptedException {
+ ServiceReconfigureInput serviceReconfigureInput = ServiceDataUtils.buildServiceReconfigureInput();
+ Services serviceMock = ModelMappingUtils.mappingServices(null, serviceReconfigureInput);
+ Optional<Services> service = Optional.of(serviceMock);
+ Mockito.when(this.serviceDataStoreOperationsMock.getService(any(String.class))).thenReturn(service);
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput input =
+ ModelMappingUtils.createServiceDeleteInput(serviceReconfigureInput);
+ ConfigurationResponseCommon configurationResponseCommon =
+ new ConfigurationResponseCommonBuilder().setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
+ .setRequestId("1").setResponseCode(ResponseCodes.RESPONSE_OK)
+ .setResponseMessage("Renderer service delete in progress").build();
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput output =
+ new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
+ .ServiceDeleteOutputBuilder().setConfigurationResponseCommon(configurationResponseCommon).build();
+ Mockito.when(
+ this.rendererServiceWrapperMock.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult))
+ .thenReturn(output);
+ ServiceReconfigureOutput result =
+ this.serviceHandlerImplMock.serviceReconfigure(serviceReconfigureInput).get().getResult();
+ Assert.assertEquals(org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus.Successful,
+ result.getStatus());
+ Assert.assertEquals("Renderer service delete in progress", result.getStatusMessage());
}
}
verify(this.rendererServiceOperationsMock).serviceImplementation(any(ServiceImplementationRequestInput.class));
}
+ @Test
+ public void onServicePathRpcResultPCRSuccessFeasabilityCheck() {
+ InjectField.inject(this.pceListenerImplMock, "serviceReconfigure", false);
+ InjectField.inject(this.pceListenerImplMock, "serviceFeasiblity", true);
+ ServicePathRpcResult notification = ServiceDataUtils.buildServicePathRpcResult(
+ ServicePathNotificationTypes.PathComputationRequest, "service 1", RpcStatusEx.Successful, "", true);
+ this.pceListenerImplMock.onServicePathRpcResult(notification);
+ verifyZeroInteractions(this.serviceDataStoreOperationsMock);
+ verifyZeroInteractions(this.rendererServiceOperationsMock);
+ }
+
@Test
public void onServicePathRpcResultCRRSuccessWithNoReconfigure() {
ServicePathRpcResult notification = ServiceDataUtils.buildServicePathRpcResult(
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
return builtInput.build();
}
+ public static ServiceFeasibilityCheckInput buildServiceFeasibilityCheckInput() {
+ ServiceFeasibilityCheckInputBuilder builtInput = new ServiceFeasibilityCheckInputBuilder();
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.feasibility.check.input
+ .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
+ .feasibility.check.input.ServiceAEndBuilder()
+ .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
+ .setNodeId("XPONDER-1-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
+ .build();
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.feasibility.check.input
+ .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
+ .feasibility.check.input.ServiceZEndBuilder()
+ .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
+ .setNodeId("XPONDER-3-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
+ .build();
+ builtInput.setCommonId("commonId");
+ builtInput.setConnectionType(ConnectionType.Service);
+ builtInput.setCustomer("Customer");
+ builtInput.setServiceAEnd(serviceAEnd);
+ builtInput.setServiceZEnd(serviceZEnd);
+ builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
+ .setRpcAction(RpcActions.ServiceFeasibilityCheck).setNotificationUrl("notification url").build());
+ return builtInput.build();
+ }
+
public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
.ServiceAEndBuilder getServiceAEndBuild() {
return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
return builder.build();
}
+ public static ServiceReconfigureInput buildServiceReconfigureInput() {
+ ServiceReconfigureInputBuilder builtInput = new ServiceReconfigureInputBuilder();
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
+ .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
+ .reconfigure.input.ServiceAEndBuilder()
+ .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
+ .setNodeId("XPONDER-1-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
+ .build();
+ org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
+ .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
+ .reconfigure.input.ServiceZEndBuilder()
+ .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
+ .setNodeId("XPONDER-3-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
+ .build();
+ builtInput.setCommonId("commonId");
+ builtInput.setConnectionType(ConnectionType.Service);
+ builtInput.setCustomer("Customer");
+ builtInput.setServiceName("service 1");
+ builtInput.setServiceAEnd(serviceAEnd);
+ builtInput.setServiceZEnd(serviceZEnd);
+ return builtInput.build();
+ }
+
public static ServicePathRpcResult buildServicePathRpcResult() {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
time.sleep(1)
# Create Service 'test' with correct parameters
- def test_07_create_service(self):
+ def test_07_create_service_success(self):
url = ("{}/operations/org-openroadm-service:service-create"
.format(self.restconf_baseurl))
data = {"input": {
time.sleep(20)
# Create Service 'test' with not compliant parameter : no 'sdnc-request-header' parameter
- def test_08_create_service(self):
+ def test_08_create_service_failed(self):
url = ("{}/operations/org-openroadm-service:service-create"
.format(self.restconf_baseurl))
data = {"input": {
time.sleep(5)
# Create Service 'test' with not compliant parameter : no 'tx-direction' for serviceAEnd
- def test_09_create_service(self):
+ def test_09_create_service_failed(self):
url = ("{}/operations/org-openroadm-service:service-create"
.format(self.restconf_baseurl))
data = {"input": {
time.sleep(5)
# Get 'test' service created
- def test_10_get_service(self):
+ def test_10_verify_service_created(self):
url = ("{}/operational/org-openroadm-service:service-list/services/test"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json',
time.sleep(1)
# get non existing service
- def test_11_get_service(self):
+ def test_11_get_non_existing_service(self):
url = ("{}/operational/org-openroadm-service:service-list/services/test1"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json',
self.assertEqual(response.status_code, 404)
time.sleep(1)
-# These tests is not available in this commit (cf commit message )
-# reconfigure 'test' to be 'test-new'
-# def test_08_reconfigure_service(self):
-# url = ("{}/operations/org-openroadm-service:service-reconfigure"
-# .format(self.restconf_baseurl))
-# data = {"input": {
-# "service-name": "test",
-# "new-service-name": "test-new",
-# "common-id": "ASATT1234567",
-# "connection-type": "infrastructure",
-# "service-a-end": {
-# "service-rate": "100",
-# "node-id": "XPDRA",
-# "service-format": "Ethernet",
-# "clli": "SNJSCAMCJP8",
-# "tx-direction": {
-# "port": {
-# "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
-# "port-type": "router",
-# "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
-# "port-rack": "000000.00",
-# "port-shelf": "00"
-# },
-# "lgx": {
-# "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
-# "lgx-port-name": "LGX Back.3",
-# "lgx-port-rack": "000000.00",
-# "lgx-port-shelf": "00"
-# }
-# },
-# "rx-direction": {
-# "port": {
-# "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
-# "port-type": "router",
-# "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
-# "port-rack": "000000.00",
-# "port-shelf": "00"
-# },
-# "lgx": {
-# "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
-# "lgx-port-name": "LGX Back.4",
-# "lgx-port-rack": "000000.00",
-# "lgx-port-shelf": "00"
-# }
-# },
-# "optic-type": "gray"
-# },
-# "service-z-end": {
-# "service-rate": "100",
-# "node-id": "XPDRC",
-# "service-format": "Ethernet",
-# "clli": "SNJSCAMCJT4",
-# "tx-direction": {
-# "port": {
-# "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
-# "port-type": "router",
-# "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
-# "port-rack": "000000.00",
-# "port-shelf": "00"
-# },
-# "lgx": {
-# "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
-# "lgx-port-name": "LGX Back.29",
-# "lgx-port-rack": "000000.00",
-# "lgx-port-shelf": "00"
-# }
-# },
-# "rx-direction": {
-# "port": {
-# "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
-# "port-type": "router",
-# "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
-# "port-rack": "000000.00",
-# "port-shelf": "00"
-# },
-# "lgx": {
-# "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
-# "lgx-port-name": "LGX Back.30",
-# "lgx-port-rack": "000000.00",
-# "lgx-port-shelf": "00"
-# }
-# },
-# "optic-type": "gray"
-# },
-# "hard-constraints": {
-# "diversity": {
-# "existing-service": [
-# "104/GE100/SNJSCAMCJP8/SNJSCAMCJT4"
-# ],
-# "existing-service-applicability": {
-# "node": "true"
-# }
-# },
-# "exclude": {
-# "fiber-bundle": [
-# "l(string)"
-# ],
-# "node-id": [
-# "SNJSCAMCJP8_000000.00"
-# ]
-# },
-# "latency": {
-# "max-latency": "30"
-# }
-# }
-# }
-# }
-# headers = {'content-type': 'application/json',
-# "Accept": "application/json"}
-# response = requests.request(
-# "POST", url, data=json.dumps(data), headers=headers,
-# auth=('admin', 'admin'))
-# self.assertEqual(response.status_code, requests.codes.ok)
-# res = response.json()
-# self.assertIn('in progress',
-# res['output']['status-message'])
-# time.sleep(30)
-#
-# # get new service 'test-new'
-# def test_09_get_service(self):
-# url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
-# .format(self.restconf_baseurl))
-# headers = {'content-type': 'application/json',
-# "Accept": "application/json"}
-# response = requests.request(
-# "GET", url, headers=headers, auth=('admin', 'admin'))
-# res = response.json()
-# self.assertEqual(
-# res['services'][0]['operational-state'],
-# 'inService')
-# time.sleep(1)
-#
-# # Modify 'test-new' state
-# def test_10_modify_service_state(self):
-# url = ("{}/operations/servicehandler:service-state-modify"
-# .format(self.restconf_baseurl))
-# data = {"input": {
-# "service-name": "test-new",
-# "operational-state": "outOfService"
-# }
-# }
-# headers = {'content-type': 'application/json'}
-# response = requests.request(
-# "POST", url, data=json.dumps(data), headers=headers,
-# auth=('admin', 'admin'))
-# res = response.json()
-# self.assertIn('Service state modified',
-# res['output']['configuration-response-common']['response-message'])
-# time.sleep(5)
-#
-# # get new service 'test-new' state
-# def test_11_get_service(self):
-# url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
-# .format(self.restconf_baseurl))
-# headers = {'content-type': 'application/json',
-# "Accept": "application/json"}
-# response = requests.request(
-# "GET", url, headers=headers, auth=('admin', 'admin'))
-# res = response.json()
-# self.assertEqual(
-# res['services'][0]['operational-state'],
-# 'outOfService')
-# time.sleep(1)
-#
-# # restore service 'test-new'
-# def test_12_restore_service(self):
-# url = ("{}/operations/org-openroadm-service:service-restoration"
-# .format(self.restconf_baseurl))
-# data = {"input": {
-# "service-name": "test-new",
-# "option": "permanent"
-# }
-# }
-# headers = {'content-type': 'application/json'}
-# response = requests.request(
-# "POST", url, data=json.dumps(data), headers=headers,
-# auth=('admin', 'admin'))
-# res = response.json()
-# self.assertIn('in progress',
-# res['output']['status-message'])
-# time.sleep(60)
-#
-# # get new service 'test-new' state
-# def test_13_get_service(self):
-# url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
-# .format(self.restconf_baseurl))
-# headers = {'content-type': 'application/json',
-# "Accept": "application/json"}
-# response = requests.request(
-# "GET", url, headers=headers, auth=('admin', 'admin'))
-# res = response.json()
-# self.assertEqual(
-# res['services'][0]['operational-state'],
-# 'inService')
-# time.sleep(1)
+ #reconfigure 'test' to be 'test-new'
+ def test_12_reconfigure_service_test(self):
+ url = ("{}/operations/org-openroadm-service:service-reconfigure"
+ .format(self.restconf_baseurl))
+ data = {"input": {
+ "service-name": "test",
+ "new-service-name": "test-new",
+ "common-id": "ASATT1234567",
+ "connection-type": "infrastructure",
+ "service-a-end": {
+ "service-rate": "100",
+ "node-id": "XPDRA",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJP8",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.3",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+ "lgx-port-name": "LGX Back.4",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ },
+ "service-z-end": {
+ "service-rate": "100",
+ "node-id": "XPDRC",
+ "service-format": "Ethernet",
+ "clli": "SNJSCAMCJT4",
+ "tx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.29",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "rx-direction": {
+ "port": {
+ "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+ "port-type": "router",
+ "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+ "port-rack": "000000.00",
+ "port-shelf": "00"
+ },
+ "lgx": {
+ "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+ "lgx-port-name": "LGX Back.30",
+ "lgx-port-rack": "000000.00",
+ "lgx-port-shelf": "00"
+ }
+ },
+ "optic-type": "gray"
+ }
+ }
+ }
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "POST", url, data=json.dumps(data), headers=headers,
+ auth=('admin', 'admin'))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Renderer service delete in progress',
+ res['output']['status-message'])
+ time.sleep(30)
+
+ # get new service 'test-new'
+ def test_13_verify_service_reconfigure(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+ .format(self.restconf_baseurl))
+ headers = {'content-type': 'application/json',
+ "Accept": "application/json"}
+ response = requests.request(
+ "GET", url, headers=headers, auth=('admin', 'admin'))
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['administrative-state'],
+ 'inService')
+ time.sleep(1)
# Delete service
- def test_12_delete_service(self):
+ def test_14_delete_service_reconfigure(self):
url = ("{}/operations/org-openroadm-service:service-delete"
.format(self.restconf_baseurl))
data = {"input": {
"notification-url": "http://localhost:8585/NotificationServer/notify"
},
"service-delete-req-info": {
- "service-name": "test",
+ "service-name": "test-new",
"due-date": "2016-11-28T00:00:01Z",
"tail-retention": "no"
}
time.sleep(20)
# Verify 'test' service deleted
- def test_13_get_service(self):
- url = ("{}/operational/org-openroadm-service:service-list/services/test"
+ def test_15_verify_service_reconfigure_deleted(self):
+ url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json',
"Accept": "application/json"}
time.sleep(1)
# Create Temp Service 'ASATT1234567' with correct parameters
- def test_14_create_temp_service(self):
+ def test_16_create_temp_service_success(self):
url = ("{}/operations/org-openroadm-service:temp-service-create"
.format(self.restconf_baseurl))
data = {
# Create Temp Service not compliant with no common-id
- def test_15_create_temp_service(self):
+ def test_17_create_temp_service_failed(self):
url = ("{}/operations/org-openroadm-service:temp-service-create"
.format(self.restconf_baseurl))
data = {
time.sleep(5)
# Get 'ASATT1234567' temp service created
- def test_16_get_temp_service(self):
+ def test_18_verify_temp_service_created(self):
url = ("{}/operational/org-openroadm-service:temp-service-list/services/ASATT1234567"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json',
time.sleep(1)
# get non existing service
- def test_17_get_temp_service(self):
+ def test_19_get_temp_service_non_existed(self):
url = ("{}/operational/org-openroadm-service:temp-service-list/services/test1"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json',
time.sleep(1)
# Delete temp service
- def test_18_delete_temp_service(self):
+ def test_20_delete_temp_service_created(self):
url = ("{}/operations/org-openroadm-service:temp-service-delete"
.format(self.restconf_baseurl))
data = {"input": {
time.sleep(20)
# Verify 'test' service deleted
- def test_19_verify_temp_service_deleted(self):
+ def test_21_verify_temp_service_deleted(self):
url = ("{}/operational/org-openroadm-service:service-list/services/ASATT1234567"
.format(self.restconf_baseurl))
headers = {'content-type': 'application/json',