diff --git a/src/confd/src/ietf-routing.c b/src/confd/src/ietf-routing.c index 0d78297c..98573c54 100644 --- a/src/confd/src/ietf-routing.c +++ b/src/confd/src/ietf-routing.c @@ -105,7 +105,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) { - struct lyd_node *areas; + struct lyd_node *areas, *default_route; int num_areas = 0; int bfd_enabled = 0; FILE *fp; @@ -120,7 +120,15 @@ int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf) fputs("router ospf\n", fp); num_areas = parse_ospf_areas(session, areas, fp); parse_ospf_redistribute(session, lydx_get_child(ospf, "redistribute"), fp); - + default_route = lydx_get_child(ospf, "default-route-advertise"); + if (default_route) { + if (lydx_get_bool(default_route, "enable")) { + fputs(" default-information originate", fp); + if (lydx_get_bool(default_route, "always")) + fputs(" always", fp); + fputs("\n", fp); + } + } fclose(fp); if (!bfd_enabled) diff --git a/src/confd/yang/infix-routing@2024-01-09.yang b/src/confd/yang/infix-routing@2024-01-09.yang index 3cfb0c00..8ca0b3af 100644 --- a/src/confd/yang/infix-routing@2024-01-09.yang +++ b/src/confd/yang/infix-routing@2024-01-09.yang @@ -171,6 +171,22 @@ module infix-routing { } } + augment "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf" { + description "ietf-ospf lack the setting to generate a default route"; + container default-route-advertise { + description "Distribute default route to network"; + leaf enable { + description "Distribute default route"; + type boolean; + } + leaf always { + description "Always distribute default route, even if no local default route exist. + If set to false, a default route will only be distributed if a default route exist + in the local routing table."; + type boolean; + } + } + } augment "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf" { description "ietf-ospf does not contain redistribution 7. How should route redistribution be configured? I see ietf-rip.yang has a separate