Getting Started with the f5-common-python SDK
If you have dabbled with python and iControl over the years, you might be familiar with some of my other “Getting Stared with …” articles on python libraries. I started my last, on Bigsuds, this way:...
Updated Jun 06, 2023
Version 2.0JRahm
Admin
Joined January 20, 2005
Muhammad_64435
Jun 04, 2018Nimbostratus
Thank you Jason for your prompt reply. I looked at Tim Rupp's modules and took your advise to use it to configure the new unit with Ansible. But still thinking to use f5-sdk to read the values from Old unit, create hosts-variable file for Ansible and then run it to configure the new unit. What do you think ?
Would you please help me again to check my code below which trying to find out how many profiles attached to the VIP :
BigIP Version : 12.1.2 HF2
The part of REST API response is below :
"profilesReference": {
"link": "https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles?ver=12.1.2",
"isSubcollection": true,
"items": [
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "http_XForwardedFor",
"partition": "Common",
"fullPath": "/Common/http_XForwardedFor",
"generation": 508,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles/~Common~http_XForwardedFor?ver=12.1.2",
"context": "all",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/http/~Common~http_XForwardedFor?ver=12.1.2"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "oneconnect",
"partition": "Common",
"fullPath": "/Common/oneconnect",
"generation": 508,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles/~Common~oneconnect?ver=12.1.2",
"context": "all",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/one-connect/~Common~oneconnect?ver=12.1.2"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "tcp-lan-optimized",
"partition": "Common",
"fullPath": "/Common/tcp-lan-optimized",
"generation": 508,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles/~Common~tcp-lan-optimized?ver=12.1.2",
"context": "serverside",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp-lan-optimized?ver=12.1.2"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "tcp-wan-optimized",
"partition": "Common",
"fullPath": "/Common/tcp-wan-optimized",
"generation": 508,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles/~Common~tcp-wan-optimized?ver=12.1.2",
"context": "clientside",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp-wan-optimized?ver=12.1.2"
}
},
{
"kind": "tm:ltm:virtual:profiles:profilesstate",
"name": "testvip-ssl",
"partition": "Common",
"fullPath": "/Common/testvip-ssl",
"generation": 508,
"selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles/~Common~testvip-ssl?ver=12.1.2",
"context": "clientside",
"nameReference": {
"link": "https://localhost/mgmt/tm/ltm/profile/client-ssl/~Common~testvip-ssl?ver=12.1.2"
}
}
]
}
}
My f5-sdk code is :
vip = mgmt.tm.ltm.virtuals.virtual.load(name='testvip', partition='Common')
print (vip.profilesReference)
for p in vip.profilesReference:
print (p)
Output is :
{'link': 'https://localhost/mgmt/tm/ltm/virtual/~Common~testvip/profiles?ver=12.1.2', 'isSubcollection': True}
link
isSubcollection
How can I get to "items" and then read the "name" of each item to identify which profile is attached to this VIP.
Thank you,
Muhammad