Skip to content

Commit d09e0a8

Browse files
authored
Merge pull request #5129 from qlyoung/doc-yang-style
doc: add style guide for YANG
2 parents d00d0f9 + 6f7a925 commit d09e0a8

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

doc/developer/workflow.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,11 @@ your new claim at the end of the list.
499499
Code Formatting
500500
---------------
501501

502-
FRR uses Linux kernel style except where noted below. Code which does not
503-
comply with these style guidelines will not be accepted.
502+
C Code
503+
^^^^^^
504+
505+
For C code, FRR uses Linux kernel style except where noted below. Code which
506+
does not comply with these style guidelines will not be accepted.
504507

505508
The project provides multiple tools to allow you to correctly style your code
506509
as painlessly as possible, primarily built around ``clang-format``.
@@ -707,6 +710,28 @@ BSD coding style applies to:
707710

708711
- ``ldpd/``
709712

713+
YANG
714+
^^^^
715+
716+
FRR uses YANG to define data models for its northbound interface. YANG models
717+
should follow conventions used by the IETF standard models. From a practical
718+
standpoint, this corresponds to the output produced by the ``yanglint`` tool
719+
included in the ``libyang`` project, which is used by FRR to parse and validate
720+
YANG models. You should run the following command on all YANG documents you
721+
write:
722+
723+
.. code-block:: console
724+
725+
yanglint -f yang <model>
726+
727+
The output of this command should be identical to the input file. The sole
728+
exception to this is comments. ``yanglint`` does not support comments and will
729+
strip them from its output. You may include comments in your YANG documents,
730+
but they should be indented appropriately (use spaces). Where possible,
731+
comments should be eschewed in favor of a suitable ``description`` statement.
732+
733+
In short, a diff between your input file and the output of ``yanglint`` should
734+
either be empty or contain only comments.
710735

711736
Specific Exceptions
712737
^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)