Search code examples
special-characterskeywordietf-netmod-yang

YANG model Special Characters includes @


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?


Solution

  • 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.