isisd: retrofit the 'log-adjacency-changes' command

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
Emanuele Di Pascale 2018-11-14 14:44:07 +01:00
parent d59c2d6be6
commit 2adf66ff35
4 changed files with 45 additions and 8 deletions

View File

@ -1878,6 +1878,24 @@ void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode,
}
}
/*
* XPath: /frr-isisd:isis/instance/log-adjacency-changes
*/
DEFPY(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes",
NO_STR "Log changes in adjacency state\n")
{
nb_cli_enqueue_change(vty, "./log-adjacency-changes",
no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
return nb_cli_apply_changes(vty, NULL);
}
void cli_show_isis_log_adjacency(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " log-adjacency-changes\n");
}
void isis_cli_init(void)
{
install_element(CONFIG_NODE, &router_isis_cmd);
@ -1963,6 +1981,8 @@ void isis_cli_init(void)
install_element(INTERFACE_NODE, &isis_priority_cmd);
install_element(INTERFACE_NODE, &no_isis_priority_cmd);
install_element(ISIS_NODE, &log_adj_changes_cmd);
}
#endif /* ifndef FABRICD */

View File

@ -119,5 +119,7 @@ void cli_show_ip_isis_network_type(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
void cli_show_isis_log_adjacency(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
#endif /* ISISD_ISIS_CLI_H_ */

View File

@ -1480,7 +1480,14 @@ isis_instance_log_adjacency_changes_create(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
/* TODO: implement me. */
struct isis_area *area;
if (event != NB_EV_APPLY)
return NB_OK;
area = yang_dnode_get_entry(dnode, true);
area->log_adj_changes = 1;
return NB_OK;
}
@ -1488,7 +1495,14 @@ static int
isis_instance_log_adjacency_changes_delete(enum nb_event event,
const struct lyd_node *dnode)
{
/* TODO: implement me. */
struct isis_area *area;
if (event != NB_EV_APPLY)
return NB_OK;
area = yang_dnode_get_entry(dnode, true);
area->log_adj_changes = 0;
return NB_OK;
}
@ -2745,6 +2759,7 @@ const struct frr_yang_module_info frr_isisd_info = {
.xpath = "/frr-isisd:isis/instance/log-adjacency-changes",
.cbs.create = isis_instance_log_adjacency_changes_create,
.cbs.delete = isis_instance_log_adjacency_changes_delete,
.cbs.cli_show = cli_show_isis_log_adjacency,
},
{
.xpath = "/frr-isisd:isis/mpls-te",

View File

@ -1807,6 +1807,7 @@ void isis_area_lsp_refresh_set(struct isis_area *area, int level,
lsp_regenerate_schedule(area, level, 1);
}
#ifdef FABRICD
DEFUN (log_adj_changes,
log_adj_changes_cmd,
"log-adjacency-changes",
@ -1831,7 +1832,7 @@ DEFUN (no_log_adj_changes,
return CMD_SUCCESS;
}
#endif /* ifdef FABRICD */
/* IS-IS configuration write function */
int isis_config_write(struct vty *vty)
{
@ -2189,17 +2190,16 @@ void isis_init()
#ifdef FABRICD
install_element(CONFIG_NODE, &router_openfabric_cmd);
install_element(CONFIG_NODE, &no_router_openfabric_cmd);
#endif /* ifdef FABRICD */
#ifdef FABRICD
install_element(ROUTER_NODE, &net_cmd);
install_element(ROUTER_NODE, &no_net_cmd);
#endif /* ifdef FABRICD */
#ifdef FABRICD
install_element(ROUTER_NODE, &isis_topology_cmd);
install_element(ROUTER_NODE, &no_isis_topology_cmd);
#endif /* ifdef FABRICD */
install_element(ROUTER_NODE, &log_adj_changes_cmd);
install_element(ROUTER_NODE, &no_log_adj_changes_cmd);
#endif /* ifdef FABRICD */
spf_backoff_cmd_init();
}