Versions Compared

Key

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

...

The following JSON data was first stored in CPS DB, then to test the GET operation:

Code Block
{
  "first-container": multiple-data-tree:interface-A": {
    "host-name": "host",
    "interface": [
      {
        "name": "a-leaf": "a-ValueInterface-A",
        "address": "10.10.10.1",
        "subnet-mask": "255.255.255.0",
        "enabled": false
      }
    ],
    "domain": "false"
  },
  "last-container": {
multiple-data-tree:interface-B": {
    "interface": [
      {
     "x-leaf": "x-value"   "name": "Interface-B",
        "address": "10.10.10.1",
        "subnet-mask": "255.255.255.0"
      }
    ]
  }
}

Analysis of Patch operation (Update node leaves)

...

  1. Updating all data trees under an anchor with root node xPath "/"

    CURL request to update all data trees

    Code Block
    curl --location --request PATCH 'http://localhost:8080/cps/api/v2v1/dataspaces/testDataspace/anchors/multipleDataTreesample/nodes?xpath=%2F&observed-timestamp=2021-03-21T00%3A10%3A34.030-0100' --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' --header 'Cookie: JSESSIONID=node056putyccbmdr1ij6x17mynl312node0iyclt1syzfqj28jzo5qc5gks1.node0' \
    --data '{
      "first-containermultiple-data-tree:interface-A": {
        "a-leafhost-name": "host-A",
        "interface": [
          {
            "name": "a-updated-valueInterface-A",
            "address": "10.10.10.100",
            "subnet-mask": "255.255.255.25",
            "enabled": false
          }
        ],
        "domain": "true"
      },
      "last-containermultiple-data-tree:interface-B": {
        "interface": [
          {
            "name": "x-leaf": "x-updated-value"
      }
    }'
    Response: 200 OK
    Interface-B",
            "address": "10.10.10.1100",
            "subnet-mask": "255.255.255.0"
          }
        ]
      }
    }'

    Response: 500 Server Error

    Code Block
    {
        "status": "500 INTERNAL_SERVER_ERROR",
        "message": "could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement",
        "details": "Check logs for details."
    }


    On performing Get operation we get the following JSON data

    Code Block
    [
        {
        "multiple-data-tree:last-container": {
        "int:interface-A": {
                "domain": "false",
                "host-name": "host",
                "interface": [
                    {
                    "x-leaf": "x-value"
        }
        "name": "Interface-A",
                        "address": "10.10.10.1",
                        "enabled": false,
                        "subnet-mask": "255.255.255.0"
                    }
                ]
            }
        },
        {
            "multiple-data-tree:first-container": {
    int:interface-B": {
                "interface": [
                    {
                       "a-leaf": "a-updated-value"
        }
       "name": "Interface-B",
                        "address": "10.10.10.1",
                        "subnet-mask": "255.255.255.0"
                    }
                ]
            }
        }
    ]


  2. Updating the first data tree
    CURL request to update first data tree

    Code Block
    curl --location --request PATCH 'http://localhost:8080/cps/api/v2v1/dataspaces/testDataspace/anchors/multipleDataTreesample/nodes?xpath=%2Ffirst-container&observed-timestamp=2021-03-21T00%3A10%3A34.030-0100' %2Finterface-A' \
    --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' --header 'Cookie: JSESSIONID=node02yp851tkv9yvzexd1irvkyqc0node0iyclt1syzfqj28jzo5qc5gks1.node0' \
    --data '{
            "first-containerint:interface": {
           "a-leaf": "a-updated-value"
      }
    }'

    Response

         "name": "Interface-A",
                "address": "10.10.10.200",
                "enabled": true,
                "subnet-mask": "255.255.255.0"
            }
        }'

    Response 200 OK
    Updated data after making get request

    Code Block
    [
      
    Code Block
    {
        "statusint:interface-A": {
          "400 BAD_REQUESTdomain": "false",
          "messagehost-name": "host",
          "interface"Failed: to[
     parse json data. Unsupported xpath or json data:{\"first-container\":{\"a-leaf\":\"a-updated-value\"}}",
    {
              "name": "Interface-A",
              "address": "10.10.10.200",
              "detailsenabled": true,
     "Schema node with name first-container was not found under (org:onap:ccsdk:multiDataTree?revision=2020-09-15)first-container."
    } "subnet-mask": "255.255.255.0"
            }
          ]
        }
      }
    ]


  3. Updating the second data tree
    CURL request to update second data tree

    Code Block
    curl --location --request PATCH 'http://localhost:8080/cps/api/v2v1/dataspaces/testDataspace/anchors/multipleDataTreesample/nodes?xpath=%2Flast-container&observed-timestamp=2021-03-21T00%3A10%3A34.030-0100' %2Finterface-B' \
    --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' --header 'Cookie: JSESSIONID=node02yp851tkv9yvzexd1irvkyqc0node0iyclt1syzfqj28jzo5qc5gks1.node0' \
    --data '{
           "last-container "int:interface": {
        "x-leaf": "x-updated-value"
      }
    }'

    Response

            "name": "Interface-B",
                "address": "10.10.10.200",
                "subnet-mask": "255.255.255.10"
            }
        }'

    Response 200 OK
    Updated data after making get request

    Code Block
    [
      
    Code Block
    {
        "statusint:interface-B": {
     "400 BAD_REQUEST",
        "messageinterface": "Failed to parse json data. Unsupported xpath or json data:{\"last-container\":{\"x-leaf\":\"x-updated-value\"}} [
            {
              "name": "Interface-B",
              "address": "10.10.10.200",
        "details      "subnet-mask": "Schema node with name last-container was not found under (org:onap:ccsdk:multiDataTree?revision=2020-09-15)last-container."
    }"255.255.255.10"
            }
          ]
        }
      }
    ]