Forum Discussion
andy_12_5042
Nimbostratus
Jul 19, 2011create a pool with members
For some reason I will hit these walls every once in a while as I have to keep wrapping my head around the best way to implement something with pycontrol.
I am trying to figure out the ...
andy_12_5042
Nimbostratus
Jul 20, 2011getting closer but this is probably not the best way to go about it:
I can do something like this to create multiple IPPortDefinition and then wrap into another instance with sequence and call create pool
l=[ p.typefactory.create('Common.IPPortDefinition') for count in xrange(2)]
ip=[1'1.1.1.','2.2.2.2']
for x,y in zip(l,ip):
x.address=y
x.port=80
mem_seq=p.typefactory.create('Common.IPPortDefinition')
mem_seq.item=[l]
mem_seq.item
pool="test"
lb_methods="LB_METHOD_DYNAMIC_RATIO "
pool=p.create(pool_names=[pool],lb_methods=[lb_methods],members=[mem_seq])
I know this is very ugly but the only purpose was to understand if I could create multiple instances and then create a pool with multiple members in a single web call using the create method. I can use this method to work with any call regardless of how many members there are or whatever. In the web call I will have to be able to feed in ips as a list and maybe do some work to clean it up. I think the biggest issue is my lack of experience with object orientation..... Once I clean everything up and get it to work via an http call to my web service, I will post back...
If anyone has a better way please post away as I am probably re-inventing the wheel here ...........
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects