Skip to content

Commit

Permalink
Merge pull request FRRouting#6789 from volta-networks/feat_ldp_igp_sync
Browse files Browse the repository at this point in the history
ldpd: Add support for LDP-IGP Synchronization
  • Loading branch information
rwestphal authored Sep 11, 2020
2 parents a77bd0f + 1cbf96a commit beb9111
Show file tree
Hide file tree
Showing 170 changed files with 8,049 additions and 18 deletions.
17 changes: 12 additions & 5 deletions isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include "isisd/isis_errors.h"
#include "isisd/isis_tx_queue.h"
#include "isisd/isis_nb.h"
#include "isisd/isis_ldp_sync.h"

DEFINE_QOBJ_TYPE(isis_circuit)

Expand Down Expand Up @@ -1280,6 +1281,7 @@ struct isis_circuit *isis_circuit_create(struct isis_area *area,
isis_circuit_if_bind(circuit, ifp);
if (circuit->area->mta && circuit->area->mta->status)
isis_link_params_update(circuit, ifp);

return circuit;
}

Expand Down Expand Up @@ -1350,11 +1352,16 @@ ferr_r isis_circuit_metric_set(struct isis_circuit *circuit, int level,
return ferr_cfg_invalid("metric %d too large for narrow metric",
metric);

circuit->te_metric[level - 1] = metric;
circuit->metric[level - 1] = metric;

if (circuit->area)
lsp_regenerate_schedule(circuit->area, level, 0);
/* inform ldp-sync of metric change
* if ldp-sync is running need to save metric
* and restore new values after ldp-sync completion.
*/
if (isis_ldp_sync_if_metric_config(circuit, level, metric)) {
circuit->te_metric[level - 1] = metric;
circuit->metric[level - 1] = metric;
if (circuit->area)
lsp_regenerate_schedule(circuit->area, level, 0);
}
return ferr_ok();
}

Expand Down
1 change: 1 addition & 0 deletions isisd/isis_circuit.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ struct isis_circuit {
uint8_t flags;
bool disable_threeway_adj;
struct bfd_info *bfd_info;
struct ldp_sync_info *ldp_sync_info;
/*
* Counters as in 10589--11.2.5.9
*/
Expand Down
180 changes: 180 additions & 0 deletions isisd/isis_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,178 @@ void cli_show_isis_log_adjacency(struct vty *vty, struct lyd_node *dnode,
vty_out(vty, " log-adjacency-changes\n");
}

/*
* XPath: /frr-isisd:isis/instance/mpls/ldp-sync
*/
DEFPY(isis_mpls_ldp_sync, isis_mpls_ldp_sync_cmd, "mpls ldp-sync",
MPLS_STR MPLS_LDP_SYNC_STR)
{
nb_cli_enqueue_change(vty, "./mpls/ldp-sync", NB_OP_CREATE, NULL);

return nb_cli_apply_changes(vty, NULL);
}

DEFPY(no_isis_mpls_ldp_sync, no_isis_mpls_ldp_sync_cmd, "no mpls ldp-sync",
NO_STR MPLS_STR NO_MPLS_LDP_SYNC_STR)
{
nb_cli_enqueue_change(vty, "./mpls/ldp-sync", NB_OP_DESTROY, NULL);

return nb_cli_apply_changes(vty, NULL);
}

void cli_show_isis_mpls_ldp_sync(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " mpls ldp-sync\n");
}

DEFPY(isis_mpls_ldp_sync_holddown, isis_mpls_ldp_sync_holddown_cmd,
"mpls ldp-sync holddown (0-10000)",
MPLS_STR MPLS_LDP_SYNC_STR
"Time to wait for LDP-SYNC to occur before restoring interface metric\n"
"Time in seconds\n")
{
nb_cli_enqueue_change(vty, "./mpls/ldp-sync/holddown", NB_OP_MODIFY,
holddown_str);

return nb_cli_apply_changes(vty, NULL);
}

DEFPY(no_isis_mpls_ldp_sync_holddown, no_isis_mpls_ldp_sync_holddown_cmd,
"no mpls ldp-sync holddown [<(1-10000)>]",
NO_STR MPLS_STR MPLS_LDP_SYNC_STR NO_MPLS_LDP_SYNC_HOLDDOWN_STR)
{
nb_cli_enqueue_change(vty, "./mpls/ldp-sync/holddown", NB_OP_DESTROY,
NULL);

return nb_cli_apply_changes(vty, NULL);
}

void cli_show_isis_mpls_ldp_sync_holddown(struct vty *vty,
struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " mpls ldp-sync holddown %s\n",
yang_dnode_get_string(dnode, NULL));
}

