diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/filter_nb.c | 82 |
1 files changed, 1 insertions, 81 deletions
diff --git a/lib/filter_nb.c b/lib/filter_nb.c index cab108e4b..4e1bde676 100644 --- a/lib/filter_nb.c +++ b/lib/filter_nb.c @@ -308,45 +308,6 @@ bool plist_is_dup(const struct lyd_node *dnode, struct plist_dup_args *pda) return pda->pda_found; } -static bool plist_is_dup_nb(const struct lyd_node *dnode) -{ - const struct lyd_node *entry_dnode = - yang_dnode_get_parent(dnode, "entry"); - struct plist_dup_args pda = {}; - int idx = 0, arg_idx = 0; - static const char *entries[] = { - "./ipv4-prefix", - "./ipv4-prefix-length-greater-or-equal", - "./ipv4-prefix-length-lesser-or-equal", - "./ipv6-prefix", - "./ipv6-prefix-length-greater-or-equal", - "./ipv6-prefix-length-lesser-or-equal", - "./any", - NULL - }; - - /* Initialize. */ - pda.pda_type = yang_dnode_get_string(entry_dnode, "../type"); - pda.pda_name = yang_dnode_get_string(entry_dnode, "../name"); - pda.pda_entry_dnode = entry_dnode; - - /* Load all values/XPaths. */ - while (entries[idx] != NULL) { - if (!yang_dnode_exists(entry_dnode, entries[idx])) { - idx++; - continue; - } - - pda.pda_xpath[arg_idx] = entries[idx]; - pda.pda_value[arg_idx] = - yang_dnode_get_string(entry_dnode, entries[idx]); - arg_idx++; - idx++; - } - - return plist_is_dup(entry_dnode, &pda); -} - /* * XPath: /frr-filter:lib/access-list */ @@ -1272,16 +1233,6 @@ static int lib_prefix_list_entry_ipv4_prefix_length_greater_or_equal_modify( prefix_list_length_validate(args) != NB_OK) return NB_ERR_VALIDATION; - if (args->event == NB_EV_VALIDATE) { - if (plist_is_dup_nb(args->dnode)) { - snprintf(args->errmsg, args->errmsg_len, - "duplicated prefix list value: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } - return NB_OK; - } - if (args->event != NB_EV_APPLY) return NB_OK; @@ -1344,16 +1295,6 @@ static int lib_prefix_list_entry_ipv4_prefix_length_lesser_or_equal_modify( prefix_list_length_validate(args) != NB_OK) return NB_ERR_VALIDATION; - if (args->event == NB_EV_VALIDATE) { - if (plist_is_dup_nb(args->dnode)) { - snprintf(args->errmsg, args->errmsg_len, - "duplicated prefix list value: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } - return NB_OK; - } - if (args->event != NB_EV_APPLY) return NB_OK; @@ -1427,12 +1368,6 @@ static int lib_prefix_list_entry_ipv6_prefix_length_greater_or_equal_modify( return NB_ERR_VALIDATION; } - if (plist_is_dup_nb(args->dnode)) { - snprintf(args->errmsg, args->errmsg_len, - "duplicated prefix list value: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } return NB_OK; } @@ -1508,12 +1443,7 @@ static int lib_prefix_list_entry_ipv6_prefix_length_lesser_or_equal_modify( "prefix-list type %s is mismatched.", af_type); return NB_ERR_VALIDATION; } - if (plist_is_dup_nb(args->dnode)) { - snprintf(args->errmsg, args->errmsg_len, - "duplicated prefix list value: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } + return NB_OK; } @@ -1574,16 +1504,6 @@ static int lib_prefix_list_entry_any_create(struct nb_cb_create_args *args) struct prefix_list_entry *ple; int type; - if (args->event == NB_EV_VALIDATE) { - if (plist_is_dup_nb(args->dnode)) { - snprintf(args->errmsg, args->errmsg_len, - "duplicated prefix list value: %s", - yang_dnode_get_string(args->dnode, NULL)); - return NB_ERR_VALIDATION; - } - return NB_OK; - } - if (args->event != NB_EV_APPLY) return NB_OK; |