Forum Discussion

paul_dawson_258's avatar
Icon for Nimbostratus rankNimbostratus
Jun 06, 2018

Query to retrieve VIP name from Node IP input

Hi, We are doing a DC migration and have the need to retrieve a list of VIP names based on the server/node IP address. I was wondering if anyone has written a script which does this already. I would ...
  • Jason_Nance_333's avatar
    Jun 06, 2018

    This should do it, though it is fairly resource-intensive if you have a lot of virtual servers / pools / nodes:

    !/usr/bin/env python3
    from f5.bigip import ManagementRoot
    from getpass import getpass
    from pprint import pprint
    hostname = ''
    username = 'foo'
    node_ips = ['',', '']
    mgmt = ManagmentRoot(hostname, username, getpass())
     Get node names that have IPs in the list
    nodes = []
    for node in
        if node.address in node_ips:
             fullPath is /PARTITION/NAME
     Get pool names which nodes in list belong
    pools = []
    for pool in
        members = pool.members_s.get_collection()
        for member in members:
             Member fullpath is '/PARTITION/NODENAME:SERVICE_PORT'
            if member.fullPath.split(':')[0] in nodes:
     Get virtual server names which pools in list belong
    virtuals = []
    for virtual in
        if hasattr(virtual, 'pool') and virtual.pool in pools: