From d32f213a2e0a1183a11d1986a3fb01fa5c912612 Mon Sep 17 00:00:00 2001 From: Emanuele Di Pascale Date: Wed, 14 Nov 2018 16:27:51 +0100 Subject: [PATCH] isisd: implemented the 'own-lsp-purge' notification Signed-off-by: Emanuele Di Pascale --- isisd/isis_northbound.c | 22 ++++++++++++++++++++++ isisd/isis_pdu.c | 7 +++++++ isisd/isisd.h | 3 +++ 3 files changed, 32 insertions(+) diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index f76d85cc36..9d7371c9c4 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -2913,6 +2913,28 @@ void isis_notif_seqno_skipped(const struct isis_circuit *circuit, nb_notification_send(xpath, arguments); } +/* + * XPath: + * /frr-isisd:own-lsp-purge + */ +void isis_notif_own_lsp_purge(const struct isis_circuit *circuit, + const char *lsp_id) +{ + const char *xpath = "/frr-isisd:own-lsp-purge"; + struct list *arguments = yang_data_list_new(); + char xpath_arg[XPATH_MAXLEN]; + struct yang_data *data; + struct isis_area *area = circuit->area; + + notif_prep_instance_hdr(xpath, area, "default", arguments); + notif_prepr_iface_hdr(xpath, circuit, arguments); + snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath); + data = yang_data_new_string(xpath_arg, lsp_id); + listnode_add(arguments, data); + + nb_notification_send(xpath, arguments); +} + /* clang-format off */ const struct frr_yang_module_info frr_isisd_info = { .name = "frr-isisd", diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index a5ec27e47e..330da9b216 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1117,6 +1117,13 @@ dontcheckadj: circuit->area->area_tag, rawlspid_print(hdr.lsp_id), lsp->hdr.seqno); + } else { + /* our own LSP with 0 remaining life time */ +#ifndef FABRICD + /* send northbound notification */ + isis_notif_own_lsp_purge( + circuit, rawlspid_print(hdr.lsp_id)); +#endif /* ifndef FABRICD */ } } goto out; diff --git a/isisd/isisd.h b/isisd/isisd.h index 9d0d7f690f..fb879395c1 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -261,6 +261,9 @@ extern void isis_notif_lsp_error(const struct isis_circuit *circuit, uint32_t offset, uint8_t tlv_type); extern void isis_notif_seqno_skipped(const struct isis_circuit *circuit, const char *lsp_id); +extern void isis_notif_own_lsp_purge(const struct isis_circuit *circuit, + const char *lsp_id); + /* Master of threads. */ extern struct thread_master *master; -- 2.39.5