02-18-2020 11:34 PM
A.yang {
    ...
    identity A1 { 
    }
    identity A2 { 
    }
}
A-ann.yang {
    ...
    tailf:annotate /A {
        identity A3 { -----------> Compilation error : unexpected keyword 'identity'
        } 
    }
}
02-24-2020 03:03 AM
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
02-24-2020 05:47 AM
Thanks for the reply.
Yes. It only allows to annotate with "tailf" statements and some validation statements.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide