CPS-837 Remove and Add Properties as part of CM-Handle registration update
References
https://lf-onap.atlassian.net/browse/CPS-837
Issues/Decisions
Issue | Notes | Decision | |
|---|---|---|---|
| 1 | Existing property not part of the update should not be updated/removed. | In the updatedCmHandles request , if we don't provide any existing property in the update , then we don't touch that property and it will remain as it is. |
Scope
Within the NCMP CM-Handle registration post request add functionality to add/remove properties of an existing CM-Handle.
Properties are removed by setting the value to null in the update registration request. (Only applicable when updatedCmHandles json tag is present)
Both Additional and Public properties should be taken care off as part of the update.
Update Open API docs with details on property updates.
Analysis
REST layer :
No change as there is no update in the incoming request structure.
Service layer (cps-ncmp-service) :
NetworkCmProxyDataServiceImpl#parseAndUpdateCmHandlesInDmiRegistration(dmiPluginRegistration): already present , we iterate over the incoming request and call the method to handle add or remove attributes from cmHandle.NetworkCmProxyDataServiceImpl#handleAddOrRemoveCmHandleProperties(leaves, targetAttributeKey, targetAttributeValue) : new method which will have logic to handle addition or removal of attributes based on the value.
CpsDataServiceImpl#replaceListContent(dataspaceName,anchorName,parentNodeXpath,dataNodes,observedTimestamp) : new overloaded method for replaceListContent.
Proposal
Scenario | URI | Payload/Input Request | Suggested Code / Changes | Comments | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Req-001 | POST {ncmpRoot}/ncmpInventory/v1/ch/ | Input | No Impact. It will create the cmHandle. | Existing behaviour. | ||||||||||||||||
Req-002 | POST {ncmpRoot}/ncmpInventory/v1/ch/ | Input
| Result
ConstantsNCMP_DATASPACE_NAME = "NCMP-Admin";
NCMP_DMI_REGISTRY_ANCHOR = "ncmp-dmi-registry";Changes:
| |||||||||||||||||
Req-003 Request to remove all the cmHandles for a particular cmHandleId. | POST {ncmpRoot}/ncmpInventory/v1/ch/ |
| ||||||||||||||||||
Req-004 Request doesn't have updatedCmHandles tag present in the incoming request. | POST {ncmpRoot}/ncmpInventory/v1/ch/ | No Change from the code pespective. | Existing behaviour. |