Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix misformatted list in nbapi docs #15251

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions doc/developer/northbound/retrofitting-configuration-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -989,27 +989,28 @@ CLI commands should be rewritten but maintained in the same file.
Since all CLI configuration commands from FRR will need to be rewritten,
this is an excellent opportunity to rework this part of the code to make
the commands easier to maintain and extend. These are the three main
recommendations: 1. Always use DEFPY instead of DEFUN to improve code
readability. 2. Always try to join multiple DEFUNs into a single DEFPY
whenever possible. As an example, there’s no need to have both
``distance (1-255) A.B.C.D/M`` and ``distance (1-255) A.B.C.D/M WORD``
when a single ``distance (1-255) A.B.C.D/M [WORD]`` would suffice. 3.
When necessary, create a separate DEFPY for ``no`` commands so that part
of the configuration command can be made optional for convenience.
Example:
``no timers basic [(5-2147483647) (5-2147483647) (5-2147483647)]``. In
this example, everything after ``no timers basic`` is ignored by FRR, so
it makes sense to accept ``no timers basic`` as a valid command. But it
also makes sense to accept all parameters
(``no timers basic (5-2147483647) (5-2147483647) (5-2147483647)``) to
make it easier to remove the command just by prefixing a “no” to it.
recommendations:

#. Always use DEFPY instead of DEFUN to improve code readability
#. Always try to join multiple DEFUNs into a single DEFPY whenever possible. As
an example, there’s no need to have both ``distance (1-255) A.B.C.D/M`` and
``distance (1-255) A.B.C.D/M WORD`` when a single ``distance (1-255)
A.B.C.D/M [WORD]`` would suffice.
#. When necessary, create a separate DEFPY for ``no`` commands so that part of
qlyoung marked this conversation as resolved.
Show resolved Hide resolved
the configuration command can be made optional for convenience. Example:
``no timers basic [(5-2147483647) (5-2147483647) (5-2147483647)]``. In this
example, everything after ``no timers basic`` is ignored by FRR, so it makes
sense to accept ``no timers basic`` as a valid command. But it also makes
sense to accept all parameters (``no timers basic (5-2147483647)
(5-2147483647) (5-2147483647)``) to make it easier to remove the command
just by prefixing a “no” to it.

To rewrite a CLI command as a dumb wrapper around the northbound
callbacks, use the ``nb_cli_cfg_change()`` function. This function
accepts as a parameter an array of ``cli_config_change`` structures that
specify the changes that need to performed on the candidate
configuration. Here’s the declaration of this structure (taken from the
*lib/northbound_cli.h* file):
``lib/northbound_cli.h`` file):

.. code:: c

Expand Down
Loading