Skip to content

Commit

Permalink
zebra: fix default value for affinity-mode
Browse files Browse the repository at this point in the history
- initialize the necessary bit when creating if_link_params
- fix CLI description to mark extended as the default mode
- correctly set mode to extended when using the "no" form of the command
- handle the "show_defaults" parameter correctly in cli_show callback

Signed-off-by: Igor Ryzhov <[email protected]>
  • Loading branch information
idryzhov committed Jan 19, 2024
1 parent 733462a commit 01be34f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ struct if_link_params *if_link_params_enable(struct interface *ifp)
iflp->unrsv_bw[i] = iflp->default_bw;

/* Update Link parameters status */
iflp->lp_status = LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW;
iflp->lp_status = LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW | LP_EXTEND_ADM_GRP;

/* Set TE metric equal to standard metric only if it is set */
if (ifp->metric != 0) {
Expand Down
12 changes: 7 additions & 5 deletions zebra/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -4738,8 +4738,8 @@ DEFPY_YANG(link_params_affinity, link_params_affinity_cmd,
DEFPY_YANG(link_params_affinity_mode, link_params_affinity_mode_cmd,
"affinity-mode <standard|extended|both>$affmode",
"Interface affinity mode\n"
"Standard Admin-Group only RFC3630,5305,5329 (default)\n"
"Extended Admin-Group only RFC7308\n"
"Standard Admin-Group only RFC3630,5305,5329\n"
"Extended Admin-Group only RFC7308 (default)\n"
"Standard and extended Admin-Group format\n")
{
const char *xpath = "./frr-zebra:zebra/link-params/affinity-mode";
Expand All @@ -4753,13 +4753,13 @@ DEFPY_YANG(no_link_params_affinity_mode, no_link_params_affinity_mode_cmd,
"no affinity-mode [<standard|extended|both>]",
NO_STR
"Interface affinity mode\n"
"Standard Admin-Group only RFC3630,5305,5329 (default)\n"
"Extended Admin-Group only RFC7308\n"
"Standard Admin-Group only RFC3630,5305,5329\n"
"Extended Admin-Group only RFC7308 (default)\n"
"Standard and extended Admin-Group format\n")
{
const char *xpath = "./frr-zebra:zebra/link-params/affinity-mode";

nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, "standard");
nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, "extended");

return nb_cli_apply_changes(vty, NULL);
}
Expand Down Expand Up @@ -4788,6 +4788,8 @@ void cli_show_affinity_mode(struct vty *vty, const struct lyd_node *dnode,
vty_out(vty, " affinity-mode standard\n");
else if (affinity_mode == AFFINITY_MODE_BOTH)
vty_out(vty, " affinity-mode both\n");
else if (affinity_mode == AFFINITY_MODE_EXTENDED && show_defaults)
vty_out(vty, " affinity-mode extended\n");
}

void cli_show_affinity(struct vty *vty, const struct lyd_node *dnode,
Expand Down

0 comments on commit 01be34f

Please sign in to comment.