]> git.proxmox.com Git - mirror_frr.git/blame - lib/northbound_cli.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / northbound_cli.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_CLI_H_
21#define _FRR_NORTHBOUND_CLI_H_
22
23#include "northbound.h"
24
1c2facd1
RW
25/* Possible formats in which a configuration can be displayed. */
26enum nb_cfg_format {
27 NB_CFG_FMT_CMDS = 0,
28 NB_CFG_FMT_JSON,
29 NB_CFG_FMT_XML,
30};
31
32extern struct nb_config *vty_shared_candidate_config;
33
a6233bfc
RW
34/*
35 * Enqueue change to be applied in the candidate configuration.
36 *
37 * vty
38 * The vty context.
39 *
40 * xpath
41 * XPath (absolute or relative) of the configuration option being edited.
42 *
43 * operation
44 * Operation to apply (either NB_OP_CREATE, NB_OP_MODIFY or NB_OP_DELETE).
45 *
46 * value
47 * New value of the configuration option. Should be NULL for typeless YANG
48 * data (e.g. presence-containers). For convenience, NULL can also be used
49 * to restore a leaf to its default value.
50 */
51extern void nb_cli_enqueue_change(struct vty *vty, const char *xpath,
52 enum nb_operation operation,
53 const char *value);
54
55/*
56 * Apply enqueued changes to the candidate configuration.
57 *
58 * vty
59 * The vty context.
60 *
61 * xpath_base_fmt
62 * Prepend the given XPath (absolute or relative) to all enqueued
63 * configuration changes.
64 *
65 * Returns:
66 * CMD_SUCCESS on success, CMD_WARNING_CONFIG_FAILED otherwise.
67 */
68extern int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt,
69 ...);
70
71/*
72 * Execute a YANG RPC or Action.
73 *
74 * xpath
75 * XPath of the YANG RPC or Action node.
76 *
77 * input
78 * List of 'yang_data' structures containing the RPC input parameters. It
79 * can be set to NULL when there are no input parameters.
80 *
81 * output
82 * List of 'yang_data' structures used to retrieve the RPC output parameters.
83 * It can be set to NULL when it's known that the given YANG RPC or Action
84 * doesn't have any output parameters.
85 *
86 * Returns:
87 * CMD_SUCCESS on success, CMD_WARNING otherwise.
88 */
1c2facd1
RW
89extern int nb_cli_rpc(const char *xpath, struct list *input,
90 struct list *output);
a6233bfc
RW
91
92/*
93 * Show CLI commands associated to the given YANG data node.
94 *
95 * vty
96 * The vty terminal to dump the configuration to.
97 *
98 * dnode
99 * libyang data node that should be shown in the form of CLI commands.
100 *
101 * show_defaults
102 * Specify whether to display default configuration values or not.
103 */
1c2facd1
RW
104extern void nb_cli_show_dnode_cmds(struct vty *vty, struct lyd_node *dnode,
105 bool show_defaults);
a6233bfc
RW
106
107/* Prototypes of internal functions. */
fbdc1c0a
RW
108extern void nb_cli_confirmed_commit_clean(struct vty *vty);
109extern int nb_cli_confirmed_commit_rollback(struct vty *vty);
1c2facd1 110extern void nb_cli_install_default(int node);
fbdc1c0a 111extern void nb_cli_init(struct thread_master *tm);
1c2facd1
RW
112extern void nb_cli_terminate(void);
113
114#endif /* _FRR_NORTHBOUND_CLI_H_ */