Skip to content

Commit

Permalink
pathd: add no pcep command
Browse files Browse the repository at this point in the history
Add "no pcep" command in segment-routing/traffic-engineering context
to deconfigure the whole pcep configuration (pce-config, pce and pcc).

Signed-off-by: Farid Mihoub <[email protected]>
(cherry picked from commit 465130a)
  • Loading branch information
Farid Mihoub authored and mergify[bot] committed Oct 31, 2023
1 parent 4a1727a commit c522a0f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pathd/path_pcep_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,35 @@ DEFPY_NOSH(
return CMD_SUCCESS;
}

DEFPY(
pcep_cli_no_pcep,
pcep_cli_no_pcep_cmd,
"no pcep",
NO_STR
"PCEP configuration\n")
{
/* Delete PCCs */
path_pcep_cli_pcc_delete(vty);

for (int i = 0; i < MAX_PCE; i++) {
/* Delete PCEs */
if (pcep_g->pce_opts_cli[i] != NULL) {
XFREE(MTYPE_PCEP, pcep_g->pce_opts_cli[i]);
pcep_g->pce_opts_cli[i] = NULL;
pcep_g->num_pce_opts_cli--;
}

/* Delete PCE-CONFIGs */
if (pcep_g->config_group_opts[i] != NULL) {
XFREE(MTYPE_PCEP, pcep_g->config_group_opts[i]);
pcep_g->config_group_opts[i] = NULL;
pcep_g->num_config_group_opts--;
}
}

return CMD_SUCCESS;
}

DEFPY_NOSH(
pcep_cli_pcep_pce_config,
pcep_cli_pcep_pce_config_cmd,
Expand Down Expand Up @@ -2013,6 +2042,7 @@ void pcep_cli_init(void)
install_default(PCEP_NODE);

install_element(SR_TRAFFIC_ENG_NODE, &pcep_cli_pcep_cmd);
install_element(SR_TRAFFIC_ENG_NODE, &pcep_cli_no_pcep_cmd);

/* PCEP configuration group related configuration commands */
install_element(PCEP_NODE, &pcep_cli_pcep_pce_config_cmd);
Expand Down

0 comments on commit c522a0f

Please sign in to comment.