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

Extend CPS Module API to allow retrieval single module definition

XMLWordPrintable

      The current endpoint for retrieving module definitions is 

      • /v1/ch/{cm-handle}/modules/definitions/

      which gives all the module definitions (module name, revision, and yang resource content) for a given cm handle name 

      The aim of this story is to be able to specify the module name returned i.e.

      • /v1/ch/{cm-handle}/modules/definitions?moduleName=myModuleName
      • /v1/ch/{cm-handle}/modules/definitions?moduleName=myModuleName&revision=myRevision

      so it returns only a specific yang resource 

       

      Open Issue: Define just name or name and version, if only name is used it could still return several yang resources

       

      # moduleName revision Behaviour
      1 Not specified not specified return collection of all modules for cmhandle (current behaviour)
      2 specified specified return collection of 1 module with 'specified' name and revisions
      Empty collection if not found!
      3 specified not specified return all modules with specified name (same module different revisions)
      Empty collection if not found!
      4 not specified Specified return all modules for cmhandle 
      Log warning about ignoring revision

       

      How?

      • Add query parameters moduleName and revision to cps-ncmp-rest/docs/openapi/swagger/ncmp.yaml for /v1/ch/{cm-handle}/modules/definitions
      • The parameters will be generated into NetworkCmProxyApi.java
      • Extend method parameters of the getModuleDefinitionsByCmHandleId in NetworkCmProxyController.java
        • rename in Yanml; operationId: getModuleDefinitionsByCmHandleId
        • update descriptions etc.
      • Update the NetworkCmProxyController getModuleDefinitionsByCmHandleId  to call new stack if module parameter(s) are specified (correctly)
      • Suggested Stack
        • InventoryPersistence.getModuleDefinitionsByCmHandleAndModule(String cmHandleId, String moduleName, String moduleRevision)
        • CpsModuleServiceImpl.getModuleDefinitionsByCmHandleAndModule(...)
        • CpsModulePersistenceServiceImpl.getModuleDefinitionsByCmHandleAndModule(...)
        • YangResourceRepository.getModuleDefinitionsByCmHandleAndModule(...)
      • The dataspace name should stay the same as "NFP-Operational".

      A/C

      1. All scenarios shall be tested and demoed
      2. update documentation in the API definition for scenario (especially #4)
      3. Query does not bring any module ( return empty collection ) or query brings only one module.

            halil.cakal Halil Cakal
            emaclee Lee Anjella Macabuhay
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: