Versions Compared

Key

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

...

Possible SolutionsPayloadDescription/FindingsComments
Identify the top-level keys in the existing JSON payload (which is JSON object) and then iterate over them and store them individually one by one in using Create node endpoint

The JSON object with multiple data trees would be structured as follows:

Code Block
{
  "container-name-1": { values },   //data tree 1
  "container-name-2": { values }    //data tree 2
}

Refer the following files for Yang and Json data (from spike CPS-341):

View file
nameJSON-object-multiple-top.json
height150
View file
nameJSON-object-multiple-top.yang
height150

  • Generally to iterate over a JSON object the top level key (here top_key_of_data_tree_1 and top_key_of_data_tree_2) is used to identify the number of data trees in the JSON object.
  • The problem with this approach is, that the libraries tested for the usecase only return the values stored under the top key and in order to retain the whole JSON we need to perform some data manipulation (concatenating key with value within CPS) which is not feasible.

Use new payload in form of JSON array and store the JSON array in CPS DB using Create node endpoint 

The JSON object with multiple data trees would be structured as follows:

Code Block
[
	{   //data tree 1
    	"container-name-1": { values }
	},
	{   //data tree 2
    	"container-name-2": { values }
	}
]

Refer the following files for Yang and Json data (from spike CPS-341):

View file
nameJSON-array-multiple-data-tree.json
height150
View file
nameJSON-array-multiple-data-tree.yang
height150

  • In this approach the data is received as JSON array and by performing simple iteration over the array we should be able to store the data with multiple trees in CPS
  • A PoC is WIP for the same.

...