/*
* XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
*/
DEFPY(isis_mpls_if_ldp_sync, isis_mpls_if_ldp_sync_cmd,
"[no] isis mpls ldp-sync",
NO_STR "IS-IS routing protocol\n" MPLS_STR MPLS_LDP_SYNC_STR)
{
const struct lyd_node *dnode;
struct interface *ifp;

dnode = yang_dnode_get(vty->candidate_config->dnode,
"%s/frr-isisd:isis", VTY_CURR_XPATH);
if (dnode == NULL) {
vty_out(vty, "ISIS is not enabled on this circuit\n");
return CMD_SUCCESS;
}

ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
if (if_is_loopback(ifp)) {
vty_out(vty, "ldp-sync does not run on loopback interface\n");
return CMD_SUCCESS;
}

if (ifp->vrf_id != VRF_DEFAULT) {
vty_out(vty, "ldp-sync only runs on DEFAULT VRF\n");
return CMD_SUCCESS;
}

nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/ldp-sync",
NB_OP_MODIFY, no ? "false" : "true");

return nb_cli_apply_changes(vty, NULL);
}


void cli_show_isis_mpls_if_ldp_sync(struct vty *vty, struct lyd_node *dnode,
bool show_defaults)
{
if (!yang_dnode_get_bool(dnode, NULL))
vty_out(vty, " no");

vty_out(vty, " isis mpls ldp-sync\n");
}

DEFPY(isis_mpls_if_ldp_sync_holddown, isis_mpls_if_ldp_sync_holddown_cmd,
"isis mpls ldp-sync holddown (0-10000)",
"IS-IS routing protocol\n" MPLS_STR MPLS_LDP_SYNC_STR
"Time to wait for LDP-SYNC to occur before restoring interface metric\n"
"Time in seconds\n")
{
const struct lyd_node *dnode;
struct interface *ifp;

dnode = yang_dnode_get(vty->candidate_config->dnode,
"%s/frr-isisd:isis", VTY_CURR_XPATH);
if (dnode == NULL) {
vty_out(vty, "ISIS is not enabled on this circuit\n");
return CMD_SUCCESS;
}

ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
if (if_is_loopback(ifp)) {
vty_out(vty, "ldp-sync does not run on loopback interface\n");
return CMD_SUCCESS;
}

if (ifp->vrf_id != VRF_DEFAULT) {
vty_out(vty, "ldp-sync only runs on DEFAULT VRF\n");
return CMD_SUCCESS;
}

nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/holddown",
NB_OP_MODIFY, holddown_str);

return nb_cli_apply_changes(vty, NULL);
}

DEFPY(no_isis_mpls_if_ldp_sync_holddown, no_isis_mpls_if_ldp_sync_holddown_cmd,
"no isis mpls ldp-sync holddown [<(1-10000)>]",
NO_STR "IS-IS routing protocol\n" MPLS_STR NO_MPLS_LDP_SYNC_STR
NO_MPLS_LDP_SYNC_HOLDDOWN_STR)
{
const struct lyd_node *dnode;
struct interface *ifp;

dnode = yang_dnode_get(vty->candidate_config->dnode,
"%s/frr-isisd:isis", VTY_CURR_XPATH);
if (dnode == NULL) {
vty_out(vty, "ISIS is not enabled on this circuit\n");
return CMD_SUCCESS;
}

ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false);
if (if_is_loopback(ifp)) {
vty_out(vty, "ldp-sync does not run on loopback interface\n");
return CMD_SUCCESS;
}

if (ifp->vrf_id != VRF_DEFAULT) {
vty_out(vty, "ldp-sync only runs on DEFAULT VRF\n");
return CMD_SUCCESS;
}

nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/holddown",
NB_OP_DESTROY, NULL);

return nb_cli_apply_changes(vty, NULL);
}

void cli_show_isis_mpls_if_ldp_sync_holddown(struct vty *vty,
struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " isis mpls ldp-sync holddown %s\n",
yang_dnode_get_string(dnode, NULL));
}

void isis_cli_init(void)
{
install_element(CONFIG_NODE, &router_isis_cmd);
Expand Down Expand Up @@ -2489,6 +2661,14 @@ void isis_cli_init(void)
install_element(INTERFACE_NODE, &no_isis_priority_cmd);

install_element(ISIS_NODE, &log_adj_changes_cmd);

install_element(ISIS_NODE, &isis_mpls_ldp_sync_cmd);
install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_cmd);
install_element(ISIS_NODE, &isis_mpls_ldp_sync_holddown_cmd);
install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_holddown_cmd);
install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_cmd);
install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_holddown_cmd);
install_element(INTERFACE_NODE, &no_isis_mpls_if_ldp_sync_holddown_cmd);
}

#endif /* ifndef FABRICD */
Loading

0 comments on commit beb9111

Please sign in to comment.