From: Farid Mihoub Date: Tue, 31 Oct 2023 10:35:29 +0000 (+0100) Subject: pathd: add no pcep command X-Git-Tag: docker/9.0.2~14^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F14706%2Fhead;p=mirror%2Ffrr.git pathd: add no pcep command 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 (cherry picked from commit 465130ac2a8ae48fbe5197676e54dfb681b327ad) --- diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 110a419d87..363610611c 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -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, @@ -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);