Commit b2d0e78
committed
ospf: route per-interface CLI through ietf-ospf YANG
Convert the per-interface DEFUNs that have RFC 9129 leaf
counterparts to DEFPY_YANG, so operators typing the legacy
syntax at vtysh land on the same NB callbacks glang emits to.
Commands converted on each daemon:
v2: ip ospf cost / hello-interval / dead-interval /
priority / mtu-ignore / passive + their `no` forms
+ the hidden `ospf X` aliases (cost, hello, priority,
dead-interval, no_ospf_cost, no_ospf_hello_interval,
no_ospf_dead_interval, no_ospf_priority)
v3: ipv6 ospf6 cost / hello-interval / dead-interval /
priority / mtu-ignore / passive + their `no` forms
Conversion pattern:
* v2 commands take an optional `[A.B.C.D]` per-address
override that has no RFC 9129 representation. Each
DEFPY_YANG body checks `if (!ifaddr_str && per_iface_xpath
returns 0)` and dispatches through nb_cli_enqueue_change /
nb_cli_apply_changes; on the negative path it falls back
to the legacy direct-mutation logic, preserving the
per-address-override capability for operators that need
it.
* The YANG path also requires the interface to be in an
area (if_area on IF_DEF_PARAMS). Operators setting
per-interface attrs on an unattached interface continue to
use the legacy path -- the YANG model can't express
"interface params before area assignment" because the
leaves live under areas/area[id]/interfaces.
* Per-leaf bodies factor into small `_apply` helpers shared
by the main `ip ospf X` form and the hidden backwards-
compat `ospf X` alias (v2 only).
Internal API:
* ospfd/ospf_vty.c gains a new ospf_per_iface_xpath helper
(mirrors ospf6d's ospf6_per_iface_xpath added in the same
file pattern). Both check the same gating conditions:
interface exists, has a VRF, ospf instance present,
if_area / oi->area set.
* v3's hello-interval / dead-interval / priority each lost
their ALIAS-based dual-purpose DEFUN that handled both set
and `no` via a runtime strmatch on argv[0]->text. Split
into clean DEFPY_YANG pairs (set + no) which is both more
readable and easier for vtysh to dispatch correctly.
Not converted (deferred):
* `ip ospf retransmit-interval`, `ip ospf area`,
`ip ospf network`, `ip ospf dead-interval minimal
hello-multiplier` -- each has complications that make
them their own follow-up slices (area instance-id
conflicts, network FRR-specific dmvpn modifiers, fast-
hello multiplier outside RFC 9129). All four continue to
work via the legacy CLI direct-mutation path.
Test coverage:
* test_ospf_per_iface_cli_routes_through_yang exercises all
twelve converted set forms (six v2 + six v3) plus their
`no` forms via vtysh on r1-eth1, confirms running-config
reflects each change and clears it on the `no`. Drives
the same NB callbacks that mgmt-set-config does, so it
proves the dispatch goes through YANG even though the
operator typed legacy syntax.
Signed-off-by: lamestllama <eric@eparsonage.com>1 parent 34edbc1 commit b2d0e78
5 files changed
Lines changed: 767 additions & 355 deletions
File tree
- ospf6d
- ospfd
- tests/topotests/ospf_topo1
0 commit comments