Forum Discussion

Brooke_Gravitt_'s avatar
Brooke_Gravitt_
Icon for Nimbostratus rankNimbostratus
Nov 16, 2011

LocalLB::Pool::create - How to create a pool ala bigpipe

Hello!

 

 

I'm trying to use the SOAP API to replace some bigpipe commands. Currently, we're automagically configuring the BIG-IP for environments at order time with our custom private cloud. Our automated process currently ssh's to the F5 and runs specific bigpipe commands depending on what configuration the customer orders ( pools, members, SSL, iRule versions, etc. ) For example, we loop through creating all the base elements based on a stored DB config for an "environment"

 

 

 

As such, we've got some singleton commands ( in this case, an empty pool. )

 

 

 

e.g.

 

bigpipe pool $BigIpCreatePool.PoolName { monitor all tcp }

 

 

 

Multiple calls to this based on how many pools this env should have ( e.g. select bigIPPoolName from bigIPEnvConfig; might return 3 pools for env type A, and 7 for env type B.)

 

 

 

I'd like to do the same using a soap call to ( iControl )LocalLB::Pool::create.

 

 

 

I can, if I specify pool members at creation time:

 

 

 

--- well, it seems you can't embed XML here. Rats! ---

 

 

 

soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

 

soap:Body

 

create xmlns="urn:iControl:LocalLB/Pool"

 

pool_names soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"

 

item xsi:type="xsd:string"scooby_doo/item

 

/pool_names

 

lb_methods soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"

 

item xsi:type="xsd:string"LB_METHOD_ROUND_ROBIN/item

 

/lb_methods

 

members soapenc:arrayType="soapenc:Array[1]" xsi:type="soapenc:Array"

 

item soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"

 

item

 

address xsi:type="xsd:string"11.48.7.236/address

 

port xsi:type="xsd:int"8080/port

 

/item

 

/item

 

/members

 

/create

 

/soap:Body

 

/soap:Envelope

 

 

 

I can't see a way to create just an empty pool - we'll be looping through adding the members later, some of the process is asynchronous - I may or may not know the complete list of nodes up front, due to the existing automated process ( and some external integration points. )

 

 

3 Replies

  • George_Watkins_'s avatar
    George_Watkins_
    Historic F5 Account

    Hi Brooke,

     

     

     

    I can't tell which SOAP library you're using so I'll give a couple different examples. There is an example written in Perl in the CodeShare: Perl Create Pool. If you're into Ruby, you can download the Ruby Library, install it (or just 'gem unpack' to extract the contents), and locate a sample script called 'create-http-virtual-and-pool.rb' in the 'examples' folder. That script is full of sanity checking goodies that will make your life easier.

     

     

     

    -George

     

  • HI! Thanks for the reply. It isn't that I can't create a pool ( the SOAP XML in my post works just fine. )

     

     

    BTW, I am not using *ANY* of the libraries, we'll be communicating directly with iControl from an ESB via SOAP.

     

     

     

    The question is how can I create just an *empty* pool. The iControl SOAP API is expecting

     

     

     

    -Pool Name

     

    -Load Balancing Type

     

    -Member List ( [ Member IP, Port ] )

     

     

     

    I'd like to create the pools, empty, as we do now ( via bigpipe,) and add the members later. If it's not possible, I'll have to add a dummy pool member and remove it later.

     

     

     

     

     

     

  • To create a pool with no members, you'll just need to pass in the following parameters

     

     

    string [] pool_names - array size 1 with the value of the pool name

     

    LBMethod [] lb_methods - array size 1 with value of lb method

     

    IPPortDefinition[][] members - 2-d array with 1st degree of size 1 (for the supplied pool) an the second degree with size 0 (for no members).

     

     

    This can be done with the following perl code:

     

     

    
    @MemberDefA;
    push @memberDefAofA, [@memberDefA];
      
    $soapResponse = $Pool->create(
      SOAP::Data->name(pool_names => [$sPool]),
      SOAP::Data->name(lb_methods => ["LB_METHOD_ROUND_ROBIN"]),
      SOAP::Data->name(members => [@memberDefAofA])
    );
    &checkResponse($soapResponse);

     

     

    This will result in the following SOAP message (with angle brackets replaced by brackets)

     

     

    
    [soap:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"]
      [soap:Body]
        [create xmlns="urn:iControl:LocalLB/Pool"]
          [pool_names soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"]
            [item xsi:type="xsd:string"]foopool[/item]
          [/pool_names]
          [lb_methods soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array"]
            [item xsi:type="xsd:string"]LB_METHOD_ROUND_ROBIN[/item]
          [/lb_methods]
          [members soapenc:arrayType="soapenc:Array[1]" xsi:type="soapenc:Array"]
            [item soapenc:arrayType="xsd:anyType[0]" xsi:type="soapenc:Array" /]
                  [/members]
        [/create]
      [/soap:Body]
    [/soap:Envelope]

     

     

    Hope this helps...

     

     

    -Joe