From 9ace83b9525677c8996fee56cf1ec28a02a96711 Mon Sep 17 00:00:00 2001 From: Isabella de Leon Date: Thu, 30 Mar 2023 16:25:02 -0700 Subject: [PATCH] isisd: Add log-pdu-drops CLI/YANG support New config functionality: r1# conf r1(config)# router isis 1 r1(config-router)# log- log-adjacency-changes Log changes in adjacency state log-pdu-drops Log any dropped PDUs r1(config-router)# log-pdu-drops r1(config-router)# end Signed-off-by: Isabella de Leon --- isisd/isis_cli.c | 21 +++++++++++++++++++++ isisd/isis_nb.c | 7 +++++++ isisd/isis_nb.h | 3 +++ isisd/isis_nb_config.c | 17 +++++++++++++++++ isisd/isisd.h | 2 ++ yang/frr-isisd.yang | 7 +++++++ 6 files changed, 57 insertions(+) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 7e1bb9255c..ee51e46858 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -3025,6 +3025,26 @@ void cli_show_isis_log_adjacency(struct vty *vty, const struct lyd_node *dnode, vty_out(vty, " log-adjacency-changes\n"); } +/* + * XPath: /frr-isisd:isis/instance/log-pdu-drops + */ +DEFPY_YANG(log_pdu_drops, log_pdu_drops_cmd, "[no] log-pdu-drops", + NO_STR "Log any dropped PDUs\n") +{ + nb_cli_enqueue_change(vty, "./log-pdu-drops", NB_OP_MODIFY, + no ? "false" : "true"); + + return nb_cli_apply_changes(vty, NULL); +} + +void cli_show_isis_log_pdu_drops(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults) +{ + if (!yang_dnode_get_bool(dnode, NULL)) + vty_out(vty, " no"); + vty_out(vty, " log-pdu-drops\n"); +} + /* * XPath: /frr-isisd:isis/instance/mpls/ldp-sync */ @@ -3290,6 +3310,7 @@ void isis_cli_init(void) install_element(INTERFACE_NODE, &isis_ti_lfa_cmd); install_element(ISIS_NODE, &log_adj_changes_cmd); + install_element(ISIS_NODE, &log_pdu_drops_cmd); install_element(ISIS_NODE, &isis_mpls_ldp_sync_cmd); install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_cmd); diff --git a/isisd/isis_nb.c b/isisd/isis_nb.c index 7dc3a0eb3d..9141bfc46c 100644 --- a/isisd/isis_nb.c +++ b/isisd/isis_nb.c @@ -558,6 +558,13 @@ const struct frr_yang_module_info frr_isisd_info = { .modify = isis_instance_log_adjacency_changes_modify, }, }, + { + .xpath = "/frr-isisd:isis/instance/log-pdu-drops", + .cbs = { + .cli_show = cli_show_isis_log_pdu_drops, + .modify = isis_instance_log_pdu_drops_modify, + }, + }, { .xpath = "/frr-isisd:isis/instance/mpls-te", .cbs = { diff --git a/isisd/isis_nb.h b/isisd/isis_nb.h index 480b2ce041..9a1f1f786f 100644 --- a/isisd/isis_nb.h +++ b/isisd/isis_nb.h @@ -196,6 +196,7 @@ int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify( int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy( struct nb_cb_destroy_args *args); int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args *args); +int isis_instance_log_pdu_drops_modify(struct nb_cb_modify_args *args); int isis_instance_mpls_te_create(struct nb_cb_create_args *args); int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args *args); int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args *args); @@ -609,6 +610,8 @@ void cli_show_ip_isis_priority(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); void cli_show_isis_log_adjacency(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); +void cli_show_isis_log_pdu_drops(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults); void cli_show_isis_mpls_ldp_sync(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); void cli_show_isis_mpls_ldp_sync_holddown(struct vty *vty, diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 3817465a64..6a9133f20b 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -1829,6 +1829,23 @@ int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args *args) return NB_OK; } +/* + * XPath: /frr-isisd:isis/instance/log-pdu-drops + */ +int isis_instance_log_pdu_drops_modify(struct nb_cb_modify_args *args) +{ + struct isis_area *area; + bool log = yang_dnode_get_bool(args->dnode, NULL); + + if (args->event != NB_EV_APPLY) + return NB_OK; + + area = nb_running_get_entry(args->dnode, NULL, true); + area->log_pdu_drops = log ? 1 : 0; + + return NB_OK; +} + /* * XPath: /frr-isisd:isis/instance/mpls-te */ diff --git a/isisd/isisd.h b/isisd/isisd.h index 0b1f1cb620..e0f7ca882e 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -195,6 +195,8 @@ struct isis_area { int ip_circuits; /* logging adjacency changes? */ uint8_t log_adj_changes; + /* logging pdu drops? */ + uint8_t log_pdu_drops; /* multi topology settings */ struct list *mt_settings; /* MPLS-TE settings */ diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang index 66ec6a410d..de925b4823 100644 --- a/yang/frr-isisd.yang +++ b/yang/frr-isisd.yang @@ -1594,6 +1594,13 @@ module frr-isisd { "Log changes to the IS-IS adjacencies in this area."; } + leaf log-pdu-drops { + type boolean; + default "false"; + description + "Log any dropped PDUs in this area."; + } + container mpls-te { presence "Present if MPLS-TE is enabled."; description -- 2.39.5