diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-06-12 18:05:19 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-06-22 10:10:56 -0300 |
| commit | 8a676ce6b13eeec581856471d543d92aae2392f6 (patch) | |
| tree | f41058a1a34c15d27cf374b4805db153302cdad6 /bfdd/bfdd_cli.c | |
| parent | 020a3906495ee68b8d070efa2f2d79e26363c67e (diff) | |
bfdd: use microseconds timers in YANG
Lets allow specification to accept microseconds, but limit the timers
configuration in FRR to milliseconds (minimum is 10 ms and maximum is 60
seconds).
This matches the RFC 5880 and the IETF BFD YANG draft model.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'bfdd/bfdd_cli.c')
| -rw-r--r-- | bfdd/bfdd_cli.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c index 64500cef7d..29b77a409a 100644 --- a/bfdd/bfdd_cli.c +++ b/bfdd/bfdd_cli.c @@ -269,20 +269,27 @@ DEFPY( "Configure peer receive interval\n" "Configure peer receive interval value in milliseconds\n") { + char value[32]; + + snprintf(value, sizeof(value), "%ld", interval * 1000); nb_cli_enqueue_change(vty, "./required-receive-interval", NB_OP_MODIFY, - interval_str); + value); + return nb_cli_apply_changes(vty, NULL); } void bfd_cli_show_rx(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { + uint32_t value; + if (show_defaults) vty_out(vty, " receive-interval %d\n", BFD_DEFREQUIREDMINRX); - else - vty_out(vty, " receive-interval %s\n", - yang_dnode_get_string(dnode, NULL)); + else { + value = yang_dnode_get_uint32(dnode, NULL); + vty_out(vty, " receive-interval %" PRIu32 "\n", value / 1000); + } } DEFPY( @@ -291,20 +298,27 @@ DEFPY( "Configure peer transmit interval\n" "Configure peer transmit interval value in milliseconds\n") { + char value[32]; + + snprintf(value, sizeof(value), "%ld", interval * 1000); nb_cli_enqueue_change(vty, "./desired-transmission-interval", - NB_OP_MODIFY, interval_str); + NB_OP_MODIFY, value); + return nb_cli_apply_changes(vty, NULL); } void bfd_cli_show_tx(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { + uint32_t value; + if (show_defaults) vty_out(vty, " transmit-interval %d\n", BFD_DEFDESIREDMINTX); - else - vty_out(vty, " transmit-interval %s\n", - yang_dnode_get_string(dnode, NULL)); + else { + value = yang_dnode_get_uint32(dnode, NULL); + vty_out(vty, " transmit-interval %" PRIu32 "\n", value / 1000); + } } DEFPY( @@ -334,20 +348,27 @@ DEFPY( "Configure peer echo interval\n" "Configure peer echo interval value in milliseconds\n") { + char value[32]; + + snprintf(value, sizeof(value), "%ld", interval * 1000); nb_cli_enqueue_change(vty, "./desired-echo-transmission-interval", - NB_OP_MODIFY, interval_str); + NB_OP_MODIFY, value); + return nb_cli_apply_changes(vty, NULL); } void bfd_cli_show_echo_interval(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { + uint32_t value; + if (show_defaults) vty_out(vty, " echo-interval %d\n", BFD_DEF_REQ_MIN_ECHO); - else - vty_out(vty, " echo-interval %s\n", - yang_dnode_get_string(dnode, NULL)); + else { + value = yang_dnode_get_uint32(dnode, NULL); + vty_out(vty, " echo-interval %" PRIu32 "\n", value / 1000); + } } void |
