2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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 WORKFLOW_ID = "<workflow_UUID>";
78 public static final String START_LOG = " start";
80 private final MsoBusinessLogic msoBusinessLogic;
81 private final CloudOwnerService cloudOwnerService;
84 public MsoController(MsoBusinessLogic msoBusinessLogic, CloudOwnerService cloudOwnerService) {
85 this.msoBusinessLogic = msoBusinessLogic;
86 this.cloudOwnerService = cloudOwnerService;
90 * Creates the svc instance.
92 * @param request the request
93 * @return the response entity
94 * @throws Exception the exception
96 @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
97 public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
98 String methodName = "createSvcInstance";
100 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
102 // always return OK, the MSO status code is embedded in the body
104 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
105 MsoResponseWrapper w = msoBusinessLogic.createSvcInstance(msoRequest);
107 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
112 * Creates the e2e svc instance.
114 * @param request the request
115 * @return the response entity
116 * @throws Exception the exception
118 @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)
119 public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
120 String methodName = "createE2eSvcInstance";
122 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
124 // always return OK, the MSO status code is embedded in the body
126 //cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
127 MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(msoRequest.get("requestDetails"));
129 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
136 * @param serviceInstanceId the service instance id
137 * @param request the request
138 * @return the response entity
139 * @throws Exception the exception
141 @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
142 public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
144 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
145 MsoResponseWrapper w = msoBusinessLogic.createVnf(msoRequest, serviceInstanceId);
147 // always return OK, the MSO status code is embedded in the body
149 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
154 * Creates the nw instance.
156 * @param serviceInstanceId the service instance id
157 * @param request the request
158 * @return the response entity
159 * @throws Exception the exception
161 @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
162 public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
163 String methodName = "createNwInstance";
164 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
166 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
167 MsoResponseWrapper w = msoBusinessLogic.createNwInstance(msoRequest, serviceInstanceId);
169 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
174 * Creates the volume group instance.
176 * @param serviceInstanceId the service instance id
177 * @param vnfInstanceId the vnf instance id
178 * @param request the request
179 * @return the response entity
180 * @throws Exception the exception
182 @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
183 public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
184 HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
185 String methodName = "createVolumeGroupInstance";
186 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
188 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
189 MsoResponseWrapper w = msoBusinessLogic.createVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId);
191 // always return OK, the MSO status code is embedded in the body
192 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
196 * Creates the vf module instance.
198 * @param serviceInstanceId the service instance id
199 * @param vnfInstanceId the vnf instance id
200 * @param request the request
201 * @return the response entity
202 * @throws Exception the exception
204 @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
205 public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
206 @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
207 String methodName = "createVfModuleInstance";
209 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
211 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
212 MsoResponseWrapper w = msoBusinessLogic.createVfModuleInstance(msoRequest, serviceInstanceId, vnfInstanceId);
214 // always return OK, the MSO status code is embedded in the body
216 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
220 * Creates a configuration instance.
222 * @param serviceInstanceId the service instance id
223 * @param request the request
224 * @return the response entity
225 * @throws Exception the exception
227 @RequestMapping(value = "/mso_create_configuration_instance/{serviceInstanceId}/configurations/", method = RequestMethod.POST)
228 public ResponseEntity<String> createConfigurationInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
229 HttpServletRequest request, @RequestBody RequestDetailsWrapper msoRequest) {
230 String methodName = "createConfigurationInstance";
231 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
233 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest.getRequestDetails());
234 MsoResponseWrapper w = msoBusinessLogic.createConfigurationInstance(msoRequest, serviceInstanceId);
236 // always return OK, the MSO status code is embedded in the body
238 return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
242 * Delete E2e svc instance.
244 * @param serviceInstanceId the service instance id
245 * @param request the request
246 * @return the response entity
247 * @throws Exception the exception
249 @RequestMapping(value = "/mso_delete_e2e_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
250 public ResponseEntity<String> deleteE2eSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
251 HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
253 LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), msoRequest);
254 MsoResponseWrapper w = msoBusinessLogic.deleteE2eSvcInstance(msoRequest.get("requestDetails"), serviceInstanceId);
255 // always return OK, the MSO status code is embedded in the body
257 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
262 * Delete svc instance.
264 * @param serviceInstanceId the service instance id
265 * @param request the request
266 * @return the response entity
267 * @throws Exception the exception
270 @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
271 public String deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
272 HttpServletRequest request, @RequestBody RequestDetails msoRequest,
273 @RequestParam(value = "serviceStatus") String serviceStatus) {
275 LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), msoRequest);
276 MsoResponseWrapper w = msoBusinessLogic.deleteSvcInstance(msoRequest, serviceInstanceId, serviceStatus);
277 // always return OK, the MSO status code is embedded in the body
279 return w.getResponse();
285 * @param serviceInstanceId the service instance id
286 * @param vnfInstanceId the vnf instance id
287 * @param request the request
288 * @return the response entity
289 * @throws Exception the exception
291 @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
293 public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
294 HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
295 String methodName = "deleteVnf";
297 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
298 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
299 MsoResponseWrapper w = msoBusinessLogic.deleteVnf(msoRequest, serviceInstanceId, vnfInstanceId);
301 // always return OK, the MSO status code is embedded in the body
302 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
307 * Delete configuration instance
308 * @param serviceInstanceId the service instance id
309 * @param configurationId the configuration id
310 * @param msoRequest the request
311 * @return the response entity
312 * @throws Exception the exception
314 @RequestMapping(value = "mso_delete_configuration/{serviceInstanceId}/configurations/{configurationId}",
315 method = RequestMethod.POST)
316 public ResponseEntity<String> deleteConfiguration(
317 @PathVariable("serviceInstanceId") String serviceInstanceId,
318 @PathVariable ("configurationId") String configurationId,
319 @RequestBody RequestDetailsWrapper msoRequest) {
321 String methodName = "deleteConfiguration";
322 LOGGER.debug(EELFLoggerDelegate.debugLogger,
323 "<== " + methodName + START_LOG);
325 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest.getRequestDetails());
326 MsoResponseWrapper w = msoBusinessLogic.deleteConfiguration(msoRequest, serviceInstanceId, configurationId);
328 // always return OK, the MSO status code is embedded in the body
329 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
333 * Activate configuration instance
334 * @param serviceInstanceId the service instace id
335 * @param configurationId the configuration id
336 * @param msoRequest the request
337 * @return the response entity
338 * @throws Exception the exception
340 @RequestMapping(value = "mso_activate_configuration/{serviceInstanceId}/configurations/{configurationId}",
341 method = RequestMethod.POST)
342 public ResponseEntity<String> activateConfiguration(
343 @PathVariable("serviceInstanceId") String serviceInstanceId,
344 @PathVariable("configurationId") String configurationId,
345 @RequestBody RequestDetails msoRequest) {
347 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
348 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, true);
350 // always return OK, the MSO status code is embedded in the body
351 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
355 * Deactivate configuration instance
356 * @param serviceInstanceId the service instace id
357 * @param configurationId the configuration id
358 * @param msoRequest the request
359 * @return the response entity
360 * @throws Exception the exception
362 @RequestMapping(value = "mso_deactivate_configuration/{serviceInstanceId}/configurations/{configurationId}",
363 method = RequestMethod.POST)
364 public ResponseEntity<String> deactivateConfiguration(
365 @PathVariable("serviceInstanceId") String serviceInstanceId,
366 @PathVariable("configurationId") String configurationId,
367 @RequestBody RequestDetails msoRequest) {
369 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
370 MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, false);
372 // always return OK, the MSO status code is embedded in the body
373 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
377 * Disable port on configuration instance
378 * @param serviceInstanceId the service instance id
379 * @param configurationId the configuration instance id
380 * @param msoRequest the request
381 * @return the response entity
382 * @throws Exception the exception
384 @RequestMapping(value = "mso_disable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
385 method = RequestMethod.POST)
386 public ResponseEntity<String> disablePortOnConfiguration(
387 @PathVariable("serviceInstanceId") String serviceInstanceId,
388 @PathVariable("configurationId") String configurationId,
389 @RequestBody RequestDetails msoRequest) {
391 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
392 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, false);
394 // always return OK, the MSO status code is embedded in the body
395 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
399 * Enable port on configuration instance
400 * @param serviceInstanceId the service instance id
401 * @param configurationId the configuration instance id
402 * @param msoRequest the request
403 * @return the response entity
404 * @throws Exception the exception
406 @RequestMapping(value = "mso_enable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
407 method = RequestMethod.POST)
408 public ResponseEntity<String> enablePortOnConfiguration(
409 @PathVariable("serviceInstanceId") String serviceInstanceId,
410 @PathVariable("configurationId") String configurationId,
411 @RequestBody RequestDetails msoRequest) {
413 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
414 MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, true);
416 // always return OK, the MSO status code is embedded in the body
417 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
423 * @param serviceInstanceId the service instance id
424 * @param vnfInstanceId the vnf instance id
425 * @param vfModuleId the vf module id
426 * @param request the request
427 * @return the response entity
428 * @throws Exception the exception
430 //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
431 @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
432 public ResponseEntity<String> deleteVfModule(
433 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
434 @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
436 String methodName = "deleteVfModule";
437 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
439 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
440 MsoResponseWrapper w = msoBusinessLogic.deleteVfModule(msoRequest, serviceInstanceId, vnfInstanceId, vfModuleId);
442 // always return OK, the MSO status code is embedded in the body
443 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
447 * Delete volume group instance.
449 * @param serviceInstanceId the service instance id
450 * @param vnfInstanceId the vnf instance id
451 * @param volumeGroupId the volume group id
452 * @param request the request
453 * @return the response entity
454 * @throws Exception the exception
456 @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
457 public ResponseEntity<String> deleteVolumeGroupInstance(
458 @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
459 HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
460 String methodName = "deleteVolumeGroupInstance";
461 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
463 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
464 MsoResponseWrapper w = msoBusinessLogic.deleteVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId, volumeGroupId);
466 // always return OK, the MSO status code is embedded in the body
467 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
471 * Delete nw instance.
473 * @param serviceInstanceId the service instance id
474 * @param networkInstanceId the network instance id
475 * @param request the request
476 * @return the response entity
477 * @throws Exception the exception
479 @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
480 public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
481 @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
482 String methodName = "deleteNwInstance";
483 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
485 cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
486 MsoResponseWrapper w = msoBusinessLogic.deleteNwInstance(msoRequest, serviceInstanceId, networkInstanceId);
488 // always return OK, the MSO status code is embedded in the body
489 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
493 * Gets the orchestration request.
495 * @param requestId the request id
496 * @param request the request
497 * @return the orchestration request
498 * @throws Exception the exception
500 @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
501 public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
502 HttpServletRequest request) {
504 String methodName = "getOrchestrationRequest";
505 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
508 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequest(requestId);
510 // always return OK, the MSO status code is embedded in the body
511 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
515 * Gets the orchestration requests.
517 * @param filterString the filter string
518 * @param request the request
519 * @return the orchestration requests
520 * @throws Exception the exception
522 @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
523 public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
524 HttpServletRequest request) {
526 String methodName = "getOrchestrationRequests";
527 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
530 MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequests(filterString);
532 // always return OK, the MSO status code is embedded in the body
533 return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
537 * activate to a pnf instance.
539 * @param serviceInstanceId the id of the service.
540 * @param requestDetails the body of the request.
541 * @return the response entity
542 * @throws Exception the exception
544 @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
545 public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
546 String methodName = "activateServiceInstance";
547 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
549 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, true);
550 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
554 * deactivate a service instance.
556 * @param serviceInstanceId the id of the service.
557 * @param requestDetails the body of the request.
558 * @return the response entity
559 * @throws Exception the exception
561 @RequestMapping(value = "/mso_deactivate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
562 public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
563 String methodName = "deactivateServiceInstance";
564 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
566 MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, false);
567 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
571 * Gets the orchestration requests for the dashboard.
572 * currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
573 * @return the orchestration requests
574 * @throws Exception the exception
576 @RequestMapping(value = "/mso_get_orch_reqs/dashboard", method = RequestMethod.GET)
577 public List<Request> getOrchestrationRequestsForDashboard() {
579 String methodName = "getOrchestrationRequestsForDashboard";
580 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
583 return msoBusinessLogic.getOrchestrationRequestsForDashboard();
587 * Gets the Manual Tasks for the given request id.
589 * @param originalRequestId the id of the original request.
591 * @throws Exception the exception
593 @RequestMapping(value = "/mso_get_man_task/{originalRequestId}", method = RequestMethod.GET)
594 public List<Task> getManualTasksByRequestId(@PathVariable("originalRequestId") String originalRequestId) {
596 String methodName = "getManualTasksByRequestId";
597 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
599 return msoBusinessLogic.getManualTasksByRequestId(originalRequestId);
603 * Complete the manual task.
605 * @param taskId the id of the task to complete.
606 * @param requestDetails the body of the request.
607 * @return the response entity
608 * @throws Exception the exception
610 @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)
611 public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) {
613 String methodName = "manualTaskComplete";
614 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
616 MsoResponseWrapper w = msoBusinessLogic.completeManualTask(requestDetails, taskId);
617 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
620 @RequestMapping(value = "/mso_remove_relationship/{serviceInstanceId}", method = RequestMethod.POST)
621 public ResponseEntity<String> removeRelationshipFromServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
622 @RequestBody RequestDetails requestDetails) {
624 String methodName = "removeRelationshipFromServiceInstance";
625 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
627 MsoResponseWrapper w;
629 w = msoBusinessLogic.removeRelationshipFromServiceInstance(requestDetails, serviceInstanceId);
630 } catch (Exception e){
631 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
632 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
634 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
637 @RequestMapping(value = "/mso_add_relationship/{serviceInstanceId}", method = RequestMethod.POST)
638 public ResponseEntity<String> addRelationshipToServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
639 @RequestBody RequestDetails requestDetails) {
641 String methodName = "addRelationshipToServiceInstance";
642 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
644 MsoResponseWrapper w;
646 w = msoBusinessLogic.addRelationshipToServiceInstance(requestDetails, serviceInstanceId);
647 } catch (Exception e){
648 LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
649 return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
651 return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
654 @RequestMapping(value = "/mso_activate_fabric_configuration/{serviceInstanceId}", method = RequestMethod.POST)
655 public MsoResponseWrapper2 activateFabricConfiguration(
656 @PathVariable("serviceInstanceId") String serviceInstanceId ,
657 @RequestBody RequestDetails requestDetails) {
659 String methodName = "activateFabricConfiguration";
660 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
662 return msoBusinessLogic.activateFabricConfiguration(serviceInstanceId, requestDetails);
665 @RequestMapping(value = "/mso_vfmodule_soft_delete/{serviceInstanceId}/{vnfInstanceId}/{vfModuleInstanceId}", method = RequestMethod.POST)
666 public MsoResponseWrapper2 deactivateAndCloudDelete(
667 @PathVariable("serviceInstanceId") String serviceInstanceId,
668 @PathVariable("vnfInstanceId") String vnfInstanceId,
669 @PathVariable("vfModuleInstanceId") String vfModuleInstanceId,
670 @RequestBody SoftDeleteRequest softDeleteRequest) {
672 String methodName = "deactivateAndCloudDelete";
673 LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
675 RequestDetails requestDetails = msoBusinessLogic.buildRequestDetailsForSoftDelete(softDeleteRequest);
677 cloudOwnerService.enrichRequestWithCloudOwner(requestDetails);
678 return msoBusinessLogic.deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails);
686 * @param response the response
687 * @throws IOException Signals that an I/O exception has occurred.
689 @ExceptionHandler(Exception.class)
690 private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
692 ControllersUtils.handleException(e, LOGGER);
694 response.setContentType("application/json; charset=UTF-8");
695 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
697 ExceptionResponse exceptionResponse = new ExceptionResponse();
698 exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
699 exceptionResponse.setMessage(e.getMessage());
701 response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
703 response.flushBuffer();