cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
764
Views
0
Helpful
2
Replies

How to add new identity entries to existing yang file via annotation file ?

ajbharad
Cisco Employee
Cisco Employee

A.yang {
    ...
    identity A1 {
    }
    identity A2 {
    }
}

A-ann.yang {
    ...
    tailf:annotate /A {
        identity A3 { -----------> Compilation error : unexpected keyword 'identity'
        } 
    }
}

2 Replies 2

gmuloche
Cisco Employee
Cisco Employee

Hello,

 

Looking at the description in the yang model for the tailf:annotate extension (located in $NCS_DIR/src/ncs/yang/tailf-common.yang), I don't believe what you are trying to achieve is possible:

 

  extension annotate {
    [ truncated ...]
    description
      "Annotates an existing statement with a 'tailf' statement or a
      validation statement.  This is useful in order to add tailf
      statements to a module without touching the module source.
      Annotation statements can be put in a separate annotation
      module, and then passed to 'confdc' (or 'pyang') when the
      original module is compiled.

      Any 'tailf' statement, except 'symlink' and 'action' can be
      annotated.  The statements 'symlink' and 'action' modifies the
      data model, and are thus not allowed.

      The validation statements 'must', 'min-elements',
      'max-elements', 'mandatory', 'unique', and 'when' can also be
      annotated.

      A 'description' can also be annotated.

      'tailf:annotate' can occur on the top-level in a module, or in
      another 'tailf:annotate' statement.

      The argument is a 'schema-nodeid', i.e. the same as for
      'augment', or a '*'.  It identifies a target node in the schema
      tree to annotate with new statements.  The special value '*' can
      be used within another 'tailf:annotate' statement, to select all
      children for annotation.

      The target node is searched for after 'uses' and 'augment'
      expansion.  All substatements to 'tailf:annotate' are treated as
      if they were written inline in the target node, with the
      exception of any 'tailf:annotate' substatements.  These are
      treated recursively.  For example, the following snippet adds
      one callpoint to /x and one to /x/y:

        tailf:annotate /x {
          tailf:callpoint xcp;
          tailf:annotate y {
            tailf:callpoint ycp;
          }
        }
      ";
  }

I am not sure about your usecase here so cannot really point you in another direction.

 

Regards,

 

Guillaume

Thanks for the reply.

Yes. It only allows to annotate with "tailf" statements and some validation statements.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: