From e9efe992c9af83c1478fbf083392966522f9cfef Mon Sep 17 00:00:00 2001 From: Farid Mihoub Date: Mon, 30 Oct 2023 15:11:47 +0100 Subject: [PATCH 1/2] pathd: add no msd command in the pcc context Add the "no msd" command to deconfigure pcc/msd node. Signed-off-by: Farid Mihoub (cherry picked from commit 444b08d16afa192c4a9d7209f1328ac95f7b289b) --- pathd/path_pcep_cli.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 9880081f35..2da321c02c 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -1018,10 +1018,14 @@ static int path_pcep_cli_pcc_delete(struct vty *vty) } static int path_pcep_cli_pcc_pcc_msd(struct vty *vty, const char *msd_str, - long msd) + long msd, bool reset) { - pcc_msd_configured_g = true; - PCEP_VTYSH_INT_ARG_CHECK(msd_str, msd, pcc_msd_g, 0, 33); + if (reset) + pcc_msd_configured_g = false; + else { + pcc_msd_configured_g = true; + PCEP_VTYSH_INT_ARG_CHECK(msd_str, msd, pcc_msd_g, 0, 33); + } return CMD_SUCCESS; } @@ -2007,11 +2011,12 @@ DEFPY(pcep_cli_no_pcc, DEFPY(pcep_cli_pcc_pcc_msd, pcep_cli_pcc_pcc_msd_cmd, - "msd (1-32)", + "[no] msd (1-32)", + NO_STR "PCC maximum SID depth \n" "PCC maximum SID depth value\n") { - return path_pcep_cli_pcc_pcc_msd(vty, msd_str, msd); + return path_pcep_cli_pcc_pcc_msd(vty, msd_str, msd, no); } DEFPY(pcep_cli_pcc_pcc_peer, From 7a29cccb214ec327acfc4c17147e540059d69502 Mon Sep 17 00:00:00 2001 From: Farid Mihoub Date: Tue, 31 Oct 2023 11:35:29 +0100 Subject: [PATCH 2/2] 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) --- pathd/path_pcep_cli.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pathd/path_pcep_cli.c b/pathd/path_pcep_cli.c index 2da321c02c..c46649b0db 100644 --- a/pathd/path_pcep_cli.c +++ b/pathd/path_pcep_cli.c @@ -1822,6 +1822,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, @@ -2092,6 +2121,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);