#include "northbound.h"
-struct cli_config_change {
- /*
- * XPath (absolute or relative) of the configuration option being
- * edited.
- */
- char xpath[XPATH_MAXLEN];
-
- /*
- * Operation to apply (either NB_OP_CREATE, NB_OP_MODIFY or
- * NB_OP_DELETE).
- */
- enum nb_operation operation;
-
- /*
- * New value of the configuration option. Should be NULL for typeless
- * YANG data (e.g. presence-containers). For convenience, NULL can also
- * be used to restore a leaf to its default value.
- */
- const char *value;
-};
-
/* Possible formats in which a configuration can be displayed. */
enum nb_cfg_format {
NB_CFG_FMT_CMDS = 0,
extern struct nb_config *vty_shared_candidate_config;
-/* Prototypes. */
-extern int nb_cli_cfg_change(struct vty *vty, char *xpath_list,
- struct cli_config_change changes[], size_t size);
+/*
+ * Enqueue change to be applied in the candidate configuration.
+ *
+ * vty
+ * The vty context.
+ *
+ * xpath
+ * XPath (absolute or relative) of the configuration option being edited.
+ *
+ * operation
+ * Operation to apply (either NB_OP_CREATE, NB_OP_MODIFY or NB_OP_DELETE).
+ *
+ * value
+ * New value of the configuration option. Should be NULL for typeless YANG
+ * data (e.g. presence-containers). For convenience, NULL can also be used
+ * to restore a leaf to its default value.
+ */
+extern void nb_cli_enqueue_change(struct vty *vty, const char *xpath,
+ enum nb_operation operation,
+ const char *value);
+
+/*
+ * Apply enqueued changes to the candidate configuration.
+ *
+ * vty
+ * The vty context.
+ *
+ * xpath_base_fmt
+ * Prepend the given XPath (absolute or relative) to all enqueued
+ * configuration changes.
+ *
+ * Returns:
+ * CMD_SUCCESS on success, CMD_WARNING_CONFIG_FAILED otherwise.
+ */
+extern int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt,
+ ...);
+
+/*
+ * Execute a YANG RPC or Action.
+ *
+ * xpath
+ * XPath of the YANG RPC or Action node.
+ *
+ * input
+ * List of 'yang_data' structures containing the RPC input parameters. It
+ * can be set to NULL when there are no input parameters.
+ *
+ * output
+ * List of 'yang_data' structures used to retrieve the RPC output parameters.
+ * It can be set to NULL when it's known that the given YANG RPC or Action
+ * doesn't have any output parameters.
+ *
+ * Returns:
+ * CMD_SUCCESS on success, CMD_WARNING otherwise.
+ */
extern int nb_cli_rpc(const char *xpath, struct list *input,
struct list *output);
+
+/*
+ * Show CLI commands associated to the given YANG data node.
+ *
+ * vty
+ * The vty terminal to dump the configuration to.
+ *
+ * dnode
+ * libyang data node that should be shown in the form of CLI commands.
+ *
+ * show_defaults
+ * Specify whether to display default configuration values or not.
+ */
extern void nb_cli_show_dnode_cmds(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+
+/* Prototypes of internal functions. */
+extern void nb_cli_confirmed_commit_clean(struct vty *vty);
+extern int nb_cli_confirmed_commit_rollback(struct vty *vty);
extern void nb_cli_install_default(int node);
-extern void nb_cli_init(void);
+extern void nb_cli_init(struct thread_master *tm);
extern void nb_cli_terminate(void);
#endif /* _FRR_NORTHBOUND_CLI_H_ */