Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-2247

NCMP exception handling extension for PolicyExecution

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Low Low
    • Oslo Release
    • None
    • NCMP
    • None

      We are building some customization around ONAP code that will allow us to support conflict handling.

      We need the ability to create HTTP 409 conflict response on NCMP's interface.

      There is an exception handler class for NCMP:

      @Slf4j
      @RestControllerAdvice(assignableTypes = {NetworkCmProxyController.class, NetworkCmProxyInventoryController.class})
      @NoArgsConstructor(access = AccessLevel.PACKAGE)
      public class NetworkCmProxyRestExceptionHandler {
       

      In this class, it is already possible to generate HTTP 409 response towards the client if `AlreadyDefinedException` is thrown:

      @ExceptionHandler({AlreadyDefinedException.class})
      public static ResponseEntity<Object> handleAlreadyDefinedExceptions(final Exception exception) {
          return buildErrorResponse(HttpStatus.CONFLICT, exception);
      } 

       

      In the same package as `AlreadyDefinedException`, there is an exception called `DataInUseException`:
      package org.onap.cps.spi.exceptions;
       
      We are asking the team to add the same handler to the above class for the `DataInUseException`:

      @ExceptionHandler({DataInUseException.class})
      public static ResponseEntity<Object> handleDataInUseException(final Exception exception) {
          return buildErrorResponse(HttpStatus.CONFLICT, exception);
      } 

      This would allow us to use this type of exception in our custom Bean built around NCMP, without changing the ONAP code.
       
      The other change that we are proposing is to extend the OpenAPI with the 409 response. Since it is already a possibility (based on the exception handler class) to have 409 on the interface, this would be useful in cps-ncmp-rest/docs/openapi/ncmp.yaml for POST operation `createResourceDataRunningForCmHandle`:
       

      409:
        $ref: 'components.yaml#/components/responses/Conflict'

       

      The components.yaml already contains the `Conflict` message format.

            Unassigned Unassigned
            emolger Gergely Molnar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: