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 according configuration.
This is also reflected in iControl REST. Using curl, I can get that list of partitions by using the path /mgmt/tm/auth/partition as follows:
$ curl -sk -u admin:xxxxxxxxxxxx https://my_bigip/mgmt/tm/auth/partition | python -mjson.tool
{
"items": [
{
"defaultRouteDomain": 0,
"description": "Repository for system objects and shared objects.",
"fullPath": "Common",
"generation": 1,
"kind": "tm:auth:partition:partitionstate",
"name": "Common",
"selfLink": "https://localhost/mgmt/tm/auth/partition/Common?ver=11.6.0"
},
{
"defaultRouteDomain": 123,
"fullPath": "my_partition1",
"generation": 1,
"kind": "tm:auth:partition:partitionstate",
"name": "my_partition1",
"selfLink": "https://localhost/mgmt/tm/auth/partition/my_partition1?ver=11.6.0"
},
{
"defaultRouteDomain": 456,
"fullPath": "my_partition2",
"generation": 1,
"kind": "tm:auth:partition:partitionstate",
"name": "my_partition2",
"selfLink": "https://localhost/mgmt/tm/auth/partition/my_partition1?ver=11.6.0"
},
],
"kind": "tm:auth:partition:partitioncollectionstate",
"selfLink": "https://localhost/mgmt/tm/auth/partition?ver=11.6.0"
}
However, when trying to adopt that using the python SDK, I do not get the same results:
>>> from f5.bigip import BigIP
>>> session = BigIP('1.2.3.4', 'admin', 'xxxxxxxxxxxx')
>>> for partition in session.auth.partitions.get_collection():
... print partition.name
...
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/f5_sdk-0.1.5-py2.7.egg/f5/bigip/mixins.py", line 82, in __getattr__
raise AttributeError(error_message)
AttributeError: '' object has no attribute 'auth'
So, .auth.partitions (or .auth generally) does not seem to be the right entry point.
Does anybody know:
-
if there is a comprehensive list of mappings of tmsh / iControl REST / python SDK paths?
-
whether the whole auth tree is still missing in the python modules and will be added later?
-
what is the right way to get a list of partitions using the f5-python-SDK?
Any help is appreciated. Many thanks in advance!
Best regards
Martin