mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-25 20:08:40 +00:00
isisd: Add nb command to configure an SRv6 locator
Add a northbound command to configure an SRv6 locator for a specific IS-IS area. After configuring a locator, `isis_zebra_srv6_manager_get_locator_chunk` is called to ask zebra to allocate a chunk from the configured locator. The allocated chunk will be owned by IS-IS. IS-IS can allocate SIDs from its chunk. Currently, we support only one locator per-area. Therefore, before configuring a locator we unset the previously configured locator, if there was any. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
This commit is contained in:
parent
6b881e41ae
commit
95096e9585
@ -867,6 +867,12 @@ const struct frr_yang_module_info frr_isisd_info = {
|
||||
.cli_show = cli_show_isis_srv6_enabled,
|
||||
},
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-isisd:isis/instance/segment-routing-srv6/locator",
|
||||
.cbs = {
|
||||
.modify = isis_instance_segment_routing_srv6_locator_modify,
|
||||
},
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-isisd:isis/instance/mpls/ldp-sync",
|
||||
.cbs = {
|
||||
|
@ -326,6 +326,8 @@ int isis_instance_segment_routing_srv6_enabled_modify(
|
||||
struct nb_cb_modify_args *args);
|
||||
void cli_show_isis_srv6_enabled(struct vty *vty, const struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
int isis_instance_segment_routing_srv6_locator_modify(
|
||||
struct nb_cb_modify_args *args);
|
||||
int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args *args);
|
||||
int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args *args);
|
||||
int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args *args);
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "isisd/isis_adjacency.h"
|
||||
#include "isisd/isis_spf.h"
|
||||
#include "isisd/isis_spf_private.h"
|
||||
#include "isisd/isis_srv6.h"
|
||||
#include "isisd/isis_te.h"
|
||||
#include "isisd/isis_mt.h"
|
||||
#include "isisd/isis_redist.h"
|
||||
@ -3477,6 +3478,55 @@ int isis_instance_segment_routing_srv6_enabled_modify(
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-isisd:isis/instance/segment-routing-srv6/locator
|
||||
*/
|
||||
int isis_instance_segment_routing_srv6_locator_modify(
|
||||
struct nb_cb_modify_args *args)
|
||||
{
|
||||
struct isis_area *area;
|
||||
const char *loc_name;
|
||||
|
||||
if (args->event != NB_EV_APPLY)
|
||||
return NB_OK;
|
||||
|
||||
area = nb_running_get_entry(lyd_parent(lyd_parent(args->dnode)), NULL,
|
||||
true);
|
||||
|
||||
loc_name = yang_dnode_get_string(args->dnode, NULL);
|
||||
|
||||
if (strncmp(loc_name, area->srv6db.config.srv6_locator_name,
|
||||
sizeof(area->srv6db.config.srv6_locator_name)) == 0) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"SRv6 locator %s is already configured", loc_name);
|
||||
return NB_ERR_NO_CHANGES;
|
||||
}
|
||||
|
||||
/* Remove previously configured locator */
|
||||
if (strncmp(area->srv6db.config.srv6_locator_name, "",
|
||||
sizeof(area->srv6db.config.srv6_locator_name)) != 0) {
|
||||
sr_debug("Unsetting previously configured SRv6 locator");
|
||||
if (!isis_srv6_locator_unset(area)) {
|
||||
zlog_warn("Failed to unset SRv6 locator");
|
||||
return NB_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
strlcpy(area->srv6db.config.srv6_locator_name, loc_name,
|
||||
sizeof(area->srv6db.config.srv6_locator_name));
|
||||
|
||||
sr_debug("Configured SRv6 locator %s for IS-IS area %s", loc_name,
|
||||
area->area_tag);
|
||||
|
||||
sr_debug("Trying to get a chunk from locator %s for IS-IS area %s",
|
||||
loc_name, area->area_tag);
|
||||
|
||||
if (isis_zebra_srv6_manager_get_locator_chunk(loc_name) < 0)
|
||||
return NB_ERR;
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-isisd:isis/instance/mpls/ldp-sync
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user