As documented at https://documentation.a10networks.com/ACOS/411x/411-P1/ACOS_4_1_1-P1/html/axapiv3/file.html I’m trying to upload text/plain files to use as axflex scripts or bw-lists.
So far I haven’t been able to POST files with any success. Each API call pushes the control CPU to 100% until the device has been rebooted.
Getting the authresponse signature, switching partitions and running clideploy commands all work like a charm.
I’ve tested my scripts on TH1030S running 4.1.1-P6 and vThunder running 4.1.4-GR1-P5.
As a last resort I tried to mimic the documented API call and configured the scripts to connect to ‘netcat’ instead of the A10 ADC to be able to see all headers and postdata:
# nc -l -p 888
POST /axapi/v3/file/aflex HTTP/1.1
Host: 127.0.0.1:888
Accept: */*
Authorization: A10 61916a9b734956575c34ae00d28fd7
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryHf1lBo4wM6uXCQm3
Content-Length: 468
------WebKitFormBoundaryHf1lBo4wM6uXCQm3
Content-Disposition: form-data; name="json"; filename="blob"
Content-Type: application/json
{"aflex":{"file":"abc","file-handle":"aflex-script.txt","action":"import"}}
------WebKitFormBoundaryHf1lBo4wM6uXCQm3
Content-Disposition: form-data; name="file"; filename="aflex-script.txt"
Content-Type: text/plain
when HTTP_REQUEST {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
------WebKitFormBoundaryHf1lBo4wM6uXCQm3--
###
API Client (php, curl, verbose enabled):
Debug output:
Headers:
Array
(
[0] => Authorization: A10 61e173c17e60458536e094240c9475
[1] => Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryHf1lBo4wM6uXCQm3
[2] => Content-Length: 468
)
Postdata:
------WebKitFormBoundaryHf1lBo4wM6uXCQm3
Content-Disposition: form-data; name="json"; filename="blob"
Content-Type: application/json
{“aflex”:{“file”:“abc”,“file-handle”:“aflex-script.txt”,“action”:“import”}}
------WebKitFormBoundaryHf1lBo4wM6uXCQm3
Content-Disposition: form-data; name="file"; filename="aflex-script.txt"
Content-Type: text/plain
when HTTP_REQUEST {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
------WebKitFormBoundaryHf1lBo4wM6uXCQm3–
CURL:
* Expire in 0 ms for 6 (transfer 0x5595ba964e30)
* Trying 10.100.4.80...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x5595ba964e30)
* Connected to 10.100.4.80 (10.100.4.80) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=vThunder
* start date: Apr 8 13:43:32 2016 GMT
* expire date: Apr 8 13:43:32 2018 GMT
* issuer: CN=vThunder
* SSL certificate verify result: self signed certificate (18), continuing anyway.
> POST /axapi/v3/file/aflex HTTP/1.1
Host: 10.100.4.80
Accept: */*
Authorization: A10 61e173c17e60458536e094240c9475
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryHf1lBo4wM6uXCQm3
Content-Length: 468
* upload completely sent off: 468 out of 468 bytes
This is when the CPU goes straight to 100% load and the client just keeps waiting for a response.
Any help would be appreciated!