Have some code. Share some code.
Showing results for 
Search instead for 
Did you mean: 

Problem this snippet solves:

This python bigsuds script prints the list of pools using a specific node.

How to use this snippet: <hostname> <username> <nodename>

Script will prompt for password.

This will only search the Common partition.

Code :

#!/usr/bin/env python

__author__ = 'buzzsurfr'
__version__ = '0.2'

#  Standard Library
import sys
import re

#  Related Third-Party
import getpass

#  Local Application/Library Specific
from f5.bigip import ManagementRoot

if len(sys.argv) < 4:
print "\n\n\tUsage: %s host user node" % sys.argv[0]

#  Get login password from CLI
userpass = getpass.getpass()

#  Connect to BIG-IP
mgmt = ManagementRoot(sys.argv[1], sys.argv[2], userpass)

#  Get list of pools and pool members
pools =

#  Node to search for
node = sys.argv[3]
if len(node) < 8 or node[:8] != '/Common/':
node = '/Common/'+node
print "Pools using Node "+node

#  Iterate through pool member list (has a list of members per pool referenced) looking for node
for pool in pools:
    member_nodes = [member.fullPath.split(':')[0] for member in pool.members_s.get_collection()]
    if node in member_nodes:
        print "\t"

Tested this on version:

Version history
Last update:
‎20-May-2016 06:51
Updated by: