Forum Discussion
tatmotiv
Jun 01, 2016Cirrostratus
Object path for list of partitions in python SDK
Hi all,
I'm trying to get the list of partitions of a BigIP using the f5-Python-SDK. In tmsh, the objects are located under auth/partition, so e.g. "tmsh list auth partition" will list the accordin...
tatmotiv
Jun 02, 2016Cirrostratus
I put that into a separate answer for anybody's convenience because formatting in comments sucks. Maybe this will be useful for someone else, too...
Going with the sys/folder resource in order to address this now. However, there are some differences between a system folder and a partition:
- The system folder "/" does not map to any partition
- When polling the system folders via iControl REST, separate folders for iApps are given back, which do not map to any partition. Confusingly, those iApp-folders are not listed when running "tmsh list sys folders" on the machine directly.
You can see what I mean when comparing
curl -sk -u admin:xxxxxxxxx https://my-lb/mgmt/tm/sys/folder | python -mjson.tool | grep name
"name": "/",
"name": "Common",
"name": "backup2.app", <--- !
"name": "backup_scf.app", <--- !
"name": "PA995-LBSS-Test",
"name": "PA997-Test1",
"name": "PA998-Test2",
"name": "PA999-Test1",
to
(/)(tmos) list sys folder | grep folder
sys folder / {
sys folder Common {
sys folder PA995-LBSS-Test {
sys folder PA997-Test1 {
sys folder PA998-Test2 {
sys folder PA999-Test1 {
and
(/)(tmos) list auth partition | grep partition
auth partition Common {
auth partition PA995-LBSS-Test {
auth partition PA997-Test1 {
auth partition PA998-Test2 { }
auth partition PA999-Test1 {
Putting all of this together, this is basically how to get a list of partitions using the python SDK (at least it works out for me):
>>> list_of_partitions = []
>>> for folder in session.sys.folders.get_collection():
... if not folder.name == "/" and not folder.name.endswith(".app"):
... list_of_partitions.append(folder.name)
...
>>> print list_of_partitions
[u'Common', u'PA995-LBSS-Test', u'PA997-Test1', u'PA998-Test2', u'PA999-Test1']
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects