From c906236be55437c4a66835fb8be996c2cf6ff22e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Fri, 12 Jan 2024 17:20:56 +0100 Subject: [PATCH] OSPF: Add support for setting explicit-router-id --- src/confd/bin/bootstrap | 1 + src/confd/src/ietf-routing.c | 4 ++++ src/confd/yang/infix-routing@2024-01-09.yang | 4 +--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/confd/bin/bootstrap b/src/confd/bin/bootstrap index a08b70cc..b449dd60 100755 --- a/src/confd/bin/bootstrap +++ b/src/confd/bin/bootstrap @@ -207,6 +207,7 @@ sysrepoctl -s $SEARCH \ -i ietf-ipv4-unicast-routing@2018-03-13.yang -g wheel -p 0660 \ -i ietf-ospf@2022-10-19.yang -g wheel -p 0660 \ -e bfd \ + -e explicit-router-id \ -i iana-if-type@2023-01-26.yang -g wheel -p 0660 \ -i ieee802-dot1q-types@2022-10-29.yang -g wheel -p 0660 \ -i infix-ip@2023-09-14.yang -g wheel -p 0660 \ diff --git a/src/confd/src/ietf-routing.c b/src/confd/src/ietf-routing.c index db42a075..1f8860c4 100644 --- a/src/confd/src/ietf-routing.c +++ b/src/confd/src/ietf-routing.c @@ -111,6 +111,7 @@ int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf) struct lyd_node *areas, *default_route; int num_areas = 0; int bfd_enabled = 0; + const char *router_id; FILE *fp; fp = fopen(OSPFD_CONF_NEXT, "w"); if (!fp) { @@ -119,6 +120,7 @@ int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf) } fputs(FRR_STATIC_CONFIG, fp); areas = lydx_get_child(ospf, "areas"); + router_id = lydx_get_cattr(ospf, "explicit-router-id"); bfd_enabled = parse_ospf_interfaces(session, areas, fp); fputs("router ospf\n", fp); num_areas = parse_ospf_areas(session, areas, fp); @@ -132,6 +134,8 @@ int parse_ospf(sr_session_ctx_t *session, struct lyd_node *ospf) fputs("\n", fp); } } + if (router_id) + fprintf(fp, " ospf router-id %s\n", router_id); 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 3cfc1aa5..6ac93d71 100644 --- a/src/confd/yang/infix-routing@2024-01-09.yang +++ b/src/confd/yang/infix-routing@2024-01-09.yang @@ -44,6 +44,7 @@ module infix-routing { description "Initial limitation"; deviate not-supported; } + deviation "/ietf-r:routing/ietf-r:router-id" { description "Set in OSPF"; deviate not-supported; @@ -230,9 +231,6 @@ module infix-routing { deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:database" { deviate not-supported; } - deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:explicit-router-id" { - deviate not-supported; - } deviation "/ietf-r:routing/ietf-r:control-plane-protocols/ietf-r:control-plane-protocol/ospf:ospf/ospf:graceful-restart" { deviate not-supported; }