I am using F5 BIGIP v10.2.x with pyCotrol v2 and I’d like to ask how can I display all available pools and their assignment to partition. Output should be similar to the one I see from GUI (Partition:[All]) when I go to LocalTraffic->Pools. Is it possible with pyControl v2?
Thanks mhite. Unfortunately, call ‘set_recursive_query_state’ is not present on 10.2 and there seems to be no equivalent command (GlobalLB.Globals.set_use_recursion_bit_state is not the same). All others seems to be present: setting active folder → Management.Partition.set_active_partition and getting pool list → LocalLB.Pool.get_list.
In the meantime I did following code:
print '[*] available pools and partition assignments:'
partitionlist=f5.Management.Partition.get_partition_list()
poollist = f5.LocalLB.Pool.get_list()
print "%6s %50s %20s" % ("id", "pool", "partition")
for activepartition in partitionlist:
f5.Management.Partition.set_active_partition(activepartition.partition_name)
for pool in poollist:
try:
f5.LocalLB.Pool.get_object_status(pool_names = [pool])[0]
print "%6s %50s %20s" % (index, pool, activepartition.partition_name)
index=index+1
except:
continue
but as you can imagine it is taking too much time to complete (up to 3minutes with 4 partitions and 300 total pools).
Does anyone have better idea how to complete such assignment?
PS. When I go to Local Traffic → Pools, following call is being made:
This method is deprecated; please use System::Session::set_active_folder instead. Sets the active partition for the current user. The active partition is the administrative partition where all configuration will take place until a new active partition is selected. Each user can only be in one active partition at any given time. By default, if not explicitly set, the active partition for a user will be “Common”. Note: Please note that this method is deprecated. If you set the partition to “[All]”, this maps to the System::Session interface method set_active_folder(“/”) and in this case this method automatically performs set_recursive_query_state(STATE_ENABLED) as well. The method uses set_active_folder, so if the partition you specify maps to no existing top-level folder it will tell you the folder doesn’t exist and behave in all respects as set_active_folder does.
you will probably need to iterate through the known partitions and build your list that way. The UI combines methods to build the views that you need to do procedurally with iControl.