You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

CPS-508 - Getting issue details... STATUS

Background

Currently CPS only supports creating a schema set by uploading the complete set of all yang resources (as a zip file). The purpose of this story is to create a special java api method that allows sending only part of the schema set. 

High level overview of what is to be done

In CPS to create an anchor the following conditions need to be satisfied. 

  1. A dataspace must be defined
  2. A schemaset must be created in the defined dataspace

Then an anchor can now be created using the dataspace and schemaset defined above

Implementation Proposal

Each subheading in this implementation proposal section will be taken from the high level overview stated above.

A dataspace must be defined

CPS service provides a method to create a dataspace

  • createDataspace method in the CpsAdminService

This method takes one parameter, dataspaceName. The value for this parameter is going to be based on the cm handle id received from NCMP.

A schemaset must be created in the defined dataspace

CPS service provides a method to create a schemaset

  • createSchemaSet method in the CpsModuleService

This method takes three parameters:

  • schemasetName : The value for this parameter is going to be based on the cm handle id received from NCMP
  • dataspaceName : The value for this parameter is going to be based on the cm handle id received from NCMP
  • yangResourcesNameToContentMap : The value for this parameter will be discussed in more details below.
YangResourceNameToContentMap parameter value

From NCMP we have a map of new yang resources and also a list of ModuleReference objects to create a full schema set.

The map of new yang resources will come in the following format:

  • Map<String, String> newYangResourcesModuleNameToContentMap 

The list of ModuleReferences will contain the following information:

  • moduleName
  • revision

Note: This list is a list of ModuleReferences for the yang resources that are already stored in the yang_resources table in the DB that the node requires.

We now have to retrieve yang resources using the list of ModuleReferences. To do this the following needs to happen.

  1. Create a new method in the YangResourceRepository interface
  2. Use this method to retrieve the yang resources
  3. Add the yang resources to a list

With a list of the yang resources, we can now add the missing yang resources to the map from above newYangResourcesModuleNameToContentMap

YangResourcesMap
// We have the list of yang resources retrieved from the db, exisitingYangResources
exisitingYangResources.forEach(yangResource -> newYangResourcesModuleNameToContentMap.put(yangResource.getModuleName(), yangResource.getContent()));






  • No labels