Bug corrections in ServiceHandler
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / ModelMappingUtils.java
1 /*
2  * Copyright © 2017 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.transportpce.servicehandler;
9
10 import java.util.ArrayList;
11 import java.util.List;
12 import java.util.concurrent.Future;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEnd;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEndBuilder;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceZEnd;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceZEndBuilder;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
20 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.response.parameters.ResponseParametersBuilder;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.Topology;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
23 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.LifecycleState;
24 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.State;
25 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
26 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutput;
27 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutputBuilder;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutputBuilder;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesBuilder;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZBuilder;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZKey;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToABuilder;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToAKey;
40 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.HardConstraintsBuilder;
41 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.SoftConstraintsBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirection;
43 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.RxDirectionBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.TxDirection;
45 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.endpoint.sp.TxDirectionBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.handler.header.ServiceHandlerHeaderBuilder;
47 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.path.PathDescriptionBuilder;
48 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInputBuilder;
49 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
50 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInputBuilder;
51 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePaths;
52 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsBuilder;
53 import org.opendaylight.yangtools.yang.common.RpcResult;
54 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
55
56 public final class ModelMappingUtils {
57
58     private ModelMappingUtils() {
59     }
60
61     public static ServiceImplementationRequestInput createServiceImplementationRequest(ServiceCreateInput input,
62          PathComputationRequestOutput pceResponse) {
63
64         ServiceImplementationRequestInputBuilder serviceImplementationRequestInputBuilder =
65             new ServiceImplementationRequestInputBuilder();
66         serviceImplementationRequestInputBuilder.setServiceName(input.getServiceName());
67         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath
68             .rev170426.service.implementation.request.input.ServiceAEndBuilder serviceAEnd =
69                 new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath
70                     .rev170426.service.implementation.request.input.ServiceAEndBuilder();
71         serviceAEnd.setServiceFormat(input.getServiceAEnd().getServiceFormat())
72             .setServiceRate(input.getServiceAEnd().getServiceRate()).setClli(input.getServiceAEnd().getClli())
73             .setNodeId(input.getServiceAEnd().getNodeId())
74             .setTxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
75             .rev170426.service.endpoint.sp.TxDirectionBuilder()
76             .setPort(input.getServiceAEnd().getTxDirection().getPort()).build())
77             .setRxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
78             .rev170426.service.endpoint.sp.RxDirectionBuilder()
79             .setPort(input.getServiceAEnd().getRxDirection().getPort()).build());
80         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath
81             .rev170426.service.implementation.request.input.ServiceZEndBuilder serviceZEnd =
82                 new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath
83                     .rev170426.service.implementation.request.input.ServiceZEndBuilder();
84         serviceZEnd.setServiceFormat(input.getServiceZEnd().getServiceFormat())
85             .setServiceRate(input.getServiceZEnd().getServiceRate()).setClli(input.getServiceZEnd().getClli())
86             .setNodeId(input.getServiceZEnd().getNodeId())
87             .setTxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
88             .rev170426.service.endpoint.sp.TxDirectionBuilder()
89             .setPort(input.getServiceZEnd().getTxDirection().getPort()).build())
90             .setRxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
91             .rev170426.service.endpoint.sp.RxDirectionBuilder()
92             .setPort(input.getServiceZEnd().getRxDirection().getPort()).build());
93         serviceImplementationRequestInputBuilder.setServiceAEnd(serviceAEnd.build());
94         serviceImplementationRequestInputBuilder.setServiceZEnd(serviceZEnd.build());
95         serviceImplementationRequestInputBuilder.setServiceHandlerHeader(
96             new ServiceHandlerHeaderBuilder().setRequestId(input.getSdncRequestHeader().getRequestId()).build());
97         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath
98             .rev170426.service.implementation.request.input.PathDescriptionBuilder pathDescBuilder =
99                 new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath
100                     .rev170426.service.implementation.request.input
101                     .PathDescriptionBuilder();
102         pathDescBuilder.setAToZDirection(pceResponse.getResponseParameters()
103                 .getPathDescription().getAToZDirection());
104         pathDescBuilder.setZToADirection(pceResponse.getResponseParameters()
105                 .getPathDescription().getZToADirection());
106         serviceImplementationRequestInputBuilder.setPathDescription(pathDescBuilder.build());
107         return serviceImplementationRequestInputBuilder.build();
108     }
109
110     public static org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426
111             .ServiceDeleteInput createServiceDeleteInput(ServiceDeleteInput serviceDeleteInput) {
112         ServiceDeleteInputBuilder builder = new ServiceDeleteInputBuilder();
113         builder.setServiceName(serviceDeleteInput.getServiceDeleteReqInfo().getServiceName());
114         builder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder().setRequestId(
115             serviceDeleteInput.getSdncRequestHeader().getRequestId()).build());
116         return builder.build();
117     }
118
119     public static ServiceAEnd createServiceAEnd(
120         org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
121             .ServiceAEnd serviceAEnd) {
122         ServiceAEndBuilder serviceAEndBuilder = new ServiceAEndBuilder();
123         serviceAEndBuilder.setClli(serviceAEnd.getClli());
124         serviceAEndBuilder.setNodeId(serviceAEnd.getNodeId());
125         serviceAEndBuilder.setRxDirection(createRxDirection(serviceAEnd.getRxDirection()));
126         serviceAEndBuilder.setServiceFormat(serviceAEnd.getServiceFormat());
127         serviceAEndBuilder.setServiceRate(serviceAEnd.getServiceRate());
128         serviceAEndBuilder.setTxDirection(createTxDirection(serviceAEnd.getTxDirection()));
129         return serviceAEndBuilder.build();
130     }
131
132     public static ServiceZEnd createServiceZEnd(
133         org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input.ServiceZEnd
134             serviceZEnd) {
135         ServiceZEndBuilder serviceZEndBuilder = new ServiceZEndBuilder();
136         serviceZEndBuilder.setClli(serviceZEnd.getClli());
137         serviceZEndBuilder.setNodeId(serviceZEnd.getNodeId());
138         serviceZEndBuilder.setRxDirection(createRxDirection(serviceZEnd.getRxDirection()));
139         serviceZEndBuilder.setServiceFormat(serviceZEnd.getServiceFormat());
140         serviceZEndBuilder.setServiceRate(serviceZEnd.getServiceRate());
141         serviceZEndBuilder.setTxDirection(createTxDirection(serviceZEnd.getTxDirection()));
142         return serviceZEndBuilder.build();
143     }
144
145     public static RxDirection createRxDirection(
146         org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.endpoint.RxDirection
147             rxDirection) {
148         RxDirectionBuilder rxDirectionBuilder = new RxDirectionBuilder();
149         rxDirectionBuilder.setPort(rxDirection.getPort());
150         return rxDirectionBuilder.build();
151     }
152
153     public static TxDirection createTxDirection(
154         org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.endpoint.TxDirection
155             txDirection) {
156         TxDirectionBuilder txDirectionBuilder = new TxDirectionBuilder();
157         txDirectionBuilder.setPort(txDirection.getPort());
158         return txDirectionBuilder.build();
159     }
160
161     public static Future<RpcResult<ServiceDeleteOutput>> createDeleteServiceReply(ServiceDeleteInput input,
162         String finalAck, String message, String responseCode) {
163         ConfigurationResponseCommonBuilder builder = new ConfigurationResponseCommonBuilder()
164                 .setAckFinalIndicator(finalAck).setResponseMessage(message).setResponseCode(responseCode);
165         if (input.getSdncRequestHeader() != null) {
166             builder.setRequestId(input.getSdncRequestHeader().getRequestId());
167         } else {
168             builder.setRequestId(null);
169         }
170         ConfigurationResponseCommon configurationResponseCommon = builder.build();
171         ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
172                 .setConfigurationResponseCommon(configurationResponseCommon).build();
173         return RpcResultBuilder.success(output).buildFuture();
174     }
175
176     public static Future<RpcResult<ServiceCreateOutput>> createCreateServiceReply(ServiceCreateInput input,
177                                                                String finalAck,
178                                                                String message, String responseCode) {
179         ResponseParametersBuilder responseParameters = new ResponseParametersBuilder();
180         ConfigurationResponseCommonBuilder configurationResponseCommon
181                 = new ConfigurationResponseCommonBuilder().setAckFinalIndicator(finalAck)
182                 .setResponseMessage(message)
183                 .setResponseCode(responseCode);
184         if (input.getSdncRequestHeader() != null) {
185             configurationResponseCommon.setRequestId(input.getSdncRequestHeader().getRequestId());
186         } else {
187             configurationResponseCommon.setRequestId(null);
188         }
189         ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
190                 .setConfigurationResponseCommon(configurationResponseCommon.build())
191                 .setResponseParameters(responseParameters.build());
192         return RpcResultBuilder.success(output.build()).buildFuture();
193     }
194
195     /*
196      * Map Input (ServiceCreateInmput, ServiceReconfigureInput) & output
197      * (PathComputationRequestOutput) to Service.
198      * @param serviceCreateInput
199      *            ServiceCreateInput parameter
200      * @param serviceReconfigureInput
201      *            serviceReconfigureInput parameter
202      * @param output
203      *            PathComputationRequestOutput parameter
204      * @return Services Service data
205      */
206     public static Services mappingServices(ServiceCreateInput serviceCreateInput,
207         ServiceReconfigureInput serviceReconfigureInput, PathComputationRequestOutput output) {
208         org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEnd aend = null;
209         org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceZEnd zend = null;
210         ServicesBuilder service = new ServicesBuilder();
211         if (serviceCreateInput != null) {
212             aend = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
213                 .ServiceAEndBuilder(serviceCreateInput.getServiceAEnd()).build();
214             zend = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
215                 .ServiceZEndBuilder(serviceCreateInput.getServiceZEnd()).build();
216             service.setServiceName(serviceCreateInput.getServiceName()).setAdministrativeState(State.OutOfService)
217                 .setOperationalState(State.OutOfService).setCommonId(serviceCreateInput.getCommonId())
218                 .setConnectionType(serviceCreateInput.getConnectionType())
219                 .setCustomer(serviceCreateInput.getCustomer())
220                 .setCustomerContact(serviceCreateInput.getCustomerContact())
221                 .setHardConstraints(serviceCreateInput.getHardConstraints())
222                 .setSoftConstraints(serviceCreateInput.getSoftConstraints())
223                 .setSdncRequestHeader(serviceCreateInput.getSdncRequestHeader())
224                 .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend);
225
226         } else if (serviceReconfigureInput != null) {
227             aend = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
228                 .ServiceAEndBuilder(serviceReconfigureInput.getServiceAEnd()).build();
229             zend = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
230                 .ServiceZEndBuilder(serviceReconfigureInput.getServiceZEnd()).build();
231             service.setServiceName(serviceReconfigureInput.getNewServiceName())
232                 .setAdministrativeState(State.OutOfService).setOperationalState(State.OutOfService)
233                 .setCommonId(serviceReconfigureInput.getCommonId())
234                 .setConnectionType(serviceReconfigureInput.getConnectionType())
235                 .setCustomer(serviceReconfigureInput.getCustomer())
236                 .setCustomerContact(serviceReconfigureInput.getCustomerContact())
237                 .setHardConstraints(serviceReconfigureInput.getHardConstraints())
238                 .setSoftConstraints(serviceReconfigureInput.getSoftConstraints())
239                 .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend);
240         }
241
242         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response
243                 .parameters.sp.ResponseParameters responseParameters = output.getResponseParameters();
244         if (responseParameters != null) {
245             // service.setPceMetric(responseParameters.getPceMetric());
246             org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426
247                 .response.parameters.sp.response.parameters.PathDescription pathDescription =
248                 responseParameters.getPathDescription();
249             if (pathDescription != null) {
250                 List<AToZ> atozList = new ArrayList<>();
251                 List<ZToA> ztoaList = new ArrayList<>();
252
253                 for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
254                     .path.description.atoz.direction.AToZ tmp : pathDescription.getAToZDirection().getAToZ()) {
255
256                     AToZKey key = new AToZKey(tmp.getKey().getId());
257                     AToZ atoz = new AToZBuilder().setId(tmp.getId()).setKey(key)
258                             // .setResource(tmp.getResource())
259                             .build();
260                     atozList.add(atoz);
261                 }
262
263                 for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
264                         .path.description.ztoa.direction.ZToA
265                         tmp : pathDescription.getZToADirection().getZToA()) {
266                     ZToAKey key = new ZToAKey(tmp.getKey().getId());
267                     ZToA ztoa = new ZToABuilder().setId(tmp.getId()).setKey(key)
268                             // .setResource(tmp.getResource())
269                             .build();
270                     ztoaList.add(ztoa);
271                 }
272
273                 Topology topology = new TopologyBuilder().setAToZ(atozList).setZToA(ztoaList).build();
274                 service.setTopology(topology);
275             }
276         }
277         return service.build();
278     }
279
280     /*
281      * Map Input (ServiceCreateInmput, ServiceReconfigureInput) & output
282      * (PathComputationRequestOutput) to ServicePath.
283      * @param serviceCreateInput
284      *            ServiceCreateInput parameter
285      * @param serviceReconfigureInput
286      *            serviceReconfigureInput parameter
287      * @param output
288      *            PathComputationRequestOutput parameter
289      * @return ServicesPaths Service Path data
290      */
291     public static ServicePaths mappingServicePaths(ServiceCreateInput serviceCreateInput,
292         ServiceReconfigureInput serviceReconfigureInput, PathComputationRequestOutput output) {
293         ServicePathsBuilder servicePathBuilder = new ServicePathsBuilder();
294         if (serviceCreateInput != null) {
295             org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
296                 .service.types.rev170426.service.path.ServiceAEndBuilder serviceAEnd =
297                 new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
298                     .service.types.rev170426.service.path.ServiceAEndBuilder();
299             serviceAEnd.setServiceFormat(serviceCreateInput.getServiceAEnd().getServiceFormat())
300                 .setServiceRate(serviceCreateInput.getServiceAEnd().getServiceRate())
301                 .setClli(serviceCreateInput.getServiceAEnd().getClli())
302                 .setNodeId(serviceCreateInput.getServiceAEnd().getNodeId())
303                 .setTxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
304                 .rev170426.service.endpoint.sp.TxDirectionBuilder()
305                 .setPort(serviceCreateInput.getServiceAEnd().getTxDirection().getPort()).build())
306                 .setRxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
307                 .rev170426.service.endpoint.sp.RxDirectionBuilder()
308                 .setPort(serviceCreateInput.getServiceAEnd().getRxDirection().getPort()).build());
309             org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
310                 .service.types.rev170426.service.path.ServiceZEndBuilder serviceZEnd =
311                 new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
312                     .service.types.rev170426.service.path.ServiceZEndBuilder();
313             serviceZEnd.setServiceFormat(serviceCreateInput.getServiceZEnd().getServiceFormat())
314                 .setServiceRate(serviceCreateInput.getServiceZEnd().getServiceRate())
315                 .setClli(serviceCreateInput.getServiceZEnd().getClli())
316                 .setNodeId(serviceCreateInput.getServiceZEnd().getNodeId())
317                 .setTxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
318                 .rev170426.service.endpoint.sp.TxDirectionBuilder()
319                 .setPort(serviceCreateInput.getServiceZEnd().getTxDirection().getPort()).build())
320                 .setRxDirection(new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
321                 .rev170426.service.endpoint.sp.RxDirectionBuilder()
322                 .setPort(serviceCreateInput.getServiceZEnd().getRxDirection().getPort()).build());
323
324             servicePathBuilder.setServiceAEnd(serviceAEnd.build());
325             servicePathBuilder.setServiceZEnd(serviceZEnd.build());
326             MappingConstraints mapConstraints = new MappingConstraints(serviceCreateInput.getHardConstraints(),
327                 serviceCreateInput.getSoftConstraints());
328             mapConstraints.serviceToServicePathConstarints();
329             if (mapConstraints.getServicePathHardConstraints() != null) {
330                 HardConstraintsBuilder hardConstraintBuilder = new HardConstraintsBuilder();
331                 hardConstraintBuilder.setCustomerCode(serviceCreateInput.getHardConstraints().getCustomerCode());
332                 hardConstraintBuilder.setCoRoutingOrGeneral(mapConstraints.getServicePathHardConstraints()
333                     .getCoRoutingOrGeneral());
334                 servicePathBuilder.setHardConstraints(hardConstraintBuilder.build());
335             }
336             if (mapConstraints.getServicePathSoftConstraints() != null) {
337                 SoftConstraintsBuilder softConstraintBuilder = new SoftConstraintsBuilder();
338                 softConstraintBuilder.setCustomerCode(mapConstraints.getServicePathSoftConstraints().getCustomerCode());
339                 softConstraintBuilder.setCoRoutingOrGeneral(mapConstraints.getServicePathSoftConstraints()
340                      .getCoRoutingOrGeneral());
341                 servicePathBuilder.setSoftConstraints(softConstraintBuilder.build());
342             }
343             servicePathBuilder.setServicePathName(serviceCreateInput.getServiceName());
344             servicePathBuilder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()
345                 .setRequestId(serviceCreateInput.getSdncRequestHeader().getRequestId()).build());
346             PathDescriptionBuilder pathDescBuilder = new PathDescriptionBuilder(output.getResponseParameters()
347                 .getPathDescription());
348             servicePathBuilder.setPathDescription(pathDescBuilder.build());
349         }
350         return servicePathBuilder.build();
351     }
352 }