ple->pl = pl;
ple->any = 1;
ple->seq = yang_dnode_get_uint32(args->dnode, "./sequence");
+ nb_running_set_entry(args->dnode, ple);
return NB_OK;
}
return NB_OK;
ple = nb_running_unset_entry(args->dnode);
- prefix_list_entry_delete(ple->pl, ple, 1);
+ if (ple->installed)
+ prefix_list_entry_delete(ple->pl, ple, 0);
+ else
+ prefix_list_entry_free(ple);
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
action_str = yang_dnode_get_string(args->dnode, NULL);
if (strcmp(action_str, "permit") == 0)
ple->type = PREFIX_PERMIT;
else
ple->type = PREFIX_DENY;
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
yang_dnode_get_prefix(&ple->prefix, args->dnode, NULL);
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
memset(&ple->prefix, 0, sizeof(ple->prefix));
ple->any = 1;
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
ple->ge = yang_dnode_get_uint8(args->dnode, NULL);
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
ple->ge = 0;
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
ple->le = yang_dnode_get_uint8(args->dnode, NULL);
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
ple->le = 0;
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
memset(&ple->prefix, 0, sizeof(ple->prefix));
ple->any = 1;
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return NB_OK;
ple = nb_running_get_entry(args->dnode, NULL, true);
+
+ /* Start prefix entry update procedure. */
+ prefix_list_entry_update_start(ple);
+
memset(&ple->prefix, 0, sizeof(ple->prefix));
ple->any = 1;
+ /* Finish prefix entry update procedure. */
+ prefix_list_entry_update_finish(ple);
+
return NB_OK;
}
return new;
}
-static void prefix_list_entry_free(struct prefix_list_entry *pentry)
+void prefix_list_entry_free(struct prefix_list_entry *pentry)
{
XFREE(MTYPE_PREFIX_LIST_ENTRY, pentry);
}
plist->master->recent = plist;
}
+/**
+ * Prefix list entry update start procedure:
+ * Remove entry from previosly installed tries and notify observers..
+ *
+ * \param[in] ple prefix list entry.
+ */
+void prefix_list_entry_update_start(struct prefix_list_entry *ple)
+{
+ struct prefix_list *pl = ple->pl;
+
+ /* Not installed, nothing to do. */
+ if (!ple->installed)
+ return;
+
+ prefix_list_trie_del(pl, ple);
+ route_map_notify_pentry_dependencies(pl->name, ple,
+ RMAP_EVENT_PLIST_DELETED);
+ pl->count--;
+
+ ple->installed = false;
+}
+
+/**
+ * Prefix list entry update finish procedure:
+ * Add entry back to trie, notify observers and call master hook.
+ *
+ * \param[in] ple prefix list entry.
+ */
+void prefix_list_entry_update_finish(struct prefix_list_entry *ple)
+{
+ struct prefix_list *pl = ple->pl;
+
+ /* Already installed, nothing to do. */
+ if (ple->installed)
+ return;
+
+ prefix_list_trie_add(pl, ple);
+ pl->count++;
+
+ route_map_notify_pentry_dependencies(pl->name, ple,
+ RMAP_EVENT_PLIST_ADDED);
+
+ /* Run hook function. */
+ if (pl->master->add_hook)
+ (*pl->master->add_hook)(pl);
+
+ route_map_notify_dependencies(pl->name, RMAP_EVENT_PLIST_ADDED);
+ pl->master->recent = pl;
+
+ ple->installed = true;
+}
+
/* Return string of prefix_list_type. */
static const char *prefix_list_type_str(struct prefix_list_entry *pentry)
{