How to add tailf:annotate range?

Hi,
I want to add range for integer, is there any way to do this? For example,

tailf:annotate-module “test” {
tailf:annotate-statement grouping[name=‘interval’] {
tailf:annotate-statement leaf[name=‘sample’] {
tailf:annotate-statement type[name=‘uint64’] {
range “1 … 10” ; // some way to annotate this range?
}
}
}
}

No. As the tailf_yang_extensions(5) man page says:

Any 'tailf' statement, except 'symlink' and 'action' can be annotated.
The validation statements 'must', 'min-elements', 'max-elements', 'mandatory', 'unique', and 'when' can also be annotated.
The type restriction statement 'pattern' can also be annotated.

ranges cannot be annotated.

True, but a range can be added through a deviation. The point here is that tools aren’t required to understand/process extension statements, thus the tailf extensions defined in the tailf-common module should not make any changes to the actual data model defined by the YANG module that is being annotated, since a client can’t be expected to “understand” those changes.

If, as in your example, the YANG module specifies type uint64, but your implementation can only handle the range 1..10, your implementation is not compliant with the model. This is “bad”, but it’s less bad if you actually announce this fact in a way that a model-aware client can “understand”. This is what deviations are for - you should read all of the section RFC 7950 - The YANG 1.1 Data Modeling Language before using them.

However a deviation is always applied to a schema node, i.e. you can’t apply it to a node in a grouping, but have to deviate the nodes resulting from uses statements for the grouping. And you can’t simply add the range to an existing type statement (a type is not a node), but have to replace the type with one that has a range statement. I.e. if your module test has e.g.

  container top {
    uses interval;
    ...
  }

you can use a deviation module with

  import test {
    prefix t;
  }
  ...
  deviation /t:top/t:sample {
    deviate replace {
      type uint64 {
        range 1..10;
      }
    }
  }

Thanks Per, it is not good to to implement not compliant with the model, but the model does not define the range, which is provided by others. I can’t touch that model.
I tried the deviation, it works! Thanks again.