cancel
Showing results for 
Search instead for 
Did you mean: 
JackofallTrades
Historic F5 Account

Problem this snippet solves:

This script is for adding Wide_IPs

Code :

import pycontrol.pyControl as pyControl

#Create the BigIP object

b = pyControl.BIGIP(hostname   = '10.10.10.10',
    username   = 'admin',
    password   = 'admin',
    wsdl_files = ['GlobalLB.WideIP']
    )

#Creat the WideIP,LB_Method and add pools. here we are setting the ratios for the pools    
d = b.GlobalLB_WideIP

try:
d.create(
              wide_ips = ['www.pycontrol.com'],
    lb_methods = ['LB_METHOD_GLOBAL_AVAILABILITY'],
  wideip_pools = [[{'order': 1, 'pool_name': 'pypool1', 'ratio': 1}]],
  wideip_rules = []

)


print "WideIP was Created."




except:print "WideIPcreate error. Check log."


#### This is the section where we are adding an alias to the WideIP.

try:
d.add_alias(
              wide_ips = ['www.pycontrol.com'],
      aliases  = [['ww2.pycontrol.com',
                           'ww3.pycontrol.com',   
                          'ww4.pycontrol.com',
                           'www.foo.com']]
      

)


print "WideIP-Alias was Created."




except:print "WideIP aslias create error. Check log.
Version history
Last update:
‎09-Mar-2015 12:24
Updated by:
Contributors