Skip to content

Commit 777454f

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: lamestllama <eric@eparsonage.com>
1 parent ef86fea commit 777454f

3 files changed

Lines changed: 184 additions & 57 deletions

File tree

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

Lines changed: 77 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,64 @@ 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+
Current Implementation
49+
----------------------
50+
51+
This branch implements the RFC 9129 ``ietf-ospf`` tree directly for OSPFv2 and
52+
OSPFv3 rather than adding an FRR-native OSPF model with parallel semantics.
53+
``yang/frr-ospfd.yang`` remains on disk for future FRR-specific OSPFv2 work,
54+
but ``ospfd`` does not link its generated schema into the daemon binary or
55+
advertise it with no callbacks behind it.
56+
57+
Both daemons load ``ietf-ospf`` and map FRR behavior toward the RFC 9129
58+
``/ietf-routing:routing/control-plane-protocols/control-plane-protocol/ietf-ospf:ospf``
59+
tree. OSPFv2 and OSPFv3 operational callbacks expose the RFC
60+
``control-plane-protocol`` list, router-id, instance LSA counters, area
61+
SPF/ABR/ASBR/LSA counters, interface list, and neighbor list with neighbor
62+
address and state. The default instance name is ``default`` for both daemons.
63+
The OSPFv2 interface list exposes one entry per interface key because RFC 9129
64+
keys the list by interface name while FRR can hold multiple OSPFv2 interface
65+
objects for different addresses on the same interface.
66+
67+
``ospfd`` and ``ospf6d`` register as mgmtd backend clients for typed
68+
``control-plane-protocol`` entries so OSPFv2 and OSPFv3 can share the standard
69+
``ietf-routing`` list without one daemon claiming the other daemon's instance.
70+
``mgmtd`` also loads the RFC OSPF modules so it can parse OSPF backend replies
71+
in the merged operational datastore.
72+
73+
The mgmtd backend matcher treats predicates in backend registrations as
74+
ownership constraints, not as a reason to hide unfiltered list data. A query
75+
with ``type='ietf-ospf:ospfv2'`` must dispatch only to ``ospfd`` and a query
76+
with ``type='ietf-ospf:ospfv3'`` must dispatch only to ``ospf6d``. A query that
77+
omits the ``type`` predicate, such as a request for the whole
78+
``control-plane-protocol`` list or one of its unkeyed descendants, still
79+
dispatches to both daemons so mgmtd can merge the OSPFv2 and OSPFv3 entries.
80+
This keeps shared IETF lists usable for current OSPF and future protocol
81+
families without special-casing OSPF in mgmtd.
82+
83+
Configuration write support is intentionally limited to CLI-equivalent RFC 9129
84+
leaves. The converted leaves are router-id, preference, area lifecycle,
85+
area-type, area summary, OSPFv2 default-cost, area ranges, per-interface area
86+
attachment, interface cost, hello-interval, dead-interval, retransmit-interval,
87+
priority, mtu-ignore, interface-type, and passive. Existing CLI commands for
88+
those leaves set the same YANG nodes as mgmtd writes.
89+
90+
Direct daemon config-file loads in ``ospfd`` and ``ospf6d`` opt in to batching
91+
so cross-leaf validation can evaluate a whole startup file in one northbound
92+
transaction. Other daemons keep the legacy per-line config-file behavior.
93+
94+
Remaining Scope
95+
---------------
96+
97+
``ietf-ospf`` remains the canonical configuration tree for everything RFC 9129
98+
models. ``frr-ospfd`` and future ``frr-ospf6d`` should augment only
99+
FRR-specific behavior that the RFC model does not cover.
100+
101+
The current config-write scope deliberately does not include redistribution,
102+
default-information-originate, virtual links, per-address OSPFv2 interface
103+
overrides, OSPFv2 NSSA translator/suppress-fa knobs, or other FRR-specific
104+
extensions outside RFC 9129. A native OSPFv3 module should be added only when
105+
there is concrete FRR-specific state or configuration to expose.
87106

88107
Test Coverage
89108
-------------
@@ -94,6 +113,25 @@ neighbor state. It also checks that ``ospfd`` and ``ospf6d`` register with mgmtd
94113
and that mgmtd's operational xpath registry includes the RFC 9129 control-plane
95114
protocol subtree.
96115

