-
Story
-
Resolution: Done
-
Medium
-
None
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: getModuleDefinitions
ByCmHandleId - update descriptions etc.
- rename in Yanml; operationId: getModuleDefinitions
- Update the NetworkCmProxyController getModuleDefinitions
ByCmHandleIdto 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
- All scenarios shall be tested and demoed
- update documentation in the API definition for scenario (especially #4)
- Query does not bring any module ( return empty collection ) or query brings only one module.