Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 Get Data Node API. This data tree is returned in form of a JSON Object as follows:

  • CURL Request to get all data nodes under an anchor:
Code Block
curl --location 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/sample/node?xpath=%2F' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE='
  • Response:
Code Block
titleCurrent JSON response body
collapsetrue
{
        "multiple-data-tree:first-container": {
            "a-leaf": "a-Value"
        }
}
  • CURL Request to get individual data tree(with xPath= /first-container) under an anchor:
Code Block
curl --location 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/multipleDataTree/node?xpath=%2Ffirst-container' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE='
  • Response:
Code Block
titleCurrent JSON response body
collapsetrue
{
        "multiple-data-tree:first-container": {
            "a-leaf": "a-Value"
        }
}
  • CURL Request to get individual data tree(with xPath= /last-container) under an anchor:
Code Block
curl --location 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/sample/node?xpath=%2Flast-container' \
--header 'Accept: application/json' \
--header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE='
  • Response:
Code Block
titleCurrent JSON response body
collapsetrue
{
    "multiple-data-tree:last-container": {
        "x-leaf": "x-value"
    }
}

Expected Outcome

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.

...

  1. Data returned as a

    Anchor
    #decision
    #decision
    JSON array, with the array containing individual data trees (This approach was finalized to be implemented in V2 of get API)

    Code Block
    titleGet all the data trees in a JSON Array
    collapsetrue
    //JSON Array
    [
      {
        "multiple-data-tree:first-container": {	 //Data Tree 1
          "a-leaf": "a-Value"
        }
      },
      {
        "multiple-data-tree:last-container": {		//Data Tree 2
          "x-leaf": "x-value"
        }
      }
    ]


  2. Data Returned as a JSON object, with all data trees in a single object

    Code Block
    titleGet all the data trees as JSON Objects
    collapsetrue
    {
      "multiple-data-tree:first-container": {
        "a-leaf": "a-Value"
      },
      "multiple-data-tree:last-container": {
        "x-leaf": "x-value"
      }
    }


Impact on CPS-NCMP_DMI plugin
Anchor
ncmpPlugin
ncmpPlugin

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