pespin has uploaded this change for review.
mgcp-client: Convert users supporting new MGW Pool VTY node during write-config
If the user (app) already supports the MGW Pool VTY command set
(mgcp_client_pool_vty_init() was called), then if single MGW mode is in
use it's because the config file was not updated to use the new MGW Pool
node. Let's convert it to the new format to help in transitioning to the
new VTY command set.
Related: SYS#5987
Change-Id: I2f6658cc66f8bcbd4a60ee2b932bb5dd65888233
---
M src/libosmo-mgcp-client/mgcp_client_vty.c
1 file changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/91/29791/1
diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c b/src/libosmo-mgcp-client/mgcp_client_vty.c
index 76f8c4f..d68c1c5 100644
--- a/src/libosmo-mgcp-client/mgcp_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -285,6 +285,11 @@
* \returns CMD_SUCCESS on success, CMD_WARNING on error */
int mgcp_client_config_write(struct vty *vty, const char *indent)
{
+ /* If caller supports MGW pool API (mgcp_client_pool_vty_init was
+ * called), then skip printing any config in this node and print it when
+ * the whole 'mgw' node is printed. */
+ if (global_mgcp_client_pool)
+ return CMD_SUCCESS;
return config_write(vty, indent, global_mgcp_client_conf);
}
@@ -339,6 +344,16 @@
config_write(vty, indent, &pool_member->conf);
}
+ /* MGW pool API is suppported by user (global_mgcp_client_pool is set
+ * because mgcp_client_pool_vty_init was called). If single MGW was
+ * configured through old VTY and no mgw in the new MGW pool VTY is
+ * replacing it, then output the single MGW converted to the new MGW
+ * pool VTY. */
+ if (llist_empty(&pool->member_list) && pool->mgcp_client_single) {
+ vty_out(vty, "%smgw 0%s", pool->vty_indent, VTY_NEWLINE);
+ config_write(vty, indent, global_mgcp_client_conf);
+ }
+
talloc_free(indent);
return CMD_SUCCESS;
}
To view, visit change 29791. To unsubscribe, or for help writing mail filters, visit settings.