Skip to content

Commit 81da1b9

Browse files
committed
doc: ospfd / ospf6d: document RFC 9129 ietf-ospf config-write scope
Replace the older "operational data only" sections in doc/user/ospfd.rst and doc/user/ospf6d.rst with a YANG / NETCONF Support entry that lists every config-write leaf the ietf-ospf series now supports plus the deliberate scope gaps: * redistribute and default-information-originate remain legacy-CLI only (RFC 9129 / RFC 8349 leave them to a separate import / export mechanism). * Per-address overrides (e.g. `ip ospf cost N A.B.C.D`) have no RFC 9129 counterpart; YANG is strictly per-interface. * FRR-specific NSSA augments (translator-role, suppress-fa, default-information-originate) are not in the RFC 9129 area grouping; they remain legacy-CLI-only. * `router ospf [vrf NAME]` instance creation is still CLI-only; YANG operations that target a non-existent instance are rejected at VALIDATE with a clear error pointing at `router ospf`. * ospf6d has no per-area stub default-cost knob; the leaf is not implemented (mgmtd reports "no backend handles this path"). This matches the existing v3 CLI surface, not a regression introduced by this conversion. * ospf6 interface-type rejects non-broadcast and hybrid at VALIDATE (ospf6d only accepts broadcast, point-to-point and point-to-multipoint). Adds a worked example showing mgmt set-config / commit apply for the explicit-router-id leaf so operators see the end-to-end mgmtd path. Documents the frr-deviations-ietf-routing-ospf interface-name leafref relaxation and the restoration of referential checks inside the per-interface callbacks. Signed-off-by: Eric Parsonage <eric@eparsonage.com>
1 parent 8e24915 commit 81da1b9

3 files changed

Lines changed: 207 additions & 57 deletions

File tree

doc/developer/ospf-yang-northbound-notes.rst

Lines changed: 93 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,80 @@ Earlier OSPF northbound work is useful context for future development:
4545
* Most callbacks are TODO/no-op stubs, so it should not be transplanted
4646
wholesale.
4747

