package org.opendaylight.transportpce.servicehandler.utils;
import com.google.common.util.concurrent.ListenableFuture;
-
-import org.opendaylight.transportpce.servicehandler.MappingConstraints;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.path.computation.request.input.ServiceAEnd;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.path.computation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.path.computation.request.input.ServiceZEnd;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.path.computation.request.input.ServiceZEndBuilder;
-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.renderer.rev171017.ServiceDeleteInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.path.computation.request.input.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.path.computation.request.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.path.computation.request.input.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.path.computation.request.input.ServiceZEndBuilder;
+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.renderer.rev210915.ServiceDeleteInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInputBuilder;
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.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.routing.constraints.sp.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.routing.constraints.sp.SoftConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirectionBuilder;
-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.service.types.rev200128.service.path.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder;
+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.http.org.transportpce.b.c._interface.service.types.rev220118.service.path.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-public final class ModelMappingUtils {
- private static final Logger LOG = LoggerFactory.getLogger(ModelMappingUtils.class);
+public final class ModelMappingUtils {
private ModelMappingUtils() {
}
ServiceImplementationRequestInputBuilder serviceImplementationRequestInputBuilder =
new ServiceImplementationRequestInputBuilder();
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();
+ org.opendaylight.yang.gen.v1.http
+ .org.opendaylight.transportpce.renderer.rev210915.service.implementation.request.input.ServiceAEndBuilder
+ serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
+ .service.implementation.request.input.ServiceAEndBuilder();
serviceAEnd.setServiceFormat(input.getServiceAEnd().getServiceFormat())
.setServiceRate(input.getServiceAEnd().getServiceRate()).setClli(input.getServiceAEnd().getClli())
.setNodeId(input.getServiceAEnd().getNodeId().getValue())
- .setTxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirectionBuilder()
+ .setTxDirection(new org.opendaylight.yang.gen.v1.http
+ .org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder()
.setPort(input.getServiceAEnd().getTxDirection().getPort()).build())
- .setRxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirectionBuilder()
+ .setRxDirection(new org.opendaylight.yang.gen.v1.http
+ .org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder()
.setPort(input.getServiceAEnd().getRxDirection().getPort()).build());
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.service.implementation
- .request.input.ServiceZEndBuilder serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.opendaylight
- .transportpce.renderer.rev171017.service.implementation.request.input.ServiceZEndBuilder();
+ org.opendaylight.yang.gen.v1.http
+ .org.opendaylight.transportpce.renderer.rev210915.service.implementation.request.input.ServiceZEndBuilder
+ serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
+ .service.implementation.request.input.ServiceZEndBuilder();
serviceZEnd.setServiceFormat(input.getServiceZEnd().getServiceFormat())
.setServiceRate(input.getServiceZEnd().getServiceRate()).setClli(input.getServiceZEnd().getClli())
.setNodeId(input.getServiceZEnd().getNodeId().getValue())
- .setTxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirectionBuilder()
+ .setTxDirection(new org.opendaylight.yang.gen.v1.http
+ .org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder()
.setPort(input.getServiceZEnd().getTxDirection().getPort()).build())
- .setRxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirectionBuilder()
+ .setRxDirection(new org.opendaylight.yang.gen.v1.http
+ .org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder()
.setPort(input.getServiceZEnd().getRxDirection().getPort()).build());
serviceImplementationRequestInputBuilder.setServiceAEnd(serviceAEnd.build());
serviceImplementationRequestInputBuilder.setServiceZEnd(serviceZEnd.build());
serviceImplementationRequestInputBuilder.setServiceHandlerHeader(
new ServiceHandlerHeaderBuilder().setRequestId(input.getSdncRequestHeader().getRequestId()).build());
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.service.implementation
- .request.input.PathDescriptionBuilder pathDescBuilder = new org.opendaylight.yang.gen.v1.http.org
- .opendaylight.transportpce.renderer.rev171017.service.implementation.request.input
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.service.implementation
+ .request.input.PathDescriptionBuilder pathDescBuilder = new org.opendaylight.yang.gen.v1.http
+ .org.opendaylight.transportpce.renderer.rev210915.service.implementation.request.input
.PathDescriptionBuilder();
pathDescBuilder.setAToZDirection(pathDescription.getAToZDirection());
pathDescBuilder.setZToADirection(pathDescription.getZToADirection());
return serviceImplementationRequestInputBuilder.build();
}
- public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
+ public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
.ServiceDeleteInput createServiceDeleteInput(ServiceInput serviceInput) {
ServiceDeleteInputBuilder builder = new ServiceDeleteInputBuilder();
builder.setServiceName(serviceInput.getServiceName());
return builder.build();
}
- public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
+ public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
.ServiceDeleteInput createServiceDeleteInput(ServiceRerouteInput serviceRerouteinput, Services services) {
ServiceDeleteInputBuilder builder = new ServiceDeleteInputBuilder();
builder.setServiceName(serviceRerouteinput.getServiceName());
return builder.build();
}
- public static ServiceAEnd createServiceAEnd(org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types
- .rev190531.ServiceEndpoint serviceAEnd) {
+ public static ServiceAEnd createServiceAEnd(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.service.types.rev190531.ServiceEndpoint serviceAEnd) {
ServiceAEndBuilder serviceAEndBuilder = new ServiceAEndBuilder();
serviceAEndBuilder.setClli(serviceAEnd.getClli());
serviceAEndBuilder.setNodeId(new NodeIdType(serviceAEnd.getNodeId().getValue()).getValue());
return serviceAEndBuilder.build();
}
- public static ServiceZEnd createServiceZEnd(org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types
- .rev190531.ServiceEndpoint serviceZEnd) {
+ public static ServiceZEnd createServiceZEnd(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.service.types.rev190531.ServiceEndpoint serviceZEnd) {
ServiceZEndBuilder serviceZEndBuilder = new ServiceZEndBuilder();
serviceZEndBuilder.setClli(serviceZEnd.getClli());
serviceZEndBuilder.setNodeId(new NodeIdType(serviceZEnd.getNodeId().getValue()).getValue());
return serviceZEndBuilder.build();
}
- public static RxDirection createRxDirection(org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types
- .rev190531.service.endpoint.RxDirection rxDirection) {
+ public static RxDirection createRxDirection(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection rxDirection) {
RxDirectionBuilder rxDirectionBuilder = new RxDirectionBuilder();
rxDirectionBuilder.setPort(rxDirection.getPort());
return rxDirectionBuilder.build();
}
- public static TxDirection createTxDirection(org.opendaylight.yang.gen.v1.http.org.openroadm.common.service
- .types.rev190531.service.endpoint.TxDirection txDirection) {
+ public static TxDirection createTxDirection(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection txDirection) {
TxDirectionBuilder txDirectionBuilder = new TxDirectionBuilder();
txDirectionBuilder.setPort(txDirection.getPort());
return txDirectionBuilder.build();
public static ServicePaths mappingServicePaths(ServiceInput serviceInput, PathComputationRequestOutput output) {
ServicePathsBuilder servicePathBuilder = new ServicePathsBuilder();
if (serviceInput != null) {
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128
+ org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118
.service.path.ServiceAEndBuilder serviceAEnd =
- new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128
+ new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118
.service.path.ServiceAEndBuilder();
serviceAEnd.setServiceFormat(serviceInput.getServiceAEnd().getServiceFormat())
.setServiceRate(serviceInput.getServiceAEnd().getServiceRate())
.setClli(serviceInput.getServiceAEnd().getClli())
.setNodeId(new NodeIdType(serviceInput.getServiceAEnd().getNodeId().getValue()).getValue())
.setTxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirectionBuilder()
+ .transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder()
.setPort(serviceInput.getServiceAEnd().getTxDirection().getPort()).build())
.setRxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirectionBuilder()
+ .transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder()
.setPort(serviceInput.getServiceAEnd().getRxDirection().getPort()).build());
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128
+ org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118
.service.path.ServiceZEndBuilder serviceZEnd =
- new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev200128
+ new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118
.service.path.ServiceZEndBuilder();
serviceZEnd.setServiceFormat(serviceInput.getServiceZEnd().getServiceFormat())
.setServiceRate(serviceInput.getServiceZEnd().getServiceRate())
.setClli(serviceInput.getServiceZEnd().getClli())
.setNodeId(new NodeIdType(serviceInput.getServiceZEnd().getNodeId().getValue()).getValue())
.setTxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.TxDirectionBuilder()
+ .transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder()
.setPort(serviceInput.getServiceZEnd().getTxDirection().getPort()).build())
.setRxDirection(new org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.service.types.rev200128.service.endpoint.sp.RxDirectionBuilder()
+ .transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder()
.setPort(serviceInput.getServiceZEnd().getRxDirection().getPort()).build());
servicePathBuilder.setServiceAEnd(serviceAEnd.build());
servicePathBuilder.setServiceZEnd(serviceZEnd.build());
- MappingConstraints mapConstraints = new MappingConstraints(serviceInput.getHardConstraints(),
- serviceInput.getSoftConstraints());
- mapConstraints.serviceToServicePathConstarints();
- if (mapConstraints.getServicePathHardConstraints() != null) {
- HardConstraintsBuilder hardConstraintBuilder = new HardConstraintsBuilder();
- hardConstraintBuilder.setCustomerCode(serviceInput.getHardConstraints().getCustomerCode());
- hardConstraintBuilder
- .setCoRoutingOrGeneral(mapConstraints.getServicePathHardConstraints().getCoRoutingOrGeneral());
- servicePathBuilder.setHardConstraints(hardConstraintBuilder.build());
+ if (serviceInput.getHardConstraints() != null) {
+ servicePathBuilder.setHardConstraints(serviceInput.getHardConstraints());
}
- if (mapConstraints.getServicePathSoftConstraints() != null) {
- SoftConstraintsBuilder softConstraintBuilder = new SoftConstraintsBuilder();
- softConstraintBuilder.setCustomerCode(mapConstraints.getServicePathSoftConstraints().getCustomerCode());
- softConstraintBuilder
- .setCoRoutingOrGeneral(mapConstraints.getServicePathSoftConstraints().getCoRoutingOrGeneral());
- servicePathBuilder.setSoftConstraints(softConstraintBuilder.build());
+ if (serviceInput.getSoftConstraints() != null) {
+ servicePathBuilder.setSoftConstraints(serviceInput.getSoftConstraints());
}
servicePathBuilder.setServicePathName(serviceInput.getServiceName());
servicePathBuilder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()