mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 23:58:44 +00:00
doc/developer: adding a CLI node: mention frr-reload.py and VTY_PUSH_XPATH
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
This commit is contained in:
parent
c6a3a68548
commit
d3bb30f588
@ -777,6 +777,7 @@ To add a new CLI node, you should:
|
|||||||
- call ``install_node()`` in the relevant daemon
|
- call ``install_node()`` in the relevant daemon
|
||||||
- define and install the new node in vtysh
|
- define and install the new node in vtysh
|
||||||
- define corresponding node entry commands in daemon and vtysh
|
- define corresponding node entry commands in daemon and vtysh
|
||||||
|
- add a new entry to the ``ctx_keywords`` dictionary in ``tools/frr-reload.py``
|
||||||
|
|
||||||
Defining the numerical node constant
|
Defining the numerical node constant
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -844,6 +845,9 @@ Defining corresponding node entry commands in daemon and vtysh
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
The command that descends into the new node is typically programmed
|
The command that descends into the new node is typically programmed
|
||||||
with ``VTY_PUSH_CONTEXT`` or equivalent in the daemon's CLI handler function.
|
with ``VTY_PUSH_CONTEXT`` or equivalent in the daemon's CLI handler function.
|
||||||
|
(If the CLI has been updated to use the new northbound architecture,
|
||||||
|
``VTY_PUSH_XPATH`` is used instead.)
|
||||||
|
|
||||||
In vtysh, you must implement a corresponding node change so that vtysh
|
In vtysh, you must implement a corresponding node change so that vtysh
|
||||||
tracks the daemon's movement through the node tree.
|
tracks the daemon's movement through the node tree.
|
||||||
|
|
||||||
@ -852,9 +856,9 @@ to replicate their parsing in vtysh, the node-descent function in the
|
|||||||
daemon must be blocked from this replication so that a hand-coded
|
daemon must be blocked from this replication so that a hand-coded
|
||||||
skeleton can be written in ``vtysh.c``.
|
skeleton can be written in ``vtysh.c``.
|
||||||
|
|
||||||
Accordingly, use one of the ``*_NOSH`` macros such as ``DEFUN_NOSH`` or
|
Accordingly, use one of the ``*_NOSH`` macros such as ``DEFUN_NOSH``,
|
||||||
``DEFPY_NOSH`` for the daemon's node-descent CLI definition, and use
|
``DEFPY_NOSH``, or ``DEFUN_YANG_NOSH`` for the daemon's node-descent
|
||||||
``DEFUNSH`` in ``vtysh.c`` for the vtysh equivalent.
|
CLI definition, and use ``DEFUNSH`` in ``vtysh.c`` for the vtysh equivalent.
|
||||||
|
|
||||||
.. seealso:: :ref:`vtysh-special-defuns`
|
.. seealso:: :ref:`vtysh-special-defuns`
|
||||||
|
|
||||||
@ -876,6 +880,22 @@ Examples:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
``ripd_whatever.c``
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
DEFPY_YANG_NOSH(my_new_node,
|
||||||
|
my_new_node_cmd,
|
||||||
|
"my-new-node foo",
|
||||||
|
"New Thing\n"
|
||||||
|
"A foo\n")
|
||||||
|
{
|
||||||
|
[...]
|
||||||
|
VTY_PUSH_XPATH(MY_NEW_NODE, xbar);
|
||||||
|
[...]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
``vtysh.c``
|
``vtysh.c``
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
@ -893,6 +913,24 @@ Examples:
|
|||||||
install_element(CONFIG_NODE, &my_new_node_cmd);
|
install_element(CONFIG_NODE, &my_new_node_cmd);
|
||||||
|
|
||||||
|
|
||||||
|
Adding a new entry to the ``ctx_keywords`` dictionary
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
In file ``tools/frr-reload.py``, the ``ctx_keywords`` dictionary
|
||||||
|
describes the various node relationships.
|
||||||
|
Add a new node entry at the appropriate level in this dictionary.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
ctx_keywords = {
|
||||||
|
[...]
|
||||||
|
"key chain ": {
|
||||||
|
"key ": {}
|
||||||
|
},
|
||||||
|
[...]
|
||||||
|
"my-new-node": {},
|
||||||
|
[...]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Inspection & Debugging
|
Inspection & Debugging
|
||||||
|
Loading…
Reference in New Issue
Block a user