Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Jira Legacy
serverSystem Jira
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyCPS-817

...

  • New method retrieveCmHandleDetails().

API details

Description

URI

Sample Response Body

Get Cm Handle details by name.

GET

 {ncmpRoot}/ncmp/v1/ch/PNFDemo

{
    "cmHandle": "Bookstore",
    "cmHandleProperties": [
        {
            "Public-Book1": "Public Sci-Fi Book",
            "Public-Book2": "Public Horror Book",
            "Public-Book3": "Public Crime Book"
        }
    ]
}


Open Question

Currently within CPS we have two separate models for CmHandles these being CmHandle and PersistenceCmHandle. These are both very similar models, the primary difference being that persistenceCmHandle also contains references to the dmiServiceName, the dmiDataServiceName and the dmiModelServiceName as seen below.

...

As PersistenceCmHandle has all the necessary fields of CmHandle, can we just modify existing code to use PerisistenceCmHandle and remove CmHandle?

Cm Handle ModelPersistence Cm Handle Model


Code Block
languagejava
titleCmHandle.java
/**
 * CmHandle.
 */
@Validated
@Getter
@Setter
@NoArgsConstructor
public class CmHandle {

    @JsonProperty("cmHandle")
    private String cmHandleID;

    @JsonSetter(nulls = Nulls.AS_EMPTY)
    @JsonProperty("cmHandleProperties")
    private Map<String, String> dmiProperties = Collections.emptyMap();

    @JsonSetter(nulls = Nulls.AS_EMPTY)
    @JsonProperty("publicCmHandleProperties")
    private Map<String, String> publicProperties = Collections.emptyMap();

}



Code Block
languagejava
titlePersistenceCmHandle.java
/**
 * DmiRegistry.
 */
@Getter
@Setter
@NoArgsConstructor
public class PersistenceCmHandle {

    private String id;

    @JsonProperty("dmi-service-name")
    private String dmiServiceName;

    @JsonProperty("dmi-data-service-name")
    private String dmiDataServiceName;

    @JsonProperty("dmi-model-service-name")
    private String dmiModelServiceName;

    @JsonProperty("additional-properties")
    private List<Property> dmiProperties;

    @JsonProperty("public-properties")
    private List<Property> publicProperties;


  • Both contained within the same package
  • Properties are only used within PersistenceCmHandle to set Persistence Cm Handle ID, DMI and public properties when a cm handle is being retrieved using the get data node api.
  • Both are contained in the same package
  • Properties are also used in DmiModelOperations and DmiData operation when getting and writing resource data to DMI, and when fetching yang resources. 
  • Is also used to persist the cm handle to the fragment table within CPS db

PROS

  • Removing potentially redundant model that is not used.

...

Add more detailed comments to both models. Rename cm handle model to RestCmHandle to further represent that it is the request body format of the REST api.and rename all related cm handle models.

Renamed Models

  • RestCmHandle → RestInputCmHandle (generated model)
  • CmHandle → NcmpServiceCmHandle
  • PersistenceCmHandle → YangModelCmHandle
  • PeristenceCmHandlesList → YangModelCmHandleList

More details can also be found in the following wiki in regard to Cm Handle models, along with CPS-NCMP's layers and dependencies, and paths taken when registering a cm handle and retrieving cm handle details.