pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-mgw/+/29791 )
Change subject: mgcp-client: Convert users supporting new MGW Pool VTY node during
write-config
......................................................................
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(-)
Approvals:
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c
b/src/libosmo-mgcp-client/mgcp_client_vty.c
index 76f8c4f..1672f97 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 supported 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
https://gerrit.osmocom.org/c/osmo-mgw/+/29791
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I2f6658cc66f8bcbd4a60ee2b932bb5dd65888233
Gerrit-Change-Number: 29791
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged