0

How to use @ as a special character for name field in YANG file. I am using type as a string which help me to accept all ASCII special characters from keyboard except @ Is @ is some kind of a Keyword or carrying some special meaning for YANG modeling language?

  • I can't tell what problem you're having. Please provide, for starters, the relevant content from your YANG file. Further, please indicate where you found that `@` wasn't "accepted", and explain what you mean by "accepted". Did you receive an error message after attempting to use the file? Please consult [How to create a Minimal, Complete, Verifiable Example](http://stackoverflow.com/help/mcve) for more details on how to improve your question so that experts on the site can help you! – Vladislav Martin Jun 15 '16 at 14:21

1 Answers1

0

I'm assuming your issue happens during YANG modeling, not during instance document validation.

No, @ character does not have special meaning in YANG modules. You are most likely attempting to use this character in a YANG identifier, which is not valid. YANG identifiers, such as statement arguments to container, leaf, leaf-list and list have to follow this grammar:

;; An identifier MUST NOT start with (('X'|'x') ('M'|'m') ('L'|'l'))
identifier          = (ALPHA / "_")
                     *(ALPHA / DIGIT / "_" / "-" / ".")
ALPHA               = %x41-5A / %x61-7A
                     ; A-Z / a-z
DIGIT               = %x30-39
                     ; 0-9                         

The first character must be an underscore or a letter, and may be followed by letters, digits, underscores, dots and hyphens. An identifier must also not start with xml regardless of letter case.

predi
  • 5,528
  • 32
  • 60