Update / Modify a Traffic Group of a Virtual Address using F5-SDK
Problem this snippet solves: I have an Active-Active LTM Deployment. Virtual Servers ( and Virtual Addresses ) are split between two units. I am trying to use F5-SDK to update traffic group so that VS/VA will move between two units. How to use this snippet: Environment Python : 3.6 F5 SDK : 3.0.20 LTM : 12.1.2 HF2 Code : from f5.bigip import ManagementRoot import sys # This will update a traffic group on a virtual address on the same bigip # Vars New_BigIP_IP = "10.10.10.10" Virt_Addr = "192.168.13.151" Traffic_Group = '/Common/traffic-group-2' # Connect f5_mgmt = ManagementRoot(New_BigIP_IP, username, password) # load Virtual Address v_a_info = f5_mgmt.tm.ltm.virtual_address_s.virtual_address.load(name=Virt_Addr,partition='Common') # Verify if traffic group needs to be updated if v_a_info.trafficGroup == Traffic_Group: print ("Traffic groups are same - no need to update - \nexiting ... ") sys.exit() #Capture the Old Traffic Group Old_Traffic_Group = v_a_info.trafficGroup print("\nOld Traffic Group : {} \nNew Traffic Group:}".format(Old_Traffic_Group,Traffic_Group)) input("Press any key to Continue.. ") # Update the New Traffic Group v_a_info.modify(trafficGroup=Traffic_Group) print ("== Traffic Group has been updated ==\n") Tested this on version: 12.1909Views0likes2Comments