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

Create cm handle from NCMP Inventory returns Server Error when cm handle already exists

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Jakarta Release
    • Jakarta Release
    • NCMP
    • None
    • Personal local environment running cps from latest master `b5a9ec3`

      Steps to reproduce:

      1. Start CPS and NCP application
      2. Send a request to create some cm handles:
      curl -X POST 'http://localhost:8080/ncmpInventory/v1/ch' \
      -H 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \
      -H 'Content-Type: application/json' \
      -H 'Cookie: JSESSIONID=node01g3jijb3xorh9a4gb5rgxnocr0.node0' \
      --data-raw '{
          "dmiPlugin": "http://localhost:8080",
          "createdCmHandles": [
              {
                  "cmHandle": "cmHandleId1"
              },
              {
                  "cmHandle": "cmHandleId2"
              },
              {
                  "cmHandle": "cmHandleId3"
              }
          ]
      }'
      

          3. Send another request to create the same cm handles again:

      curl -X POST 'http://localhost:8080/ncmpInventory/v1/ch' \ 
      -H 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' \ 
      -H 'Content-Type: application/json' \ 
      -H 'Cookie: JSESSIONID=node01g3jijb3xorh9a4gb5rgxnocr0.node0' \ 
      --data-raw '{
          "dmiPlugin": "http://localhost:8080",
          "createdCmHandles": [
              {
                  "cmHandle": "cmHandleId1"
              },
              {
                  "cmHandle": "cmHandleId2"
              },
              {
                  "cmHandle": "cmHandleId3"
              }
          ]
      }'

      Current behaviour:

      HTTP request response code is `500 Internal Server Error` with body:

      {
          "status": "500 INTERNAL_SERVER_ERROR",
          "message": "Already defined exception",
          "details": "Data node with name (one or more) of [/dmi-registry/cm-handles[@id='cmHandleId3'], /dmi-registry/cm-handles[@id='cmHandleId2'], /dmi-registry/cm-handles[@id='cmHandleId1']] already exists for ncmp-dmi-registry."
      }
      

      and server logs: error.log

       

      Expected behaviour:

      HTTP response code is `400 Bad Request` (with the same unchanged message and details in the body)

      See also https://wiki.onap.org/display/DW/CPS+Exceptions+and+REST+APIs+HTTP+Response+Codes#CPSExceptionsandRESTAPIsHTTPResponseCodes-CPS-NCMP:

      NCMP Inventory #8 - POST /v1/ch:  "Invalid requests should return 400"

            Unassigned Unassigned
            brusak brusak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: