F5Networks / f5-appsvcs-extension

F5 BIG-IP Application Services 3 Extension
Apache License 2.0
169 stars 54 forks source link

configuration via curl not working as expected #884

Closed MSlawik closed 1 month ago

MSlawik commented 1 month ago

Environment

Summary

Sending declaration through Postman is working, but throws an error using cURL.

Steps To Reproduce

Steps to reproduce the behavior:

Using Postman this is working on a blank configuration:

  1. POST https://{{cbip}}/mgmt/shared/appsvcs/declare { "class": "ADC", "schemaVersion": "3.0.0", "id": "generated-for-testing", "test": { "class": "Tenant", "application-a": { "class": "Application", "my-virtual-a": { "class": "Service_HTTP", "virtualAddresses": [ "10.1.2.1" ], "virtualPort": 80, "pool": "my-pool-a" }, "my-pool-a": { "class": "Pool", "members": [ { "servicePort": 80, "serverAddresses": [ "10.1.0.1", "10.1.0.2" ] } ] } } } }

When putting the body into a file and issuing this cURL, its working fine as well: curl -sku admin:password -H “Content-Type: application/json” -X POST -d @initapp https://192.168.0.219/mgmt/shared/appsvcs/declare

When adding a second app to the same tenant using Postman I end up with two apps in the "test" tenant - as expected. POST https://{{cbip}}/mgmt/shared/appsvcs/declare/test/applications/ { "schemaVersion": "3.0.0", "id": "generated-for-testing", "application-b": { "class": "Application", "my-virtual-b": { "class": "Service_HTTP", "virtualAddresses": [ "10.1.2.2" ], "virtualPort": 80, "pool": "my-pool-b" }, "my-pool-b": { "class": "Pool", "members": [ { "servicePort": 80, "serverAddresses": [ "10.1.0.1", "10.1.0.2" ] } ] } } }

But if I'm using a cURL command to add the second app I'm having issues. Again I'm adding the body in a second file (application) and use: curl -sku admin:password -H “Content-Type: application/json” -X POST -d @application https://192.168.0.219/mgmt/shared/appsvcs/declare/test/applications

But instead of adding a second VIP I'm getting this error: {"code":422,"message":"Invalid data property: Per-app declaration must contain at least one application","declaration":{}}

I'm not understanding why the first call is working using cURL but the second doesn't.

Thx, Marcus

mdditt2000 commented 1 month ago

Please submit an SR with F5 support and provide the number

MSlawik commented 1 month ago

Case # is 00704327.

Adam-Q commented 1 month ago

Hi Marcus, I believe you're using wrong double quote characters in: -H “Content-Type: application/json”

Can you try with this: -H "Content-Type: application/json"

MSlawik commented 1 month ago

Great catch Adam. That was the problem.