How To's - Interact with F5 BigIP using Python

How To's - Interact with F5 BigIP using Python

Hi there, this will be a short and basic script on how to interact with F5 using python (v3).

from f5.bigip import ManagementRoot

mgmt = ManagementRoot("192.168.12.3", "admin", "superpassword")

ltm = mgmt.tm.ltm

# Get a list of all virtual servers

print(f'{" Virtual servers  ":=^50}')

virtuals = ltm.virtuals.get_collection()

for virtual in virtuals:

    print(f"{virtual.name}")

    for vs in virtuals:

        print(" ->" , f"{vs.pool}")

# Get a list of all pools

print(f'{" Pool ":=^50}')

pools = ltm.pools.get_collection()

for pool in pools:

    print(pool.name)

    for member in pool.members_s.get_collection():

        print(" ->" , member.name)

# Get a list of all nodes

print(f'{" Nodes ":=^50}')

nodes = ltm.nodes.get_collection()

for node in nodes:

    print(f"{node.name}" " has a an IP of " f"{node.address}")

Result

No alt text provided for this image

And that’s it. 

I hope you enjoyed this post, leave your comments below and I'll see you on the next one.


Great job. May be you could add a function to see what certifications Https VIP has

Like
Reply

To view or add a comment, sign in

More articles by Silésio Carvalho

  • The Power of Visualization

    I am Silésio Carvalho, CCIE #65745 and I passed the CCIE lab exam on November 30 2021. If you paid attention to the…

    8 Comments
  • ForticlientEMS fails connection with Fortihate

    For those trying to play with Fortigate ZTNA, if you're using Fortigate on evaluation mode, one of the restrictions…

  • Why you won't become a CCIE

    I'm not the author for the text below but I wanted to share this with you, in case you're thinking about taking the…

    10 Comments
  • Trobleshoot SD-WAN – Part 2

    Hi there, in the last article we saw how to troubleshoot control connection failure on Cisco SD-WAN, caused by…

  • Trobleshoot SD-WAN – Part 1

    Hi there, While deploying Cisco SD-WAN you might face control connection errors related to certificate. Here are some…

  • Como eu começaria de novo, em Networking (Redes)?

    Estou nesta jornada a mais de uma década e até a data, tem sido uma caminhada nada fácil (por opção minha) mas muito…

    6 Comments
  • CCIE - The Plan

    Hi there, first of all, I’d like thank everyone for the congratulations messages. As a thank you back, I’ll share with…

    21 Comments
  • How To's - Deploy Checkpoint Remote Access VPN

    Hi there, in this post we'll see how to deploy remote access using Checkpoint Remote Access VPN client. Some…

    3 Comments
  • How To’s – Deploy DMVPN Front Door VRF (automating with ansible)

    Hi there, in this post we're going to deploy DMVPN Front Door VRF and using ansible. Basically, we'll be using DMVPN…

    1 Comment
  • How To’s – Deploy DMVPN Dual Hub Dual Cloud

    Hi there, in this post we’ll see how to deploy DMVPN Dual Hub Dual Cloud. Basically it means we’ll have two or more…

Insights from the community

Others also viewed

Explore topics