OSPF: Add support to generate a default route inside OSPF

This commit is contained in:
Mattias Walström
2024-01-10 17:51:46 +01:00
committed by Joachim Wiberg
parent 34c807e955
commit 95e9334812
2 changed files with 26 additions and 2 deletions
+10 -2
View File
@@ -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)
@@ -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