diff options
author | Sebastien Merle <sebastien@netdef.org> | 2020-10-16 16:55:51 +0200 |
---|---|---|
committer | Sebastien Merle <sebastien@netdef.org> | 2020-12-18 16:47:52 +0100 |
commit | efba0985fcddee80df257147f7e398b52dad089b (patch) | |
tree | c668019fceae6ee01caf43fd7fcacf3df58fccb4 /vtysh/vtysh.c | |
parent | pathd: New SR-TE policy management daemon (diff) | |
download | frr-efba0985fcddee80df257147f7e398b52dad089b.tar.xz frr-efba0985fcddee80df257147f7e398b52dad089b.zip |
pathd: Add optional support for PCEP to pathd
This new dynamic module makes pathd behave as a PCC for dynamic candidate path
using the external library pcpelib https://github.com/volta-networks/pceplib .
The candidate paths defined as dynamic will trigger computation requests to the
configured PCE, and the PCE response will be used to update the policy.
It supports multiple PCE. The one with smaller precedence will be elected
as the master PCE, and only if the connection repeatedly fails, the PCC will
switch to another PCE.
Example of configuration:
segment-routing
traffic-eng
pcep
pce-config CONF
source-address ip 10.10.10.10
sr-draft07
!
pce PCE1
config CONF
address ip 1.1.1.1
!
pce PCE2
config CONF
address ip 2.2.2.2
!
pcc
peer PCE1 precedence 10
peer PCE2 precedence 20
!
!
!
!
Co-authored-by: Brady Johnson <brady@voltanet.io>
Co-authored-by: Emanuele Di Pascale <emanuele@voltanet.io>
Co-authored-by: GalaxyGorilla <sascha@netdef.org>
Co-authored-by: Javier Garcia <javier.garcia@voltanet.io>
Co-authored-by: Renato Westphal <renato@opensourcerouting.org>
Co-authored-by: Sebastien Merle <sebastien@netdef.org>
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
Diffstat (limited to '')
-rw-r--r-- | vtysh/vtysh.c | 129 |
1 files changed, 119 insertions, 10 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 93a63cd96..22eff40cd 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -541,8 +541,12 @@ static int vtysh_execute_func(const char *line, int pager) vtysh_execute("exit"); } else if ((saved_node == SR_SEGMENT_LIST_NODE || saved_node == SR_POLICY_NODE - || saved_node == SR_CANDIDATE_DYN_NODE) - && (tried > 0)) { + || saved_node == SR_CANDIDATE_DYN_NODE + || saved_node == PCEP_NODE + || saved_node == PCEP_PCE_CONFIG_NODE + || saved_node == PCEP_PCE_NODE + || saved_node == PCEP_PCC_NODE) + && (tried > 0)) { vtysh_execute("exit"); } else if (tried) { vtysh_execute("end"); @@ -826,16 +830,24 @@ int vtysh_mark_file(const char *filename) && (tried == 1)) { vty_out(vty, "exit\n"); } else if (((prev_node == SEGMENT_ROUTING_NODE) - || (prev_node == SR_TRAFFIC_ENG_NODE) - || (prev_node == SR_SEGMENT_LIST_NODE) - || (prev_node == SR_POLICY_NODE) - || (prev_node == SR_CANDIDATE_DYN_NODE)) + || (prev_node == SR_TRAFFIC_ENG_NODE) + || (prev_node == SR_SEGMENT_LIST_NODE) + || (prev_node == SR_POLICY_NODE) + || (prev_node == SR_CANDIDATE_DYN_NODE) + || (prev_node == PCEP_NODE) + || (prev_node == PCEP_PCE_CONFIG_NODE) + || (prev_node == PCEP_PCE_NODE) + || (prev_node == PCEP_PCC_NODE)) && (tried > 0)) { ending = (vty->node != SEGMENT_ROUTING_NODE) - && (vty->node != SR_TRAFFIC_ENG_NODE) - && (vty->node != SR_SEGMENT_LIST_NODE) - && (vty->node != SR_POLICY_NODE) - && (vty->node != SR_CANDIDATE_DYN_NODE); + && (vty->node != SR_TRAFFIC_ENG_NODE) + && (vty->node != SR_SEGMENT_LIST_NODE) + && (vty->node != SR_POLICY_NODE) + && (vty->node != SR_CANDIDATE_DYN_NODE) + && (vty->node != PCEP_NODE) + && (vty->node != PCEP_PCE_CONFIG_NODE) + && (vty->node != PCEP_PCE_NODE) + && (vty->node != PCEP_PCC_NODE); if (ending) tried--; while (tried-- > 0) @@ -1284,6 +1296,34 @@ static struct cmd_node srte_candidate_dyn_node = { .prompt = "%s(config-sr-te-candidate)# ", }; +static struct cmd_node pcep_node = { + .name = "srte pcep", + .node = PCEP_NODE, + .parent_node = SR_TRAFFIC_ENG_NODE, + .prompt = "%s(config-sr-te-pcep)# " +}; + +static struct cmd_node pcep_pcc_node = { + .name = "srte pcep pcc", + .node = PCEP_PCC_NODE, + .parent_node = PCEP_NODE, + .prompt = "%s(config-sr-te-pcep-pcc)# ", +}; + +static struct cmd_node pcep_pce_node = { + .name = "srte pcep pce-peer", + .node = PCEP_PCE_NODE, + .parent_node = PCEP_NODE, + .prompt = "%s(config-sr-te-pcep-pce-peer)# ", +}; + +static struct cmd_node pcep_pce_config_node = { + .name = "srte pcep pce-config", + .node = PCEP_PCE_CONFIG_NODE, + .parent_node = PCEP_NODE, + .prompt = "%s(pcep-sr-te-pcep-pce-config)# ", +}; + static struct cmd_node vrf_node = { .name = "vrf", .node = VRF_NODE, @@ -2091,6 +2131,48 @@ DEFUNSH(VTYSH_PATHD, srte_policy_candidate_dyn_path, vty->node = SR_CANDIDATE_DYN_NODE; return CMD_SUCCESS; } + +#if defined(HAVE_PATHD_PCEP) + +DEFUNSH(VTYSH_PATHD, pcep, pcep_cmd, + "pcep", + "Configure SR pcep\n") +{ + vty->node = PCEP_NODE; + return CMD_SUCCESS; +} + +DEFUNSH(VTYSH_PATHD, pcep_cli_pcc, pcep_cli_pcc_cmd, + "[no] pcc", + NO_STR + "PCC configuration\n") +{ + vty->node = PCEP_PCC_NODE; + return CMD_SUCCESS; +} + +DEFUNSH(VTYSH_PATHD, pcep_cli_pce, pcep_cli_pce_cmd, + "[no] pce WORD", + NO_STR + "PCE configuration\n" + "Peer name\n") +{ + vty->node = PCEP_PCE_NODE; + return CMD_SUCCESS; +} + +DEFUNSH(VTYSH_PATHD, pcep_cli_pcep_pce_config, pcep_cli_pcep_pce_config_cmd, + "[no] pce-config WORD", + NO_STR + "PCEP peer Configuration Group\n" + "PCEP peer Configuration Group name\n") +{ + vty->node = PCEP_PCE_CONFIG_NODE; + return CMD_SUCCESS; +} + +#endif /* HAVE_PATHD_PCEP */ + #endif /* HAVE_PATHD */ DEFUNSH(VTYSH_RMAP, vtysh_route_map, vtysh_route_map_cmd, @@ -4304,6 +4386,33 @@ void vtysh_init_vty(void) install_element(SR_TRAFFIC_ENG_NODE, &srte_segment_list_cmd); install_element(SR_TRAFFIC_ENG_NODE, &srte_policy_cmd); install_element(SR_POLICY_NODE, &srte_policy_candidate_dyn_path_cmd); + +#if defined(HAVE_PATHD_PCEP) + install_node(&pcep_node); + install_node(&pcep_pcc_node); + install_node(&pcep_pce_node); + install_node(&pcep_pce_config_node); + + install_element(PCEP_NODE, &vtysh_exit_pathd_cmd); + install_element(PCEP_NODE, &vtysh_quit_pathd_cmd); + install_element(PCEP_PCC_NODE, &vtysh_exit_pathd_cmd); + install_element(PCEP_PCC_NODE, &vtysh_quit_pathd_cmd); + install_element(PCEP_PCE_NODE, &vtysh_exit_pathd_cmd); + install_element(PCEP_PCE_NODE, &vtysh_quit_pathd_cmd); + install_element(PCEP_PCE_CONFIG_NODE, &vtysh_exit_pathd_cmd); + install_element(PCEP_PCE_CONFIG_NODE, &vtysh_quit_pathd_cmd); + + install_element(PCEP_NODE, &vtysh_end_all_cmd); + install_element(PCEP_PCC_NODE, &vtysh_end_all_cmd); + install_element(PCEP_PCE_NODE, &vtysh_end_all_cmd); + install_element(PCEP_PCE_CONFIG_NODE, &vtysh_end_all_cmd); + + install_element(SR_TRAFFIC_ENG_NODE, &pcep_cmd); + install_element(PCEP_NODE, &pcep_cli_pcc_cmd); + install_element(PCEP_NODE, &pcep_cli_pcep_pce_config_cmd); + install_element(PCEP_NODE, &pcep_cli_pce_cmd); +#endif /* HAVE_PATHD_PCEP */ + #endif /* HAVE_PATHD */ /* keychain */ |