Forum Discussion

Tim_18689's avatar
Tim_18689
Icon for Cirrus rankCirrus
Jan 18, 2013

Here is a basic example of pool creation using bigsuds

I am a novice at python and it was difficult for me to figure out the syntax for creating a pool using bigsuds. The examples on code share were a little advanced to help me when I was just starting out so I am posting very basic examples here that can be used to figure out the syntax when creating more advanced scripts using bigsuds.

 

 

This will create a pool, set a monitor, enable Priority Group activation, and set the priority group value for the members.

 

 

 

 

 

!/usr/bin/python

 

 

import bigsuds

 

 

set target system and supply login info

 

b = bigsuds.BIGIP(

 

hostname = '10.3.214.70',

 

username = 'admin',

 

password = 'admin',

 

)

 

 

make members

 

b.LocalLB.Pool.create_v2(

 

pool_names = ['fake2'],

 

lb_methods = ['LB_METHOD_ROUND_ROBIN'],

 

members = [[

 

{'address': '10.1.212.233', 'port': '80'},

 

{'address': '10.1.212.234', 'port': '80'},

 

{'address': '10.1.212.235', 'port': '80'},

 

{'address': '10.1.212.236', 'port': '80'},

 

{'address': '10.1.212.237', 'port': '80'}

 

]]

 

)

 

 

adding monitor to pool

 

b.LocalLB.Pool.set_monitor_association(

 

monitor_associations = [{'monitor_rule': {'monitor_templates': ['/Common/http'], 'quorum': 0,'type': 'MONITOR_RULE_TYPE_SINGLE'},'pool_name': 'fake2'}]

 

)

 

 

 

adding "Priority Group Activation" value

 

b.LocalLB.Pool.set_minimum_active_member(

 

pool_names = ['fake2'],

 

values = ['2']

 

)

 

 

 

setting the priority group membership for pool members

 

b.LocalLB.Pool.set_member_priority(

 

pool_names = ['fake2'],

 

members = [[

 

{'address': '10.1.212.233', 'port': '80'},

 

{'address': '10.1.212.234', 'port': '80'},

 

{'address': '10.1.212.235', 'port': '80'},

 

{'address': '10.1.212.236', 'port': '80'},

 

{'address': '10.1.212.237', 'port': '80'}

 

]],

 

priorities = [[10, 10, 10, 5, 5 ]]

 

)

 

 

 

No RepliesBe the first to reply