]> git.proxmox.com Git - mirror_frr.git/blame - lib/northbound.h
lib: add support for confirmed commits
[mirror_frr.git] / lib / northbound.h
CommitLineData
1c2facd1
RW
1/*
2 * Copyright (C) 2018 NetDEF, Inc.
3 * Renato Westphal
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef _FRR_NORTHBOUND_H_
21#define _FRR_NORTHBOUND_H_
22
fbdc1c0a 23#include "thread.h"
1c2facd1 24#include "hook.h"
1c2facd1
RW
25#include "linklist.h"
26#include "openbsd-tree.h"
1a4bc045
RW
27#include "yang.h"
28#include "yang_translator.h"
1c2facd1
RW
29
30/* Forward declaration(s). */
31struct vty;
32
33/* Northbound events. */
34enum nb_event {
35 /*
36 * The configuration callback is supposed to verify that the changes are
37 * valid and can be applied.
38 */
39 NB_EV_VALIDATE,
40
41 /*
42 * The configuration callback is supposed to prepare all resources
43 * required to apply the changes.
44 */
45 NB_EV_PREPARE,
46
47 /*
48 * Transaction has failed, the configuration callback needs to release
49 * all resources previously allocated.
50 */
51 NB_EV_ABORT,
52
53 /*
54 * The configuration changes need to be applied. The changes can't be
55 * rejected at this point (errors are logged and ignored).
56 */
57 NB_EV_APPLY,
58};
59
60/*
61 * Northbound operations.
62 *
63 * Refer to the documentation comments of nb_callbacks for more details.
64 */
65enum nb_operation {
66 NB_OP_CREATE,
67 NB_OP_MODIFY,
68 NB_OP_DELETE,
69 NB_OP_MOVE,
70 NB_OP_APPLY_FINISH,
71 NB_OP_GET_ELEM,
72 NB_OP_GET_NEXT,
73 NB_OP_GET_KEYS,
74 NB_OP_LOOKUP_ENTRY,
75 NB_OP_RPC,
76};
77
78union nb_resource {
79 int fd;
80 void *ptr;
81};
82
83struct nb_callbacks {
84 /*
85 * Configuration callback.
86 *
87 * A presence container, list entry, leaf-list entry or leaf of type
88 * empty has been created.
89 *
90 * For presence-containers and list entries, the callback is supposed to
91 * initialize the default values of its children (if any) from the YANG
92 * models.
93 *
94 * event
95 * The transaction phase. Refer to the documentation comments of
96 * nb_event for more details.
97 *
98 * dnode
99 * libyang data node that is being created.
100 *
101 * resource
102 * Pointer to store resource(s) allocated during the NB_EV_PREPARE
103 * phase. The same pointer can be used during the NB_EV_ABORT and
104 * NB_EV_APPLY phases to either release or make use of the allocated
105 * resource(s). It's set to NULL when the event is NB_EV_VALIDATE.
106 *
107 * Returns:
108 * - NB_OK on success.
109 * - NB_ERR_VALIDATION when a validation error occurred.
110 * - NB_ERR_RESOURCE when the callback failed to allocate a resource.
111 * - NB_ERR_INCONSISTENCY when an inconsistency was detected.
112 * - NB_ERR for other errors.
113 */
114 int (*create)(enum nb_event event, const struct lyd_node *dnode,
115 union nb_resource *resource);
116
117 /*
118 * Configuration callback.
119 *
120 * The value of a leaf has been modified.
121 *
122 * List keys don't need to implement this callback. When a list key is
123 * modified, the northbound treats this as if the list was deleted and a
124 * new one created with the updated key value.
125 *
126 * event
127 * The transaction phase. Refer to the documentation comments of
128 * nb_event for more details.
129 *
130 * dnode
131 * libyang data node that is being modified
132 *
133 * resource
134 * Pointer to store resource(s) allocated during the NB_EV_PREPARE
135 * phase. The same pointer can be used during the NB_EV_ABORT and
136 * NB_EV_APPLY phases to either release or make use of the allocated
137 * resource(s). It's set to NULL when the event is NB_EV_VALIDATE.
138 *
139 * Returns:
140 * - NB_OK on success.
141 * - NB_ERR_VALIDATION when a validation error occurred.
142 * - NB_ERR_RESOURCE when the callback failed to allocate a resource.
143 * - NB_ERR_INCONSISTENCY when an inconsistency was detected.
144 * - NB_ERR for other errors.
145 */
146 int (*modify)(enum nb_event event, const struct lyd_node *dnode,
147 union nb_resource *resource);
148
149 /*
150 * Configuration callback.
151 *
152 * A presence container, list entry, leaf-list entry or optional leaf
153 * has been deleted.
154 *
155 * The callback is supposed to delete the entire configuration object,
156 * including its children when they exist.
157 *
158 * event
159 * The transaction phase. Refer to the documentation comments of
160 * nb_event for more details.
161 *
162 * dnode
163 * libyang data node that is being deleted.
164 *
165 * Returns:
166 * - NB_OK on success.
167 * - NB_ERR_VALIDATION when a validation error occurred.
168 * - NB_ERR_INCONSISTENCY when an inconsistency was detected.
169 * - NB_ERR for other errors.
170 */
171 int (*delete)(enum nb_event event, const struct lyd_node *dnode);
172
173 /*
174 * Configuration callback.
175 *
176 * A list entry or leaf-list entry has been moved. Only applicable when
177 * the "ordered-by user" statement is present.
178 *
179 * event
180 * The transaction phase. Refer to the documentation comments of
181 * nb_event for more details.
182 *
183 * dnode
184 * libyang data node that is being moved.
185 *
186 * Returns:
187 * - NB_OK on success.
188 * - NB_ERR_VALIDATION when a validation error occurred.
189 * - NB_ERR_INCONSISTENCY when an inconsistency was detected.
190 * - NB_ERR for other errors.
191 */
192 int (*move)(enum nb_event event, const struct lyd_node *dnode);
193
194 /*
195 * Optional configuration callback.
196 *
197 * The 'apply_finish' callbacks are called after all other callbacks
198 * during the apply phase (NB_EV_APPLY). These callbacks are called only
199 * under one of the following two cases:
200 * - The data node has been created or modified (but not deleted);
201 * - Any change was made within the descendants of the data node (e.g. a
202 * child leaf was modified, created or deleted).
203 *
204 * In the second case above, the 'apply_finish' callback is called only
205 * once even if multiple changes occurred within the descendants of the
206 * data node.
207 *
208 * dnode
209 * libyang data node associated with the 'apply_finish' callback.
210 */
211 void (*apply_finish)(const struct lyd_node *dnode);
212
213 /*
214 * Operational data callback.
215 *
1a4bc045
RW
216 * The callback function should return the value of a specific leaf,
217 * leaf-list entry or inform if a typeless value (presence containers or
218 * leafs of type empty) exists or not.
1c2facd1
RW
219 *
220 * xpath
221 * YANG data path of the data we want to get.
222 *
223 * list_entry
1a4bc045 224 * Pointer to list entry (might be NULL).
1c2facd1
RW
225 *
226 * Returns:
227 * Pointer to newly created yang_data structure, or NULL to indicate
228 * the absence of data.
229 */
230 struct yang_data *(*get_elem)(const char *xpath,
231 const void *list_entry);
232
233 /*
1a4bc045 234 * Operational data callback for YANG lists and leaf-lists.
1c2facd1 235 *
1a4bc045
RW
236 * The callback function should return the next entry in the list or
237 * leaf-list. The 'list_entry' parameter will be NULL on the first
238 * invocation.
1c2facd1 239 *
1a4bc045
RW
240 * parent_list_entry
241 * Pointer to parent list entry.
1c2facd1
RW
242 *
243 * list_entry
1a4bc045 244 * Pointer to (leaf-)list entry.
1c2facd1
RW
245 *
246 * Returns:
1a4bc045
RW
247 * Pointer to the next entry in the (leaf-)list, or NULL to signal
248 * that the end of the (leaf-)list was reached.
1c2facd1 249 */
1a4bc045
RW
250 const void *(*get_next)(const void *parent_list_entry,
251 const void *list_entry);
1c2facd1
RW
252
253 /*
254 * Operational data callback for YANG lists.
255 *
256 * The callback function should fill the 'keys' parameter based on the
257 * given list_entry.
258 *
259 * list_entry
260 * Pointer to list entry.
261 *
262 * keys
263 * Structure to be filled based on the attributes of the provided
264 * list entry.
265 *
266 * Returns:
267 * NB_OK on success, NB_ERR otherwise.
268 */
269 int (*get_keys)(const void *list_entry, struct yang_list_keys *keys);
270
271 /*
272 * Operational data callback for YANG lists.
273 *
274 * The callback function should return a list entry based on the list
275 * keys given as a parameter.
276 *
1a4bc045
RW
277 * parent_list_entry
278 * Pointer to parent list entry.
279 *
1c2facd1
RW
280 * keys
281 * Structure containing the keys of the list entry.
282 *
283 * Returns:
284 * Pointer to the list entry if found, or NULL if not found.
285 */
1a4bc045
RW
286 const void *(*lookup_entry)(const void *parent_list_entry,
287 const struct yang_list_keys *keys);
1c2facd1
RW
288
289 /*
290 * RPC and action callback.
291 *
292 * Both 'input' and 'output' are lists of 'yang_data' structures. The
293 * callback should fetch all the input parameters from the 'input' list,
294 * and add output parameters to the 'output' list if necessary.
295 *
296 * xpath
297 * XPath of the YANG RPC or action.
298 *
299 * input
300 * Read-only list of input parameters.
301 *
302 * output
303 * List of output parameters to be populated by the callback.
304 *
305 * Returns:
306 * NB_OK on success, NB_ERR otherwise.
307 */
308 int (*rpc)(const char *xpath, const struct list *input,
309 struct list *output);
310
311 /*
312 * Optional callback to show the CLI command associated to the given
313 * YANG data node.
314 *
315 * vty
316 * The vty terminal to dump the configuration to.
317 *
318 * dnode
319 * libyang data node that should be shown in the form of a CLI
320 * command.
321 *
322 * show_defaults
323 * Specify whether to display default configuration values or not.
324 * This parameter can be ignored most of the time since the
325 * northbound doesn't call this callback for default leaves or
326 * non-presence containers that contain only default child nodes.
327 * The exception are commands associated to multiple configuration
328 * nodes, in which case it might be desirable to hide one or more
329 * parts of the command when this parameter is set to false.
330 */
331 void (*cli_show)(struct vty *vty, struct lyd_node *dnode,
332 bool show_defaults);
333};
334
335/*
336 * Northbound-specific data that is allocated for each schema node of the native
337 * YANG modules.
338 */
339struct nb_node {
340 /* Back pointer to the libyang schema node. */
341 const struct lys_node *snode;
342
343 /* Data path of this YANG node. */
344 char xpath[XPATH_MAXLEN];
345
346 /* Priority - lower priorities are processed first. */
347 uint32_t priority;
348
349 /* Callbacks implemented for this node. */
350 struct nb_callbacks cbs;
351
352 /*
353 * Pointer to the parent node (disconsidering non-presence containers).
354 */
355 struct nb_node *parent;
356
357 /* Pointer to the nearest parent list, if any. */
358 struct nb_node *parent_list;
359
544ca69a
RW
360 /* Flags. */
361 uint8_t flags;
362
1c2facd1
RW
363#ifdef HAVE_CONFD
364 /* ConfD hash value corresponding to this YANG path. */
365 int confd_hash;
366#endif
367};
544ca69a
RW
368/* The YANG container or list contains only config data. */
369#define F_NB_NODE_CONFIG_ONLY 0x01
1c2facd1
RW
370
371struct frr_yang_module_info {
372 /* YANG module name. */
373 const char *name;
374
375 /* Northbound callbacks. */
376 const struct {
377 /* Data path of this YANG node. */
378 const char *xpath;
379
380 /* Callbacks implemented for this node. */
381 struct nb_callbacks cbs;
382
383 /* Priority - lower priorities are processed first. */
384 uint32_t priority;
385 } nodes[];
386};
387
388/* Northbound error codes. */
389enum nb_error {
390 NB_OK = 0,
391 NB_ERR,
392 NB_ERR_NO_CHANGES,
393 NB_ERR_NOT_FOUND,
394 NB_ERR_LOCKED,
395 NB_ERR_VALIDATION,
396 NB_ERR_RESOURCE,
397 NB_ERR_INCONSISTENCY,
398};
399
400/* Default priority. */
401#define NB_DFLT_PRIORITY (UINT32_MAX / 2)
402
403/* Default maximum of configuration rollbacks to store. */
404#define NB_DLFT_MAX_CONFIG_ROLLBACKS 20
405
406/* Northbound clients. */
407enum nb_client {
408 NB_CLIENT_CLI = 0,
5bce33b3 409 NB_CLIENT_CONFD,
a7ca2199 410 NB_CLIENT_SYSREPO,
1c2facd1
RW
411};
412
413/* Northbound configuration. */
414struct nb_config {
415 struct lyd_node *dnode;
416 uint32_t version;
417};
418
419/* Northbound configuration callback. */
420struct nb_config_cb {
421 RB_ENTRY(nb_config_cb) entry;
422 enum nb_operation operation;
423 char xpath[XPATH_MAXLEN];
424 const struct nb_node *nb_node;
425 const struct lyd_node *dnode;
426};
427RB_HEAD(nb_config_cbs, nb_config_cb);
428RB_PROTOTYPE(nb_config_cbs, nb_config_cb, entry, nb_config_cb_compare);
429
430/* Northbound configuration change. */
431struct nb_config_change {
432 struct nb_config_cb cb;
433 union nb_resource resource;
434 bool prepare_ok;
435};
436
437/* Northbound configuration transaction. */
438struct nb_transaction {
439 enum nb_client client;
440 char comment[80];
441 struct nb_config *config;
442 struct nb_config_cbs changes;
443};
444
1a4bc045
RW
445/* Callback function used by nb_oper_data_iterate(). */
446typedef int (*nb_oper_data_cb)(const struct lys_node *snode,
447 struct yang_translator *translator,
448 struct yang_data *data, void *arg);
449
450/* Iterate over direct child nodes only. */
451#define NB_OPER_DATA_ITER_NORECURSE 0x0001
452
1c2facd1
RW
453DECLARE_HOOK(nb_notification_send, (const char *xpath, struct list *arguments),
454 (xpath, arguments))
455
456extern int debug_northbound;
457extern struct nb_config *running_config;
458
544ca69a
RW
459/*
460 * Create a northbound node for all YANG schema nodes.
461 */
462void nb_nodes_create(void);
463
464/*
465 * Delete all northbound nodes from all YANG schema nodes.
466 */
467void nb_nodes_delete(void);
468
1c2facd1
RW
469/*
470 * Find the northbound node corresponding to a YANG data path.
471 *
472 * xpath
473 * XPath to search for (with or without predicates).
474 *
475 * Returns:
476 * Pointer to northbound node if found, NULL otherwise.
477 */
478extern struct nb_node *nb_node_find(const char *xpath);
479
480/*
481 * Create a new northbound configuration.
482 *
483 * dnode
484 * Pointer to a libyang data node containing the configuration data. If NULL
485 * is given, an empty configuration will be created.
486 *
487 * Returns:
488 * Pointer to newly created northbound configuration.
489 */
490extern struct nb_config *nb_config_new(struct lyd_node *dnode);
491
492/*
493 * Delete a northbound configuration.
494 *
495 * config
496 * Pointer to the config that is going to be deleted.
497 */
498extern void nb_config_free(struct nb_config *config);
499
500/*
501 * Duplicate a northbound configuration.
502 *
503 * config
504 * Northbound configuration to duplicate.
505 *
506 * Returns:
507 * Pointer to duplicated configuration.
508 */
509extern struct nb_config *nb_config_dup(const struct nb_config *config);
510
511/*
512 * Merge one configuration into another.
513 *
514 * config_dst
515 * Configuration to merge to.
516 *
517 * config_src
518 * Configuration to merge config_dst with.
519 *
520 * preserve_source
521 * Specify whether config_src should be deleted or not after the merge
522 * operation.
523 *
524 * Returns:
525 * NB_OK on success, NB_ERR otherwise.
526 */
527extern int nb_config_merge(struct nb_config *config_dst,
528 struct nb_config *config_src, bool preserve_source);
529
530/*
531 * Replace one configuration by another.
532 *
533 * config_dst
534 * Configuration to be replaced.
535 *
536 * config_src
537 * Configuration to replace config_dst.
538 *
539 * preserve_source
540 * Specify whether config_src should be deleted or not after the replace
541 * operation.
542 */
543extern void nb_config_replace(struct nb_config *config_dst,
544 struct nb_config *config_src,
545 bool preserve_source);
546
547/*
548 * Edit a candidate configuration.
549 *
550 * candidate
551 * Candidate configuration to edit.
552 *
553 * nb_node
554 * Northbound node associated to the configuration being edited.
555 *
556 * operation
557 * Operation to apply.
558 *
559 * xpath
560 * XPath of the configuration node being edited.
561 *
562 * previous
563 * Previous value of the configuration node. Should be used only when the
564 * operation is NB_OP_MOVE, otherwise this parameter is ignored.
565 *
566 * data
567 * New value of the configuration node.
568 *
569 * Returns:
570 * - NB_OK on success.
571 * - NB_ERR_NOT_FOUND when the element to be deleted was not found.
572 * - NB_ERR for other errors.
573 */
574extern int nb_candidate_edit(struct nb_config *candidate,
575 const struct nb_node *nb_node,
576 enum nb_operation operation, const char *xpath,
577 const struct yang_data *previous,
578 const struct yang_data *data);
579
580/*
581 * Check if a candidate configuration is outdated and needs to be updated.
582 *
583 * candidate
584 * Candidate configuration to check.
585 *
586 * Returns:
587 * true if the candidate is outdated, false otherwise.
588 */
589extern bool nb_candidate_needs_update(const struct nb_config *candidate);
590
591/*
592 * Update a candidate configuration by rebasing the changes on top of the latest
593 * running configuration. Resolve conflicts automatically by giving preference
594 * to the changes done in the candidate configuration.
595 *
596 * candidate
597 * Candidate configuration to update.
598 *
599 * Returns:
600 * NB_OK on success, NB_ERR otherwise.
601 */
602extern int nb_candidate_update(struct nb_config *candidate);
603
604/*
605 * Validate a candidate configuration. Perform both YANG syntactic/semantic
606 * validation and code-level validation using the northbound callbacks.
607 *
608 * WARNING: the candidate can be modified as part of the validation process
609 * (e.g. add default nodes).
610 *
611 * candidate
612 * Candidate configuration to validate.
613 *
614 * Returns:
615 * NB_OK on success, NB_ERR_VALIDATION otherwise.
616 */
617extern int nb_candidate_validate(struct nb_config *candidate);
618
619/*
620 * Create a new configuration transaction but do not commit it yet. Only
621 * validate the candidate and prepare all resources required to apply the
622 * configuration changes.
623 *
624 * candidate
625 * Candidate configuration to commit.
626 *
627 * client
628 * Northbound client performing the commit.
629 *
630 * comment
631 * Optional comment describing the commit.
632 *
633 * transaction
634 * Output parameter providing the created transaction when one is created
635 * successfully. In this case, it must be either aborted using
636 * nb_candidate_commit_abort() or committed using
637 * nb_candidate_commit_apply().
638 *
639 * Returns:
640 * - NB_OK on success.
641 * - NB_ERR_NO_CHANGES when the candidate is identical to the running
642 * configuration.
643 * - NB_ERR_LOCKED when there's already another transaction in progress.
644 * - NB_ERR_VALIDATION when the candidate fails the validation checks.
645 * - NB_ERR_RESOURCE when the system fails to allocate resources to apply
646 * the candidate configuration.
647 * - NB_ERR for other errors.
648 */
649extern int nb_candidate_commit_prepare(struct nb_config *candidate,
650 enum nb_client client,
651 const char *comment,
652 struct nb_transaction **transaction);
653
654/*
655 * Abort a previously created configuration transaction, releasing all resources
656 * allocated during the preparation phase.
657 *
658 * transaction
659 * Candidate configuration to abort. It's consumed by this function.
660 */
661extern void nb_candidate_commit_abort(struct nb_transaction *transaction);
662
663/*
664 * Commit a previously created configuration transaction.
665 *
666 * transaction
667 * Configuration transaction to commit. It's consumed by this function.
668 *
669 * save_transaction
670 * Specify whether the transaction should be recorded in the transactions log
671 * or not.
672 *
673 * transaction_id
674 * Optional output parameter providing the ID of the committed transaction.
675 */
676extern void nb_candidate_commit_apply(struct nb_transaction *transaction,
677 bool save_transaction,
678 uint32_t *transaction_id);
679
680/*
681 * Create a new transaction to commit a candidate configuration. This is a
682 * convenience function that performs the two-phase commit protocol
683 * transparently to the user. The cost is reduced flexibility, since
684 * network-wide and multi-daemon transactions require the network manager to
685 * take into account the results of the preparation phase of multiple managed
686 * entities.
687 *
688 * candidate
689 * Candidate configuration to commit. It's preserved regardless if the commit
690 * operation fails or not.
691 *
692 * client
693 * Northbound client performing the commit.
694 *
695 * save_transaction
696 * Specify whether the transaction should be recorded in the transactions log
697 * or not.
698 *
699 * comment
700 * Optional comment describing the commit.
701 *
702 * transaction_id
703 * Optional output parameter providing the ID of the committed transaction.
704 *
705 * Returns:
706 * - NB_OK on success.
707 * - NB_ERR_NO_CHANGES when the candidate is identical to the running
708 * configuration.
709 * - NB_ERR_LOCKED when there's already another transaction in progress.
710 * - NB_ERR_VALIDATION when the candidate fails the validation checks.
711 * - NB_ERR_RESOURCE when the system fails to allocate resources to apply
712 * the candidate configuration.
713 * - NB_ERR for other errors.
714 */
715extern int nb_candidate_commit(struct nb_config *candidate,
716 enum nb_client client, bool save_transaction,
717 const char *comment, uint32_t *transaction_id);
718
1a4bc045
RW
719/*
720 * Iterate over operetional data.
721 *
722 * xpath
723 * Data path of the YANG data we want to iterate over.
724 *
725 * translator
726 * YANG module translator (might be NULL).
727 *
728 * flags
729 * NB_OPER_DATA_ITER_ flags to control how the iteration is performed.
730 *
731 * cb
732 * Function to call with each data node.
733 *
734 * arg
735 * Arbitrary argument passed as the fourth parameter in each call to 'cb'.
736 *
737 * Returns:
738 * NB_OK on success, NB_ERR otherwise.
739 */
740extern int nb_oper_data_iterate(const char *xpath,
741 struct yang_translator *translator,
742 uint32_t flags, nb_oper_data_cb cb, void *arg);
743
1c2facd1
RW
744/*
745 * Validate if the northbound operation is valid for the given node.
746 *
747 * operation
748 * Operation we want to check.
749 *
750 * snode
751 * libyang schema node we want to check.
752 *
753 * Returns:
754 * true if the operation is valid, false otherwise.
755 */
756extern bool nb_operation_is_valid(enum nb_operation operation,
757 const struct lys_node *snode);
758
759/*
760 * Send a YANG notification. This is a no-op unless the 'nb_notification_send'
761 * hook was registered by a northbound plugin.
762 *
763 * xpath
764 * XPath of the YANG notification.
765 *
766 * arguments
767 * Linked list containing the arguments that should be sent. This list is
768 * deleted after being used.
769 *
770 * Returns:
771 * NB_OK on success, NB_ERR otherwise.
772 */
773extern int nb_notification_send(const char *xpath, struct list *arguments);
774
775/*
776 * Return a human-readable string representing a northbound event.
777 *
778 * event
779 * Northbound event.
780 *
781 * Returns:
782 * String representation of the given northbound event.
783 */
784extern const char *nb_event_name(enum nb_event event);
785
786/*
787 * Return a human-readable string representing a northbound operation.
788 *
789 * operation
790 * Northbound operation.
791 *
792 * Returns:
793 * String representation of the given northbound operation.
794 */
795extern const char *nb_operation_name(enum nb_operation operation);
796
797/*
798 * Return a human-readable string representing a northbound error.
799 *
800 * error
801 * Northbound error.
802 *
803 * Returns:
804 * String representation of the given northbound error.
805 */
806extern const char *nb_err_name(enum nb_error error);
807
808/*
809 * Return a human-readable string representing a northbound client.
810 *
811 * client
812 * Northbound client.
813 *
814 * Returns:
815 * String representation of the given northbound client.
816 */
817extern const char *nb_client_name(enum nb_client client);
818
819/*
820 * Initialize the northbound layer. Should be called only once during the
821 * daemon initialization process.
822 *
823 * modules
824 * Array of YANG modules to parse and initialize.
825 *
826 * nmodules
827 * Size of the modules array.
828 */
fbdc1c0a 829extern void nb_init(struct thread_master *tm, const struct frr_yang_module_info *modules[],
1c2facd1
RW
830 size_t nmodules);
831
832/*
833 * Finish the northbound layer gracefully. Should be called only when the daemon
834 * is exiting.
835 */
836extern void nb_terminate(void);
837
838#endif /* _FRR_NORTHBOUND_H_ */