Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ Change Log

All notable changes to the project are documented in this file.

[v26.01.0][UNRELEASED]
-------------------------

### Changes

- Add support for configurable OSPF debug logging, issue #1281. Debug options
can now be enabled per category (bfd, packet, ism, nsm, default-information,
nssa). All debug options are disabled by default to prevent log flooding in
production environments. See the documentation for usage examples

[v25.11.0][] - 2025-12-02
-------------------------

Expand Down
42 changes: 42 additions & 0 deletions doc/networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,48 @@ routes`.

admin@example:/>

For more detailed troubleshooting, OSPF debug logging can be enabled to
capture specific protocol events. Debug messages are written to the
routing log file (`/var/log/routing`).

> [!CAUTION]
> Debug logging significantly increases log output and may impact
> performance. Only enable debug categories needed for troubleshooting,
> and disable them when done.

To enable specific OSPF debug categories:

admin@example:/> configure
admin@example:/config/> edit routing control-plane-protocol ospfv2 name default ospf debug
admin@example:/config/routing/…/ospf/debug/> set bfd true
admin@example:/config/routing/…/ospf/debug/> set nsm true
admin@example:/config/routing/…/ospf/debug/> leave
admin@example:/>

Available debug categories include:

- `bfd`: BFD (Bidirectional Forwarding Detection) events
- `packet`: Detailed packet debugging (all OSPF packets)
- `ism`: Interface State Machine events
- `nsm`: Neighbor State Machine events
- `default-information`: Default route origination
- `nssa`: Not-So-Stubby Area events

All debug options are disabled by default. Refer to the `infix-routing`
YANG model for the complete list of available debug options.

To view current debug settings:

admin@example:/> show running-config routing control-plane-protocol

To disable all debug logging, simply delete the debug settings or set
all options back to `false`:

admin@example:/> configure
admin@example:/config/> delete routing control-plane-protocol ospfv2 name default ospf debug
admin@example:/config/> leave
admin@example:/>


### View routing table

Expand Down
45 changes: 35 additions & 10 deletions src/confd/src/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,7 @@ int parse_ospf_areas(sr_session_ctx_t *session, struct lyd_node *areas, FILE *fp

int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf)
{
const char *static_debug = "! OSPF default debug\
debug ospf bfd\n\
debug ospf packet all detail\n\
debug ospf ism\n\
debug ospf nsm\n\
debug ospf default-information\n\
debug ospf nssa\n\
! OSPF configuration\n";
struct lyd_node *areas, *default_route;
struct lyd_node *areas, *default_route, *debug;
const char *router_id;
int bfd_enabled = 0;
int num_areas = 0;
Expand All @@ -154,7 +146,40 @@ debug ospf nssa\n\
}

fputs(FRR_STATIC_CONFIG, fp);
fputs(static_debug, fp);

/* Handle OSPF debug configuration */
debug = lydx_get_child(ospf, "debug");
if (debug) {
int any_debug = 0;

if (lydx_get_bool(debug, "bfd")) {
fputs("debug ospf bfd\n", fp);
any_debug = 1;
}
if (lydx_get_bool(debug, "packet")) {
fputs("debug ospf packet all detail\n", fp);
any_debug = 1;
}
if (lydx_get_bool(debug, "ism")) {
fputs("debug ospf ism\n", fp);
any_debug = 1;
}
if (lydx_get_bool(debug, "nsm")) {
fputs("debug ospf nsm\n", fp);
any_debug = 1;
}
if (lydx_get_bool(debug, "default-information")) {
fputs("debug ospf default-information\n", fp);
any_debug = 1;
}
if (lydx_get_bool(debug, "nssa")) {
fputs("debug ospf nssa\n", fp);
any_debug = 1;
}

if (any_debug)
Comment thread
troglobit marked this conversation as resolved.
fputs("!\n", fp);
}

areas = lydx_get_child(ospf, "areas");
router_id = lydx_get_cattr(ospf, "explicit-router-id");
Expand Down
2 changes: 1 addition & 1 deletion src/confd/yang/confd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ MODULES=(
"[email protected]"
"[email protected]"
"[email protected]"
"infix-routing@2025-11-12.yang"
"infix-routing@2025-12-02.yang"
"[email protected]"
"[email protected]"
"[email protected]"
Expand Down
47 changes: 47 additions & 0 deletions src/confd/yang/confd/infix-routing.yang
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ module infix-routing {
contact "[email protected]";
description "Deviations and augments for ietf-routing and ietf-ospf.";

revision 2025-12-02 {
description "Add configurable OSPF debug logging container.
Allows users to enable specific OSPF debug categories
(bfd, packet, ism, nsm, default-information, nssa) for troubleshooting.
All debug options default to disabled to prevent log flooding.";
reference "Issue #1281";
}

revision 2025-11-12 {
description "Add area-id augmentation to OSPF local-rib routes.
Add uptime, role, and interface-name augmentations to OSPF neighbor state.
Expand Down Expand Up @@ -306,6 +314,45 @@ module infix-routing {
}
}
}
augment "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf" {
description "Add support for configurable OSPF debug logging.
Allows users to enable specific OSPF debug categories for troubleshooting.
All debug options default to disabled to prevent log flooding in
production environments.";
container debug {
description "OSPF debug logging configuration";
leaf bfd {
type boolean;
default false;
description "Enable OSPF BFD (Bidirectional Forwarding Detection) debug messages";
}
leaf packet {
type boolean;
default false;
description "Enable detailed OSPF packet debug messages (all packet types)";
}
leaf ism {
type boolean;
default false;
description "Enable OSPF Interface State Machine debug messages";
}
leaf nsm {
type boolean;
default false;
description "Enable OSPF Neighbor State Machine debug messages";
}
leaf default-information {
type boolean;
default false;
description "Enable OSPF default route origination debug messages";
}
leaf nssa {
type boolean;
default false;
description "Enable OSPF NSSA (Not-So-Stubby Area) debug messages";
}
}
}
deviation "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
deviate add {
must "count(../../../../ospf:areas/ospf:area/ospf:interfaces/ospf:interface[ospf:name=current()/name]) <= 1" {
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions test/case/routing/Readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Tests verifying standard routing protocols and configuration:
- OSPF multi-area configuration and inter-area routing
- OSPF with BFD (Bidirectional Forwarding Detection)
- OSPF default route advertisement and propagation
- OSPF debug logging configuration and verification
- Route preference handling for OSPF routes
- Route preference handling for DHCP-learned routes
- Administrative distance configuration (route preference 255)
Expand Down Expand Up @@ -37,6 +38,10 @@ include::ospf_default_route_advertise/Readme.adoc[]

<<<

include::ospf_debug/Readme.adoc[]

<<<

include::route_pref_ospf/Readme.adoc[]

<<<
Expand Down
3 changes: 3 additions & 0 deletions test/case/routing/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@

- name: OSPF Default route advertise
case: ospf_default_route_advertise/test.py

- name: OSPF Debug Logging
case: ospf_debug/test.py
1 change: 1 addition & 0 deletions test/case/routing/ospf_debug/Readme.adoc
Loading