a10networks / acos-client

ACOS API Client
Apache License 2.0
35 stars 61 forks source link

vport updates on 4.0.3 sometimes returns error #108

Closed dougwig closed 4 years ago

dougwig commented 8 years ago

We might need to catch and maybe send '' or not None? Clearing templates will be tricky.

send: 'POST /axapi/v3/slb/virtual-server/e1ecdb70-2e0a-4451-9e47-2bde8c15ce0b/port/80+tcp HTTP/1.1\r\nHost: 10.90.100.
249\r\nContent-Length: 262\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: ACOS-Client-AGENT-1.3.1alph
a\r\nConnection: keep-alive\r\nContent-type: application/json\r\nAuthorization: A10 56d8e5f203ca3f262ef4a3d56c9570\r\n
\r\n{"port": {"service-group": "e1ecdb70-2e0a-4451-9e47-2bde8c15ce0b-PORT-80", "protocol": "tcp", "name": "c5d80c89-9a
55-4e4e-97ed-f50785d895e1", "auto": 1, "template-persist-source-ip": null, "extended-stats": 1, "port-number": 80, "te
mplate-persist-cookie": null}}'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Date: Tue, 29 Mar 2016 21:57:55 GMT
header: Server: Apache
header: Content-Length: 200
header: Connection: close
header: Content-Type: application/json
axapi_http: data = {
    "response": {
        "status": "fail",
        "err": {
            "msg": "JSON message is wrong.",
            "code": 1023508480,
            "from": "JSON",
            "location": "port.template-persist-cookie"
        }
    }
}
016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/slb/virtual_port.py", line 115, in update
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/slb/virtual_port.py", line 94, in _set
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     return self._post(url, params, **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/base.py", line 38, in _post
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     return self._request('POST', action, params, **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/base.py", line 32, in _request
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     self.auth_header, **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/axapi_http.py", line 127, in request
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     acos_responses.raise_axapi_ex(r, method, api_url)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/responses.py", line 204, in raise_axapi_ex
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     raise ae.ACOSException(code, response['response']['err']['msg'])
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin ACOSException: 1023508480 JSON message is wrong.
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin
Cedev commented 8 years ago

Workaround merged in in PR #113

Even with the workaround removing templates doesn't work with 4.0.3 devices; the workaround keeps it from being a fatal error and makes other updates to the device.

ghost commented 8 years ago

Looking at the code, TCP virtual ports can't have a Cookie persist type, hence the JSON message error. I can see a number of ways of skinning this cat and ending up with a cute hat instead of bloodied hands:

Knowing all this, we have a limited number of protocols we can use with cookies, a smaller subset that allows using a property of the TCP connection, and everything else is UDP. It might even be better to create an inverse ruleset that specifies the types of session persistence that cannot be used with that type... that seems like it would require less information to make the correct decision,

hthompson6 commented 4 years ago

Issue is stale. Closing for now. Please re-open if required.