summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yang/frr-zebra.yang1
-rw-r--r--zebra/interface.c48
-rw-r--r--zebra/zebra_nb.c7
-rw-r--r--zebra/zebra_nb_config.c2
4 files changed, 11 insertions, 47 deletions
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang
index d74e9e84d2..23b243889a 100644
--- a/yang/frr-zebra.yang
+++ b/yang/frr-zebra.yang
@@ -1993,6 +1993,7 @@ module frr-zebra {
type uint32 {
range "1..100000";
}
+ units "megabits/sec";
description
"Link bandwidth informational parameter, in megabits.";
}
diff --git a/zebra/interface.c b/zebra/interface.c
index 82f681c848..38e4ae2e00 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -3868,52 +3868,23 @@ int if_no_shutdown(struct interface *ifp)
return 0;
}
-DEFUN (bandwidth_if,
+DEFPY_YANG (bandwidth_if,
bandwidth_if_cmd,
- "bandwidth (1-100000)",
- "Set bandwidth informational parameter\n"
- "Bandwidth in megabits\n")
-{
- int idx_number = 1;
- VTY_DECLVAR_CONTEXT(interface, ifp);
- unsigned int bandwidth;
-
- bandwidth = strtol(argv[idx_number]->arg, NULL, 10);
-
- /* bandwidth range is <1-100000> */
- if (bandwidth < 1 || bandwidth > 100000) {
- vty_out(vty, "Bandwidth is invalid\n");
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- ifp->bandwidth = bandwidth;
-
- /* force protocols to recalculate routes due to cost change */
- if (if_is_operative(ifp))
- zebra_interface_up_update(ifp);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_bandwidth_if,
- no_bandwidth_if_cmd,
- "no bandwidth [(1-100000)]",
+ "[no] bandwidth ![(1-100000)]$bw",
NO_STR
"Set bandwidth informational parameter\n"
"Bandwidth in megabits\n")
{
- VTY_DECLVAR_CONTEXT(interface, ifp);
-
- ifp->bandwidth = 0;
-
- /* force protocols to recalculate routes due to cost change */
- if (if_is_operative(ifp))
- zebra_interface_up_update(ifp);
+ if (!no)
+ nb_cli_enqueue_change(vty, "./frr-zebra:zebra/bandwidth",
+ NB_OP_CREATE, bw_str);
+ else
+ nb_cli_enqueue_change(vty, "./frr-zebra:zebra/bandwidth",
+ NB_OP_DESTROY, NULL);
- return CMD_SUCCESS;
+ return nb_cli_apply_changes(vty, NULL);
}
-
struct cmd_node link_params_node = {
.name = "link-params",
.node = LINK_PARAMS_NODE,
@@ -5515,7 +5486,6 @@ void zebra_if_init(void)
install_element(INTERFACE_NODE, &linkdetect_cmd);
install_element(INTERFACE_NODE, &shutdown_if_cmd);
install_element(INTERFACE_NODE, &bandwidth_if_cmd);
- install_element(INTERFACE_NODE, &no_bandwidth_if_cmd);
install_element(INTERFACE_NODE, &ip_address_cmd);
install_element(INTERFACE_NODE, &no_ip_address_cmd);
install_element(INTERFACE_NODE, &ip_address_peer_cmd);
diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c
index 89bbd66bc0..bf5650ce61 100644
--- a/zebra/zebra_nb.c
+++ b/zebra/zebra_nb.c
@@ -345,13 +345,6 @@ const struct frr_yang_module_info frr_zebra_info = {
}
},
{
- .xpath = "/frr-interface:lib/interface/frr-zebra:zebra/bandwidth",
- .cbs = {
- .modify = lib_interface_zebra_bandwidth_modify,
- .destroy = lib_interface_zebra_bandwidth_destroy,
- }
- },
- {
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/link-params/legacy-admin-group",
.cbs = {
.modify = lib_interface_zebra_legacy_admin_group_modify,
diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c
index 247082f7be..8d27d321af 100644
--- a/zebra/zebra_nb_config.c
+++ b/zebra/zebra_nb_config.c
@@ -1140,7 +1140,7 @@ int lib_interface_zebra_bandwidth_modify(struct nb_cb_modify_args *args)
uint32_t bandwidth;
ifp = nb_running_get_entry(args->dnode, NULL, true);
- bandwidth = yang_dnode_get_uint32(args->dnode, "bandwidth");
+ bandwidth = yang_dnode_get_uint32(args->dnode, NULL);
ifp->bandwidth = bandwidth;