48-
Implementation Plan
49-
-------------------
50-
51-
1. Do not register inert FRR-native OSPF modules. ``yang/frr-ospfd.yang``
52-
remains on disk for future work, but ``ospfd`` no longer links its generated
53-
schema into the daemon binary or advertises it with no callbacks behind it.
54-
Add ``frr-ospfd`` or future ``frr-ospf6d`` module registrations only when
55-
there is a concrete FRR-specific augment or callback to expose.
56-
57-
2. Keep ``ietf-ospf`` loaded for both daemons and map FRR behavior toward the
58-
RFC 9129
59-
``/ietf-routing:routing/control-plane-protocols/control-plane-protocol/ietf-ospf:ospf``
60-
tree. The first OSPFv2 and OSPFv3 operational callbacks now expose the RFC
61-
``control-plane-protocol`` list, router-id, instance LSA counters, area
62-
SPF/ABR/ASBR/LSA counters, interface list, and neighbor list with neighbor
63-
address and state. The default instance name is ``default`` for both daemons.
64-
The OSPFv2 interface list currently exposes the first ``ospf_interface`` per
65-
interface key because RFC 9129 keys the list by interface name while FRR can
66-
hold multiple OSPFv2 interface objects for different addresses on the same
67-
interface.
68-
69-
3. Add mgmtd backend registration after there is at least a narrow set of real
70-
callbacks or an explicitly operational-only xpath set. ``ospfd`` and
71-
``ospf6d`` register as mgmtd backend clients for
72-
``/ietf-routing:routing/control-plane-protocols/control-plane-protocol``.
73-
``mgmtd`` also loads the RFC OSPF modules so it can parse OSPF backend
74-
replies in the merged operational datastore.
75-
76-
4. Port operational callbacks from PR #18401 into the current model, beginning
77-
with OSPF instance and area statistics.
78-
79-
5. Convert configuration in narrow CLI-equivalent slices. For each leaf or list,
80-
move existing CLI behavior into a northbound callback and make the CLI set
81-
the YANG node. ``ietf-ospf`` should be the canonical configuration tree for
82-
everything RFC 9129 models; ``frr-ospfd`` and future ``frr-ospf6d`` should
83-
augment only FRR-specific behavior that the RFC model does not cover.
84-
85-
6. Add FRR-native OSPFv3 YANG only when a concrete FRR-specific augment is
86-
needed.
48+
FRR also has an experimental YANG module translator for mapping non-native
49+
models onto native FRR models with deviation modules and XPath translation
50+
tables. This branch does not use that mechanism because OSPF does not yet have
51+
a complete callback-backed native OSPF YANG model to serve as the source of
52+
truth. Instead, RFC 9129 is implemented directly as the canonical northbound
53+
surface for the OSPF behavior it covers.
54+
55+
Current Implementation
56+
----------------------
57+
58+
This branch implements the RFC 9129 ``ietf-ospf`` tree directly for OSPFv2 and
59+
OSPFv3 rather than adding an FRR-native OSPF model with parallel semantics.
60+
``yang/frr-ospfd.yang`` remains on disk for future FRR-specific OSPFv2 work,
61+
but ``ospfd`` does not link its generated schema into the daemon binary or
62+
advertise it with no callbacks behind it.
63+
64+
Both daemons load ``ietf-ospf`` and map FRR behavior toward the RFC 9129
65+
``/ietf-routing:routing/control-plane-protocols/control-plane-protocol/ietf-ospf:ospf``
66+
tree. OSPFv2 and OSPFv3 operational callbacks expose the RFC
67+
``control-plane-protocol`` list, router-id, instance LSA counters, area
68+
SPF/ABR/ASBR/LSA counters, interface list, and neighbor list with neighbor
69+
address and state. The default instance name is ``default`` for normal
70+
``ospfd`` and ``ospf6d`` instances. In ``ospfd --instance N`` daemon-instance
71+
mode, the RFC 9129 ``control-plane-protocol`` name is the decimal instance ID
72+
(``N``), matching the legacy ``router ospf N`` CLI. The OSPFv2 interface list
73+
exposes one entry per interface key because RFC 9129 keys the list by interface
74+
name while FRR can hold multiple OSPFv2 interface objects for different
75+
addresses on the same interface.
76+
77+
``ospfd`` and ``ospf6d`` register as mgmtd backend clients for typed
78+
``control-plane-protocol`` entries so OSPFv2 and OSPFv3 can share the standard
79+
``ietf-routing`` list without one daemon claiming the other daemon's instance.
80+
Instanced ``ospfd`` backends further constrain their registration with the
81+
``name`` key so ``ospfd-1`` and ``ospfd-2`` receive only edits for their own
82+
RFC 9129 protocol instance.
83+
``mgmtd`` also loads the RFC OSPF modules so it can parse OSPF backend replies
84+
in the merged operational datastore.
85+
86+
The mgmtd backend matcher treats predicates in backend registrations as
87+
ownership constraints, not as a reason to hide unfiltered list data. A query
88+
with ``type='ietf-ospf:ospfv2'`` must dispatch only to ``ospfd`` and a query
89+
with ``type='ietf-ospf:ospfv3'`` must dispatch only to ``ospf6d``. A query that
90+
omits the ``type`` predicate, such as a request for the whole
91+
``control-plane-protocol`` list or one of its unkeyed descendants, still
92+
dispatches to both daemons so mgmtd can merge the OSPFv2 and OSPFv3 entries.
93+
This keeps shared IETF lists usable for current OSPF and future protocol
94+
families without special-casing OSPF in mgmtd.
95+
96+
Configuration write support is intentionally limited to CLI-equivalent RFC 9129
97+
leaves. The converted leaves are router-id, preference, area lifecycle,
98+
area-type, area summary, OSPFv2 default-cost, area ranges, per-interface area
99+
attachment, interface cost, hello-interval, dead-interval, retransmit-interval,
100+
priority, mtu-ignore, interface-type, and passive. Existing CLI commands for
101+
those leaves set the same YANG nodes as mgmtd writes.
102+
103+
Direct daemon config-file loads in ``ospfd`` and ``ospf6d`` opt in to batching
104+
for the process lifetime, so cross-leaf validation can evaluate any direct
105+
daemon config-file load as one northbound transaction. This is not a
106+
startup-only temporary flag; a later ``config_from_file()`` call in these
107+
daemons has the same cross-leaf validation requirements. Other daemons keep the
108+
legacy per-line config-file behavior.
109+
110+
Remaining Scope
111+
---------------
112+
113+
``ietf-ospf`` remains the canonical configuration tree for everything RFC 9129
114+
models. ``frr-ospfd`` and future ``frr-ospf6d`` should augment only
115+
FRR-specific behavior that the RFC model does not cover.
116+
117+
The current config-write scope deliberately does not include redistribution,
118+
default-information-originate, virtual links, per-address OSPFv2 interface
119+
overrides, OSPFv2 NSSA translator/suppress-fa knobs, or other FRR-specific
120+
extensions outside RFC 9129. A native OSPFv3 module should be added only when
121+
there is concrete FRR-specific state or configuration to expose.
87122

88123
Test Coverage
89124
-------------
@@ -94,6 +129,25 @@ neighbor state. It also checks that ``ospfd`` and ``ospf6d`` register with mgmtd
94129
and that mgmtd's operational xpath registry includes the RFC 9129 control-plane
95130
protocol subtree.
96131

132+
The operational tests also include a targeted mgmtd dispatch check. Predicate
133+
queries for ``ietf-ospf:ospfv2`` and ``ietf-ospf:ospfv3`` must return exactly
134+
one protocol entry from the correct backend, and the backend subscription check
135+
must show that the other OSPF daemon was not selected. Unfiltered parent/list
136+
queries must still select both OSPF daemons. A predicate query against
137+
``ietf-interfaces`` verifies that untyped backend registrations still match.
138+
139+
The same test file includes config-write checks for the supported OSPFv2 and
140+
OSPFv3 leaves. The tests exercise mgmtd writes, legacy CLI writes routed through
141+
YANG, negative validation paths, and cleanup after deleting and recreating an
142+
area.
143+
144+
``tests/topotests/ospf_yang_startup_config/test_ospf_yang_startup_config.py``
145+
checks startup config-file batching in an isolated one-router topology. Its
146+
``r1/ospfd.conf`` places an OSPFv2 ``default-cost`` line before the stub-area
147+
line that makes it valid; startup succeeds only when the whole daemon config
148+
file is committed as one northbound transaction. ``r1/ospf6d.conf`` keeps a
149+
matching OSPFv3 stub area in the startup path.
150+
97151
The test queries the merged mgmtd operational datastore rather than daemon-local
98152
``show yang operational-data`` output. Zebra supplies the narrow
99153
``/ietf-interfaces:interfaces/interface`` operational state needed to satisfy RFC

doc/user/ospf6d.rst

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -933,21 +933,46 @@ Showing OSPF6 information
933933
This command shows the graceful-restart helper details including helper
934934
configuration parameters.
935935

936-
YANG Operational Data
937-
---------------------
938-
939-
OSPFv3 operational state is available through the standard :rfc:`9129`
940-
``ietf-ospf`` YANG model. The current support is operational data only; OSPFv3
941-
configuration is still managed through the existing FRR CLI.
936+
YANG / NETCONF Support
937+
----------------------
942938

943-
The following example retrieves the OSPFv3 instance from the mgmtd operational
944-
datastore:
939+
OSPFv3 operational state and a subset of OSPFv3 configuration are exposed
940+
through the standard :rfc:`9129` ``ietf-ospf`` YANG model. The OSPFv3
941+
instance itself remains owned by the legacy ``router ospf6`` CLI, but
942+
per-area, per-interface and per-instance configuration leaves are routed
943+
through the mgmtd northbound and can be read, set, and committed through
944+
NETCONF / RESTCONF / ``vtysh``'s ``mgmt`` subcommands as well as the legacy
945+
CLI.
946+
947+
The supported set mirrors the OSPFv2 side documented in :ref:`ospfv2`, with
948+
two v3-specific gaps:
949+
950+
* ``areas/area/default-cost``: ospf6d has no per-area stub default-cost
951+
knob, so this leaf is not implemented. Setting it via YANG is rejected
952+
by mgmtd as ``no backend handles this path``. This matches FRR's existing
953+
v3 CLI surface (which has no ``area X default-cost`` equivalent) and is a
954+
pre-existing v2/v3 feature gap, not introduced by this conversion.
955+
* ``interface-type``: RFC 9129 declares ``broadcast``, ``non-broadcast``,
956+
``point-to-multipoint``, ``point-to-point`` and ``hybrid``. ospf6d only
957+
accepts ``broadcast``, ``point-to-point`` and ``point-to-multipoint``;
958+
the NB callback rejects ``non-broadcast`` and ``hybrid`` at VALIDATE
959+
with a clear error.
960+
961+
Otherwise the set of supported leaves (router-id, area lifecycle,
962+
area-type, area summary, ranges, per-interface attachment, cost,
963+
hello-interval, dead-interval, retransmit-interval, priority, mtu-ignore,
964+
passive, preference) is identical to OSPFv2.
965+
966+
Examples
967+
^^^^^^^^
968+
969+
Retrieve the OSPFv3 instance from the operational datastore:
945970

946971
.. code-block:: shell
947972
948973
vtysh -c 'show mgmt get-data /ietf-routing:routing/control-plane-protocols/control-plane-protocol[type="ietf-ospf:ospfv3"][name="default"] datastore operational'
949974
950-
To retrieve the merged operational datastore, including the OSPFv3 protocol
975+
Retrieve the merged operational datastore, including the OSPFv3 protocol
951976
entry and the ``ietf-interfaces`` data used by OSPF interface leafrefs:
952977

953978
.. code-block:: shell

doc/user/ospfd.rst

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,27 +1083,98 @@ Showing Information
10831083
Displays the Graceful Restart Helper details including helper
10841084
config changes.
10851085

1086-
YANG Operational Data
1087-
---------------------
1088-
1089-
OSPF operational state is available through the standard :rfc:`9129`
1090-
``ietf-ospf`` YANG model. The current support is operational data only; OSPF
1091-
configuration is still managed through the existing FRR CLI.
1086+
YANG / NETCONF Support
1087+
----------------------
10921088

