Forum Discussion
Retrieve virtual Server config using f5-SDK
Hi,
I am trying to retrieve virtual server config using sdk python module. Like (tmsh list /ltm virtual /Common/test-2).
I was able to do with below if keep static value (partition/VIP name).
vip_config_backup=b.tm.util.bash.exec_cmd("run",utilCmdArgs='-c "tmsh list /ltm virtual /Common/test-2"')
But i want to pass the partition and VIP name dynamically ? is there another way to achieve this or better way. I almost complete the script but stuck here. Any help would be appreciated.
Vip =test-2
partition=Common
vip_config_backup=b.tm.util.bash.exec_cmd("run",utilCmdArgs='-c "tmsh list /ltm virtual /Vip/partition"')
Thanks in Advance
AN
2 Replies
- amintej_297711
Nimbostratus
I used pyhton argparse for retreive user input, example:
parser = argparse.ArgumentParser(description='Script for getting big ip informtation') parser.add_argument("partition", help="Big ip partition") parser.add_argument("virtualserver", help="Big ip user") args = parser.parse_args() Parse input arguments args = parser.parse_args() partition = args.partition virtualserver = args.virtualserver
- PeteWhite
Employee
You're using iControl to run a tmsh command to retrieve the VS config. This is not the way to do it - use the SDK to retrieve the virtual server config directly:
vip_config_backup=b.tm.ltm.virtuals.virtual.load(name='test-2')
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com