From: Mark Stapp Date: Wed, 30 Jan 2019 09:54:25 +0000 (-0500) Subject: libs, rip, isis: change northbound operation enum to DESTROY X-Git-Tag: 7.1_pulled~248^2~11 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=95ce849b58cb8706b32d6cfb957286c8007da37e;p=mirror%2Ffrr.git libs, rip, isis: change northbound operation enum to DESTROY 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 --- diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index c68f49f92d..bd8b58e8f0 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -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 [ 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); diff --git a/lib/if.c b/lib/if.c index 16b6512441..48841c7ee8 100644 --- 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); } diff --git a/lib/northbound.c b/lib/northbound.c index 951c2d5cbc..15139aa8d0 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -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: diff --git a/lib/northbound.h b/lib/northbound.h index 557c4fb7ce..4d760e2d33 100644 --- a/lib/northbound.h +++ b/lib/northbound.h @@ -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, diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index 53149d0fd2..a8e0017819 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -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)) diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 860c27edbd..f426f52bd9 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -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; diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 5bb81ef157..6fbcdc059b 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -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 /, 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 /\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"); diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c index a187e80fd7..23a4803170 100644 --- a/ripngd/ripng_cli.c +++ b/ripngd/ripng_cli.c @@ -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); diff --git a/tools/gen_northbound_callbacks.c b/tools/gen_northbound_callbacks.c index eded87c12e..f6c757f5d7 100644 --- a/tools/gen_northbound_callbacks.c +++ b/tools/gen_northbound_callbacks.c @@ -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 =