03-May-2021 19:32
Hello All,
I'm trying a lot for the automation. I'm finding a step to login to one device. I want my script to login to multiple device and to search for a pool member
Connect to the BigIP and configure the basic objectsmgmt = ManagementRoot("bigip.example.com", "admin", "somepassword")
Could you please help how can I use python sdk to login to multiple devices?
Regards,
Thiyagu
17-May-2021
12:16
- last edited on
04-Jun-2023
20:54
by
JimmyPackets
Hello Thiyagu.
Try this:
from f5.bigip import ManagementRoot
# ----------------------------------------------------------
sessions = []
devices = ["bigip1.example.com", "bigip2.example.com"]
poolmember = "mymember"
for device in devices:
session = ManagementRoot(device,"username","password",token=True)
sessions.append(session)
for session in sessions:
for pool in session.tm.ltm.pools.get_collection():
for member in pool.members_s.get_collection():
if member.name.split(':')[0] == poolmember:
print("Pool member \"{}\" detected in {}".format(poolmember, session.hostname))
Regards,
Dario.