mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 14:17:20 +00:00
bgpd: register nb routing hook
On bgpd bootstrap register routing hook which ensures only single bgp named instance created per vrf routing hierarchy. Signed-off-by: Chirag Shah <chirag@nvidia.com>
This commit is contained in:
parent
ff8a8a7ac1
commit
374069da83
@ -501,6 +501,10 @@ int main(int argc, char **argv)
|
|||||||
/* Initializations. */
|
/* Initializations. */
|
||||||
bgp_vrf_init();
|
bgp_vrf_init();
|
||||||
|
|
||||||
|
hook_register(routing_conf_event,
|
||||||
|
routing_control_plane_protocols_name_validate);
|
||||||
|
|
||||||
|
|
||||||
/* BGP related initialization. */
|
/* BGP related initialization. */
|
||||||
bgp_init((unsigned short)instance);
|
bgp_init((unsigned short)instance);
|
||||||
|
|
||||||
|
@ -3407,6 +3407,13 @@ int routing_control_plane_protocols_control_plane_protocol_bgp_peer_groups_peer_
|
|||||||
int routing_control_plane_protocols_control_plane_protocol_bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_flowspec_soft_reconfiguration_modify(
|
int routing_control_plane_protocols_control_plane_protocol_bgp_peer_groups_peer_group_afi_safis_afi_safi_ipv6_flowspec_soft_reconfiguration_modify(
|
||||||
struct nb_cb_modify_args *args);
|
struct nb_cb_modify_args *args);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback registered with routing_nb lib to validate only
|
||||||
|
* one instance of bgp instance is allowed
|
||||||
|
*/
|
||||||
|
int routing_control_plane_protocols_name_validate(
|
||||||
|
struct nb_cb_create_args *args);
|
||||||
|
|
||||||
/* Optional 'cli_show' callbacks. */
|
/* Optional 'cli_show' callbacks. */
|
||||||
void cli_show_router_bgp(struct vty *vty, struct lyd_node *dnode,
|
void cli_show_router_bgp(struct vty *vty, struct lyd_node *dnode,
|
||||||
bool show_defaults);
|
bool show_defaults);
|
||||||
|
@ -44,6 +44,20 @@ FRR_CFG_DEFAULT_ULONG(BGP_KEEPALIVE,
|
|||||||
{ .val_ulong = 60 },
|
{ .val_ulong = 60 },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
int routing_control_plane_protocols_name_validate(
|
||||||
|
struct nb_cb_create_args *args)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
name = yang_dnode_get_string(args->dnode, "./name");
|
||||||
|
if (!strmatch(name, "bgp")) {
|
||||||
|
snprintf(args->errmsg, args->errmsg_len,
|
||||||
|
"per vrf only one bgp instance is supported.");
|
||||||
|
return NB_ERR_VALIDATION;
|
||||||
|
}
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath:
|
* XPath:
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/global
|
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/global
|
||||||
|
Loading…
Reference in New Issue
Block a user