I'm pulling my hair out because of the following problem.
I need to deploy a VIP automatically, using a Python script. It is basically only a POST against the /api/vsvip API, by using the Python requests module.
I have previously created some other objects this way without issues, like a Cloud or Pool.
The problem I am facing now is, that every time I use POST to create a VIP, I get an error 400 as response with the message: "error": "VrfContext not found"
However, when I take the payload and copy it into the Swagger UI and POST it there, it works fine. The same user account is used. The VRF Context is passed as a "vrf_context_ref" attribute in the payload and is 100% correct.
Another test I did was to create a VIP using the Controller UI, capture the payload using the browsers' developer mode and use this payload as a variable value for the payload in the Python script. With this, I also get the same error as above.
Here is the payload I used for testing:
{
"east_west_placement": false,
"cloud_ref": "https://controller_url/api/cloud/cloud-2d7450ed-aa93-45d4-ada9-0fc2496f5d41#cloud_name",
"dns_info": [
{
"type": "DNS_RECORD_A",
"algorithm": "DNS_RECORD_RESPONSE_CONSISTENT_HASH",
"fqdn": "vip1.mydomain.local"
}
],
"vip": [
{
"enabled": true,
"auto_allocate_ip": true,
"auto_allocate_floating_ip": false,
"avi_allocated_vip": false,
"avi_allocated_fip": false,
"auto_allocate_ip_type": "V4_ONLY",
"prefix_length": 32,
"ipam_network_subnet": {
"network_ref": "network_ref_from_ipam",
"subnet": {
"ip_addr": {
"addr": "10.1.1.0",
"type": "V4"
},
"mask": 27
}
},
"vip_id": 1
}
],
"bgp_peer_labels": [],
"vrf_context_ref": "https://controller_url/api/vrfcontext/vrfcontext-d20b9c13-ebd5-4e78-8b05-b215add157d9#T1-Gateway",
"tier1_lr": "/infra/tier-1s/T1-Gateway",
"name": "manualviptest"
}
Request URL: https://controller_url/api/vsvip
Is it a bug maybe?
I am out of ideas.