2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.vid.controller;
24 import com.fasterxml.jackson.databind.ObjectMapper;
25 import org.onap.portalsdk.core.controller.RestrictedBaseController;
26 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
27 import org.onap.vid.model.ExceptionResponse;
28 import org.onap.vid.model.SoftDeleteRequest;
29 import org.onap.vid.mso.MsoBusinessLogic;
30 import org.onap.vid.mso.MsoResponseWrapper;
31 import org.onap.vid.mso.MsoResponseWrapper2;
32 import org.onap.vid.mso.rest.Request;
33 import org.onap.vid.mso.rest.RequestDetails;
34 import org.onap.vid.mso.rest.RequestDetailsWrapper;
35 import org.onap.vid.mso.rest.Task;
36 import org.onap.vid.services.CloudOwnerService;
37 import org.springframework.beans.factory.annotation.Autowired;
38 import org.springframework.http.HttpStatus;
39 import org.springframework.http.ResponseEntity;
40 import org.springframework.web.bind.annotation.*;
42 import javax.servlet.http.HttpServletRequest;
43 import javax.servlet.http.HttpServletResponse;
44 import java.io.IOException;
45 import java.util.LinkedHashMap;
46 import java.util.List;
48 import static org.onap.vid.utils.Logging.getMethodName;
51 * The Class MsoController.
54 @RequestMapping("mso")
55 public class MsoController extends RestrictedBaseController {
60 private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(MsoController.class);
63 * The Constant SVC_INSTANCE_ID.
65 public static final String SVC_INSTANCE_ID = "<service_instance_id>";
66 public static final String REQUEST_TYPE = "<request_type>";
69 * The Constant CONFIGURATION_ID
71 public static final String CONFIGURATION_ID = "<configuration_id>";
74 * The Constant VNF_INSTANCE_ID.
76 public static final String VNF_INSTANCE_ID = "<vnf_instance_id>";
77 public static final String START_LOG = " start";
79 private final MsoBusinessLogic msoBusinessLogic;
80 private final CloudOwnerService cloudOwnerService;
83 public MsoController(MsoBusinessLogic msoBusinessLogic, CloudOwnerService cloudOwnerService) {
84 this.msoBusinessLogic = msoBusinessLogic;
85 this.cloudOwnerService = cloudOwnerService;
89 * Creates the svc instance.
91 * @param request the request
92 * @return the response entity
93 * @throws Exception the exception
95 @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
96 public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
97 String methodName = "createSvcInstance";
99 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
101 // always return OK, the MSO status code is embedded in the body
103 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
104 MsoResponseWrapper w = msoBusinessLogic.createSvcInstance(msoRequest);
106 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
111 * Creates the e2e svc instance.
113 * @param request the request
114 * @return the response entity
115 * @throws Exception the exception
117 @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)
118 public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
119 String methodName = "createE2eSvcInstance";
121 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
123 // always return OK, the MSO status code is embedded in the body
125 //cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
126 MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(msoRequest.get("requestDetails"));
128 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
135 * @param serviceInstanceId the service instance id
136 * @param request the request
137 * @return the response entity
138 * @throws Exception the exception
140 @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
141 public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
143 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
144 MsoResponseWrapper w = msoBusinessLogic.createVnf(msoRequest, serviceInstanceId);
146 // always return OK, the MSO status code is embedded in the body
148 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
153 * Creates the nw instance.
155 * @param serviceInstanceId the service instance id
156 * @param request the request
157 * @return the response entity
158 * @throws Exception the exception
160 @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
161 public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
162 String methodName = "createNwInstance";
163 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
165 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
166 MsoResponseWrapper w = msoBusinessLogic.createNwInstance(msoRequest, serviceInstanceId);
168 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
173 * Creates the volume group instance.
175 * @param serviceInstanceId the service instance id
176 * @param vnfInstanceId the vnf instance id
177 * @param request the request
178 * @return the response entity
179 * @throws Exception the exception
181 @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
182 public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
183 HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
184 String methodName = "createVolumeGroupInstance";
185 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
187 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
188 MsoResponseWrapper w = msoBusinessLogic.createVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId);
190 // always return OK, the MSO status code is embedded in the body
191 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
195 * Creates the vf module instance.
197 * @param serviceInstanceId the service instance id
198 * @param vnfInstanceId the vnf instance id
199 * @param request the request
200 * @return the response entity
201 * @throws Exception the exception
203 @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
204 public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
205 @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
206 String methodName = "createVfModuleInstance";
208 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
210 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
211 MsoResponseWrapper w = msoBusinessLogic.createVfModuleInstance(msoRequest, serviceInstanceId, vnfInstanceId);
213 // always return OK, the MSO status code is embedded in the body
215 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
219 * Creates a configuration instance.
221 * @param serviceInstanceId the service instance id
222 * @param request the request
223 * @return the response entity
224 * @throws Exception the exception
226 @RequestMapping(value = "/mso_create_configuration_instance/{serviceInstanceId}/configurations/", method = RequestMethod.POST)
227 public ResponseEntity<String> createConfigurationInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
228 HttpServletRequest request, @RequestBody RequestDetailsWrapper msoRequest) {
229 String methodName = "createConfigurationInstance";
230 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
232 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest.getRequestDetails());
233 MsoResponseWrapper w = msoBusinessLogic.createConfigurationInstance(msoRequest, serviceInstanceId);
235 // always return OK, the MSO status code is embedded in the body
237 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
241 * Delete E2e svc instance.
243 * @param serviceInstanceId the service instance id
244 * @param request the request
245 * @return the response entity
246 * @throws Exception the exception
248 @RequestMapping(value = "/mso_delete_e2e_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
249 public ResponseEntity<String> deleteE2eSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
250 HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
252 LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), msoRequest);
253 MsoResponseWrapper w = msoBusinessLogic.deleteE2eSvcInstance(msoRequest.get("requestDetails"), serviceInstanceId);
254 // always return OK, the MSO status code is embedded in the body
256 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
261 * Delete svc instance.
263 * @param serviceInstanceId the service instance id
264 * @param request the request
265 * @return the response entity
266 * @throws Exception the exception
269 @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
270 public String deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
271 HttpServletRequest request, @RequestBody RequestDetails msoRequest,
272 @RequestParam(value = "serviceStatus") String serviceStatus) {
274 LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), msoRequest);
275 MsoResponseWrapper w = msoBusinessLogic.deleteSvcInstance(msoRequest, serviceInstanceId, serviceStatus);
276 // always return OK, the MSO status code is embedded in the body
278 return w.getResponse();
284 * @param serviceInstanceId the service instance id
285 * @param vnfInstanceId the vnf instance id
286 * @param request the request
287 * @return the response entity
288 * @throws Exception the exception
290 @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
292 public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
293 HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
294 String methodName = "deleteVnf";
296 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
297 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
298 MsoResponseWrapper w = msoBusinessLogic.deleteVnf(msoRequest, serviceInstanceId, vnfInstanceId);
300 // always return OK, the MSO status code is embedded in the body
301 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
306 * Delete configuration instance
307 * @param serviceInstanceId the service instance id
308 * @param configurationId the configuration id
309 * @param msoRequest the request
310 * @return the response entity
311 * @throws Exception the exception
313 @RequestMapping(value = "mso_delete_configuration/{serviceInstanceId}/configurations/{configurationId}",
314 method = RequestMethod.POST)
315 public ResponseEntity<String> deleteConfiguration(
316 @PathVariable("serviceInstanceId") String serviceInstanceId,
317 @PathVariable ("configurationId") String configurationId,
318 @RequestBody RequestDetailsWrapper msoRequest) {
320 String methodName = "deleteConfiguration";
321 LOGGER.debug(EELFLoggerDelegate.debugLogger,
322 "<== " + methodName + START_LOG);
324 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest.getRequestDetails());
325 MsoResponseWrapper w = msoBusinessLogic.deleteConfiguration(msoRequest, serviceInstanceId, configurationId);
327 // always return OK, the MSO status code is embedded in the body
328 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
332 * Activate configuration instance
333 * @param serviceInstanceId the service instace id
334 * @param configurationId the configuration id
335 * @param msoRequest the request
336 * @return the response entity
337 * @throws Exception the exception
339 @RequestMapping(value = "mso_activate_configuration/{serviceInstanceId}/configurations/{configurationId}",
340 method = RequestMethod.POST)
341 public ResponseEntity<String> activateConfiguration(
342 @PathVariable("serviceInstanceId") String serviceInstanceId,
343 @PathVariable("configurationId") String configurationId,
344 @RequestBody RequestDetails msoRequest) {
346 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
347 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, true);
349 // always return OK, the MSO status code is embedded in the body
350 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
354 * Deactivate configuration instance
355 * @param serviceInstanceId the service instace id
356 * @param configurationId the configuration id
357 * @param msoRequest the request
358 * @return the response entity
359 * @throws Exception the exception
361 @RequestMapping(value = "mso_deactivate_configuration/{serviceInstanceId}/configurations/{configurationId}",
362 method = RequestMethod.POST)
363 public ResponseEntity<String> deactivateConfiguration(
364 @PathVariable("serviceInstanceId") String serviceInstanceId,
365 @PathVariable("configurationId") String configurationId,
366 @RequestBody RequestDetails msoRequest) {
368 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
369 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, false);
371 // always return OK, the MSO status code is embedded in the body
372 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
376 * Disable port on configuration instance
377 * @param serviceInstanceId the service instance id
378 * @param configurationId the configuration instance id
379 * @param msoRequest the request
380 * @return the response entity
381 * @throws Exception the exception
383 @RequestMapping(value = "mso_disable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
384 method = RequestMethod.POST)
385 public ResponseEntity<String> disablePortOnConfiguration(
386 @PathVariable("serviceInstanceId") String serviceInstanceId,
387 @PathVariable("configurationId") String configurationId,
388 @RequestBody RequestDetails msoRequest) {
390 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
391 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, false);
393 // always return OK, the MSO status code is embedded in the body
394 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
398 * Enable port on configuration instance
399 * @param serviceInstanceId the service instance id
400 * @param configurationId the configuration instance id
401 * @param msoRequest the request
402 * @return the response entity
403 * @throws Exception the exception
405 @RequestMapping(value = "mso_enable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
406 method = RequestMethod.POST)
407 public ResponseEntity<String> enablePortOnConfiguration(
408 @PathVariable("serviceInstanceId") String serviceInstanceId,
409 @PathVariable("configurationId") String configurationId,
410 @RequestBody RequestDetails msoRequest) {
412 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
413 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, true);
415 // always return OK, the MSO status code is embedded in the body
416 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
422 * @param serviceInstanceId the service instance id
423 * @param vnfInstanceId the vnf instance id
424 * @param vfModuleId the vf module id
425 * @param request the request
426 * @return the response entity
427 * @throws Exception the exception
429 //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
430 @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
431 public ResponseEntity<String> deleteVfModule(
432 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
433 @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
435 String methodName = "deleteVfModule";
436 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
438 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
439 MsoResponseWrapper w = msoBusinessLogic.deleteVfModule(msoRequest, serviceInstanceId, vnfInstanceId, vfModuleId);
441 // always return OK, the MSO status code is embedded in the body
442 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
446 * Delete volume group instance.
448 * @param serviceInstanceId the service instance id
449 * @param vnfInstanceId the vnf instance id
450 * @param volumeGroupId the volume group id
451 * @param request the request
452 * @return the response entity
453 * @throws Exception the exception
455 @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
456 public ResponseEntity<String> deleteVolumeGroupInstance(
457 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
458 HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
459 String methodName = "deleteVolumeGroupInstance";
460 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
462 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
463 MsoResponseWrapper w = msoBusinessLogic.deleteVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId, volumeGroupId);
465 // always return OK, the MSO status code is embedded in the body
466 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
470 * Delete nw instance.
472 * @param serviceInstanceId the service instance id
473 * @param networkInstanceId the network instance id
474 * @param request the request
475 * @return the response entity
476 * @throws Exception the exception
478 @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
479 public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
480 @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
481 String methodName = "deleteNwInstance";
482 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
484 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
485 MsoResponseWrapper w = msoBusinessLogic.deleteNwInstance(msoRequest, serviceInstanceId, networkInstanceId);
487 // always return OK, the MSO status code is embedded in the body
488 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
492 * Gets the orchestration request.
494 * @param requestId the request id
495 * @param request the request
496 * @return the orchestration request
497 * @throws Exception the exception
499 @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
500 public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
501 HttpServletRequest request) {
503 String methodName = "getOrchestrationRequest";
504 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
507 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequest(requestId);
509 // always return OK, the MSO status code is embedded in the body
510 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
514 * Gets the orchestration requests.
516 * @param filterString the filter string
517 * @param request the request
518 * @return the orchestration requests
519 * @throws Exception the exception
521 @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
522 public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
523 HttpServletRequest request) {
525 String methodName = "getOrchestrationRequests";
526 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
529 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequests(filterString);
531 // always return OK, the MSO status code is embedded in the body
532 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
536 * activate to a pnf instance.
538 * @param serviceInstanceId the id of the service.
539 * @param requestDetails the body of the request.
540 * @return the response entity
541 * @throws Exception the exception
543 @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
544 public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
545 String methodName = "activateServiceInstance";
546 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
548 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, true);
549 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
553 * deactivate a service instance.
555 * @param serviceInstanceId the id of the service.
556 * @param requestDetails the body of the request.
557 * @return the response entity
558 * @throws Exception the exception
560 @RequestMapping(value = "/mso_deactivate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
561 public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
562 String methodName = "deactivateServiceInstance";
563 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
565 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, false);
566 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
570 * Gets the orchestration requests for the dashboard.
571 * currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
572 * @return the orchestration requests
573 * @throws Exception the exception
575 @RequestMapping(value = "/mso_get_orch_reqs/dashboard", method = RequestMethod.GET)
576 public List<Request> getOrchestrationRequestsForDashboard() {
578 String methodName = "getOrchestrationRequestsForDashboard";
579 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
582 return msoBusinessLogic.getOrchestrationRequestsForDashboard();
586 * Gets the Manual Tasks for the given request id.
588 * @param originalRequestId the id of the original request.
590 * @throws Exception the exception
592 @RequestMapping(value = "/mso_get_man_task/{originalRequestId}", method = RequestMethod.GET)
593 public List<Task> getManualTasksByRequestId(@PathVariable("originalRequestId") String originalRequestId) {
595 String methodName = "getManualTasksByRequestId";
596 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
598 return msoBusinessLogic.getManualTasksByRequestId(originalRequestId);
602 * Complete the manual task.
604 * @param taskId the id of the task to complete.
605 * @param requestDetails the body of the request.
606 * @return the response entity
607 * @throws Exception the exception
609 @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)
610 public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) {
612 String methodName = "manualTaskComplete";
613 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
615 MsoResponseWrapper w = msoBusinessLogic.completeManualTask(requestDetails, taskId);
616 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
619 @RequestMapping(value = "/mso_remove_relationship/{serviceInstanceId}", method = RequestMethod.POST)
620 public ResponseEntity<String> removeRelationshipFromServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
621 @RequestBody RequestDetails requestDetails) {
623 String methodName = "removeRelationshipFromServiceInstance";
624 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
626 MsoResponseWrapper w;
628 w = msoBusinessLogic.removeRelationshipFromServiceInstance(requestDetails, serviceInstanceId);
629 } catch (Exception e){
630 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
631 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
633 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
636 @RequestMapping(value = "/mso_add_relationship/{serviceInstanceId}", method = RequestMethod.POST)
637 public ResponseEntity<String> addRelationshipToServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
638 @RequestBody RequestDetails requestDetails) {
640 String methodName = "addRelationshipToServiceInstance";
641 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
643 MsoResponseWrapper w;
645 w = msoBusinessLogic.addRelationshipToServiceInstance(requestDetails, serviceInstanceId);
646 } catch (Exception e){
647 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
648 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
650 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
653 @RequestMapping(value = "/mso_activate_fabric_configuration/{serviceInstanceId}", method = RequestMethod.POST)
654 public MsoResponseWrapper2 activateFabricConfiguration(
655 @PathVariable("serviceInstanceId") String serviceInstanceId ,
656 @RequestBody RequestDetails requestDetails) {
658 String methodName = "activateFabricConfiguration";
659 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
661 return msoBusinessLogic.activateFabricConfiguration(serviceInstanceId, requestDetails);
664 @RequestMapping(value = "/mso_vfmodule_soft_delete/{serviceInstanceId}/{vnfInstanceId}/{vfModuleInstanceId}", method = RequestMethod.POST)
665 public MsoResponseWrapper2 deactivateAndCloudDelete(
666 @PathVariable("serviceInstanceId") String serviceInstanceId,
667 @PathVariable("vnfInstanceId") String vnfInstanceId,
668 @PathVariable("vfModuleInstanceId") String vfModuleInstanceId,
669 @RequestBody SoftDeleteRequest softDeleteRequest) {
671 String methodName = "deactivateAndCloudDelete";
672 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
674 RequestDetails requestDetails = msoBusinessLogic.buildRequestDetailsForSoftDelete(softDeleteRequest);
676 cloudOwnerService.enrichRequestWithCloudOwner(requestDetails);
677 return msoBusinessLogic.deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails);
685 * @param response the response
686 * @throws IOException Signals that an I/O exception has occurred.
688 @ExceptionHandler(Exception.class)
689 private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
691 ControllersUtils.handleException(e, LOGGER);
693 response.setContentType("application/json; charset=UTF-8");
694 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
696 ExceptionResponse exceptionResponse = new ExceptionResponse();
697 exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
698 exceptionResponse.setMessage(e.getMessage());
700 response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
702 response.flushBuffer();