]> git.puffer.fish Git - matthieu/frr.git/commitdiff
libs, rip, isis: change northbound operation enum to DESTROY
authorMark Stapp <mjs@voltanet.io>
Wed, 30 Jan 2019 09:54:25 +0000 (04:54 -0500)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 11 Feb 2019 17:49:49 +0000 (15:49 -0200)
Change the northbound lib operation from DELETE to DESTROY;
make the required changes in the users of the northbound, in
the cli, rip, ripng, and isis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
isisd/isis_cli.c
lib/if.c
lib/northbound.c
lib/northbound.h
lib/northbound_confd.c
lib/northbound_sysrepo.c
ripd/rip_cli.c
ripngd/ripng_cli.c
tools/gen_northbound_callbacks.c

index c68f49f92dd89221d14f898b76f372357a1e1f2e..bd8b58e8f0bd91dff4fa493b98950e5e50d8d096 100644 (file)
@@ -89,7 +89,7 @@ DEFPY(no_router_isis, no_router_isis_cmd, "no router isis WORD$tag",
                return CMD_ERR_NOTHING_TODO;
        }
 
-       nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+       nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
        area = isis_area_lookup(tag);
        if (area && area->circuit_list && listcount(area->circuit_list)) {
                for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode,
@@ -103,7 +103,7 @@ DEFPY(no_router_isis, no_router_isis_cmd, "no router isis WORD$tag",
                                temp_xpath, XPATH_MAXLEN,
                                "/frr-interface:lib/interface[name='%s'][vrf='%s']/frr-isisd:isis",
                                circuit->interface->name, vrf_name);
-                       nb_cli_enqueue_change(vty, temp_xpath, NB_OP_DELETE,
+                       nb_cli_enqueue_change(vty, temp_xpath, NB_OP_DESTROY,
                                              NULL);
                }
        }
@@ -289,7 +289,7 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
                    && !yang_dnode_get_bool(dnode,
                                            "./frr-isisd:isis/ipv4-routing"))
                        nb_cli_enqueue_change(vty, "./frr-isisd:isis",
-                                             NB_OP_DELETE, NULL);
+                                             NB_OP_DESTROY, NULL);
                else
                        nb_cli_enqueue_change(vty,
                                              "./frr-isisd:isis/ipv6-routing",
@@ -299,7 +299,7 @@ DEFPY(no_ip_router_isis, no_ip_router_isis_cmd,
                    && !yang_dnode_get_bool(dnode,
                                            "./frr-isisd:isis/ipv6-routing"))
                        nb_cli_enqueue_change(vty, "./frr-isisd:isis",
-                                             NB_OP_DELETE, NULL);
+                                             NB_OP_DESTROY, NULL);
                else
                        nb_cli_enqueue_change(vty,
                                              "./frr-isisd:isis/ipv4-routing",
@@ -336,7 +336,7 @@ DEFPY(net, net_cmd, "[no] net WORD",
       "XX.XXXX. ... .XXX.XX  Network entity title (NET)\n")
 {
        nb_cli_enqueue_change(vty, "./area-address",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, net);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, net);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -589,7 +589,7 @@ DEFPY(no_area_passwd, no_area_passwd_cmd,
       "Configure the authentication password for an area\n"
       "Set the authentication password for a routing domain\n")
 {
-       nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+       nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, "./%s", cmd);
 }
