-
Bug
-
Resolution: Done
-
Medium
-
Montreal Release
-
None
AAI Bulk API returns an information about a number (index) of an operation which makes whole transaction failing but not for all cases. When you send a bulk request with an operation which tries to delete a non-existing object you have a response
{"requestError":{"serviceException":{"messageId":"SVC3000","text":"Invalid input performing %1 on %2 (msg=%3) (ec=%4)","variables":["POST","v27/bulk/single-transaction","Invalid input performing %1 on %2:Operation 0 with action (DELETE) on uri (/cloud-infrastructure/complexes/complex/test-parse-bulk-response) failed with status code (404), error code (ERR.5.4.6114) and msg (Node Not Found:No Node of type complex found at: /cloud-infrastructure/complexes/complex/test-bulk-response)","ERR.5.2.3000"]}}}.
You can see there is an information that Operation 0 with action Delete is failing. But if user sends a request which can't be parsed due to fact some fields are missing it returns
{"requestError":{"serviceException":{"messageId":"SVC3000","text":"Invalid input performing %1 on %2 (msg=%3) (ec=%4)","variables":["POST","v27/bulk/single-transaction","Invalid input performing %1 on %2:Missing required property: physical-location-type,Missing required property: street1,Missing required property: city,Missing required property: postal-code,Missing required property: country,Missing required property: region","ERR.5.2.3000"]}}}
so there is no information about an operation index.
I analysed a bit a code of AAI and found that this exception is raised by aai-aai-common/aai-core/src/main/java/org/onap/aai/restcore/RESTAPI.java at master · onap/aai-aai-common (github.com) and that method is called on aai-resources/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java at master · onap/aai-resources (github.com). That code is already on try...catch section
try { ... this.validateIntrospector(obj, loader, bulkOperation.getUri(), bulkOperation.getHttpMethod()); <-- It raises AAIError exception ... } catch (UnsupportedEncodingException e) { throw new AAIException("AAI_3000", String.format(objectUnMarshallMsg, i, bulkOperation.getRawReq())); }
but as you can see above it's only UnsupportedEncodingException error catched. If that would be an AAIError we would have an information which operation is failing