ospfd: introduce additional opaque capability check in the GR code

Before starting the graceful restart procedures, ospf_gr_prepare()
verifies for each configured OSPF instance whether it has the opaque
capability enabled (a pre-requisite for GR). If not, a warning is
emitted and GR isn't performed on that instance.

This PR introduces an additional opaque capability check that will
return a CLI error when the opaque capability isn't enabled. The
idea is to make it easier for the user to identify when the GR
activation has failed, instead of requiring him or her to check
the logs for errors.

The original opaque capability check from ospf_gr_prepare() was
retaining as it's possible that that function might be called from
other contexts in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2021-10-09 20:02:16 -03:00
parent d6f60d2276
commit eedc80c1f5

View file

@ -734,6 +734,18 @@ DEFPY(graceful_restart_prepare, graceful_restart_prepare_cmd,
IP_STR IP_STR
"Prepare to restart the OSPF process") "Prepare to restart the OSPF process")
{ {
struct ospf *ospf;
struct listnode *node;
for (ALL_LIST_ELEMENTS_RO(om->ospf, node, ospf)) {
if (!CHECK_FLAG(ospf->config, OSPF_OPAQUE_CAPABLE)) {
vty_out(vty,
"%% Can't start graceful restart: opaque capability not enabled (VRF %s)\n\n",
ospf_get_name(ospf));
return CMD_WARNING;
}
}
ospf_gr_prepare(); ospf_gr_prepare();
return CMD_SUCCESS; return CMD_SUCCESS;