diff options
author | Emanuele Di Pascale <emanuele@voltanet.io> | 2018-11-14 15:03:24 +0100 |
---|---|---|
committer | Emanuele Di Pascale <emanuele@voltanet.io> | 2018-12-18 15:24:46 +0100 |
commit | 56e22fb62cade6099d4b0cc47ba2d2d3e18d6565 (patch) | |
tree | e067b1b287df3a688526c761a75a0993950c80e6 /isisd | |
parent | isisd: implement the 'database-overload' notification (diff) | |
download | frr-56e22fb62cade6099d4b0cc47ba2d2d3e18d6565.tar.xz frr-56e22fb62cade6099d4b0cc47ba2d2d3e18d6565.zip |
isisd: implement the 'lsp-too-large' notification
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_northbound.c | 44 | ||||
-rw-r--r-- | isisd/isis_pdu.c | 5 | ||||
-rw-r--r-- | isisd/isisd.h | 2 |
3 files changed, 51 insertions, 0 deletions
diff --git a/isisd/isis_northbound.c b/isisd/isis_northbound.c index 657cc0027..de380876a 100644 --- a/isisd/isis_northbound.c +++ b/isisd/isis_northbound.c @@ -2466,6 +2466,25 @@ static void notif_prep_instance_hdr(const char *xpath, listnode_add(args, data); } +static void notif_prepr_iface_hdr(const char *xpath, + const struct isis_circuit *circuit, + struct list *args) +{ + char xpath_arg[XPATH_MAXLEN]; + struct yang_data *data; + + snprintf(xpath_arg, sizeof(xpath_arg), "%s/interface-name", xpath); + data = yang_data_new_string(xpath_arg, circuit->interface->name); + listnode_add(args, data); + snprintf(xpath_arg, sizeof(xpath_arg), "%s/interface-level", xpath); + data = yang_data_new_enum(xpath_arg, circuit->is_type); + listnode_add(args, data); + snprintf(xpath_arg, sizeof(xpath_arg), "%s/extended-circuit-id", xpath); + /* we do not seem to have the extended version of the circuit_id */ + data = yang_data_new_uint32(xpath_arg, (uint32_t)circuit->circuit_id); + listnode_add(args, data); +} + /* * XPath: * /frr-isisd:database-overload @@ -2485,6 +2504,31 @@ void isis_notif_db_overload(const struct isis_area *area, bool overload) nb_notification_send(xpath, arguments); } +/* + * XPath: + * /frr-isisd:lsp-too-large + */ +void isis_notif_lsp_too_large(const struct isis_circuit *circuit, + uint32_t pdu_size, const char *lsp_id) +{ + const char *xpath = "/frr-isisd:lsp-too-large"; + 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/pdu-size", xpath); + data = yang_data_new_uint32(xpath_arg, pdu_size); + listnode_add(arguments, data); + 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 6303536c1..2347a1547 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -2238,6 +2238,11 @@ void send_lsp(struct isis_circuit *circuit, struct isis_lsp *lsp, lsp->hdr.checksum, lsp->hdr.rem_lifetime, circuit->interface->name, stream_get_endp(lsp->pdu), stream_get_size(circuit->snd_stream)); +#ifndef FABRICD + /* send a northbound notification */ + isis_notif_lsp_too_large(circuit, stream_get_endp(lsp->pdu), + rawlspid_print(lsp->hdr.lsp_id)); +#endif /* ifndef FABRICD */ if (isis->debugs & DEBUG_PACKET_DUMP) zlog_dump_data(STREAM_DATA(lsp->pdu), stream_get_endp(lsp->pdu)); diff --git a/isisd/isisd.h b/isisd/isisd.h index 73f91bde0..c5f3f3734 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -223,6 +223,8 @@ extern void isis_northbound_init(void); /* YANG northbound notifications */ extern void isis_notif_db_overload(const struct isis_area *area, bool overload); +extern void isis_notif_lsp_too_large(const struct isis_circuit *circuit, + uint32_t pdu_size, const char *lsp_id); /* Master of threads. */ extern struct thread_master *master; |