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

Attach a (JSON) data instance for a container with children to a given Anchor

XMLWordPrintable

      -pre conditions

      dataspace created, anchor creates, schema set uploaded and associated with anchor

      Steps/flow

      1. Upload some json data for an anchor
      2. Retrieve the anchor to get the schemasSet name
      3. System should retrieve the schema set resources/schemaContext for that anchor (CPS-135) (using cache)
      4. Parse & validate the uploaded yang into a data node object (tree)
      5. Persist the data node using the code developed as part of CPS-136

      Scope of this user story:

      • Tie together what has been delivered in CPS-135/136/137:
        • Add relevant Java API method to store JSON Data Object
        • add relevant REST API method to store JSON Data Object
        • Add and handle error handling (especially HTTP code)

       

      Use existing code to convert a json file with just data for 1 container and 1 child into Fragments PoJo and then store the Fragments

      Might need to create a new simpler sample store instance (in test resources) from https://gerrit.onap.org/r/gitweb?p=cps.git;a=blob;f=cps-service/src/test/resources/bookstore.json;h=d1b8d6882dd96b57251d8dee35f2e565881415d2;hb=refs/heads/master

      Retrieve the Schema Set from Anchor to create a schemacontext , similar to what is done here: https://gerrit.onap.org/r/c/cps/+/116280/8/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java

      Validate data is confirm that Module (using existing validation built-in ODL Yang parser)

      Creating fragment is done already here : org.onap.cps.utils.YangUtils#fragmentNormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<? extends org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument,?>, org.opendaylight.yangtools.yang.model.api.Module)

      If data not confirm model i.e ODL Parser thrown an exception it should be rejected (see exception handling agreed here: https://wiki.onap.org/display/DW/CPS+Exceptions+and+REST+API+HTTP+Response+Codes)

      Acceptance Criteria

      1. Create a Wiki Page with Proposal and get team agreement
        1. include exceptions and error codes documented on https://wiki.onap.org/display/DW/CPS+Exceptions+and+REST+API+HTTP+Response+Codes
      2. Can add a valid json data file to an existing anchor
        1. parent and child (or children) will be persisted 
        2. The Anchor fragment (created earlier) should become the parent for the Data fragment
      3. JSON File will be rejected if not confirm the model
      4. All relevant testing should be included
        1. MVC 'semi-integration' test
        2. DB Level tests should be included (in CPS-136)
        3. Unit test where needed to fill coverage

       

            niamhcore niamhcore
            ToineSiebelink Toine Siebelink
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: