]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "bgpd: convert neighbor peer config to transactional"
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 13 May 2021 22:52:20 +0000 (01:52 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 19 May 2021 08:04:21 +0000 (11:04 +0300)
This reverts commit 8611c7f3b6f33cb5ef8687bc126354d06eadbfcf.

bgpd/bgp_nb_config.c
bgpd/bgp_vty.c

index 1bf3ddaabea886792b70902140ea8c25dde5b0ff..aa52c3ba3283cfcf45a0da085c3e2010344af278 100644 (file)
@@ -2856,29 +2856,12 @@ int bgp_neighbors_neighbor_capability_options_dynamic_capability_modify(
 int bgp_neighbors_neighbor_capability_options_strict_capability_modify(
        struct nb_cb_modify_args *args)
 {
-       struct bgp *bgp;
-       const char *peer_str;
-       struct peer *peer;
-       bool enable = false;
-
        switch (args->event) {
        case NB_EV_VALIDATE:
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
-               return NB_OK;
        case NB_EV_APPLY:
-               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);
-
+               /* TODO: implement me. */
                break;
        }
 
@@ -2947,29 +2930,12 @@ int bgp_neighbors_neighbor_capability_options_capability_negotiate_modify(
 int bgp_neighbors_neighbor_capability_options_override_capability_modify(
        struct nb_cb_modify_args *args)
 {
-       struct bgp *bgp;
-       const char *peer_str;
-       struct peer *peer;
-       bool enable = false;
-
        switch (args->event) {
        case NB_EV_VALIDATE:
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
-               return NB_OK;
        case NB_EV_APPLY:
-               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);
-
+               /* TODO: implement me. */
                break;
        }
 
@@ -4872,31 +4838,12 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_dynamic_capability_modi
 int bgp_neighbors_unnumbered_neighbor_capability_options_strict_capability_modify(
        struct nb_cb_modify_args *args)
 {
-       struct bgp *bgp;
-       const char *peer_str;
-       struct peer *peer;
-       bool enable = false;
-
        switch (args->event) {
        case NB_EV_VALIDATE:
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
-               return NB_OK;
        case NB_EV_APPLY:
-               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);
-
+               /* TODO: implement me. */
                break;
        }
 
@@ -4967,29 +4914,12 @@ int bgp_neighbors_unnumbered_neighbor_capability_options_capability_negotiate_mo
 int bgp_neighbors_unnumbered_neighbor_capability_options_override_capability_modify(
        struct nb_cb_modify_args *args)
 {
-       struct bgp *bgp;
-       const char *peer_str;
-       struct peer *peer;
-       bool enable = false;
-
        switch (args->event) {
        case NB_EV_VALIDATE:
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
-               return NB_OK;
        case NB_EV_APPLY:
-               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);
-
+               /* TODO: implement me. */
                break;
        }
 
@@ -6750,30 +6680,12 @@ int bgp_peer_groups_peer_group_capability_options_dynamic_capability_modify(
 int bgp_peer_groups_peer_group_capability_options_strict_capability_modify(
        struct nb_cb_modify_args *args)
 {
-       struct bgp *bgp;
-       const char *peer_str;
-       struct peer *peer;
-       bool enable = false;
-
        switch (args->event) {
        case NB_EV_VALIDATE:
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
-               return NB_OK;
        case NB_EV_APPLY:
-               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);
-
+               /* TODO: implement me. */
                break;
        }
 
@@ -6843,30 +6755,12 @@ int bgp_peer_groups_peer_group_capability_options_capability_negotiate_modify(
 int bgp_peer_groups_peer_group_capability_options_override_capability_modify(
        struct nb_cb_modify_args *args)
 {
-       struct bgp *bgp;
-       const char *peer_str;
-       struct peer *peer;
-       bool enable = false;
-
        switch (args->event) {
        case NB_EV_VALIDATE:
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
-               return NB_OK;
        case NB_EV_APPLY:
-               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);
-
+               /* TODO: implement me. */
                break;
        }
 
index 70f9b4697d3266428dbe0620455ea3bd2ab5154f..447e558fa39bd0de622affb44f2539cdf60bc5bc 100644 (file)
@@ -7424,94 +7424,56 @@ ALIAS_HIDDEN(no_neighbor_weight, no_neighbor_weight_hidden_cmd,
 
 
 /* Override capability negotiation. */
-DEFUN_YANG (neighbor_override_capability,
-           neighbor_override_capability_cmd,
-           "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
-           NEIGHBOR_STR
-           NEIGHBOR_ADDR_STR2
-           "Override capability negotiation result\n")
+DEFUN (neighbor_override_capability,
+       neighbor_override_capability_cmd,
+       "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Override capability negotiation result\n")
 {
        int idx_peer = 1;
-       char base_xpath[XPATH_MAXLEN];
-
-       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);
+       return peer_flag_set_vty(vty, argv[idx_peer]->arg,
+                                PEER_FLAG_OVERRIDE_CAPABILITY);
 }
 
-DEFUN_YANG (no_neighbor_override_capability,
-           no_neighbor_override_capability_cmd,
-           "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
-           NO_STR
-           NEIGHBOR_STR
-           NEIGHBOR_ADDR_STR2
-           "Override capability negotiation result\n")
+DEFUN (no_neighbor_override_capability,
+       no_neighbor_override_capability_cmd,
+       "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Override capability negotiation result\n")
 {
        int idx_peer = 2;
-       char base_xpath[XPATH_MAXLEN];
-
-       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);
+       return peer_flag_unset_vty(vty, argv[idx_peer]->arg,
+                                  PEER_FLAG_OVERRIDE_CAPABILITY);
 }
 
-DEFUN_YANG (neighbor_strict_capability,
-           neighbor_strict_capability_cmd,
-           "neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
-           NEIGHBOR_STR
-           NEIGHBOR_ADDR_STR2
-           "Strict capability negotiation match\n")
+DEFUN (neighbor_strict_capability,
+       neighbor_strict_capability_cmd,
+       "neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Strict capability negotiation match\n")
 {
        int idx_peer = 1;
-       char base_xpath[XPATH_MAXLEN];
 
-       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/strict-capability",
-               NB_OP_MODIFY, "true");
-
-       return nb_cli_apply_changes(vty, base_xpath);
+       return peer_flag_set_vty(vty, argv[idx_peer]->arg,
+                                PEER_FLAG_STRICT_CAP_MATCH);
 }
 
-DEFUN_YANG (no_neighbor_strict_capability,
-           no_neighbor_strict_capability_cmd,
-           "no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
-           NO_STR
-           NEIGHBOR_STR
-           NEIGHBOR_ADDR_STR2
-           "Strict capability negotiation match\n")
+DEFUN (no_neighbor_strict_capability,
+       no_neighbor_strict_capability_cmd,
+       "no neighbor <A.B.C.D|X:X::X:X|WORD> strict-capability-match",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Strict capability negotiation match\n")
 {
        int idx_peer = 2;
-       char base_xpath[XPATH_MAXLEN];
-
-       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/strict-capability",
-               NB_OP_MODIFY, "false");
 
-       return nb_cli_apply_changes(vty, base_xpath);
+       return peer_flag_unset_vty(vty, argv[idx_peer]->arg,
+                                  PEER_FLAG_STRICT_CAP_MATCH);
 }
 
 DEFUN_YANG (neighbor_timers,