Skip to end of metadata
Go to start of metadata

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

Compare with Current View Page History

« Previous Version 8 Next »

References

Overview

Currently, the published DMI-registry model shows the property 'additional properties' as shown on lines 32 to line 43 of the yang model below. This property is not queryable and therefore, is not recommended to be published to the public.

The purpose of this study is 

  • to propose an alternative model so there will be 2 yang models wherein one depends on the other.
    • One is public and seen on CPS-E05 then augments to what is visible to the NCMP-DMI implementations


current dmi yang resource
module dmi-registry {

  yang-version 1.1;

  namespace "org:onap:cps:ncmp";

  prefix dmi-reg;

  organization "Nordix Foundation";

  contact "rahul.tyagi@est.tech";

  revision "2021-05-20" {
    description
    "Initial Version";
  }

  container dmi-registry {

    list cm-handles {

      key "id";

      leaf id {
        type string;
      }

      leaf dmi-service-name {
        type string;
      }

      list additional-properties {

        key "name";

        leaf name {
          type string;
        }

        leaf value {
          type string;
        }
      }
    }
  }
}

Extending data models (augment) 

See brief on YANG language on Support for Yang Language

By using the keyword 'augment' on yang models, we are allowed to extend a data model i.e. add nodes to the current structure

The argument following this keyword is the location in the data model hierarchy to the extension is to be added.

For example, if we want to add a new list directly inside the list 'cm-handles' in the  'dmi-registry' container of the current dmi-registry model then the argument for the augment keyword would be /dmi-registry/cm-handles

  • where augment statements can add nodes
    • container
    • list
    • choice
    • case
    • input
    • output
    • notification node


The following models are proposed to achieve augmentation:

1. Dmi Registry model without the 'additional properties'
Dmi registry model without additional properties
module dmi-registry {

  yang-version 1.1;

  namespace "org:onap:cps:ncmp";

  prefix dmi-reg;

  organization "Nordix Foundation";

  contact "rahul.tyagi@est.tech";

  revision "2021-05-20" {
    description
    "Initial Version";
  }

  container dmi-registry {

    list cm-handles {

      key "id";

      leaf id {
        type string;
      }

      leaf dmi-service-name {
        type string;
      }
    }
  }
}


2. Model that holds the 'augment' statement
Model that holds the 'augment' statement
module sampleDmiAugment {

  yang-version 1.1;

  namespace "org:onap:cps:ncmp/private-dmi-model";

  prefix dmi-aug;

  import dmi-registry {
    prefix "dmi-reg";
  }


  augment "/dmi-reg:dmi-registry/dmi-reg:cm-handles" {
    description
      "Private additional properties";
    list additional-properties {

      key "name";

      leaf name {
        type string;
      }

      leaf value {
        type string;
      }
    }
  }

}


 Using pyang tool, these two models were validated to confirm that the resulting schema tree module model includes the nodes that were intended to be added to the dmi-registry model


Testing

Successful Parsing of the models [dmi-registry-sample, extended-dmi-registry]



DescriptionNotes and Results
1Create Dataspacedataspace 'my-dataspace' created
  • dataspace table

2

Create schemaset with Zip File resource


201 created

'my-schema-set-2'

  • schema_set table


  • schema_set_yang_resources table


  • yang_resource table

3

Create Anchor

    • schema-set-name: my-schema-set-2

201 created

'my-anchor'

  • anchor table

4

Create Node

201 created

5

Get a schemaset

    • dataspace-name: my-dataspace
    • schema-set-name: my-schema-set-2
200

Open Issues/Questions

Issue/QuestionDescriptionNotesResolution
new model
  • module name for the model that holds the augment statement


new module name = extended-dmi-registry

prefix = ext-dmi

Loading data with Liquibase

Dmi registry model is loaded via Liquibase which means that the content of the yang resource is already set 

  • will the new model need to be loaded 
  • how will the 'import' statement work to create a new model

New JIRA ticket created for this

see CPS-1183 - Getting issue details... STATUS  

ODL Yang tool

what is needed to acknowledge the augment statement for a new model

  • new model will contain a prefix of the module name



  • No labels