vty: Check with the application before writing the config

For the BSC/NITB application we see that people modify the band
without modifying the ARFCN. This creates an unbootable config.
Using the new hook the BSC/NITB can check if the config is
consistent and prevent the config file being written.

Related: SYS#739
This commit is contained in:
Holger Hans Peter Freyther 2014-11-21 10:40:07 +01:00
parent e15ac060e7
commit 9f0f978c8d
3 changed files with 12 additions and 0 deletions

View File

@ -1,2 +1,3 @@
#library what description / commit summary line
libosmocore abi-change logging: Add ability to save/print current log filters
libosmovty abi-change vty: Check with the application before writing the config

View File

@ -159,6 +159,8 @@ struct vty_app_info {
enum node_type (*go_parent_cb)(struct vty *vty);
/*! \brief call-back to determine if node is config node */
int (*is_config_node)(struct vty *vty, int node);
/*! \brief Check if the config is consistent before write */
int (*config_is_consistent)(struct vty *vty);
};
/* Prototypes. */

View File

@ -2497,6 +2497,15 @@ DEFUN(config_write_file,
char *failed_file;
int rc;
if (host.app_info->config_is_consistent) {
rc = host.app_info->config_is_consistent(vty);
if (!rc) {
vty_out(vty, "Configuration is not consistent%s",
VTY_NEWLINE);
return CMD_WARNING;
}
}
if (host.config == NULL) {
vty_out(vty, "Can't save to configuration file, using vtysh.%s",
VTY_NEWLINE);