Forum Discussion
A_J_
Altostratus
Mar 09, 2022Creating a wideip using Python f5-sdk
Hello!
I am trying to create a wideip using the 'payload' method in python, drawing all the attributes from a JSON file but I keep getting the following error:
{ "code":400,"message":"one or more configuration identifiers must be provided","errorStack":[],"apiError":26214401}
I'm not sure what I'm missing. If anyone has a sample code or could take a look, it would be greatly appreciated!
JSON:
"testwideip.com": {
"wideipkind": "tm:gtm:wideip:a:astate",
"lbmode": "",
"ttl": 3600,
"pools": [
{
"p1": {
"kind": "tm:gtm:pool:a:astate",
"name": "p1,
"partition": "Common",
"order": 0
}
}
]
}
Python:
with open(filename, 'r') as fh:
content = json.load(fh)
wideip = "testwideip.com"
name = wideip
wideipkind = content[wideip]["wideipkind"]
lbmode = content[wideip]["lbmode"]
ttl = content[wideip]["ttl"]
pools = content[wideip]["pools"]
payload = {}
payload['name'] = name
payload['kind'] = wideipkind
if lbmode:
payload['poolLbMode'] = lbmode
payload['pools'] = pools
payload['ttlPersistence'] = ttl
mgmt.tm.gtm.wideips.a_s.a.create(**payload)
1 Reply
- Anesh
Cirrostratus
the f5 python SDK is no longer under active development. I would recommend using the native iControl REST API. i have an example in the blog post https://f5automation.xyz/articles/How-to-create-wideip-F5-GTM-DNS-using-Python