diff options
Diffstat (limited to 'zebra/zebra_nb_config.c')
| -rw-r--r-- | zebra/zebra_nb_config.c | 327 |
1 files changed, 0 insertions, 327 deletions
diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index ba9f96b7de..6296f6f445 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -1218,9 +1218,6 @@ int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args) return NB_ERR; } - /* Mark as having FRR configuration */ - vrf_set_user_cfged(vrf); - break; } @@ -1268,10 +1265,6 @@ int lib_vrf_zebra_l3vni_id_destroy(struct nb_cb_destroy_args *args) return NB_ERR; } - /* If no other FRR config for this VRF, mark accordingly. */ - if (!zebra_vrf_has_config(zvrf)) - vrf_reset_user_cfged(vrf); - break; } @@ -1294,323 +1287,3 @@ int lib_vrf_zebra_prefix_only_modify(struct nb_cb_modify_args *args) return NB_OK; } - -/* - * XPath: - * /frr-route-map:lib/route-map/entry/match-condition/frr-zebra:ipv4-prefix-length - */ -int lib_route_map_entry_match_condition_ipv4_prefix_length_modify( - struct nb_cb_modify_args *args) -{ - struct routemap_hook_context *rhc; - const char *length; - int condition, rv; - - if (args->event != NB_EV_APPLY) - return NB_OK; - - /* Add configuration. */ - rhc = nb_running_get_entry(args->dnode, NULL, true); - length = yang_dnode_get_string(args->dnode, NULL); - condition = - yang_dnode_get_enum(args->dnode, "../frr-route-map:condition"); - - /* Set destroy information. */ - switch (condition) { - case 100: /* ipv4-prefix-length */ - rhc->rhc_rule = "ip address prefix-len"; - break; - - case 102: /* ipv4-next-hop-prefix-length */ - rhc->rhc_rule = "ip next-hop prefix-len"; - break; - } - rhc->rhc_mhook = generic_match_delete; - rhc->rhc_event = RMAP_EVENT_MATCH_DELETED; - - rv = generic_match_add(NULL, rhc->rhc_rmi, rhc->rhc_rule, length, - RMAP_EVENT_MATCH_ADDED); - if (rv != CMD_SUCCESS) { - rhc->rhc_mhook = NULL; - return NB_ERR_INCONSISTENCY; - } - - return NB_OK; -} - -int lib_route_map_entry_match_condition_ipv4_prefix_length_destroy( - struct nb_cb_destroy_args *args) -{ - return lib_route_map_entry_match_destroy(args); -} - -/* - * XPath: - * /frr-route-map:lib/route-map/entry/match-condition/frr-zebra:ipv6-prefix-length - */ -int lib_route_map_entry_match_condition_ipv6_prefix_length_modify( - struct nb_cb_modify_args *args) -{ - struct routemap_hook_context *rhc; - const char *length; - int rv; - - if (args->event != NB_EV_APPLY) - return NB_OK; - - /* Add configuration. */ - rhc = nb_running_get_entry(args->dnode, NULL, true); - length = yang_dnode_get_string(args->dnode, NULL); - - /* Set destroy information. */ - rhc->rhc_mhook = generic_match_delete; - rhc->rhc_rule = "ipv6 address prefix-len"; - rhc->rhc_event = RMAP_EVENT_MATCH_DELETED; - - rv = generic_match_add(NULL, rhc->rhc_rmi, "ipv6 address prefix-len", - length, RMAP_EVENT_MATCH_ADDED); - if (rv != CMD_SUCCESS) { - rhc->rhc_mhook = NULL; - return NB_ERR_INCONSISTENCY; - } - - return NB_OK; -} - -int lib_route_map_entry_match_condition_ipv6_prefix_length_destroy( - struct nb_cb_destroy_args *args) -{ - return lib_route_map_entry_match_destroy(args); -} - -/* - * XPath: - * /frr-route-map:lib/route-map/entry/match-condition/frr-zebra:source-protocol - */ -int lib_route_map_entry_match_condition_source_protocol_modify( - struct nb_cb_modify_args *args) -{ - struct routemap_hook_context *rhc; - const char *type; - int rv; - - switch (args->event) { - case NB_EV_VALIDATE: - type = yang_dnode_get_string(args->dnode, NULL); - if (proto_name2num(type) == -1) { - snprintf(args->errmsg, args->errmsg_len, - "invalid protocol: %s", type); - return NB_ERR_VALIDATION; - } - return NB_OK; - case NB_EV_PREPARE: - case NB_EV_ABORT: - return NB_OK; - case NB_EV_APPLY: - /* NOTHING */ - break; - } - - /* Add configuration. */ - rhc = nb_running_get_entry(args->dnode, NULL, true); - type = yang_dnode_get_string(args->dnode, NULL); - - /* Set destroy information. */ - rhc->rhc_mhook = generic_match_delete; - rhc->rhc_rule = "source-protocol"; - rhc->rhc_event = RMAP_EVENT_MATCH_DELETED; - - rv = generic_match_add(NULL, rhc->rhc_rmi, "source-protocol", type, - RMAP_EVENT_MATCH_ADDED); - if (rv != CMD_SUCCESS) { - rhc->rhc_mhook = NULL; - return NB_ERR_INCONSISTENCY; - } - - return NB_OK; -} - -int lib_route_map_entry_match_condition_source_protocol_destroy( - struct nb_cb_destroy_args *args) -{ - return lib_route_map_entry_match_destroy(args); -} - -/* - * XPath: - * /frr-route-map:lib/route-map/entry/match-condition/frr-zebra:source-instance - */ -int lib_route_map_entry_match_condition_source_instance_modify( - struct nb_cb_modify_args *args) -{ - struct routemap_hook_context *rhc; - const char *type; - int rv; - - if (args->event != NB_EV_APPLY) - return NB_OK; - - /* Add configuration. */ - rhc = nb_running_get_entry(args->dnode, NULL, true); - type = yang_dnode_get_string(args->dnode, NULL); - - /* Set destroy information. */ - rhc->rhc_mhook = generic_match_delete; - rhc->rhc_rule = "source-instance"; - rhc->rhc_event = RMAP_EVENT_MATCH_DELETED; - - rv = generic_match_add(NULL, rhc->rhc_rmi, "source-instance", type, - RMAP_EVENT_MATCH_ADDED); - if (rv != CMD_SUCCESS) { - rhc->rhc_mhook = NULL; - return NB_ERR_INCONSISTENCY; - } - - return NB_OK; -} - -int lib_route_map_entry_match_condition_source_instance_destroy( - struct nb_cb_destroy_args *args) -{ - return lib_route_map_entry_match_destroy(args); -} - -/* - * XPath: /frr-route-map:lib/route-map/entry/set-action/frr-zebra:source-v4 - */ -int lib_route_map_entry_set_action_source_v4_modify( - struct nb_cb_modify_args *args) -{ - struct routemap_hook_context *rhc; - struct interface *pif = NULL; - const char *source; - struct vrf *vrf; - struct prefix p; - int rv; - - switch (args->event) { - case NB_EV_VALIDATE: - memset(&p, 0, sizeof(p)); - yang_dnode_get_ipv4p(&p, args->dnode, NULL); - if (zebra_check_addr(&p) == 0) { - snprintf(args->errmsg, args->errmsg_len, - "invalid IPv4 address: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } - - RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { - pif = if_lookup_exact_address(&p.u.prefix4, AF_INET, - vrf->vrf_id); - if (pif != NULL) - break; - } - /* - * On startup the local address *may* not have come up - * yet. We need to allow startup configuration of - * set src or we are fudged. Log it for future fun - */ - if (pif == NULL) - zlog_warn("set src %pI4 is not a local address", - &p.u.prefix4); - return NB_OK; - case NB_EV_PREPARE: - case NB_EV_ABORT: - return NB_OK; - case NB_EV_APPLY: - /* NOTHING */ - break; - } - - /* Add configuration. */ - rhc = nb_running_get_entry(args->dnode, NULL, true); - source = yang_dnode_get_string(args->dnode, NULL); - - /* Set destroy information. */ - rhc->rhc_shook = generic_set_delete; - rhc->rhc_rule = "src"; - - rv = generic_set_add(NULL, rhc->rhc_rmi, "src", source); - if (rv != CMD_SUCCESS) { - rhc->rhc_shook = NULL; - return NB_ERR_INCONSISTENCY; - } - - return NB_OK; -} - -int lib_route_map_entry_set_action_source_v4_destroy( - struct nb_cb_destroy_args *args) -{ - return lib_route_map_entry_set_destroy(args); -} - -/* - * XPath: /frr-route-map:lib/route-map/entry/set-action/frr-zebra:source-v6 - */ -int lib_route_map_entry_set_action_source_v6_modify( - struct nb_cb_modify_args *args) -{ - struct routemap_hook_context *rhc; - struct interface *pif = NULL; - const char *source; - struct vrf *vrf; - struct prefix p; - int rv; - - switch (args->event) { - case NB_EV_VALIDATE: - memset(&p, 0, sizeof(p)); - yang_dnode_get_ipv6p(&p, args->dnode, NULL); - if (zebra_check_addr(&p) == 0) { - snprintf(args->errmsg, args->errmsg_len, - "invalid IPv6 address: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } - - RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { - pif = if_lookup_exact_address(&p.u.prefix6, AF_INET6, - vrf->vrf_id); - if (pif != NULL) - break; - } - /* - * On startup the local address *may* not have come up - * yet. We need to allow startup configuration of - * set src or we are fudged. Log it for future fun - */ - if (pif == NULL) - zlog_warn("set src %pI6 is not a local address", - &p.u.prefix6); - return NB_OK; - case NB_EV_PREPARE: - case NB_EV_ABORT: - return NB_OK; - case NB_EV_APPLY: - /* NOTHING */ - break; - } - - /* Add configuration. */ - rhc = nb_running_get_entry(args->dnode, NULL, true); - source = yang_dnode_get_string(args->dnode, NULL); - - /* Set destroy information. */ - rhc->rhc_shook = generic_set_delete; - rhc->rhc_rule = "src"; - - rv = generic_set_add(NULL, rhc->rhc_rmi, "src", source); - if (rv != CMD_SUCCESS) { - rhc->rhc_shook = NULL; - return NB_ERR_INCONSISTENCY; - } - - return NB_OK; -} - -int lib_route_map_entry_set_action_source_v6_destroy( - struct nb_cb_destroy_args *args) -{ - return lib_route_map_entry_set_destroy(args); -} |
