Details
-
Bug
-
Status: Closed
-
Medium
-
Resolution: Done
-
Jakarta Release
Description
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
Attachments
Issue Links
- relates to
-
CPS-917 Structured Errors response for passthrough use-cases in NCMP
-
- Closed
-