X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=servicehandler%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fservicehandler%2Futils%2FServiceDataUtils.java;h=863c6eac817d70109cb72dd8370bb8a2a0bbcc08;hb=1e2f9a502de80450411761fd2f636e2b7ee32301;hp=a56f6d0209776f20bb6f661e08c990f6b842a969;hpb=8371930fcfb3dc4475348da36df6432407d06bde;p=transportpce.git diff --git a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ServiceDataUtils.java b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ServiceDataUtils.java index a56f6d020..863c6eac8 100644 --- a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ServiceDataUtils.java +++ b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ServiceDataUtils.java @@ -15,18 +15,17 @@ import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.concurrent.Callable; import java.util.concurrent.Executors; -import org.opendaylight.transportpce.servicehandler.MappingConstraints; import org.opendaylight.transportpce.servicehandler.ModelMappingUtils; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.ServicePathRpcResult; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.ServicePathRpcResultBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescription; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescriptionBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceRpcResultSp; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceRpcResultSpBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev171017.ServiceRpcResultSh; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev171017.ServiceRpcResultShBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.ServicePathRpcResult; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.ServicePathRpcResultBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.service.path.rpc.result.PathDescription; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.service.path.rpc.result.PathDescriptionBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSp; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSpBuilder; +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.node.types.rev181130.NodeIdType; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.RpcActions; @@ -63,14 +62,14 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.feasibility.check.inputs.ServiceAEndBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.feasibility.check.inputs.ServiceZEnd; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.feasibility.check.inputs.ServiceZEndBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.AToZDirection; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.AToZDirectionBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.ZToADirection; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.ZToADirectionBuilder; -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.service.types.rev200128.RpcStatusEx; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.ServicePathNotificationTypes; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.handler.header.ServiceHandlerHeaderBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirectionBuilder; +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.service.types.rev220118.RpcStatusEx; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.ServicePathNotificationTypes; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yangtools.yang.common.Uint32; @@ -160,9 +159,6 @@ public final class ServiceDataUtils { } public static PathComputationRequestInput createPceRequestInput(ServiceCreateInput input) { - MappingConstraints mappingConstraints = - new MappingConstraints(input.getHardConstraints(), input.getSoftConstraints()); - mappingConstraints.serviceToServicePathConstarints(); ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder(); SdncRequestHeader serviceHandler = input.getSdncRequestHeader(); if (serviceHandler != null) { @@ -172,9 +168,9 @@ public final class ServiceDataUtils { .setServiceName(input.getServiceName()) .setResourceReserve(true) .setServiceHandlerHeader(serviceHandlerHeader.build()) - .setHardConstraints(mappingConstraints.getServicePathHardConstraints()) - .setSoftConstraints(mappingConstraints.getServicePathSoftConstraints()) - .setPceMetric(PceMetric.TEMetric) + .setHardConstraints(input.getHardConstraints()) + .setSoftConstraints(input.getSoftConstraints()) + .setPceRoutingMetric(PceMetric.TEMetric) .setServiceAEnd(ModelMappingUtils.createServiceAEnd(input.getServiceAEnd())) .setServiceZEnd(ModelMappingUtils.createServiceZEnd(input.getServiceZEnd())) .build(); @@ -392,19 +388,20 @@ public final class ServiceDataUtils { return builder.build(); } - public static ServiceRpcResultSp buildServiceRpcResultSp() { + public static RendererRpcResultSp buildRendererRpcResultSp() { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx"); OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC); DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime)); - ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder(); + RendererRpcResultSpBuilder builder = new RendererRpcResultSpBuilder(); builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest) .setServiceName("service 1").setStatus(RpcStatusEx.Successful).setStatusMessage("success"); return builder.build(); } - public static ServiceRpcResultSp buildServiceRpcResultSp(ServicePathNotificationTypes servicePathNotificationTypes, + public static RendererRpcResultSp buildRendererRpcResultSp( + ServicePathNotificationTypes servicePathNotificationTypes, String serviceName, RpcStatusEx rpcStatusEx, String message) { - ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder(); + RendererRpcResultSpBuilder builder = new RendererRpcResultSpBuilder(); builder.setNotificationType(servicePathNotificationTypes).setServiceName(serviceName) .setStatus(rpcStatusEx).setStatusMessage(message); return builder.build(); @@ -413,7 +410,7 @@ public final class ServiceDataUtils { public static ServiceRpcResultSh buildServiceRpcResultSh( ServiceNotificationTypes serviceNotificationTypes, String serviceName, - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.RpcStatusEx + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx rpcStatusEx, String message) { ServiceRpcResultShBuilder builder = new ServiceRpcResultShBuilder(); @@ -422,11 +419,11 @@ public final class ServiceDataUtils { return builder.build(); } - public static ServiceRpcResultSp buildFailedServiceRpcResultSp() { + public static RendererRpcResultSp buildFailedRendererRpcResultSp() { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx"); OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC); DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime)); - ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder(); + RendererRpcResultSpBuilder builder = new RendererRpcResultSpBuilder(); builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest) .setServiceName("service 1").setStatus(RpcStatusEx.Failed).setStatusMessage("failed"); return builder.build();