mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 20:13:53 +00:00
bgpd: convert neighbor peer config to transactional
Signed-off-by: Chirag Shah <chirag@nvidia.com>
This commit is contained in:
parent
04261decb9
commit
8611c7f3b6
@ -2837,12 +2837,29 @@ int bgp_neighbors_neighbor_capability_options_dynamic_capability_modify(
|
|||||||
int bgp_neighbors_neighbor_capability_options_strict_capability_modify(
|
int bgp_neighbors_neighbor_capability_options_strict_capability_modify(
|
||||||
struct nb_cb_modify_args *args)
|
struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
const char *peer_str;
|
||||||
|
struct peer *peer;
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
bgp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
peer_str = yang_dnode_get_string(args->dnode,
|
||||||
|
"../../remote-address");
|
||||||
|
peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg,
|
||||||
|
args->errmsg_len);
|
||||||
|
|
||||||
|
enable = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
peer_flag_modify_nb(bgp, peer_str, peer,
|
||||||
|
PEER_FLAG_STRICT_CAP_MATCH, enable,
|
||||||
|
args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2911,12 +2928,29 @@ int bgp_neighbors_neighbor_capability_options_capability_negotiate_modify(
|
|||||||
int bgp_neighbors_neighbor_capability_options_override_capability_modify(
|
int bgp_neighbors_neighbor_capability_options_override_capability_modify(
|
||||||
struct nb_cb_modify_args *args)
|
struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
const char *peer_str;
|
||||||
|
struct peer *peer;
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
bgp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
peer_str = yang_dnode_get_string(args->dnode,
|
||||||
|
"../../remote-address");
|
||||||
|
peer = bgp_neighbor_peer_lookup(bgp, peer_str, args->errmsg,
|
||||||
|
args->errmsg_len);
|
||||||
|
|
||||||
|
enable = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
peer_flag_modify_nb(bgp, peer_str, peer,
|
||||||
|
PEER_FLAG_OVERRIDE_CAPABILITY, enable,
|
||||||
|
args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4837,12 +4871,31 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_dynamic_capability_modi
|
|||||||
int bgp_neighbors_unnumbered_neighbor_capability_options_strict_capability_modify(
|
int bgp_neighbors_unnumbered_neighbor_capability_options_strict_capability_modify(
|
||||||
struct nb_cb_modify_args *args)
|
struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
const char *peer_str;
|
||||||
|
struct peer *peer;
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
bgp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
peer_str =
|
||||||
|
yang_dnode_get_string(args->dnode, "../../interface");
|
||||||
|
peer = bgp_unnumbered_neighbor_peer_lookup(
|
||||||
|
bgp, peer_str, args->errmsg, args->errmsg_len);
|
||||||
|
if (!peer)
|
||||||
|
return NB_ERR_INCONSISTENCY;
|
||||||
|
|
||||||
|
enable = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
peer_flag_modify_nb(bgp, peer_str, peer,
|
||||||
|
PEER_FLAG_STRICT_CAP_MATCH, enable,
|
||||||
|
args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4913,12 +4966,29 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_capability_negotiate_mo
|
|||||||
int bgp_neighbors_unnumbered_neighbor_capability_options_override_capability_modify(
|
int bgp_neighbors_unnumbered_neighbor_capability_options_override_capability_modify(
|
||||||
struct nb_cb_modify_args *args)
|
struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
const char *peer_str;
|
||||||
|
struct peer *peer;
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
bgp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
peer_str =
|
||||||
|
yang_dnode_get_string(args->dnode, "../../interface");
|
||||||
|
peer = bgp_unnumbered_neighbor_peer_lookup(
|
||||||
|
bgp, peer_str, args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
|
enable = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
peer_flag_modify_nb(bgp, peer_str, peer,
|
||||||
|
PEER_FLAG_OVERRIDE_CAPABILITY, enable,
|
||||||
|
args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6696,12 +6766,30 @@ int bgp_peer_groups_peer_group_capability_options_dynamic_capability_modify(
|
|||||||
int bgp_peer_groups_peer_group_capability_options_strict_capability_modify(
|
int bgp_peer_groups_peer_group_capability_options_strict_capability_modify(
|
||||||
struct nb_cb_modify_args *args)
|
struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
const char *peer_str;
|
||||||
|
struct peer *peer;
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
bgp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
peer_str = yang_dnode_get_string(args->dnode,
|
||||||
|
"../../peer-group-name");
|
||||||
|
peer = bgp_peer_group_peer_lookup(bgp, peer_str);
|
||||||
|
if (!peer)
|
||||||
|
return NB_ERR_INCONSISTENCY;
|
||||||
|
|
||||||
|
enable = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
peer_flag_modify_nb(bgp, peer_str, peer,
|
||||||
|
PEER_FLAG_STRICT_CAP_MATCH, enable,
|
||||||
|
args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6771,12 +6859,30 @@ int bgp_peer_groups_peer_group_capability_options_capability_negotiate_modify(
|
|||||||
int bgp_peer_groups_peer_group_capability_options_override_capability_modify(
|
int bgp_peer_groups_peer_group_capability_options_override_capability_modify(
|
||||||
struct nb_cb_modify_args *args)
|
struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
const char *peer_str;
|
||||||
|
struct peer *peer;
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
bgp = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
peer_str = yang_dnode_get_string(args->dnode,
|
||||||
|
"../../peer-group-name");
|
||||||
|
peer = bgp_peer_group_peer_lookup(bgp, peer_str);
|
||||||
|
if (!peer)
|
||||||
|
return NB_ERR_INCONSISTENCY;
|
||||||
|
|
||||||
|
enable = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
peer_flag_modify_nb(bgp, peer_str, peer,
|
||||||
|
PEER_FLAG_OVERRIDE_CAPABILITY, enable,
|
||||||
|
args->errmsg, args->errmsg_len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
106
bgpd/bgp_vty.c
106
bgpd/bgp_vty.c
@ -7199,56 +7199,94 @@ ALIAS_HIDDEN(no_neighbor_weight, no_neighbor_weight_hidden_cmd,
|
|||||||
|
|
||||||
|
|
||||||
/* Override capability negotiation. */
|
/* Override capability negotiation. */
|
||||||
DEFUN (neighbor_override_capability,
|
DEFUN_YANG (neighbor_override_capability,
|
||||||
neighbor_override_capability_cmd,
|
neighbor_override_capability_cmd,
|
||||||
"neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
|
"neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
|
||||||
NEIGHBOR_STR
|
NEIGHBOR_STR
|
||||||
NEIGHBOR_ADDR_STR2
|
NEIGHBOR_ADDR_STR2
|
||||||
"Override capability negotiation result\n")
|
"Override capability negotiation result\n")
|
||||||
{
|
{
|
||||||
int idx_peer = 1;
|
int idx_peer = 1;
|
||||||
return peer_flag_set_vty(vty, argv[idx_peer]->arg,
|
char base_xpath[XPATH_MAXLEN];
|
||||||
PEER_FLAG_OVERRIDE_CAPABILITY);
|
|
||||||
|
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||||
|
sizeof(base_xpath), NULL)
|
||||||
|
< 0)
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(
|
||||||
|
vty, "./capability-options/override-capability",
|
||||||
|
NB_OP_MODIFY, "true");
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, base_xpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_neighbor_override_capability,
|
DEFUN_YANG (no_neighbor_override_capability,
|
||||||
no_neighbor_override_capability_cmd,
|
no_neighbor_override_capability_cmd,
|
||||||
"no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
|
"no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
|
||||||
NO_STR
|
NO_STR
|
||||||
NEIGHBOR_STR
|
NEIGHBOR_STR
|
||||||
NEIGHBOR_ADDR_STR2
|
NEIGHBOR_ADDR_STR2
|
||||||
"Override capability negotiation result\n")
|
"Override capability negotiation result\n")
|
||||||
{
|
{
|
||||||
int idx_peer = 2;
|
int idx_peer = 2;
|
||||||
return peer_flag_unset_vty(vty, argv[idx_peer]->arg,
|
char base_xpath[XPATH_MAXLEN];
|
||||||
PEER_FLAG_OVERRIDE_CAPABILITY);
|
|
||||||
|
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||||
|
sizeof(base_xpath), NULL)
|
||||||
|
< 0)
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(
|
||||||
|
vty, "./capability-options/override-capability",
|
||||||
|
NB_OP_MODIFY, "false");
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, base_xpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (neighbor_strict_capability,
|
DEFUN_YANG (neighbor_strict_capability,
|
||||||
neighbor_strict_capability_cmd,
|
neighbor_strict_capability_cmd,
|
||||||
"neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
|
"neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
|
||||||
NEIGHBOR_STR
|
NEIGHBOR_STR
|
||||||
NEIGHBOR_ADDR_STR2
|
NEIGHBOR_ADDR_STR2
|
||||||
"Strict capability negotiation match\n")
|
"Strict capability negotiation match\n")
|
||||||
{
|
{
|
||||||
int idx_peer = 1;
|
int idx_peer = 1;
|
||||||
|
char base_xpath[XPATH_MAXLEN];
|
||||||
|
|
||||||
return peer_flag_set_vty(vty, argv[idx_peer]->arg,
|
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||||
PEER_FLAG_STRICT_CAP_MATCH);
|
sizeof(base_xpath), NULL)
|
||||||
|
< 0)
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(
|
||||||
|
vty, "./capability-options/strict-capability",
|
||||||
|
NB_OP_MODIFY, "true");
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, base_xpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_neighbor_strict_capability,
|
DEFUN_YANG (no_neighbor_strict_capability,
|
||||||
no_neighbor_strict_capability_cmd,
|
no_neighbor_strict_capability_cmd,
|
||||||
"no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
|
"no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
|
||||||
NO_STR
|
NO_STR
|
||||||
NEIGHBOR_STR
|
NEIGHBOR_STR
|
||||||
NEIGHBOR_ADDR_STR2
|
NEIGHBOR_ADDR_STR2
|
||||||
"Strict capability negotiation match\n")
|
"Strict capability negotiation match\n")
|
||||||
{
|
{
|
||||||
int idx_peer = 2;
|
int idx_peer = 2;
|
||||||
|
char base_xpath[XPATH_MAXLEN];
|
||||||
|
|
||||||
return peer_flag_unset_vty(vty, argv[idx_peer]->arg,
|
if (peer_and_group_lookup_nb(vty, argv[idx_peer]->arg, base_xpath,
|
||||||
PEER_FLAG_STRICT_CAP_MATCH);
|
sizeof(base_xpath), NULL)
|
||||||
|
< 0)
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(
|
||||||
|
vty, "./capability-options/strict-capability",
|
||||||
|
NB_OP_MODIFY, "false");
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, base_xpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN_YANG (neighbor_timers,
|
DEFUN_YANG (neighbor_timers,
|
||||||
|
Loading…
Reference in New Issue
Block a user