Overview
In CPS-341 the POST operation to create a new data node was updated to bring support for a multiple data trees under a single anchor (or a single root "/" node). In order to achieve this, the JSON data containing multiple data trees are parsed into a Collection of data nodes.
...
It is to be noted here that the methods used for GET operation are not limited to Get a Node API and are reused in other API's as well. All the APIS discussed below internally call the getFragmentWithoutDescendantsByXpath()
to retrieve the data trees. This epic covers the impact on all the API's due to the above mentioned changes in CPS core.
A common task across the API's is to maintain backwards compatibility as well.
References
Jira server ONAP Jira columnIds issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 425b2b0a-557c-3c0c-b515-579789cceedb key CPS-1391 Jira server ONAP Jira columnIds issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 425b2b0a-557c-3c0c-b515-579789cceedb key CPS-341 - CPS-341 Spike: Support multiple data tree instances under 1 anchor
Related Tasks/Jira/Wiki
- Implement Get data node v2:
- Support Patch operation for multiple data nodes:
Open Issues and Decisions
# | API | Issue/Description | Notes | Decision |
---|---|---|---|---|
1 | Get operation should return all the data trees under the root when xpath is set to "/" | after discussion with Toine Siebelink it was decided to give priority to the GET operation first, before heading for other API's. A discussion with the architects is to be scheduled to discuss upon the following points:
after discussion with the architects it was decided to have a v2 of the GET API and the v2 will return all the data nodes in an array |
| |
2 | Response body of GET API | should GET Data Node return a JSON array or JSON object in response for multiple data trees | as discussed in weekly meeting, it was decided that v2 of the GET API will return JSON Array and v1 will remain as is (that is returns single data node as JSON Object) | |
3 | Impact on NCMP DMI plugin | impact analysis of Get Data Node returning multiple data trees on NCMP DMI plugin | The task is not of high priority as of now. As per CPS-sub team discussion this task was put on hold. |
|
4 | Update Data Node API | Update data node had inconsistencies where, updating leaf nodes for multiple container nodes would throw unexpected error. And updating multiple list items in a list data node would cause partial update operation | After presenting the findings for patch operation and as per discussion in CPS sub team daily call, it was concluded that support for Patch operation for multiple data nodes would solve the inconsistencies found in the existing Patch operation. | Support for Patch for multiple data nodes to be implemented. |
List of impacted API's
Operation | API | Issues | Possible Solution | ||||||
---|---|---|---|---|---|---|---|---|---|
GET
| Get a Node |
|
| ||||||
PUT |
|
- when the API is called with xpath set to "/", it will return all the data trees
- once all the data trees are returned the PUT operation will be performed
- if xpath is set to "/" and the number of data trees on which the replace operation is being performed is less than the total number of data trees the operation of retrieving all the data trees is not feasible
- when xpath is set to "/" the replace operation can return an error message
- the user can specify the data tree for which Replace operation is to be performed, but the drawback of this approach is if the number of data trees on which replace operation is to be performed is significantly big
- when delete operation is performed with xpath set to root all the data trees must be deleted
- when the API is called and xpath is set to "/", a get operation is executed internally to retrieve all the data trees first
- once all the data trees are returned in a List the API proceeds to perform the Patch operation
- if xpath is set to "/" and the number of data trees on which the patch operation is being performed is less than the total number of data trees the operation of retrieving all the data trees is not feasible
- when xpath is set to "/" the patch operation can return an error message
- the user can specify the data tree for which patch operation is to be performed, but the drawback of this approach is, when the number of data trees on which patch operation is to be performed is significantly big
- when the API is called with xpath set to "/", it will return all the data trees
- once all the data trees are returned the PUT operation will be performed
- if xpath is set to / and the number of data trees on which the replace operation is being performed is less than the total number of data trees the operation of retrieving all the data trees is not feasible
- this operation is to be performed on a list in an existing data tree. hence the possibility of multiple lists in multiple trees bring updated at same time is to be taken into consideration
|
| ||||||||
DELETE | Delete a datanode |
| |||||||
PATCH
| Update node leaves |
| Update node API should support Patch operation for multiple data nodes.
| ||||||
POST | Add list element to existing list |
|