116+
The operational tests also include a targeted mgmtd dispatch check. Predicate
117+
queries for ``ietf-ospf:ospfv2`` and ``ietf-ospf:ospfv3`` must return exactly
118+
one protocol entry from the correct backend, and the backend subscription check
119+
must show that the other OSPF daemon was not selected. Unfiltered parent/list
120+
queries must still select both OSPF daemons. A predicate query against
121+
``ietf-interfaces`` verifies that untyped backend registrations still match.
122+
123+
The same test file includes config-write checks for the supported OSPFv2 and
124+
OSPFv3 leaves. The tests exercise mgmtd writes, legacy CLI writes routed through
125+
YANG, negative validation paths, and cleanup after deleting and recreating an
126+
area.
127+
128+
``tests/topotests/ospf_yang_startup_config/test_ospf_yang_startup_config.py``
129+
checks startup config-file batching in an isolated one-router topology. Its
130+
``r1/ospfd.conf`` places an OSPFv2 ``default-cost`` line before the stub-area
131+
line that makes it valid; startup succeeds only when the whole daemon config
132+
file is committed as one northbound transaction. ``r1/ospf6d.conf`` keeps a
133+
matching OSPFv3 stub area in the startup path.
134+
97135
The test queries the merged mgmtd operational datastore rather than daemon-local
98136
``show yang operational-data`` output. Zebra supplies the narrow
99137
``/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: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,27 +1083,91 @@ 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+
Supported configuration leaves
1097+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1098+
1099+
Under ``/ietf-routing:routing/control-plane-protocols/control-plane-protocol[type='ietf-ospf:ospfv2']/ietf-ospf:ospf``:
1100+
1101+
* ``explicit-router-id``
1102+
* ``preference/{all,intra-area,inter-area,internal,external}`` (admin distance)
1103+
* ``areas/area`` (list create / destroy keyed by ``area-id``)
1104+
* ``areas/area/area-type`` (``normal-area``, ``stub-area``, ``nssa-area``)
1105+
* ``areas/area/summary`` (totally-stubby toggle; RFC 9129 inverts FRR's
1106+
``no-summary`` sense)
1107+
* ``areas/area/default-cost`` (stub / NSSA only)
1108+
* ``areas/area/ranges/range`` (list create / destroy), with ``advertise``
1109+
and ``cost`` leaves
1110+
* ``areas/area/interfaces/interface`` (list create / destroy: assigns an
1111+
interface to the area), plus the per-interface leaves
1112+
``cost``, ``hello-interval``, ``dead-interval``, ``retransmit-interval``,
1113+
``priority``, ``mtu-ignore``, ``interface-type``, ``passive``
1114+
1115+
Out of scope for this slice
1116+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1117+
1118+
* ``redistribute`` and ``default-information-originate`` are FRR-specific
1119+
concepts that RFC 9129 / :rfc:`8349` leave to a separate import / export
1120+
mechanism. They stay reachable through the legacy CLI on the
1121+
direct-mutation path.
1122+
* Per-address overrides (e.g. ``ip ospf cost N A.B.C.D``) have no RFC 9129
1123+
counterpart; the YANG model is strictly per-interface. The legacy CLI
1124+
with an explicit address argument continues to use direct mutation.
1125+
* FRR-specific area NSSA augments (translator-role,
1126+
default-information-originate, suppress-fa) are not in the RFC 9129 area
1127+
grouping; they remain legacy-CLI-only.
1128+
* The ``router ospf [vrf NAME]`` instance creation step is still
1129+
CLI-only; YANG operations that target a non-existent instance are
1130+
rejected at VALIDATE with a clear error pointing at ``router ospf``.
1131+
1132+
Examples
1133+
^^^^^^^^
1134+
1135+
Retrieve the OSPFv2 instance from the operational datastore:
10951136

10961137
.. code-block:: shell
10971138
10981139
vtysh -c 'show mgmt get-data /ietf-routing:routing/control-plane-protocols/control-plane-protocol[type="ietf-ospf:ospfv2"][name="default"] datastore operational'
10991140
1100-
To retrieve the merged operational datastore, including the OSPF protocol
1141+
Retrieve the merged operational datastore, including the OSPF protocol
11011142
entry and the ``ietf-interfaces`` data used by OSPF interface leafrefs:
11021143

11031144
.. code-block:: shell
11041145
11051146
vtysh -c 'show mgmt get-data /* datastore operational'
11061147
1148+
Set the router-id through mgmtd, then commit:
1149+
1150+
.. code-block:: shell
1151+
1152+
vtysh -c 'configure terminal file-lock' \
1153+
-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"' \
1154+
-c 'mgmt commit apply'
1155+
1156+
The corresponding ``ospf router-id 10.0.0.1`` legacy CLI command takes the
1157+
same path through the northbound; both surfaces converge on the same
1158+
committed running configuration.
1159+
1160+
Interface leafref relaxation
1161+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1162+
1163+
RFC 9129's per-interface entry keys on a leafref into
1164+
``/ietf-interfaces:interfaces/interface/name``. The
1165+
``frr-deviations-ietf-routing-ospf`` deviation relaxes this so OSPF config
1166+
can be staged ahead of interface plumbing (useful when emitting config from
1167+
an external orchestrator). The relaxation removes libyang's referential
1168+
check; the NB callbacks restore it themselves, rejecting unknown interface
1169+
names at VALIDATE with a clear error.
1170+
11071171
.. _opaque-lsa:
11081172

11091173
Opaque LSA

0 commit comments

Comments
 (0)