Forum Discussion

amintej's avatar
amintej
Icon for Cirrus rankCirrus
Mar 22, 2018

F5 SDK: How to create VS with SNAT pool setting?

Hello guys,

 

How can I create virtual server with SNAT Pool setting ? I want to include snat setting in my code:

 

mgmt.tm.ltm.virtuals.virtual.create(name=vs_name,destination=vs_destination,ipProtocol='tcp',pool=p_name)

1 Reply

  • Hi amintej,

    You can do something like this:

    if snatNone:
      virtual.sourceAddressTranslation = {"type" : "none"}
      
    if snatPool:
      virtual.sourceAddressTranslation = {"type" : "snat", "pool" : poolname }
    
    if automap:
      virtual.sourceAddressTranslation = {"type" : "automap" }
    

    Remember to call virtual.update() after making modifications to the virtual object (not just SNAT!)