Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Node to Pool to VIP referencing in IControl

Hello,

Want to know how I gather info where node will reference to pools it's in, and pools assignments to VIP(s) NodeAddressV2.get_metadata supposed to give me this info, but I am getting empty list.

Thanks in advance

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Unless you're using metadata capable config (MCC) objects, you won't see that information. However, it's easy to build a reverse lookup using API.

Here's an example using python (bigsuds). For simplicity, I'm storing the list of pools and their members locally and using a known node name, but this can easily be iterated.

import bigsuds

#  Node to search for
node = '/Common/1.2.3.4'
print "Pools using Node "+node

#  Connect to BIG-IP
b = bigsuds.BIGIP(hostname, username, password)

#  Get list of pools and pool members
pools = b.LocalLB.Pool.get_list()
members = b.LocalLB.Pool.get_member_v2(pools)

#  Iterate through pool member list (has a list of members per pool referenced) looking for node
for i, pool in enumerate(pool_members):
    for member in pool:
        if member['address'] == node:
          print "\t"+pools[i]

and here's the same for Pools to Virtual Servers:

import bigsuds

#  Pool to search for
pool = '/Common/my_pool'
print "Virtual Servers using Pool "+pool

#  Connect to BIG-IP
b = bigsuds.BIGIP(hostname, username, password)

#  Get list of pools and pool members
virtual_servers = b.LocalLB.VirtualServer.get_list()
vs_pools = b.LocalLB.VirtualServer.get_default_pool_name(virtual_servers)

#  Iterate through pool member list (has a list of members per pool referenced) looking for node
for i, vs_pool in enumerate(vs_pools):
    if pool == vs_pool:
      print "\t"+virtual_servers[i]
0
Comments on this Answer
Comment made 29-Jan-2016 by stecino 56
Thanks for the feedback, I was trying to avoid having to do that :) This will be pretty expensive query every time i run it. I may have to cache for some short period of time vip and pool list to make this faster
0
Comment made 31-Jan-2016 by Theo 380
I actually offload to a MySQL database and give each property a "cache for" value. Thus it pulls certain data less often. This is just the "magic sauce" behind the program. Happy coding!
0