]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd, yang: fix replace-as yang leaf 8666/head
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 13 May 2021 11:32:52 +0000 (14:32 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 14 May 2021 14:00:11 +0000 (17:00 +0300)
The leaf is called "no-replace-as" in the model but is used reversed in
all the code. Let's rename it to comply with the actual behavior.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
bgpd/bgp_nb.c
bgpd/bgp_nb.h
bgpd/bgp_nb_config.c
bgpd/bgp_vty.c
yang/frr-bgp-common-structure.yang

index 71824cd6d3e5014a6aff7a336ab71f75d43ee607..a4249990ae1891fac64fc17ee8f8b61b92abcf95 100644 (file)
@@ -635,9 +635,9 @@ const struct frr_yang_module_info frr_bgp_info = {
                        }
                },
                {
-                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/no-replace-as",
+                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/replace-as",
                        .cbs = {
-                               .modify = bgp_neighbors_neighbor_local_as_no_replace_as_modify,
+                               .modify = bgp_neighbors_neighbor_local_as_replace_as_modify,
                        }
                },
                {
@@ -925,9 +925,9 @@ const struct frr_yang_module_info frr_bgp_info = {
                        }
                },
                {
-                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/no-replace-as",
+                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/replace-as",
                        .cbs = {
-                               .modify = bgp_neighbors_unnumbered_neighbor_local_as_no_replace_as_modify,
+                               .modify = bgp_neighbors_unnumbered_neighbor_local_as_replace_as_modify,
                        }
                },
                {
@@ -1216,9 +1216,9 @@ const struct frr_yang_module_info frr_bgp_info = {
                        }
                },
                {
-                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/no-replace-as",
+                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/replace-as",
                        .cbs = {
-                               .modify = bgp_peer_groups_peer_group_local_as_no_replace_as_modify,
+                               .modify = bgp_peer_groups_peer_group_local_as_replace_as_modify,
                        }
                },
                {
index f8bb31aad6ec5f4793714bc3385322b6eb97dad9..ec4a4b6ab7635f2e751fae2f8d9fe00030533542 100644 (file)
@@ -233,7 +233,7 @@ int bgp_neighbors_neighbor_local_as_local_as_destroy(
        struct nb_cb_destroy_args *args);
 int bgp_neighbors_neighbor_local_as_no_prepend_modify(
        struct nb_cb_modify_args *args);
-int bgp_neighbors_neighbor_local_as_no_replace_as_modify(
+int bgp_neighbors_neighbor_local_as_replace_as_modify(
        struct nb_cb_modify_args *args);
 int bgp_neighbors_neighbor_bfd_options_enable_modify(
        struct nb_cb_modify_args *args);
@@ -365,7 +365,7 @@ int bgp_neighbors_unnumbered_neighbor_local_as_local_as_destroy(
        struct nb_cb_destroy_args *args);
 int bgp_neighbors_unnumbered_neighbor_local_as_no_prepend_modify(
        struct nb_cb_modify_args *args);
-int bgp_neighbors_unnumbered_neighbor_local_as_no_replace_as_modify(
+int bgp_neighbors_unnumbered_neighbor_local_as_replace_as_modify(
        struct nb_cb_modify_args *args);
 int bgp_neighbors_unnumbered_neighbor_bfd_options_enable_modify(
        struct nb_cb_modify_args *args);
@@ -497,7 +497,7 @@ int bgp_peer_groups_peer_group_local_as_local_as_destroy(
        struct nb_cb_destroy_args *args);
 int bgp_peer_groups_peer_group_local_as_no_prepend_modify(
        struct nb_cb_modify_args *args);
-int bgp_peer_groups_peer_group_local_as_no_replace_as_modify(
+int bgp_peer_groups_peer_group_local_as_replace_as_modify(
        struct nb_cb_modify_args *args);
 int bgp_peer_groups_peer_group_bfd_options_enable_modify(
        struct nb_cb_modify_args *args);
index a430124b51a292342bb999a6c296d979bf2bc0f7..3b7d95c0f3d4a9af982148543787ffbc1de41565 100644 (file)
@@ -3472,9 +3472,8 @@ void bgp_neighbors_neighbor_local_as_apply_finish(
                as = yang_dnode_get_uint32(args->dnode, "./local-as");
        if (yang_dnode_exists(args->dnode, "./no-prepend"))
                no_prepend = yang_dnode_get_bool(args->dnode, "./no-prepend");
-       if (yang_dnode_exists(args->dnode, "./no-replace-as"))
-               replace_as =
-                       yang_dnode_get_bool(args->dnode, "./no-replace-as");
+       if (yang_dnode_exists(args->dnode, "./replace-as"))
+               replace_as = yang_dnode_get_bool(args->dnode, "./replace-as");
 
        if (!as && !no_prepend && !replace_as)
                ret = peer_local_as_unset(peer);
@@ -3557,9 +3556,9 @@ int bgp_neighbors_neighbor_local_as_no_prepend_modify(
 
 /*
  * XPath:
- * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/no-replace-as
+ * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/neighbor/local-as/replace-as
  */
-int bgp_neighbors_neighbor_local_as_no_replace_as_modify(
+int bgp_neighbors_neighbor_local_as_replace_as_modify(
        struct nb_cb_modify_args *args)
 {
        switch (args->event) {
@@ -5491,9 +5490,8 @@ void bgp_neighbors_unnumbered_neighbor_local_as_apply_finish(
                as = yang_dnode_get_uint32(args->dnode, "./local-as");
        if (yang_dnode_exists(args->dnode, "./no-prepend"))
                no_prepend = yang_dnode_get_bool(args->dnode, "./no-prepend");
-       if (yang_dnode_exists(args->dnode, "./no-replace-as"))
-               replace_as =
-                       yang_dnode_get_bool(args->dnode, "./no-replace-as");
+       if (yang_dnode_exists(args->dnode, "./replace-as"))
+               replace_as = yang_dnode_get_bool(args->dnode, "./replace-as");
 
        if (!as && !no_prepend && !replace_as)
                ret = peer_local_as_unset(peer);
@@ -5558,9 +5556,9 @@ int bgp_neighbors_unnumbered_neighbor_local_as_no_prepend_modify(
 
 /*
  * XPath:
- * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/no-replace-as
+ * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/neighbors/unnumbered-neighbor/local-as/replace-as
  */
-int bgp_neighbors_unnumbered_neighbor_local_as_no_replace_as_modify(
+int bgp_neighbors_unnumbered_neighbor_local_as_replace_as_modify(
        struct nb_cb_modify_args *args)
 {
        switch (args->event) {
@@ -7378,9 +7376,8 @@ void bgp_peer_groups_peer_group_local_as_apply_finish(
                as = yang_dnode_get_uint32(args->dnode, "./local-as");
        if (yang_dnode_exists(args->dnode, "./no-prepend"))
                no_prepend = yang_dnode_get_bool(args->dnode, "./no-prepend");
-       if (yang_dnode_exists(args->dnode, "./no-replace-as"))
-               replace_as =
-                       yang_dnode_get_bool(args->dnode, "./no-replace-as");
+       if (yang_dnode_exists(args->dnode, "./replace-as"))
+               replace_as = yang_dnode_get_bool(args->dnode, "./replace-as");
 
        if (!as && !no_prepend && !replace_as)
                ret = peer_local_as_unset(peer);
@@ -7460,9 +7457,9 @@ int bgp_peer_groups_peer_group_local_as_no_prepend_modify(
 
 /*
  * XPath:
- * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/no-replace-as
+ * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/peer-groups/peer-group/local-as/replace-as
  */
-int bgp_peer_groups_peer_group_local_as_no_replace_as_modify(
+int bgp_peer_groups_peer_group_local_as_replace_as_modify(
        struct nb_cb_modify_args *args)
 {
        switch (args->event) {
index 9be614ad62c0eb874fcc48c182fb8f4958122765..3e37e238fb595ba8785a9e77281d6c5ae9cb893a 100644 (file)
@@ -4829,7 +4829,7 @@ DEFUN_YANG(
                              argv[idx_number]->arg);
        nb_cli_enqueue_change(vty, "./local-as/no-prepend", NB_OP_MODIFY,
                              "true");
-       nb_cli_enqueue_change(vty, "./local-as/no-replace-as", NB_OP_MODIFY,
+       nb_cli_enqueue_change(vty, "./local-as/replace-as", NB_OP_MODIFY,
                              "true");
 
        return nb_cli_apply_changes(vty, base_xpath);
@@ -4855,7 +4855,7 @@ DEFUN_YANG(no_neighbor_local_as,
        nb_cli_enqueue_change(vty, "./local-as/local-as", NB_OP_DESTROY, NULL);
        nb_cli_enqueue_change(vty, "./local-as/no-prepend", NB_OP_MODIFY,
                              "false");
-       nb_cli_enqueue_change(vty, "./local-as/no-replace-as", NB_OP_MODIFY,
+       nb_cli_enqueue_change(vty, "./local-as/replace-as", NB_OP_MODIFY,
                              "false");
 
        return nb_cli_apply_changes(vty, base_xpath);
index 232c78899e4fa0d232b36973e15c6cfbbbb95e84..2ad22a143539fe7326d4807d8cf613c00eb8c30f 100644 (file)
@@ -124,7 +124,7 @@ submodule frr-bgp-common-structure {
            set to 'false' it will prepend local-as to updates.";
       }
 
-      leaf no-replace-as {
+      leaf replace-as {
         type boolean;
         default "false";
         description