2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.mso.adapters.vnf;
27 import javax.ws.rs.Consumes;
28 import javax.ws.rs.DELETE;
29 import javax.ws.rs.GET;
30 import javax.ws.rs.HEAD;
31 import javax.ws.rs.POST;
32 import javax.ws.rs.PUT;
33 import javax.ws.rs.Path;
34 import javax.ws.rs.PathParam;
35 import javax.ws.rs.Produces;
36 import javax.ws.rs.QueryParam;
37 import javax.ws.rs.core.Response;
38 import javax.ws.rs.core.GenericEntity;
39 import javax.ws.rs.core.MediaType;
40 import javax.xml.ws.Holder;
42 import org.apache.http.HttpStatus;
44 import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
45 import org.openecomp.mso.cloud.CloudConfigFactory;
46 import org.openecomp.mso.entity.MsoRequest;
47 import org.openecomp.mso.logger.MessageEnum;
48 import org.openecomp.mso.logger.MsoLogger;
49 import org.openecomp.mso.openstack.beans.VnfStatus;
50 import org.openecomp.mso.openstack.beans.VnfRollback;
51 import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
52 import org.openecomp.mso.properties.MsoPropertiesFactory;
53 import org.openecomp.mso.adapters.vnfrest.*;
56 * This class services calls to the REST interface for VF Modules (http://host:port/vnfs/rest/v1/vnfs)
57 * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
58 * For testing, call with cloudSiteId = ___TESTING___
59 * To test exceptions, also set tenantId = ___TESTING___
62 public class VnfAdapterRest {
63 private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
64 private static final String TESTING_KEYWORD = "___TESTING___";
65 private final CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
66 private final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
67 private final MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
68 //TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth,
73 @Produces(MediaType.TEXT_HTML)
74 public Response healthcheck () {
75 String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
76 return Response.ok().entity(CHECK_HTML).build();
80 * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid>
82 * {"deleteVfModuleRequest":
83 {"cloudSiteId": "DAN",
84 "tenantId": "214b428a1f554c02935e66330f6a5409",
86 "vfModuleId": "somemodid",
87 "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73",
89 "notificationUrl": "http://localhost:8089/vnfmock",
93 "serviceInstanceId": "sa1"
98 @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
99 @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
100 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
101 public Response deleteVfModule (
102 @PathParam("aaiVnfId") String aaiVnfId,
103 @PathParam("aaiVfModuleId") String aaiVfModuleId,
104 final DeleteVfModuleRequest req)
106 LOGGER.debug("Delete VfModule enter: " + req.toJsonString());
107 if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
108 LOGGER.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
110 .status(HttpStatus.SC_BAD_REQUEST)
111 .type(MediaType.TEXT_PLAIN)
112 .entity("vnfid in URL does not match content")
115 if (aaiVfModuleId == null || !aaiVfModuleId.equals(req.getVfModuleId())) {
116 LOGGER.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
118 .status(HttpStatus.SC_BAD_REQUEST)
119 .type(MediaType.TEXT_PLAIN)
120 .entity("vfModuleId in URL does not match content")
123 DeleteVfModuleTask task = new DeleteVfModuleTask(req);
124 if (req.isSynchronous()) {
125 // This is a synchronous request
128 .status(task.getStatusCode())
129 .entity(task.getGenericEntityResponse())
132 // This is an asynchronous request
134 Thread t1 = new Thread(task);
136 } catch (Exception e) {
137 // problem handling delete, send generic failure as sync resp to caller
138 LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "deleteVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in deleteVfModule", e);
139 return Response.serverError().build();
141 // send sync response (ACK) to caller
142 LOGGER.debug ("deleteVNFVolumes exit");
143 return Response.status(HttpStatus.SC_ACCEPTED).build();
147 public class DeleteVfModuleTask implements Runnable {
148 private final DeleteVfModuleRequest req;
149 private DeleteVfModuleResponse response = null;
150 private VfModuleExceptionResponse eresp = null;
151 private boolean sendxml;
153 public DeleteVfModuleTask(DeleteVfModuleRequest req) {
155 this.sendxml = true; // can be set with a field or header later
157 public int getStatusCode() {
158 return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
160 public Object getGenericEntityResponse() {
161 return (response != null)
162 ? new GenericEntity<DeleteVfModuleResponse>(response) {}
163 : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
165 private String getResponse() {
166 if (response != null) {
167 return sendxml ? response.toXmlString() : response.toJsonString();
169 return sendxml ? eresp.toXmlString() : eresp.toJsonString();
176 String cloudsite = req.getCloudSiteId();
177 Holder<Map<String, String>> outputs = new Holder <> ();
178 if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
179 //vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest());
180 vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs);
182 response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value);
183 } catch (VnfException e) {
184 LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - Delete VNF Module", e);
185 eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
187 if (!req.isSynchronous()) {
188 BpelRestClient bpelClient = new BpelRestClient();
189 bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
191 LOGGER.debug ("Delete vfModule exit: code=" + getStatusCode() + ", resp="+ getResponse());
196 * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaiVnfId>/vf-modules/<aaiVfModuleId>?cloudSiteId=DAN&tenantId=vfModule?&skipAAI=TRUE&msoRequest.requestId=ra1&msoRequest.serviceInstanceId=si1&vfModuleName=T2N2S1
198 * {"queryVfModuleResponse": {
199 "vfModuleId": "AvfmodId",
200 "vfModuleOutputs": {"entry": {
201 "key": "server_private_ip_1",
202 "value": "10.100.1.25"
204 "vfModuleStackId": "RaaVnf1/abfa8a6d-feb1-40af-aea3-109403b1cf6b",
206 "vnfStatus": "ACTIVE"
210 @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
211 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
212 public Response queryVfModule(
213 @PathParam("aaiVnfId") String aaiVnfId,
214 @PathParam("aaiVfModuleId") String aaiVfModuleId,
215 @QueryParam("cloudSiteId") String cloudSiteId,
216 @QueryParam("tenantId") String tenantId,
217 @QueryParam("vfModuleName") String vfModuleName, //RAA? Id in doc
218 @QueryParam("skipAAI") Boolean skipAAI,
219 @QueryParam("msoRequest.requestId") String requestId,
220 @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId)
222 //This request responds synchronously only
223 LOGGER.debug ("Query vfModule enter:" + vfModuleName);
224 MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
227 int respStatus = HttpStatus.SC_OK;
228 QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null);
229 Holder<Boolean> vnfExists = new Holder<>();
230 Holder<String> vfModuleId = new Holder<>();
231 Holder<VnfStatus> status = new Holder<>();
232 Holder<Map<String, String>> outputs = new Holder <> ();
233 vnfAdapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
234 if (!vnfExists.value) {
235 LOGGER.debug ("vfModule not found");
236 respStatus = HttpStatus.SC_NOT_FOUND;
238 LOGGER.debug ("vfModule found" + vfModuleId.value + ", status=" + status.value);
239 qryResp.setVfModuleId(vfModuleId.value);
240 qryResp.setVnfStatus(status.value);
241 qryResp.setVfModuleOutputs(outputs.value);
243 LOGGER.debug ("Query vfModule exit");
246 .entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {})
248 } catch (VnfException e) {
249 LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, "", "queryVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - queryVfModule", e);
250 VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
252 .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
253 .entity(new GenericEntity<VfModuleExceptionResponse>(excResp) {})
258 /*URL: http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules
260 * {"createVfModuleRequest":
261 {"cloudSiteId": "DAN",
262 "tenantId": "214b428a1f554c02935e66330f6a5409",
263 "vnfId": "somevnfid",
264 "vfModuleId": "somemodid",
265 "vfModuleName": "RaaVnf1",
266 "vnfType": "ApacheVnf",
267 "vfModuleParams": {"entry": [
268 {"key": "network_id",
269 "value": "59ed7b41-2983-413f-ba93-e7d437433916"},
271 "value": "086c9298-5c57-49b7-bb2b-6fd5730c5d92"},
272 {"key": "server_name_0",
275 "failIfExists": true,
277 "notificationUrl": "http://localhost:8089/vnfmock",
281 "serviceInstanceId": "sa1"
286 @Path("{aaiVnfId}/vf-modules")
287 @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
288 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
289 public Response createVfModule(
290 @PathParam("aaiVnfId") String aaiVnfId,
291 final CreateVfModuleRequest req)
293 LOGGER.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
294 if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
295 LOGGER.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
297 .status(HttpStatus.SC_BAD_REQUEST)
298 .type(MediaType.TEXT_PLAIN)
299 .entity("vnfid in URL does not match content")
302 CreateVfModuleTask task = new CreateVfModuleTask(req);
303 if (req.isSynchronous()) {
304 // This is a synchronous request
307 .status(task.getStatusCode())
308 .entity(task.getGenericEntityResponse())
311 // This is an asynchronous request
313 Thread t1 = new Thread(task);
315 } catch (Exception e) {
316 // problem handling create, send generic failure as sync resp to caller
317 LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, "", "createVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
318 return Response.serverError().build();
320 // send sync response (ACK) to caller
321 LOGGER.debug ("createVfModule exit");
322 return Response.status(HttpStatus.SC_ACCEPTED).build();
326 public class CreateVfModuleTask implements Runnable {
327 private final CreateVfModuleRequest req;
328 private CreateVfModuleResponse response = null;
329 private VfModuleExceptionResponse eresp = null;
330 private boolean sendxml;
332 public CreateVfModuleTask(CreateVfModuleRequest req) {
334 this.sendxml = true; // can be set with a field or header later
336 public int getStatusCode() {
337 return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
339 public Object getGenericEntityResponse() {
340 return (response != null)
341 ? new GenericEntity<CreateVfModuleResponse>(response) {}
342 : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
344 private String getResponse() {
345 if (response != null) {
346 return sendxml ? response.toXmlString() : response.toJsonString();
348 return sendxml ? eresp.toXmlString() : eresp.toJsonString();
354 LOGGER.debug ("CreateVfModuleTask start");
356 // Synchronous Web Service Outputs
357 Holder <String> vfModuleStackId = new Holder <> ();
358 Holder <Map <String, String>> outputs = new Holder <> ();
359 Holder <VnfRollback> vnfRollback = new Holder <> ();
360 String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
361 LOGGER.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
362 String cloudsite = req.getCloudSiteId();
363 if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
364 String tenant = req.getTenantId();
365 if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
366 throw new VnfException("testing.");
368 vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudsite,
369 true, false, new MsoRequest("reqid", "svcid"),
370 req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType(), req.getModelCustomizationUuid());
371 vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
372 outputs.value = VolumeAdapterRest.testMap();
374 // vnfAdapter.createVnf (createReq.getCloudSiteId(),
375 // createReq.getTenantId(),
376 // createReq.getVnfType(),
377 // createReq.getVnfVersion(),
378 // createReq.getVfModuleName(),
379 // createReq.getRequestType(),
380 // createReq.getVolumeGroupStackId(),
381 // createReq.getVfModuleParams(),
382 // createReq.getFailIfExists(),
383 // createReq.getBackout(),
384 // createReq.getMsoRequest(),
388 vnfAdapter.createVfModule(req.getCloudSiteId(),
391 completeVnfVfModuleType,
393 req.getVfModuleName(),
394 req.getRequestType(),
395 req.getVolumeGroupStackId(),
396 req.getBaseVfModuleStackId(),
397 req.getModelCustomizationUuid(),
398 req.getVfModuleParams(),
399 req.getFailIfExists(),
406 VfModuleRollback modRollback = new VfModuleRollback(vnfRollback.value, req.getVfModuleId(), vfModuleStackId.value, req.getMessageId());
407 response = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
408 vfModuleStackId.value, Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
409 } catch (VnfException e) {
410 LOGGER.debug("Exception :",e);
411 eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
413 if (!req.isSynchronous()) {
414 BpelRestClient bpelClient = new BpelRestClient();
415 bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
417 LOGGER.debug ("CreateVfModuleTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
422 @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
423 @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
424 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
425 public Response updateVfModule(
426 @PathParam("aaiVnfId") String aaiVnfId,
427 @PathParam("aaiVfModuleId") String aaiVfModuleId,
428 final UpdateVfModuleRequest req)
430 LOGGER.debug("Update VfModule enter: " + req.toJsonString());
431 UpdateVfModulesTask task = new UpdateVfModulesTask(req);
432 if (req.isSynchronous()) {
433 // This is a synchronous request
436 .status(task.getStatusCode())
437 .entity(task.getGenericEntityResponse())
440 // This is an asynchronous request
442 Thread t1 = new Thread(task);
444 } catch (Exception e) {
445 // problem handling create, send generic failure as sync resp to caller
446 LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, "", "updateVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - updateVfModule", e);
447 return Response.serverError().build();
449 // send sync response (ACK) to caller
450 LOGGER.debug ("updateVfModules exit");
451 return Response.status(HttpStatus.SC_ACCEPTED).build();
455 public class UpdateVfModulesTask implements Runnable {
456 private final UpdateVfModuleRequest req;
457 private UpdateVfModuleResponse response = null;
458 private VfModuleExceptionResponse eresp = null;
459 private boolean sendxml;
461 public UpdateVfModulesTask(UpdateVfModuleRequest req) {
463 this.sendxml = true; // can be set with a field or header later
465 public int getStatusCode() {
466 return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
468 public Object getGenericEntityResponse() {
469 return (response != null)
470 ? new GenericEntity<UpdateVfModuleResponse>(response) {}
471 : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
473 private String getResponse() {
474 if (response != null) {
475 return sendxml ? response.toXmlString() : response.toJsonString();
477 return sendxml ? eresp.toXmlString() : eresp.toJsonString();
483 //MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
485 // Synchronous Web Service Outputs
486 Holder <String> vfModuleStackId = new Holder <> ();
487 Holder <Map <String, String>> outputs = new Holder <> ();
488 Holder <VnfRollback> vnfRollback = new Holder <> ();
489 String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
490 LOGGER.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
492 vnfAdapter.updateVfModule (req.getCloudSiteId(),
495 completeVnfVfModuleType,
497 req.getVfModuleName(),
498 req.getRequestType(),
499 req.getVolumeGroupStackId(),
500 req.getBaseVfModuleStackId(),
501 req.getVfModuleStackId(),
502 req.getModelCustomizationUuid(),
503 req.getVfModuleParams(),
508 response = new UpdateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
509 vfModuleStackId.value, outputs.value, req.getMessageId());
510 } catch (VnfException e) {
511 LOGGER.debug("Exception :",e);
512 eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
514 if (!req.isSynchronous()) {
515 // This is asynch, so POST response back to caller
516 BpelRestClient bpelClient = new BpelRestClient ();
517 bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml);
519 LOGGER.debug ("Update VfModule exit: code=" + getStatusCode() + ", resp="+ getResponse());
523 * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid>/rollback
525 * {"deleteVfModuleRequest":
526 {"cloudSiteId": "DAN",
527 "tenantId": "214b428a1f554c02935e66330f6a5409",
528 "vnfId": "somevnfid",
529 "vfModuleId": "somemodid",
530 "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73",
532 "notificationUrl": "http://localhost:8089/vnfmock",
536 "serviceInstanceId": "sa1"
541 @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback")
542 @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
543 @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
544 public Response rollbackVfModule (
545 @PathParam("aaiVnfId") String aaiVnfId,
546 @PathParam("aaiVfModuleId") String aaiVfModuleId,
547 //@QueryParam("rollback") String rollback,
548 final RollbackVfModuleRequest req)
550 LOGGER.debug("Rollback VfModule enter: " + req.toJsonString());
551 RollbackVfModulesTask task = new RollbackVfModulesTask(req);
552 if (req.isSynchronous()) {
553 // This is a synchronous request
556 .status(task.getStatusCode())
557 .entity(task.getGenericEntityResponse())
560 // This is an asynchronous request
562 Thread t1 = new Thread(task);
564 } catch (Exception e) {
565 // problem handling create, send generic failure as sync resp to caller
566 LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e);
567 return Response.serverError().build();
569 // send sync response (ACK) to caller
570 LOGGER.debug ("rollbackVfModule exit");
571 return Response.status(HttpStatus.SC_ACCEPTED).build();
575 public class RollbackVfModulesTask implements Runnable {
576 private final RollbackVfModuleRequest req;
577 private RollbackVfModuleResponse response = null;
578 private VfModuleExceptionResponse eresp = null;
579 private boolean sendxml;
581 public RollbackVfModulesTask(RollbackVfModuleRequest req) {
583 this.sendxml = true; // can be set with a field or header later
585 public int getStatusCode() {
586 return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
588 public Object getGenericEntityResponse() {
589 return (response != null)
590 ? new GenericEntity<RollbackVfModuleResponse>(response) {}
591 : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
593 private String getResponse() {
594 if (response != null) {
595 return sendxml ? response.toXmlString() : response.toJsonString();
597 return sendxml ? eresp.toXmlString() : eresp.toJsonString();
603 VfModuleRollback vmr = req.getVfModuleRollback();
604 VnfRollback vrb = new VnfRollback(
605 vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, true,
606 vmr.getMsoRequest(), null, null, null, null);
607 vnfAdapter.rollbackVnf (vrb);
608 response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
609 } catch (VnfException e) {
610 LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e);
611 eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId());
613 if (!req.isSynchronous()) {
614 // This is asynch, so POST response back to caller
615 BpelRestClient bpelClient = new BpelRestClient ();
616 bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml);
618 LOGGER.debug ("RollbackVfModulesTask exit: code=" + getStatusCode() + ", resp="+ getResponse());