private String responseCode;
private final GnpyConsumer gnpyConsumer;
private PortMapping portMapping;
- // Define the termination points whose reserved status is not taken into account during the pruning process
+ // Define the termination points whose reservation status is not taken into account during the pruning process
private Endpoints endpoints;
public PceSendingPceRPCs(GnpyConsumer gnpyConsumer) {
private List<LinkId> linksToExclude = new ArrayList<>();
private PceResult returnStructure;
private PortMapping portMapping;
- // Define the termination points whose reserved status is not taken into account during the pruning process
+ // Define the termination points whose reservation status is not taken into account during the pruning process
private Endpoints endpoints;
private enum ConstraintTypes {
}
public static ListenableFuture<RpcResult<ServiceRerouteOutput>> createRerouteServiceReply(
- ServiceRerouteInput input, String finalAckYes, String message) {
+ ServiceRerouteInput input, String finalAckYes, String message, String responseCode) {
return RpcResultBuilder
.success(
new ServiceRerouteOutputBuilder()
.setConfigurationResponseCommon(
new ConfigurationResponseCommonBuilder()
- .setResponseMessage(message)
- .build())
+ .setAckFinalIndicator(finalAckYes)
+ .setResponseCode(responseCode)
+ .setResponseMessage(message)
+ .build())
.setHardConstraints(null)
.setSoftConstraints(null)
.build())
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceDeleteInput;
* Super class of {@link ServiceCreateInput} and {@link TempServiceCreateInput}.
*
* @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
- *
*/
public class ServiceInput {
private String serviceName;
setServiceReconfigure(false);
}
+ public ServiceInput(ServiceRerouteInput serviceRerouteInput) {
+ setServiceName(serviceRerouteInput.getServiceName());
+ setSdncRequestHeader(serviceRerouteInput.getSdncRequestHeader());
+ setServiceResiliency(serviceRerouteInput.getServiceResiliency());
+ setServiceReconfigure(false);
+ }
+
public ServiceCreateInput getServiceCreateInput() {
ServiceCreateInputBuilder serviceCreateInputBuilder = new ServiceCreateInputBuilder()
.setCommonId(commonId)
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
+import java.util.Map;
import java.util.Optional;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ServiceNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo.TailRetention;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZKey;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
return "Service '" + serviceName + "' does not exist in datastore";
}
+ public static String servicePathNotInDS(String serviceName) {
+ return "Service Path from '" + serviceName + "' does not exist in datastore";
+ }
+
public static String serviceInService(String serviceName) {
return "Service '" + serviceName + "' is in 'inService' state";
}
if (servicesObject.isEmpty()) {
LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
return ModelMappingUtils.createRerouteServiceReply(
- input, ResponseCodes.FINAL_ACK_NO,
- LogMessages.serviceNotInDS(serviceName));
+ input, ResponseCodes.FINAL_ACK_YES,
+ LogMessages.serviceNotInDS(serviceName),
+ ResponseCodes.RESPONSE_FAILED);
}
Services service = servicesObject.get();
- DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
- OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
- DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
- SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
- .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
- .setRequestId(service.getSdncRequestHeader().getRequestId())
- .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
- .setRpcAction(RpcActions.ServiceDelete);
- ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
- .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
- .setServiceName(serviceName).setDueDate(datetime)
- .setTailRetention(TailRetention.No).build())
- .setSdncRequestHeader(sdncBuilder.build());
- ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
+ Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
+ if (servicePathsObject.isEmpty()) {
+ LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
+ return ModelMappingUtils.createRerouteServiceReply(
+ input, ResponseCodes.FINAL_ACK_YES,
+ LogMessages.servicePathNotInDS(serviceName),
+ ResponseCodes.RESPONSE_FAILED);
+ }
+ ServicePaths servicePaths = servicePathsObject.get();
+ // serviceInput for later use maybe...
+ ServiceInput serviceInput = new ServiceInput(input);
serviceInput.setServiceAEnd(service.getServiceAEnd());
serviceInput.setServiceZEnd(service.getServiceZEnd());
serviceInput.setConnectionType(service.getConnectionType());
- this.pceListenerImpl.setInput(serviceInput);
- this.pceListenerImpl.setServiceReconfigure(true);
- this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
- this.rendererListenerImpl.setServiceInput(serviceInput);
- this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
- this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
- .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
- new ServiceInput(deleteInputBldr.build()));
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
- .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
- ServiceNotificationTypes.ServiceDeleteResult, null);
+ serviceInput.setCommonId(service.getCommonId());
+ serviceInput.setHardConstraints(service.getHardConstraints());
+ serviceInput.setSoftConstraints(service.getSoftConstraints());
+ serviceInput.setCustomer(service.getCustomer());
+ serviceInput.setCustomerContact(service.getCustomerContact());
+
+ // Get the network xpdr termination points
+ 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());
+
if (output == null) {
- LOG.error("serviceReroute: {}", LogMessages.RENDERER_DELETE_FAILED);
+ LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
return ModelMappingUtils.createRerouteServiceReply(
input, ResponseCodes.FINAL_ACK_YES,
- LogMessages.RENDERER_DELETE_FAILED);
+ LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
}
- LOG.info("RPC ServiceReroute in progress...");
+ LOG.info("RPC ServiceReroute is done");
ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
- return ModelMappingUtils.createRerouteServiceReply(
- input, common.getAckFinalIndicator(),
- common.getResponseMessage());
+ return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
+ common.getResponseMessage(), common.getResponseCode());
}
@Override
*/
package org.opendaylight.transportpce.servicehandler.listeners;
-import static org.opendaylight.transportpce.servicehandler.ModelMappingUtils.createServiceAEndReroute;
-import static org.opendaylight.transportpce.servicehandler.ModelMappingUtils.createServiceZEndReroute;
-
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.Collection;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.Restorable;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.routing.metric.RoutingMetric;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.resiliency.ServiceResiliency;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.create.input.ServiceAEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.create.input.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
private final ScheduledExecutorService executor;
public ServiceListener(ServicehandlerImpl servicehandlerImpl, ServiceDataStoreOperations serviceDataStoreOperations,
- NotificationPublishService notificationPublishService,
- PathComputationService pathComputationService) {
+ NotificationPublishService notificationPublishService) {
this.servicehandlerImpl = servicehandlerImpl;
this.notificationPublishService = notificationPublishService;
this.serviceDataStoreOperations = serviceDataStoreOperations;
- this.pathComputationService = pathComputationService;
this.executor = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(4));
mapServiceInputReroute = new HashMap<>();
}
&& inputAfter.getServiceResiliency().getResiliency() != null
&& inputAfter.getServiceResiliency().getResiliency().equals(Restorable.VALUE)) {
LOG.info("Attempting to reroute the service '{}'...", serviceInputName);
- if (!serviceRerouteCheck(inputBefore)) {
+ if (!serviceRerouteCheck(serviceInputName, inputAfter.getServiceResiliency(),
+ inputAfter.getRoutingMetric())) {
LOG.info("No other path available, cancelling reroute process of service '{}'...",
serviceInputName);
continue;
}
/**
- * Call the PCE RPC path-computation-reroute-request to check if any other path exists.
+ * Prior to the reroute steps: check that an alternative route of the service is possible.
*
- * @param input Service to be rerouted
+ * @param serviceNameToReroute Name of the service
+ * @param serviceResiliency Resiliency of the service
+ * @param routingMetric Metric of the routing
*/
- 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)
+ private boolean serviceRerouteCheck(String serviceNameToReroute, ServiceResiliency serviceResiliency,
+ RoutingMetric routingMetric) {
+ ServiceRerouteInput serviceRerouteInput = new ServiceRerouteInputBuilder()
+ .setServiceName(serviceNameToReroute)
+ .setServiceResiliency(serviceResiliency)
+ .setRoutingMetric(routingMetric)
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+ .setRpcAction(RpcActions.ServiceReroute)
.build())
.build();
- ListenableFuture<PathComputationRerouteRequestOutput> res =
- pathComputationService.pathComputationRerouteRequest(inputPC);
+ ListenableFuture<RpcResult<ServiceRerouteOutput>> res = this.servicehandlerImpl.serviceReroute(
+ serviceRerouteInput);
try {
- return res.get().getConfigurationResponseCommon().getResponseCode().equals(ResponseCodes.RESPONSE_OK);
+ return res.get().getResult().getConfigurationResponseCommon().getResponseCode()
+ .equals(ResponseCodes.RESPONSE_OK);
} catch (ExecutionException | InterruptedException e) {
LOG.warn("ServiceRerouteCheck FAILED ! ", e);
return false;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.Endpoints;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultShBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ServiceEndpoint;
.build();
}
+ public PathComputationRerouteRequestOutput performPCEReroute(HardConstraints hardConstraints,
+ SoftConstraints softConstraints, SdncRequestHeader serviceHandler, ServiceEndpoint serviceAEnd,
+ ServiceEndpoint serviceZEnd,
+ Endpoints endpoints) {
+ // TODO: Make it asynchronous
+ LOG.info("Calling path computation reroute");
+ PathComputationRerouteRequestInput inputPCE = createPceRerouteRequestInput(hardConstraints, softConstraints,
+ serviceHandler, serviceAEnd, serviceZEnd, endpoints);
+ ListenableFuture<PathComputationRerouteRequestOutput> res =
+ pathComputationService.pathComputationRerouteRequest(inputPCE);
+ try {
+ return res.get();
+ } catch (ExecutionException | InterruptedException e) {
+ LOG.warn("PerformPCEReroute FAILED ! ", e);
+ return new PathComputationRerouteRequestOutputBuilder()
+ .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
+ .setAckFinalIndicator(ResponseCodes.FINAL_ACK_YES)
+ .setRequestId("None")
+ .setResponseCode(ResponseCodes.RESPONSE_OK)
+ .setResponseMessage("PCE calculation FAILED")
+ .build())
+ .build();
+ }
+ }
+
private PathComputationRequestInput createPceRequestInput(String serviceName,
SdncRequestHeader serviceHandler, HardConstraints hardConstraints,
SoftConstraints softConstraints, Boolean reserveResource, ServiceEndpoint serviceAEnd,
.build();
}
+ private PathComputationRerouteRequestInput createPceRerouteRequestInput(HardConstraints hardConstraints,
+ SoftConstraints softConstraints, SdncRequestHeader serviceHandler, ServiceEndpoint serviceAEnd,
+ ServiceEndpoint serviceZEnd, Endpoints endpoints) {
+ LOG.info("Mapping Service-reroute to PCE requests");
+ return new PathComputationRerouteRequestInputBuilder()
+ .setServiceHandlerHeader(serviceHandler == null
+ ? new ServiceHandlerHeaderBuilder().build()
+ : new ServiceHandlerHeaderBuilder().setRequestId(serviceHandler.getRequestId()).build())
+ .setHardConstraints(hardConstraints)
+ .setSoftConstraints(softConstraints)
+ .setPceRoutingMetric(PceMetric.TEMetric)
+ .setEndpoints(new EndpointsBuilder()
+ .setAEndTp(endpoints.getAEndTp())
+ .setZEndTp(endpoints.getZEndTp())
+ .build())
+ .setServiceAEnd(ModelMappingUtils.createServiceAEndReroute(serviceAEnd))
+ .setServiceZEnd(ModelMappingUtils.createServiceZEndReroute(serviceZEnd))
+ .build();
+ }
+
private CancelResourceReserveInput mappingCancelResourceReserve(String serviceName,
SdncRequestHeader sdncRequestHeader) {
LOG.info("Mapping to PCE Cancel resource request input");
<argument ref="serviceHandlerImpl" />
<argument ref="serviceDatastoreOperation" />
<argument ref="notificationPublishService" />
- <argument ref="pathComputationService" />
</bean>
<bean id="rendererListener" class="org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl">
@Test
public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
- // serviceReroute is calling service delete method in renderer
- Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
//create service to be rerouted later
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesBuilder;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService;
when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.DELETE);
when(service.getDataBefore()).thenReturn(buildService(State.InService, AdminStates.InService));
ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations,
- notificationPublishService, pathComputationService);
+ notificationPublishService);
listener.onDataTreeChanged(changes);
verify(ch, times(1)).getRootNode();
verify(service, times(1)).getModificationType();
when(service.getDataBefore()).thenReturn(buildService(State.InService, AdminStates.InService));
when(service.getDataAfter()).thenReturn(serviceDown);
ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations,
- notificationPublishService, pathComputationService);
+ notificationPublishService);
listener.onDataTreeChanged(changes);
verify(ch, times(1)).getRootNode();
verify(service, times(1)).getModificationType();
when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.SUBTREE_MODIFIED);
when(service.getDataBefore()).thenReturn(buildService(State.InService, AdminStates.InService));
ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations,
- notificationPublishService, pathComputationService);
+ notificationPublishService);
listener.onDataTreeChanged(changes);
verify(ch, times(1)).getRootNode();
verify(service, times(2)).getModificationType();
.build())
.build())
.buildFuture());
+ when(servicehandler.serviceReroute(any())).thenReturn(
+ RpcResultBuilder.success(
+ new ServiceRerouteOutputBuilder()
+ .setConfigurationResponseCommon(
+ new ConfigurationResponseCommonBuilder()
+ .setResponseCode(ResponseCodes.RESPONSE_OK)
+ .build())
+ .build())
+ .buildFuture());
when(servicehandler.serviceCreate(any())).thenReturn(
RpcResultBuilder.success(
new ServiceCreateOutputBuilder()
.build())
.build())
.buildFuture());
- ServiceListener listener = Mockito.spy(new ServiceListener(servicehandler, serviceDataStoreOperations,
- notificationPublishService, pathComputationService));
- Mockito.doReturn(true).when(listener).serviceRerouteCheck(any());
-
+ ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations,
+ notificationPublishService);
listener.onDataTreeChanged(changes);
verify(ch, times(1)).getRootNode();
verify(service, times(1)).getModificationType();
when(service.getDataBefore()).thenReturn(buildService(State.InService, AdminStates.InService));
when(service.getDataAfter()).thenReturn(serviceAfter);
ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations,
- notificationPublishService, pathComputationService);
+ notificationPublishService);
listener.onDataTreeChanged(changes);
verify(ch, times(1)).getRootNode();
verify(service, times(1)).getModificationType();