Forum Discussion

jordanjh1's avatar
jordanjh1
Icon for Nimbostratus rankNimbostratus
Mar 19, 2020

Set Protocol Profile (Server) And HTTP Profile (Server) via the SDK

I am trying to set the Protocol Profile (Server) and the HTTP Profile (Server) via the Python SDK. I am putting the profiles I want in a dictionary object.

profiles = {

"profiles": [ "f5-tcp-lan", "f5-tcp-progressive", "http_x_forward_for", "custom", "clientssl", "serverssl" ]

}

######THE ABOVE VALUES ARE IN THIS ORDER#####

#PROTOCOL PROFILE (Client)

#PROTOCOL PROFILE (Server)

#HTTP PROFILE (Client)

#HTTP PROFILE (Server)

#SSL Profile (Client)

#SSL Profile (Server)

##########################################

 

 

BIGIP_CONN = ManagementRoot("1.1.1.1","admin","123")

vip = BIGIP_CONN.tm.ltm.virtuals.get_collection()[1]

 

vip.update(**profiles)

 

When I do this I get the following error:

 

iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri: https://labf52:443/mgmt/tm/ltm/virtual/~Common~myvipname/

Text: '{"code":400,"message":"01070097:3: Virtual server /Common/myvipname lists duplicate profiles.","errorStack":[],"apiError":3}'

 

Even if I put the VIP at all defaults with none of these profiles it still throws the error

  • I think you need to delete the profiles first then proceed with adding the new ones.

    My assumption is that the F5 is seeing you trying to add two HTTP profiles (client), two client SSL profiles, etc.

  • Yes, that is exactly what I was doing. I had to change the dictionary from just an array of profile names to a list of dictionaries with name/value pairs for the name of the profile and the context:

    FROM THIS

    profiles = {

    "profiles": [ "f5-tcp-lan", "f5-tcp-progressive", "http_x_forward_for", "custom", "clientssl", "serverssl" ]

    }

     

    TO THIS

     profiles = {

     

     "profiles": [ {"name": "f5-tcp-lan", "context": "clientside"},{"name": "f5-tcp-progressive", "context": "server

     side"}, {"name": "http_x_forward_for", "context": "clientside"}, {"name":"custom", "context": "all"}, {"name":

     "clientssl", "context": " clientside"}, {"name": "serverssl", "context": "serverssl"} ]

     

     }