@@ -892,7 +892,7 @@ DEFPY(no_spf_delay_ietf, no_spf_delay_ietf_cmd,
       "Maximum duration needed to learn all the events related to a single failure\n"
       "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
 {
-       nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DELETE,
+       nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -947,7 +947,7 @@ DEFPY(no_isis_mpls_te_on, no_isis_mpls_te_on_cmd, "no mpls-te [on]",
       "Disable the MPLS-TE functionality\n"
       "Enable the MPLS-TE functionality\n")
 {
-       nb_cli_enqueue_change(vty, "/frr-isisd:isis/mpls-te", NB_OP_DELETE,
+       nb_cli_enqueue_change(vty, "/frr-isisd:isis/mpls-te", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1014,16 +1014,16 @@ DEFPY(isis_default_originate, isis_default_originate_cmd,
       "Pointer to route-map entries\n")
 {
        if (no)
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
        else {
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
                nb_cli_enqueue_change(vty, "./always", NB_OP_MODIFY,
                                      always ? "true" : "false");
                nb_cli_enqueue_change(vty, "./route-map",
-                                     rmap ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     rmap ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      rmap ? rmap : NULL);
                nb_cli_enqueue_change(vty, "./metric",
-                                     metric ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     metric ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      metric ? metric_str : NULL);
                if (strmatch(ip, "ipv6") && !always) {
                        vty_out(vty,
@@ -1094,14 +1094,14 @@ DEFPY(isis_redistribute, isis_redistribute_cmd,
       "Pointer to route-map entries\n")
 {
        if (no)
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
        else {
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
                nb_cli_enqueue_change(vty, "./route-map",
-                                     route_map ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     route_map ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      route_map ? route_map : NULL);
                nb_cli_enqueue_change(vty, "./metric",
-                                     metric ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     metric ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      metric ? metric_str : NULL);
        }
 
@@ -1182,7 +1182,7 @@ DEFPY(isis_topology, isis_topology_cmd,
                         topology);
 
        if (no)
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
        else {
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
                nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY,
@@ -1297,7 +1297,7 @@ DEFPY(no_isis_passwd, no_isis_passwd_cmd, "no isis password [<md5|clear> WORD]",
       "Cleartext password\n"
       "Circuit password\n")
 {
-       nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DELETE,
+       nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
index 16b6512441849131cc303b60cf5bf2c4a5dc0d8c..48841c7ee8abd660eaf514545548b0645e1a512d 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -1160,7 +1160,7 @@ DEFPY (no_interface,
        if (!vrfname)
                vrfname = VRF_DEFAULT_NAME;
 
-       nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+       nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(
                vty, "/frr-interface:lib/interface[name='%s'][vrf='%s']",
@@ -1207,7 +1207,7 @@ DEFPY  (no_interface_desc,
        NO_STR
        "Interface specific description\n")
 {
-       nb_cli_enqueue_change(vty, "./description", NB_OP_DELETE, NULL);
+       nb_cli_enqueue_change(vty, "./description", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
index 951c2d5cbcf540df0622e659ebe9a0ddd171929e..15139aa8d04049f6272b5bdd4a4be25dc03eda85 100644 (file)
@@ -184,7 +184,7 @@ static unsigned int nb_node_validate_cbs(const struct nb_node *nb_node)
                                     !!nb_node->cbs.create, false);
        error += nb_node_validate_cb(nb_node, NB_OP_MODIFY,
                                     !!nb_node->cbs.modify, false);
-       error += nb_node_validate_cb(nb_node, NB_OP_DELETE,
+       error += nb_node_validate_cb(nb_node, NB_OP_DESTROY,
                                     !!nb_node->cbs.destroy, false);
        error += nb_node_validate_cb(nb_node, NB_OP_MOVE, !!nb_node->cbs.move,
                                     false);
@@ -417,7 +417,7 @@ static void nb_config_diff(const struct nb_config *config1,
                        break;
                case LYD_DIFF_DELETED:
                        dnode = diff->first[i];
-                       operation = NB_OP_DELETE;
+                       operation = NB_OP_DESTROY;
                        break;
                case LYD_DIFF_CHANGED:
                        dnode = diff->second[i];
@@ -485,7 +485,7 @@ int nb_candidate_edit(struct nb_config *candidate,
                        lyd_validate(&dnode, LYD_OPT_CONFIG, ly_native_ctx);
                }
                break;
-       case NB_OP_DELETE:
+       case NB_OP_DESTROY:
                dnode = yang_dnode_get(candidate->dnode, xpath_edit);
                if (!dnode)
                        /*
@@ -741,7 +741,7 @@ static int nb_configuration_callback(const enum nb_event event,
        case NB_OP_MODIFY:
                ret = (*nb_node->cbs.modify)(event, dnode, resource);
                break;
-       case NB_OP_DELETE:
+       case NB_OP_DESTROY:
                ret = (*nb_node->cbs.destroy)(event, dnode);
                break;
        case NB_OP_MOVE:
@@ -912,7 +912,7 @@ static void nb_transaction_apply_finish(struct nb_transaction *transaction)
                 * (the 'apply_finish' callbacks from the node ancestors should
                 * be called though).
                 */
-               if (change->cb.operation == NB_OP_DELETE) {
+               if (change->cb.operation == NB_OP_DESTROY) {
                        char xpath[XPATH_MAXLEN];
 
                        dnode = dnode->parent;
@@ -1359,7 +1359,7 @@ bool nb_operation_is_valid(enum nb_operation operation,
                        return false;
                }
                return true;
-       case NB_OP_DELETE:
+       case NB_OP_DESTROY:
                if (!CHECK_FLAG(snode->flags, LYS_CONFIG_W))
                        return false;
 
@@ -1511,8 +1511,8 @@ const char *nb_operation_name(enum nb_operation operation)
                return "create";
        case NB_OP_MODIFY:
                return "modify";
-       case NB_OP_DELETE:
-               return "delete";
+       case NB_OP_DESTROY:
+               return "destroy";
        case NB_OP_MOVE:
                return "move";
        case NB_OP_APPLY_FINISH:
index 557c4fb7ce5a8869d17b596ee8b374e02d54142f..4d760e2d33304decb86b6d56349a25a20c75f5e8 100644 (file)
@@ -65,7 +65,7 @@ enum nb_event {
 enum nb_operation {
        NB_OP_CREATE,
        NB_OP_MODIFY,
-       NB_OP_DELETE,
+       NB_OP_DESTROY,
        NB_OP_MOVE,
        NB_OP_APPLY_FINISH,
        NB_OP_GET_ELEM,
index 53149d0fd22b956d4341e78919e0d45bb7c86eb9..a8e00178194c16bff91f0318e20929e35973bc1c 100644 (file)
@@ -228,7 +228,7 @@ frr_confd_cdb_diff_iter(confd_hkeypath_t *kp, enum cdb_iter_op cdb_op,
                nb_op = NB_OP_CREATE;
                break;
        case MOP_DELETED:
-               nb_op = NB_OP_DELETE;
+               nb_op = NB_OP_DESTROY;
                break;
        case MOP_VALUE_SET:
                if (nb_operation_is_valid(NB_OP_MODIFY, nb_node->snode))
index 860c27edbd023c5809f60d0889096c6131a6c3ca..f426f52bd99ab89b78fa7bee745fec5314598868 100644 (file)
@@ -202,10 +202,10 @@ static int frr_sr_process_change(struct nb_config *candidate,
                 * notified about the removal of all of its leafs, even the ones
                 * that are non-optional. We need to ignore these notifications.
                 */
-               if (!nb_operation_is_valid(NB_OP_DELETE, nb_node->snode))
+               if (!nb_operation_is_valid(NB_OP_DESTROY, nb_node->snode))
                        return NB_OK;
 
-               nb_op = NB_OP_DELETE;
+               nb_op = NB_OP_DESTROY;
                break;
        case SR_OP_MOVED:
                nb_op = NB_OP_MOVE;
index 5bb81ef157c2f1a10da77634e89a7ab22cbebd1c..6fbcdc059be0f87e900f9b344585d6834c4027f4 100644 (file)
@@ -62,7 +62,7 @@ DEFPY (no_router_rip,
        "Enable a routing process\n"
        "Routing Information Protocol (RIP)\n")
 {
-       nb_cli_enqueue_change(vty, "/frr-ripd:ripd/instance", NB_OP_DELETE,
+       nb_cli_enqueue_change(vty, "/frr-ripd:ripd/instance", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -213,9 +213,9 @@ DEFPY (rip_distance_source,
                nb_cli_enqueue_change(vty, "./distance", NB_OP_MODIFY,
                                      distance_str);
                nb_cli_enqueue_change(vty, "./access-list",
-                                     acl ? NB_OP_MODIFY : NB_OP_DELETE, acl);
+                                     acl ? NB_OP_MODIFY : NB_OP_DESTROY, acl);
        } else
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, "./distance/source[prefix='%s']",
                                    prefix_str);
@@ -244,7 +244,7 @@ DEFPY (rip_neighbor,
        "Neighbor address\n")
 {
        nb_cli_enqueue_change(vty, "./explicit-neighbor",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, neighbor_str);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, neighbor_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -266,7 +266,7 @@ DEFPY (rip_network_prefix,
        "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
 {
        nb_cli_enqueue_change(vty, "./network",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, network_str);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, network_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -288,7 +288,7 @@ DEFPY (rip_network_if,
        "Interface name\n")
 {
        nb_cli_enqueue_change(vty, "./interface",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, network);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, network);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -319,7 +319,7 @@ DEFPY (rip_offset_list,
                nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY,
                                      metric_str);
        } else
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(
                vty, "./offset-list[interface='%s'][direction='%s']",
@@ -379,9 +379,9 @@ DEFPY (rip_passive_interface,
        "Interface name\n")
 {
        nb_cli_enqueue_change(vty, "./passive-interface",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, ifname);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, ifname);
        nb_cli_enqueue_change(vty, "./non-passive-interface",
-                             no ? NB_OP_CREATE : NB_OP_DELETE, ifname);
+                             no ? NB_OP_CREATE : NB_OP_DESTROY, ifname);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -417,13 +417,13 @@ DEFPY (rip_redistribute,
        if (!no) {
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
                nb_cli_enqueue_change(vty, "./route-map",
-                                     route_map ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     route_map ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      route_map);
                nb_cli_enqueue_change(vty, "./metric",
-                                     metric_str ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     metric_str ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      metric_str);
        } else
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, "./redistribute[protocol='%s']",
                                    protocol);
@@ -454,7 +454,7 @@ DEFPY (rip_route,
        "IP prefix <network>/<length>\n")
 {
        nb_cli_enqueue_change(vty, "./static-route",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, route_str);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, route_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -942,7 +942,7 @@ DEFPY (no_ip_rip_authentication_key_chain,
        "Authentication key-chain\n"
        "name of key-chain\n")
 {
-       nb_cli_enqueue_change(vty, "./authentication-key-chain", NB_OP_DELETE,
+       nb_cli_enqueue_change(vty, "./authentication-key-chain", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, "./frr-ripd:rip");
index a187e80fd7a4691a79e507ad6ada5a1c6900f766..23a48031704a45b8b48801814116146222647b12 100644 (file)
@@ -62,7 +62,7 @@ DEFPY (no_router_ripng,
        "Enable a routing process\n"
        "Make RIPng instance command\n")
 {
-       nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_DELETE,
+       nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -170,7 +170,7 @@ DEFPY (ripng_network_prefix,
        "IPv6 network\n")
 {
        nb_cli_enqueue_change(vty, "./network",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, network_str);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, network_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -192,7 +192,7 @@ DEFPY (ripng_network_if,
        "Interface name\n")
 {
        nb_cli_enqueue_change(vty, "./interface",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, network);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, network);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -223,7 +223,7 @@ DEFPY (ripng_offset_list,
                nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY,
                                      metric_str);
        } else
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(
                vty, "./offset-list[interface='%s'][direction='%s']",
@@ -257,7 +257,7 @@ DEFPY (ripng_passive_interface,
        "Interface name\n")
 {
        nb_cli_enqueue_change(vty, "./passive-interface",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, ifname);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, ifname);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -286,13 +286,13 @@ DEFPY (ripng_redistribute,
        if (!no) {
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
                nb_cli_enqueue_change(vty, "./route-map",
-                                     route_map ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     route_map ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      route_map);
                nb_cli_enqueue_change(vty, "./metric",
-                                     metric_str ? NB_OP_MODIFY : NB_OP_DELETE,
+                                     metric_str ? NB_OP_MODIFY : NB_OP_DESTROY,
                                      metric_str);
        } else
-               nb_cli_enqueue_change(vty, ".", NB_OP_DELETE, NULL);
+               nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, "./redistribute[protocol='%s']",
                                    protocol);
@@ -323,7 +323,7 @@ DEFPY (ripng_route,
        "Set static RIPng route announcement\n")
 {
        nb_cli_enqueue_change(vty, "./static-route",
-                             no ? NB_OP_DELETE : NB_OP_CREATE, route_str);
+                             no ? NB_OP_DESTROY : NB_OP_CREATE, route_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -345,7 +345,7 @@ DEFPY (ripng_aggregate_address,
        "Aggregate network\n")
 {
        nb_cli_enqueue_change(vty, "./aggregate-address",
-                             no ? NB_OP_DELETE : NB_OP_CREATE,
+                             no ? NB_OP_DESTROY : NB_OP_CREATE,
                              aggregate_address_str);
 
        return nb_cli_apply_changes(vty, NULL);
index eded87c12eec2fee83e07323d41f3da2838d176c..f6c757f5d7d163b4c213f829c133214ee1a91ebf 100644 (file)
@@ -54,7 +54,7 @@ static struct nb_callback_info {
                        "enum nb_event event, const struct lyd_node *dnode, union nb_resource *resource",
        },
        {
-               .operation = NB_OP_DELETE,
+               .operation = NB_OP_DESTROY,
                .return_type = "int ",
                .return_value = "NB_OK",
                .arguments =