1093-
The following example retrieves the OSPFv2 instance from the mgmtd operational
1094-
datastore:
1089+
OSPF operational state and a subset of OSPF configuration are exposed through
1090+
the standard :rfc:`9129` ``ietf-ospf`` YANG model. The OSPF instance itself
1091+
remains owned by the legacy ``router ospf`` CLI, but per-area, per-interface
1092+
and per-instance configuration leaves are routed through the mgmtd northbound
1093+
so they can be read, set and committed via NETCONF / RESTCONF / ``vtysh``'s
1094+
``mgmt`` subcommands as well as the legacy CLI.
1095+
1096+
For the default or VRF-based daemon, the RFC 9129
1097+
``control-plane-protocol`` name is the OSPF VRF name, normally ``default``.
1098+
When ``ospfd`` is started in daemon-instance mode, the RFC 9129 name is the
1099+
decimal instance ID used by the legacy CLI; for example, ``router ospf 5`` is
1100+
addressed as ``control-plane-protocol[type='ietf-ospf:ospfv2'][name='5']``.
1101+
This keeps separate ``ospfd`` backend processes distinct in mgmtd.
1102+
1103+
Supported configuration leaves
1104+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1105+
1106+
Under ``/ietf-routing:routing/control-plane-protocols/control-plane-protocol[type='ietf-ospf:ospfv2']/ietf-ospf:ospf``:
1107+
1108+
* ``explicit-router-id``
1109+
* ``preference/{all,intra-area,inter-area,internal,external}`` (admin distance)
1110+
* ``areas/area`` (list create / destroy keyed by ``area-id``)
1111+
* ``areas/area/area-type`` (``normal-area``, ``stub-area``, ``nssa-area``)
1112+
* ``areas/area/summary`` (totally-stubby toggle; RFC 9129 inverts FRR's
1113+
``no-summary`` sense)
1114+
* ``areas/area/default-cost`` (stub / NSSA only)
1115+
* ``areas/area/ranges/range`` (list create / destroy), with ``advertise``
1116+
and ``cost`` leaves
1117+
* ``areas/area/interfaces/interface`` (list create / destroy: assigns an
1118+
interface to the area), plus the per-interface leaves
1119+
``cost``, ``hello-interval``, ``dead-interval``, ``retransmit-interval``,
1120+
``priority``, ``mtu-ignore``, ``interface-type``, ``passive``
1121+
1122+
Out of scope for this slice
1123+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1124+
1125+
* ``redistribute`` and ``default-information-originate`` are FRR-specific
1126+
concepts that RFC 9129 / :rfc:`8349` leave to a separate import / export
1127+
mechanism. They stay reachable through the legacy CLI on the
1128+
direct-mutation path.
1129+
* Per-address overrides (e.g. ``ip ospf cost N A.B.C.D``) have no RFC 9129
1130+
counterpart; the YANG model is strictly per-interface. The legacy CLI
1131+
with an explicit address argument continues to use direct mutation.
1132+
* FRR-specific area NSSA augments (translator-role,
1133+
default-information-originate, suppress-fa) are not in the RFC 9129 area
1134+
grouping; they remain legacy-CLI-only.
1135+
* The ``router ospf [{(1-65535)|vrf NAME}]`` instance creation step is still
1136+
CLI-only; YANG operations that target a non-existent instance are
1137+
rejected at VALIDATE with a clear error pointing at ``router ospf``.
1138+
1139+
Examples
1140+
^^^^^^^^
1141+
1142+
Retrieve the OSPFv2 instance from the operational datastore:
10951143

10961144
.. code-block:: shell
10971145
10981146
vtysh -c 'show mgmt get-data /ietf-routing:routing/control-plane-protocols/control-plane-protocol[type="ietf-ospf:ospfv2"][name="default"] datastore operational'
10991147
1100-
To retrieve the merged operational datastore, including the OSPF protocol
1148+
Retrieve the merged operational datastore, including the OSPF protocol
11011149
entry and the ``ietf-interfaces`` data used by OSPF interface leafrefs:
11021150

11031151
.. code-block:: shell
11041152
11051153
vtysh -c 'show mgmt get-data /* datastore operational'
11061154
1155+
Set the router-id through mgmtd, then commit:
1156+
1157+
.. code-block:: shell
1158+
1159+
vtysh -c 'configure terminal file-lock' \
1160+
-c 'mgmt set-config /ietf-routing:routing/control-plane-protocols/control-plane-protocol[type="ietf-ospf:ospfv2"][name="default"]/ietf-ospf:ospf/explicit-router-id "10.0.0.1"' \
1161+
-c 'mgmt commit apply'
1162+
1163+
The corresponding ``ospf router-id 10.0.0.1`` legacy CLI command takes the
1164+
same path through the northbound; both surfaces converge on the same
1165+
committed running configuration.
1166+
1167+
Interface leafref relaxation
1168+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1169+
1170+
RFC 9129's per-interface entry keys on a leafref into
1171+
``/ietf-interfaces:interfaces/interface/name``. The
1172+
``frr-deviations-ietf-routing-ospf`` deviation relaxes this so OSPF config
1173+
can be staged ahead of interface plumbing (useful when emitting config from
1174+
an external orchestrator). The relaxation removes libyang's referential
1175+
check; the NB callbacks restore it themselves, rejecting unknown interface
1176+
names at VALIDATE with a clear error.
1177+
11071178
.. _opaque-lsa:
11081179

11091180
Opaque LSA

0 commit comments

Comments
 (0)