mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:09:17 +00:00
sharpd: send new OPAQUE messages
Add a simple cli to exercise the new OPAQUE messages. Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
79b3664a67
commit
2ac6c90d18
@ -547,6 +547,20 @@ DEFPY (logpump,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (send_opaque,
|
||||
send_opaque_cmd,
|
||||
"sharp send opaque type (1-255) (1-1000)$count",
|
||||
"Sharp Routing Protocol\n"
|
||||
"Send messages for testing\n"
|
||||
"Send opaque messages\n"
|
||||
"Type code to send\n"
|
||||
"Type code to send\n"
|
||||
"Number of messages to send\n")
|
||||
{
|
||||
sharp_opaque_send(type, count);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void sharp_vty_init(void)
|
||||
{
|
||||
install_element(ENABLE_NODE, &install_routes_data_dump_cmd);
|
||||
@ -559,6 +573,7 @@ void sharp_vty_init(void)
|
||||
install_element(ENABLE_NODE, &sharp_lsp_prefix_v4_cmd);
|
||||
install_element(ENABLE_NODE, &sharp_remove_lsp_prefix_v4_cmd);
|
||||
install_element(ENABLE_NODE, &logpump_cmd);
|
||||
install_element(ENABLE_NODE, &send_opaque_cmd);
|
||||
|
||||
install_element(VIEW_NODE, &show_debugging_sharpd_cmd);
|
||||
|
||||
|
@ -480,6 +480,35 @@ static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send OPAQUE messages, using subtype 'type'.
|
||||
*/
|
||||
void sharp_opaque_send(uint32_t type, uint32_t count)
|
||||
{
|
||||
uint8_t buf[100];
|
||||
int ret;
|
||||
uint32_t i;
|
||||
|
||||
/* Prepare a small payload */
|
||||
for (i = 0; i < sizeof(buf); i++) {
|
||||
if (type < 255)
|
||||
buf[i] = type;
|
||||
else
|
||||
buf[i] = 255;
|
||||
}
|
||||
|
||||
/* Send some messages */
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = zclient_send_opaque(zclient, type, buf, sizeof(buf));
|
||||
if (ret < 0) {
|
||||
zlog_debug("%s: send_opaque() failed => %d",
|
||||
__func__, ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern struct zebra_privs_t sharp_privs;
|
||||
|
||||
void sharp_zebra_init(void)
|
||||
|
@ -44,5 +44,8 @@ int sharp_install_lsps_helper(bool install_p, const struct prefix *p,
|
||||
uint8_t type, int instance, uint32_t in_label,
|
||||
const struct nexthop_group *nhg,
|
||||
const struct nexthop_group *backup_nhg);
|
||||
/* Send OPAQUE messages, using subtype 'type'. */
|
||||
void sharp_opaque_send(uint32_t type, uint32_t count);
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user