diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2018-11-14 10:55:54 +0100 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2018-12-18 15:23:49 +0100 |
commit | 66e45e10f1ea725b5acbd2579151e644be80147e (patch) | |
tree | ea3a4d18d0e6907609029dcf56bfe6406415c739 /isisd | |
parent | isisd: retrofit the 'spf-delay-ietf' command (diff) | |
download | frr-66e45e10f1ea725b5acbd2579151e644be80147e.tar.xz frr-66e45e10f1ea725b5acbd2579151e644be80147e.zip |
isisd: retrofit the 'purge-originator' command
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_cli.c | 20 | ||||
-rw-r--r-- | isisd/isis_cli.h | 2 | ||||
-rw-r--r-- | isisd/isis_northbound.c | 19 | ||||
-rw-r--r-- | isisd/isis_vty_common.c | 14 | ||||
-rw-r--r-- | isisd/isis_vty_fabricd.c | 14 |
5 files changed, 53 insertions, 16 deletions
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index a57fbd469..d2c88eda5 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -881,6 +881,24 @@ void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode, yang_dnode_get_string(dnode, "./time-to-learn")); } +/* + * XPath: /frr-isisd:isis/instance/purge-originator + */ +DEFPY(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator", + NO_STR "Use the RFC 6232 purge-originator\n") +{ + nb_cli_enqueue_change(vty, "./purge-originator", + no ? NB_OP_DELETE : NB_OP_CREATE, NULL); + + return nb_cli_apply_changes(vty, NULL); +} + +void cli_show_isis_purge_origin(struct vty *vty, struct lyd_node *dnode, + bool show_defaults) +{ + vty_out(vty, " purge-originator\n"); +} + void isis_cli_init(void) { install_element(CONFIG_NODE, &router_isis_cmd); @@ -920,6 +938,8 @@ void isis_cli_init(void) install_element(ISIS_NODE, &no_spf_interval_cmd); install_element(ISIS_NODE, &spf_delay_ietf_cmd); install_element(ISIS_NODE, &no_spf_delay_ietf_cmd); + + install_element(ISIS_NODE, &area_purge_originator_cmd); } #endif /* ifndef FABRICD */ diff --git a/isisd/isis_cli.h b/isisd/isis_cli.h index 59128c616..1b2e89c5d 100644 --- a/isisd/isis_cli.h +++ b/isisd/isis_cli.h @@ -55,5 +55,7 @@ void cli_show_isis_spf_min_interval(struct vty *vty, struct lyd_node *dnode, bool show_defaults); void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode, bool show_defaults); +void cli_show_isis_purge_origin(struct vty *vty, struct lyd_node *dnode, + bool show_defaults); #endif /* ISISD_ISIS_CLI_H_ */ diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index 454299c3d..f55a0ccf3 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -343,14 +343,28 @@ static int isis_instance_purge_originator_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->purge_originator = true; + return NB_OK; } static int isis_instance_purge_originator_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->purge_originator = false; + return NB_OK; } @@ -1976,6 +1990,7 @@ const struct frr_yang_module_info frr_isisd_info = { .xpath = "/frr-isisd:isis/instance/purge-originator", .cbs.create = isis_instance_purge_originator_create, .cbs.delete = isis_instance_purge_originator_delete, + .cbs.cli_show = cli_show_isis_purge_origin, }, { .xpath = "/frr-isisd:isis/instance/lsp/mtu", diff --git a/isisd/isis_vty_common.c b/isisd/isis_vty_common.c index 3c4279095..c8625b6d4 100644 --- a/isisd/isis_vty_common.c +++ b/isisd/isis_vty_common.c @@ -439,18 +439,6 @@ DEFUN (no_isis_bfd, return CMD_SUCCESS; } -DEFUN (area_purge_originator, - area_purge_originator_cmd, - "[no] purge-originator", - NO_STR - "Use the RFC 6232 purge-originator\n") -{ - VTY_DECLVAR_CONTEXT(isis_area, area); - - area->purge_originator = !!strcmp(argv[0]->text, "no"); - return CMD_SUCCESS; -} - void isis_vty_init(void) { install_element(INTERFACE_NODE, &isis_passive_cmd); @@ -480,7 +468,5 @@ void isis_vty_init(void) install_element(INTERFACE_NODE, &isis_bfd_cmd); install_element(INTERFACE_NODE, &no_isis_bfd_cmd); - install_element(ROUTER_NODE, &area_purge_originator_cmd); - isis_vty_daemon_init(); } diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c index 4cd32a951..acf1c49db 100644 --- a/isisd/isis_vty_fabricd.c +++ b/isisd/isis_vty_fabricd.c @@ -680,6 +680,18 @@ DEFUN (spf_delay_ietf, return CMD_SUCCESS; } +DEFUN (area_purge_originator, + area_purge_originator_cmd, + "[no] purge-originator", + NO_STR + "Use the RFC 6232 purge-originator\n") +{ + VTY_DECLVAR_CONTEXT(isis_area, area); + + area->purge_originator = !!strcmp(argv[0]->text, "no"); + return CMD_SUCCESS; +} + void isis_vty_daemon_init(void) { install_element(ROUTER_NODE, &fabric_tier_cmd); @@ -716,4 +728,6 @@ void isis_vty_daemon_init(void) install_element(ROUTER_NODE, &spf_delay_ietf_cmd); install_element(ROUTER_NODE, &no_spf_delay_ietf_cmd); + + install_element(ROUTER_NODE, &area_purge_originator_cmd); } |