13-Apr-2020 20:10
is there any way to get pool member configuration with single rest api request instead of one by one ,or if there any batch request of pool member configuration
14-Apr-2020
00:20
- last edited on
21-Nov-2022
16:23
by
JimmyPackets
Hello caulfiedd spurred.
The next SDK command is equivalent to this REST query
pools = session.tm.ltm.pools.get_collection()
#REST query --> https:// <F5_mgmt_IP>/mgmt/tm/ltm/pool
If you check the REST query manually, you will see that the output is next:
{
"kind": "tm:ltm:pool:poolcollectionstate",
"selfLink": "https://localhost/mgmt/tm/ltm/pool?ver\u003d12.1.5",
"items": [
{
"kind": "tm:ltm:pool:poolstate",
"name": "P-AKIRA_80",
"partition": "Common",
"fullPath": "/Common/P-AKIRA_80",
"generation": 293,
"selfLink": "https://localhost/mgmt/tm/ltm/pool/~Common~P-AKIRA_80?ver\u003d12.1.5",
"allowNat": "yes",
"allowSnat": "yes",
"ignorePersistedWeight": "disabled",
"ipTosToClient": "pass-through",
"ipTosToServer": "pass-through",
"linkQosToClient": "pass-through",
"linkQosToServer": "pass-through",
"loadBalancingMode": "round-robin",
"minActiveMembers": 0,
"minUpMembers": 0,
"minUpMembersAction": "failover",
"minUpMembersChecking": "disabled",
"monitor": "/Common/gateway_icmp",
"queueDepthLimit": 0,
"queueOnConnectionLimit": "disabled",
"queueTimeLimit": 0,
"reselectTries": 0,
"serviceDownAction": "none",
"slowRampTime": 10,
"membersReference": {
"link": "https://localhost/mgmt/tm/ltm/pool/~Common~P-AKIRA_80/members?ver\u003d12.1.5",
"isSubcollection": true
}
},
...<REST OF POOL INSTANCES>
}
As you can see above, you are collecting the whole information of the pool configuration, but not about the pool members, which is a subcollection and it should be gathered individualy
"membersReference": {
"link": "https://localhost/mgmt/tm/ltm/pool/~Common~P-AKIRA_80/members?ver\u003d12.1.5",
"isSubcollection": true
}
If you want to know more about the pool members, you should query them using this next code (in the comment I show you the underlying REST query)
for pool in pools:
print("Pool: {}".format(pool.name))
for member in pool.members_s.get_collection():
#REST query --> https:// <F5_mgmt_IP>/mgmt/tm/ltm/pool/<pool_name>/members
print("Member: {}".format(member.name))
Let me know if this is helpful.
KR,
Dario.
14-Apr-2020
04:33
- last edited on
04-Jun-2023
21:30
by
JimmyPackets
I don't know in python, but with the Java SDK, there is a method to get the members of an array of pools :
String pool[]=new String[20] ; //Your array of pool here
CommonAddressPort PoolMember[][]==icInterfaces.getLocalLBPool().get_member_v2(pool) ;
So maybe there is something similar in python.