Forum Discussion

verlocs_96134's avatar
verlocs_96134
Icon for Nimbostratus rankNimbostratus
Apr 03, 2012

SNATPool create_v2 Translation Address argument

What I'm using: pycontrol on python 2.6

 

What I'm talking to: bigip v11

 

 

When I attempt to call the create_v2 command for SNATPool, I am providing an array of string for the snatpool name, and an array of array of string for the translation addresses. Regardless of what I provide for the translation address (string address or string ip address), my input is always being bounced with:

 

 

primary_error_code: 17236295

 

secondary_error_code: 0

 

error_string: 01070147:3: Snatpool /Common/****************(Obfuscated) must reference at least one translation address.

 

 

 

I've tried a number of variations to rule out possibilities of the input somehow being not in the right structure, as well as trying with a translation address already existing in f5. I've even created the translation address, called the translation address get_list method and stuck its output into an array and fed it into create.

 

 

I have also ruled out any issues with the addresses I am attempting to use, because I am successfully able to create the snatpool using the web ui.

 

 

All I'm left with is suspecting that the snatpool create_v2 method itself isn't working.

 

 

  • Resolved.

     

     

    Documentation is incorrect.

     

     

    https://devcentral.f5.com/wiki/iControl.LocalLB__SNATPool.ashx

     

     

    Although the create_v2 method is supposed to be accepting String [] [], it does not succeed with that input. Using IPAddressSequenceSequence is successful.

     

     

    I suspect that the person who "updated" the create method into create_v2, well... didn't.

     

  • Hi Verlocs,

     

     

    This doesn't sound right to me, so I would like to find out more about what you're experiencing. Would you post exactly the steps you did?

     

     

    Are you sure you have the updated wsdl? You said you were using create_v2, so it seems you could not be using old wsdl for this or mistakenly using create, which does take the argument type you said worked in create_v2.

     

     

    The translation_addresses argument to create_v2 is definitely a StringSeqSeq. Here's the WSDL. Does this match your wsdl? (see /usr/local/www/iControl/wsdl/LocalLB.SNATPool.wsdl for one way to look at it). Notice the create_v2 section. I use pycontrol 1.x, so I pass a string in either case (maybe you use the type factory thing to make the argument).

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    There is another thing we can do to debug it. You can turn on the iControl logging during your test so as to see what is getting handed to iControl as far as arguments. try

     

     

    tmsh mod sys db icontrol.loglevel value debug

     

    bigstart restart httpd

     

    tail -f /var/log/ltm | tee /tmp/1

     

     

    tmsh mod sys db icontrol.loglevel value none

     

     

     

    What I recommend is that you do the preceding logging once during your test where you pass the StringSeqSeq, and then once when you pass the IPAddressSeqSeq, and compare the log. You will be able to see what iControl thought you passed in each case.

     

     

    Another thing we can do is tcpdump what goes on the wire as far as SOAP but maybe that can wait.

     

     

    Todd Cromwell III

     

     

  • That did not get posted quite faithfully. I will try again. The wsdl is

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    and between the tail and tmsh I said - run your test, then press ctrl-c. and then after the last tmsh mod, go look at /tmp/1.

     

  • oh well. If you go look at your wsdl on the bigip you will see that create_v2 has StringSeqSeq for t_a arg.
  • Here is a session using pyControl 1.x.

     

     

    tmsh, create the trans addr:

     

    root@(localhost)(cfg-sync Standalone)(Active)(/Common)(tmos) create ltm snat-translation t4 address 10.1.1.4

     

     

    pycontrol 1.x, create the snat pool:

     

    >>> ls.LocalLB_SNATPool.create_v2(snat_pools=['sp4'], translation_addresses=[['t4']])

     

    {}

     

     

    tmsh, show what got created:

     

    [root@localhost:Active] iControl tmsh list ltm snatpool sp4

     

    ltm snatpool sp4 {

     

    members {

     

    t4

     

    }

     

    }

     

     

    logging during the iControl op:

     

    Apr 3 17:36:49 localhost debug iControlPortal.cgi[21524]: LocalLB:SNATPool::create_v2 called by user "admin"

     

    Apr 3 17:36:49 localhost debug iControlPortal.cgi[21524]: LocalLB: [0] Name: sp4

     

    Apr 3 17:36:49 localhost debug iControlPortal.cgi[21524]: LocalLB: [0] SNAT Pool: sp4

     

    Apr 3 17:36:49 localhost debug iControlPortal.cgi[21524]: LocalLB: [0] Translation Address: t4

     

    Apr 3 17:36:49 localhost debug iControlPortal.cgi[21524]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

     

    Notice with pycontrol 1.x you don't need a TypeFactory thing to make the arguments. Either way I pass a string, whether the argument is String or IPAddress. I do not know pyControl 2.x very well, but if you post what you are doing in pyControl 2.x, I can try to help. Do you use a TypeFactory?
  • As I said I do not use pyControl 2.x - I think 1.x is easier to use, because it doesn't ever require the typefactory thing (though it doesn't handle exceptions as well as 2.x). I haven't got a chance to test this yet (as a person I want to ask about it is not present), but apparently what is needed to do the nested arrays in 2.x is something like the following. Are you using the typefactory thing? If you aren't, perhaps that is your problem. Perhaps if you are trying to do it as I posted above for 1.x, your code may happen to work for StringSeqSeq because maybe that is a special case which I think might be allowed for strings where one can then avoid the typefactory thing (aided by: an IPAddress is really just a string as far as the wsdl goes). As I said, for pyControl 1.x, this is much easier because you can nest things with [[]] to your heart's content with no troubles.

     

     

    ictl = pyc.BIGIP(hostname=”1.2.3.4”, username=”admin”, password=”admin”, fromurl=True, wsdls=[“LocalLB.SNATPool”, …])

     

     

    tas = ictl.LocalLB.SNATPool.typefactory.create(“Common.IPAddressSequenceSequence”)

     

    arr1 = ictl.LocalLB.SNATPool.typefactory.create(“Common.IPAddressSequence”)

     

    arr1.item = [“a”, “b”, “c”]

     

    arr2 = ictl.LocalLB.SNATPool.typefactory.create(“Common.IPAddressSequence”)

     

    arr2.item = [“d”, “e”, “f”]

     

     

    tas.item = [arr1, arr2] this is apparently like [[a, b, c], [d, e, f]] in pyControl 1.x

     

     

    ictl.LocalLB.SNATPool.create_v2([“sp1”, ”sp2”], tas)

     

     

    As I said, this may or may not be quite right but something like that is apparently needed. In any case the logging described above will help tell what iControl is seeing internally.
  • Hi Todd,

     

     

    You should be able to preserve the XML tags using [ code ] [/ code ] blocks:

     

     

    
    https://bigip11/iControl/iControlPortal.cgi?WSDL=LocalLB.SNATPool
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

     

     

    Aaron
  • Yep, that worked, in pycontrol 2.x, as follows:

    
    >>> tas = ictl.LocalLB.SNATPool.typefactory.create("Common.IPAddressSequenceSequence")
    >>> arr1 = ictl.LocalLB.SNATPool.typefactory.create("Common.IPAddressSequence")
    >>> arr1.item = ["10.1.1.8"]
    >>> tas.item=[arr1]
    >>> ictl.LocalLB.SNATPool.create_v2(["sp8"],tas)
    
    [root@localhost:Active] iControl  tmsh list ltm snatpool sp8
    ltm snatpool sp8 {
        members {
            10.1.1.8
        }
    }
     

    So with the proper coding in pyControl 2.x, the IPAddress type works as expected. As I said I do not like the type factory thing; pyControl 1.x did not require it.