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

Wrong error response format in case of Dmi plugin error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Kohn Release
    • Jakarta Release
    • NCMP

      Current behavior
      NCMP still gives back error in old format if the dmiPlugin responds with error

      500 INTERNAL_SERVER_ERROR
      {
          "status": "500 INTERNAL_SERVER_ERROR",
          "message": "404 : \"{\"status\":\"Not Found\",\"message\":\"OPERATION_FAILED\",\"details\":\"Requested resource not found.\"}\"",
          "details": "Check logs for details."
      } 

      Expected behavior
      Based on previous CPS items (CPS-917) and the code, if a DMI plugin responds with an error in case of dmiDataOperations the error returned by NCMP should be in DmiErrorMessageDmiresponse format.

       

      502 Bad Gateway
      {
        message: <message>
        "dmi-response":
         {
          "http-code": "404",
          "body": 
           {
           "status":"Not Found",
           "message":"OPERATION_FAILED",
           "details":"Requested resource not found."
           }
         }
      }

      Reproduction
      Send get request on non existing item in a dmiPlugi, where dmiPlugin will respond with 404 http code

      <ncmp_url>/ncmp/v1/ch/<cmhandle_id>/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=NonExistingItem=NonExistingItem

       

      Or send get request on non available dmiPlugin, where dmiPlugin will respond with 404 http code

      <ncmp_url>/ncmp/v1/ch/<cmhandle_id_of_nonresponding_dmi_plugin>/data/ds/ncmp-datastore:passthrough-operational?resourceIdentifier=ExistingItem=ExistingItem

       

      Additional information
      NetworkCmProxyRestExceptionHandler would return the correct format if a HttpClientRequestException came from the  NetworkCmProxyDataServiceImpl, but it never gives back an HttpClientRequestException because the restClient  throws HttpStatusCodeException in case of dmiPlugin error responses.
      NetworkCmProxyDataServiceImpl tries to check the response code however there is an exception.

      Logs
      Logs about the exception which should be handled right way, can be found in attachment

            ToineSiebelink Toine Siebelink
            csaba.eder csaba Eder
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: