...
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 | 4 | CPS Core API's under this link | The remaining CPS core API's might require modification with respect to decisions made for the GET operation. Based upon the decisions for the above Issue this table will be updated from time to time. | in the meeting it was decided to focus on GET operation first as the work on remaining API's seemed different from the one for the GET API. Also it was decided to first have a discussion with the architects regarding the GET API and then have a separate discussion for the remaining API;s. |
List of impacted API's
Operation | API | Issues | Possible Solution | ||||||
---|---|---|---|---|---|---|---|---|---|
GET
| Get a Node |
|
| ||||||
PUT remainingAPI | remainingAPI |
|
|
| |||||
DELETE | Delete a datanode |
| |||||||
PATCH | Update node leaves |
|
| ||||||
POST | Add list element to existing list |
|
|
The existing GET operation
Code Block |
---|
//Returns single fragment entity
default FragmentEntity findFirstRootByDataspaceAndAnchor(@NonNull DataspaceEntity dataspaceEntity,
@NonNull AnchorEntity anchorEntity) {
return findRootsByDataspaceAndAnchor(dataspaceEntity.getId(), anchorEntity.getId()).stream().findFirst()
.orElseThrow(() -> new DataNodeNotFoundException(dataspaceEntity.getName(), anchorEntity.getName())); |
...
Currently after multiple data trees are stored in CPS DB. On performing the GET operation on the same data, with xpath set as root "/", the first data tree is returned by the CPS-Core Get Data Node API. This data tree is returned in form of a JSON Object as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
{
"multiple-data-tree:first-container": {
"a-leaf": "a-Value"
}
} |
After the GET API is updated, we want all the data trees to be returned when the xpath is set to root "/" and when a specific xpath is provided we want the functionality to remain as is. Now, when the xpath is set as root, CPS should return all the data trees. Now there are two possible responses we can get here:
Code Block | ||||
---|---|---|---|---|
| ||||
[ //JSON Array
{ //Data Tree 1
"multiple-data-tree:first-container": {
"a-leaf": "a-Value"
}
},
{ //Data Tree 2
"multiple-data-tree:last-container": {
"x-leaf": "x-value"
}
}
] |
| |||||||||
PATCH
| Update node leaves |
| Update node API should support Patch operation for multiple data nodes.
| ||||||
POST | Add list element to existing list |
|
Code Block | ||||
---|---|---|---|---|
| ||||
{ //Data Tree 1
"multiple-data-tree:first-container": {
"a-leaf": "a-Value"
}
},
{ //Data Tree 2
"multiple-data-tree:last-container": {
"x-leaf": "x-value"
}
} |
...
The CPS NCMP DMI plugin internally calls the getDataNode method in order to fetch the configuration data for NCMP-DMI plugin, As of now it expects only a single DataNode to be returned by the getDataNode method and with the updated GET API we are now getting a collection of one or more data nodes from the getDtaNode method.
A couple of things to be checked here are:
- Will there be any Impact of multiple data nodes on the functionality of NCMP plugin
- Appropriate approach to bring in support for multiple data nodes into NCMP
The error was noticed in the following files, where the getDataNode method is being called internally:
...