Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-591

CPS-Core Leaf stored as integer is being returned from DB as float

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Istanbul Release
    • Istanbul Release
    • CPS-Core
    • None

      REASON: We use GSON.fromJson() to parse the JSON data received from DB into a DataNode Object. It is unable to parse Integers and defaults all numerical data to Double Objects.

       

      YANG cps-cavsta-onap-internal@2021-01-28.yang
      Data Space E2EDemo
      Schema Set in CPS/Model in TBDMT based query ran-coverage-area
      Anchor coverage-area-onap
      Top Parent Node ran-coverage-area
      Data Node cavsta-data.json

      Attached are YANG file and associated JSON payload used for testing.

      Node is created in CPS-Core using, POST http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/coverage-area-onap/nodes

      When following query is performed, 

      http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/coverage-area-onap/nodes/query?cps-path=/ran-coverage-area&include-descendants=true

       

      following result is obtained, and not sure why "decimal point and 0" are included in the value (most probably as String?)

       
      [
      {
      "xpath": "/ran-coverage-area",
      "leaves": {},
      "childDataNodes": [
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']",
      "leaves":

      { "mcc": "310", "mnc": "410" }

      ,
      "childDataNodes": [
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']",
      "leaves":

      { "coverageArea": "Chennai" }

      ,
      "childDataNodes": [
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='202']",
      "leaves":

      { "nRTAC": 202.0 }

      ,
      "childDataNodes": [
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='202']/taCellsList[@cellLocalId='15155']",
      "leaves":

      { "cellLocalId": 15155.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='202']/taCellsList[@cellLocalId='15176']",
      "leaves":

      { "cellLocalId": 15176.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='202']/taCellsList[@cellLocalId='15174']",
      "leaves":

      { "cellLocalId": 15174.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='202']/taCellsList[@cellLocalId='15175']",
      "leaves":

      { "cellLocalId": 15175.0 }

      ,
      "childDataNodes": []
      }
      ]
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='101']",
      "leaves":

      { "nRTAC": 101.0 }

      ,
      "childDataNodes": [
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='101']/taCellsList[@cellLocalId='15296']",
      "leaves":

      { "cellLocalId": 15296.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='101']/taCellsList[@cellLocalId='15290']",
      "leaves":

      { "cellLocalId": 15290.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='101']/taCellsList[@cellLocalId='15289']",
      "leaves":

      { "cellLocalId": 15289.0 }

      ,
      "childDataNodes": []
      }
      ]
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='303']",
      "leaves":

      { "nRTAC": 303.0 }

      ,
      "childDataNodes": [
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='303']/taCellsList[@cellLocalId='15826']",
      "leaves":

      { "cellLocalId": 15826.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='303']/taCellsList[@cellLocalId='15825']",
      "leaves":

      { "cellLocalId": 15825.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='303']/taCellsList[@cellLocalId='13999']",
      "leaves":

      { "cellLocalId": 13999.0 }

      ,
      "childDataNodes": []
      },
      {
      "xpath": "/ran-coverage-area/pLMNIdList[@mcc='310' and @mnc='410']/coverage-area[@coverageArea='Chennai']/coverageAreaTAList[@nRTAC='303']/taCellsList[@cellLocalId='14000']",
      "leaves":

      { "cellLocalId": 14000.0 }

      ,
      "childDataNodes": []
      }
      ]
      }
      ]
      }
      ]
      }
      ]
      }
      ]
       
      The below XPATH query works

       sandeepos@sandeepos-Gazelle:~/NetworkSlicing/configDB/CPS/gerrit/Aug2021/common-cps-and-tbdmt/common$ curl -g -H "Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=" --request GET 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/coverage-area-onap/node?xpath=/ran-coverage-area/pLMNIdList[@mcc=%27310%27%20and%20@mnc=%27410%27]/coverage-area[@coverageArea=%27Chennai%27]/coverageAreaTAList[@nRTAC=%27101%27]&include-descendants=true'

      {"nRTAC":101.0,"taCellsList":[

      {"cellLocalId":15296.0}

      ,{"cellLocalId":15289.0},{"cellLocalId":15290.0}]} 

      However - please advise why above values have decimal point and 0 included? 

      Thanks!

            lukegleeson lukegleeson
            sandeeplinux sandeeplinux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: