Forum Discussion

Ali_Hyder's avatar
Ali_Hyder
Icon for Nimbostratus rankNimbostratus
Sep 28, 2019

How to get the list of VIP Name, IP & Its Client SSL profile using Python SDK?

I am trying to get a list of Client SSL Profile configured to each VIP using Python SDK. I could able to gather information upto VIP name and IP, but looks like getting SSL profile attached to is not straight forward.

 

I need to do this using script as i have nearly 40+ Load Balancers with nearly 100 VIPs in each.

 

from f5.bigip import ManagementRoot

import getpass

 

user = input("Username:")

password = getpass.getpass("Password:")

f5_ip = '10.1.1.1'

partition = 'Common'

 

mgmt = ManagementRoot(f5_ip, user, password)

ltm = mgmt.tm.ltm

for virtual in virtuals:

print("VS {} IP {} Profile {}".format(virtual.name, virtual.destination, virtual.profilesReference)

 

 

ltm virtual ABC_VIP_443 {

  destination 10.2.2.2:https

  ip-protocol tcp

  mask 255.255.255.255

  pool ABC_Pool_8443

  profiles {

    serverssl {

      context serverside

    }

    wild_ABC_com {

      context clientside

    }

 

 

  • Hi Ali,

    from f5.bigip import ManagementRoot
    import getpass
     
    user = input("Username:")
    password = getpass.getpass("Password:")
    f5_ip = "10.1.1.1"
     
    mgmt = ManagementRoot(f5_ip, user, password)
     
    virtuals = mgmt.tm.ltm.virtuals.get_collection()
    for virtual in virtuals:
        client_ssl = "None"
        for profile in virtual.profiles_s.get_collection():
            if profile.context == "clientside":
                client_ssl = profile.name
        
        print("VS {} IP {} Profile {}".format(virtual.name, virtual.destination, client_ssl))